/* ── Fonts (local) ─────────────────────────────────────── */
@font-face {
  font-family: 'Geist';
  src: url('fonts/Geist-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist';
  src: url('fonts/Geist-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist';
  src: url('fonts/Geist-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('fonts/GeistMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('fonts/GeistMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f6f6f4;
  --surface:     #ffffff;
  --border:      #e4e4e0;
  --border-soft: #ececea;
  --text:        #1a1a18;
  --muted:       #9a9994;
  --accent:      #1a1a18;
  --danger:      #d93025;
  --radius:      12px;
  --font:        'Geist', system-ui, -apple-system, sans-serif;
  --mono:        'Geist Mono', 'Fira Code', monospace;
  --shadow:      0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}

body.dark {
  --bg:          #111110;
  --surface:     #1a1a18;
  --border:      #2e2e2b;
  --border-soft: #252523;
  --text:        #e8e8e4;
  --muted:       #6b6b66;
  --shadow:      0 1px 3px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2);
}

body.dark .save-btn {
  background: var(--text);
  color: #111110;
  border-color: var(--text);
}

body.dark .toast {
  background: var(--text);
  color: #111110;
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  transition: background .2s, color .2s;
}

/* ── Header ────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0;
  padding: 18px 24px;
  z-index: 100;
}

.logo {
  display: block;
  height: 32px;
  width: auto;
  opacity: .75;
  transition: opacity .15s;
  cursor: pointer;
}

.logo:hover { opacity: 1; }

body.dark .logo { filter: invert(1); }

/* ── About Links ───────────────────────────────────────── */
.about-link {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text);
  transition: all .15s;
}

.about-link:hover {
  background: var(--bg);
  border-color: var(--text);
}

.about-link-coffee {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

.about-link-coffee:hover {
  opacity: .85;
  background: var(--text);
  color: var(--surface);
}

.about-version {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
}

.about-features-list {
  list-style: none;
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  font-size: 12.5px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.about-features-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.about-features-list li::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.about-features-list code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ── Privacy Modal ─────────────────────────────────────── */
.privacy-section { margin-top: 18px; }

.privacy-section h4 {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.privacy-section p {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.65;
}

.privacy-section code {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
  color: var(--text);
}

/* ── View Toggle ───────────────────────────────────────── */
.view-toggle {
  display: flex;
  gap: 2px;
  justify-content: center;
  padding: 80px 0 16px;
}

.toggle-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 400;
  cursor: pointer;
  transition: all .15s ease;
}

.toggle-btn:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.toggle-btn.active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

/* ── Workspace ─────────────────────────────────────────── */
.workspace {
  display: flex;
  max-width: 1200px;
  width: calc(100% - 48px);
  margin: 0 auto;
  min-height: 500px;
  height: calc(100vh - 200px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all .2s ease, background .2s, border-color .2s;
}

.workspace.view-left #editorPanel2,
.workspace.view-left .panel-divider { display: none; }
.workspace.view-left #editorPanel { flex: 1; }

.workspace.view-right #editorPanel,
.workspace.view-right .panel-divider { display: none; }
.workspace.view-right #editorPanel2 { flex: 1; }

/* ── Panel Shared ──────────────────────────────────────── */
.panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.editor-panel { flex: 1; }

.panel-divider {
  width: 1px;
  background: var(--border-soft);
  flex-shrink: 0;
  position: relative;
  cursor: col-resize;
  transition: background .15s;
  z-index: 10;
}

.panel-divider::before {
  content: '';
  position: absolute;
  top: 0;
  left: -5px;
  right: -5px;
  bottom: 0;
}

.panel-divider:hover,
.panel-divider.dragging {
  background: var(--border);
}

.panel-divider.snapped {
  background: var(--text);
  opacity: .25;
}

.panel-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 32px;
  border-radius: 4px;
  background: var(--border);
  opacity: 0;
  transition: opacity .15s;
}

.panel-divider:hover::after,
.panel-divider.dragging::after {
  opacity: 1;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.panel-label {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-action {
  font-family: var(--font);
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 6px;
  transition: all .12s;
}

.panel-action:hover {
  color: var(--text);
  background: var(--bg);
}

/* ── Editor ────────────────────────────────────────────── */
.note-textarea {
  flex: 1;
  width: 100%;
  padding: 16px 18px;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  background: transparent;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-textarea::placeholder { color: var(--muted); }

/* ── Note Preview ──────────────────────────────────────── */
.note-preview {
  flex: 1;
  width: 100%;
  padding: 16px 18px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  background: transparent;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
}

.note-preview .task-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: pre-wrap;
}

.note-preview .task-line input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--muted);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  top: 2px;
  transition: border-color .12s, background .12s;
}

.note-preview .task-line input[type="checkbox"]:hover { border-color: var(--text); }

.note-preview .task-line input[type="checkbox"]:checked {
  background: var(--text);
  border-color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='1.5,5 4,7.5 8.5,2.5' fill='none' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 80%;
  background-repeat: no-repeat;
  background-position: center;
}

.note-preview .task-line input[type="checkbox"]:checked::after { display: none; }

.note-preview .task-done {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--border);
}

/* ── Bubble List ───────────────────────────────────────── */
.note-preview .bubble-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  margin: 2px 0;
  white-space: pre-wrap;
}

.note-preview .bubble-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.note-preview .bubble-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  cursor: pointer;
  transition: all .12s;
  user-select: none;
  white-space: nowrap;
}

.note-preview .bubble-btn:hover {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

body.dark .note-preview .task-line input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='1.5,5 4,7.5 8.5,2.5' fill='none' stroke='%23111110' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.note-preview .preview-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 6px 0;
}

/* ── Hex Color Dot ─────────────────────────────────────── */
.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.18);
  flex-shrink: 0;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

body.dark .color-dot { border-color: rgba(255,255,255,.15); }

.color-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.bubble-color-dot { top: 0; }

/* ── Panel Footer ──────────────────────────────────────── */
.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px 12px;
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.char-count {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.copy-note-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font);
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 6px;
  transition: all .12s;
}

.copy-note-btn:hover {
  color: var(--text);
  background: var(--bg);
}

/* ── Form Buttons ──────────────────────────────────────── */
.form-btn {
  font-family: var(--font);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .12s;
}

.cancel-btn {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.cancel-btn:hover { color: var(--text); background: var(--surface); }

.save-btn {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.save-btn:hover { opacity: .85; }

/* ── Footer ────────────────────────────────────────────── */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 24px 24px;
}

.footer-link {
  font-family: var(--font);
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .12s;
}

.footer-link:hover { color: var(--text); }

/* ── Theme Toggle Switch ───────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

#checkboxInput { display: none; }

.toggleSwitch {
  position: relative;
  width: 34px;
  height: 20px;
  background-color: var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: background-color .2s;
}

.toggleSwitch::after {
  content: "";
  position: absolute;
  height: 14px;
  width: 14px;
  top: 3px;
  left: 3px;
  background-color: var(--muted);
  border-radius: 50%;
  transition: transform .2s, background-color .2s;
}

#checkboxInput:checked + .toggleSwitch::after {
  transform: translateX(14px);
  background-color: var(--text);
}

#checkboxInput:checked + .toggleSwitch { background-color: var(--border); }

.footer-dot {
  font-size: 11px;
  color: var(--border);
}

/* ── Toast ─────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--text);
  color: #fff;
  font-size: 12.5px;
  padding: 8px 16px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  white-space: nowrap;
  z-index: 200;
  font-family: var(--font);
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Modals ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  backdrop-filter: blur(2px);
  animation: fadeIn .15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 28px 24px;
  max-width: 440px;
  width: calc(100% - 48px);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,.12);
  animation: slideUp .18s ease;
}

@keyframes slideUp {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-box h3 {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 12px;
}

.modal-box p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
}

.modal-box code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text);
}

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  transition: all .12s;
}

.modal-close:hover { background: var(--bg); color: var(--text); }

/* ── Scrollbar global ──────────────────────────────────── */
body { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 620px) {
  .workspace {
    flex-direction: column;
    height: auto;
    min-height: 0;
  }

  .panel-divider {
    width: 100%;
    height: 1px;
  }

  .editor-panel { min-height: 280px; }
  .note-textarea { min-height: 200px; }
  .view-toggle { padding-top: 72px; }

  .workspace.view-left  { height: calc(100vh - 180px); }
  .workspace.view-right { height: calc(100vh - 180px); }
}