
/* ==========================================================
   Quiet Line — main stylesheet
   Two variants share most rules; .variant-* class on <body>
   swaps fonts, textures, and a few accents.
   ========================================================== */

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

button, .text-btn, .dropdown-item, .style-option, .sidebar-btn,
.status-badge, .modal-content, .ob-card, .tweaks-panel {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

input, textarea { user-select: text; }
.canvas-wrapper, .top-bar, .path-style-panel, .reflection-sidebar,
.ob-card, .tweaks-panel, .preview-toolbar, .app-logo { user-select: none; }

body {
  background: var(--bg);
  color: var(--text);
  display: flex;
  overflow: hidden;
  transition: background .35s ease, color .35s ease;
  font-family: 'Inter', sans-serif;
}

/* ───── THEMES ─────────────────────────────────────────── */
.theme-road {
  --bg: #ece4d3;
  --paper-tint: #ddd1ba;
  --dot: #b9a78a;
  --rule: rgba(94, 75, 60, 0.07);
  --node-fill: #f3ecdc;
  --node-stroke: #5e4b3c;
  --path-color: #3f2f20;
  --ink-soft: rgba(63, 47, 32, 0.55);
  --ui-bg: rgba(248, 243, 232, 0.78);
  --panel-bg: rgba(248, 243, 232, 0.78);
  --text: #2c241a;
  --text-soft: rgba(44, 36, 26, 0.6);
  --accent: #7f6e5a;
  --accent-ink: #5a3d23;
  --accent-light: rgba(127, 110, 90, 0.22);
  --halo: rgba(154, 116, 80, 0.4);
  --selection: #d49b67;
}
.theme-air {
  --bg: #eef3f7;
  --paper-tint: #dde6ee;
  --dot: #aac0d4;
  --rule: rgba(46, 75, 95, 0.06);
  --node-fill: #f4f8fc;
  --node-stroke: #3a5f7a;
  --path-color: #1f3b52;
  --ink-soft: rgba(31, 59, 82, 0.55);
  --ui-bg: rgba(255, 255, 255, 0.78);
  --panel-bg: rgba(255, 255, 255, 0.78);
  --text: #1e3b4f;
  --text-soft: rgba(30, 59, 79, 0.6);
  --accent: #5d7e98;
  --accent-ink: #2d4d68;
  --accent-light: rgba(93, 126, 152, 0.22);
  --halo: rgba(93, 126, 152, 0.4);
  --selection: #c97e57;
}
.theme-night {
  --bg: #131a1f;
  --paper-tint: #1a242b;
  --dot: #2e4858;
  --rule: rgba(160, 215, 230, 0.05);
  --node-fill: #1c2a33;
  --node-stroke: #7ad0e0;
  --path-color: #aee0ec;
  --ink-soft: rgba(174, 224, 236, 0.55);
  --ui-bg: rgba(20, 30, 36, 0.78);
  --panel-bg: rgba(20, 30, 36, 0.78);
  --text: #d6ecf5;
  --text-soft: rgba(214, 236, 245, 0.6);
  --accent: #5cbfd0;
  --accent-ink: #aee0ec;
  --accent-light: rgba(92, 191, 208, 0.2);
  --halo: rgba(92, 191, 208, 0.45);
  --selection: #f0c47e;
}

/* ───── FONT FAMILY OVERRIDES (topbar picker) ─────────── */
body[data-display-font] .app-logo,
body[data-display-font] .sidebar-title-input,
body[data-display-font] .ob-headline,
body[data-display-font] .meta-title {
  font-family: var(--display-font) !important;
}
body[data-display-font-style="italic"] .app-logo,
body[data-display-font-style="italic"] .sidebar-title-input,
body[data-display-font-style="italic"] .ob-headline,
body[data-display-font-style="italic"] .meta-title {
  font-style: italic !important;
}
body[data-display-font="Caveat"]      { --display-font: 'Caveat', cursive; }
body[data-display-font="Lora"]        { --display-font: 'Lora', Georgia, serif; }
body[data-display-font="EB Garamond"] { --display-font: 'EB Garamond', Georgia, serif; }
body[data-display-font="Spectral"]    { --display-font: 'Spectral', Georgia, serif; }
body[data-display-font="Cormorant Garamond"] { --display-font: 'Cormorant Garamond', Georgia, serif; }
body[data-display-font="Old Standard TT"]    { --display-font: 'Old Standard TT', Georgia, serif; }
body[data-display-font="Fraunces"]    { --display-font: 'Fraunces', Georgia, serif; }

/* ───── VARIANT OVERRIDES ──────────────────────────────── */
.variant-sketch {
  --display-font: 'Caveat', 'Bradley Hand', cursive;
  --body-font: 'Lora', Georgia, serif;
  --ui-font: 'Inter', sans-serif;
}
.variant-sketch .app-logo,
.variant-sketch .sidebar-title-input,
.variant-sketch .ob-headline,
.variant-sketch .meta-title {
  font-family: var(--display-font);
  font-weight: 400;
  letter-spacing: 0.005em;
}
.variant-sketch .sidebar-section textarea,
.variant-sketch .ob-body,
.variant-sketch .quote {
  font-family: var(--body-font);
  font-style: italic;
}

.variant-refined {
  --display-font: 'EB Garamond', 'Iowan Old Style', Georgia, serif;
  --body-font: 'Inter', sans-serif;
  --ui-font: 'Inter', sans-serif;
}
.variant-refined .app-logo,
.variant-refined .sidebar-title-input,
.variant-refined .ob-headline,
.variant-refined .meta-title {
  font-family: var(--display-font);
  font-weight: 400;
  letter-spacing: -0.01em;
}
.variant-refined .sidebar-section textarea,
.variant-refined .ob-body {
  font-family: var(--body-font);
  font-style: normal;
}

/* ───── APP CHROME ─────────────────────────────────────── */
#app { display: flex; width: 100%; height: 100%; position: relative; }

.app-logo {
  position: absolute; top: 20px; left: 24px; z-index: 35;
  pointer-events: auto;
  color: var(--text); opacity: 0.32;
  display: block;
}
.app-logo:hover { opacity: 0.65; transition: opacity .2s ease; }
.app-logo .logo-img {
  display: block;
  width: 120px; height: auto;
  color: var(--text);
}
.app-logo .logo-img path,
.app-logo .logo-img polygon { fill: currentColor; }

.top-bar {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  z-index: 30; display: flex; align-items: center; gap: 4px;
  background: var(--panel-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--dot); border-radius: 48px; padding: 5px 8px;
  box-shadow: 0 6px 22px rgba(0,0,0,0.04);
}
.bar-group { display: flex; gap: 2px; align-items: center; }
.bar-divider { width: 1px; height: 22px; background: var(--dot); margin: 0 6px; opacity: 0.55; }

.text-btn {
  background: transparent; border: none; border-radius: 40px;
  padding: 9px 16px; font-size: 14px; font-weight: 450;
  color: var(--text); cursor: pointer; transition: background .12s, color .12s, transform .08s;
  letter-spacing: -0.005em; line-height: 1; white-space: nowrap;
}
.text-btn:hover { background: var(--accent-light); }
.text-btn:active { transform: scale(0.97); }
.text-btn .glyph { display: inline-block; width: 1em; opacity: 0.7; margin-right: 4px; }

.dropdown { position: relative; }
.dropdown-content {
  display: none; position: absolute; top: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); background: var(--panel-bg);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--dot); border-radius: 22px; padding: 6px;
  min-width: 184px; z-index: 100;
  box-shadow: 0 12px 28px rgba(0,0,0,0.08);
}
.dropdown:hover .dropdown-content,
.dropdown.open .dropdown-content { display: block; }
.dropdown-item {
  padding: 9px 14px; border-radius: 16px; cursor: pointer;
  color: var(--text); display: flex; align-items: center; gap: 10px;
  font-size: 14px; transition: background .1s;
}
.dropdown-item:hover { background: var(--accent-light); }
.dropdown-item.active { color: var(--accent-ink); }
.dropdown-item.active::after { content: '✓'; margin-left: auto; opacity: 0.7; }
.dropdown-item .dd-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; font-size: 13px; color: var(--text-soft);
  font-family: 'Inter', sans-serif; letter-spacing: -0.02em;
}
.dropdown-item.locked .dd-glyph { opacity: 0.5; }
.dropdown-item .dd-lock {
  margin-left: auto; font-size: 11px; opacity: 0.55;
  letter-spacing: 0.02em;
}
.dropdown-item:not(.locked) .dd-lock { display: none; }

/* ───── ACTIVATION MODAL ───────────────────────────── */
.activate-container {
  width: min(92vw, 440px);
  background: var(--panel-bg); border: 1px solid var(--dot);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: 22px; padding: 30px 30px 24px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
  font-family: 'Inter', sans-serif;
  color: var(--text);
}
.activate-eyebrow {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.22em;
  opacity: 0.55; margin-bottom: 12px;
}
.activate-title {
  font-family: var(--display-font, 'EB Garamond'), Georgia, serif;
  font-size: 26px; font-weight: 500; margin: 0 0 8px;
  letter-spacing: -0.005em;
}
.activate-body {
  font-size: 13.5px; line-height: 1.5; opacity: 0.78;
  margin: 0 0 20px;
}
.activate-status {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; margin: 0 0 18px;
  background: var(--accent-light); border-radius: 12px;
  font-size: 12.5px; color: var(--accent-ink);
}
.activate-status .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  flex: none;
}
.activate-input {
  width: 100%; padding: 13px 16px; border-radius: 12px;
  border: 1px solid var(--dot); background: var(--node-fill);
  color: var(--text); font-size: 14px; outline: none;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  letter-spacing: 0.08em; text-transform: uppercase;
  transition: border-color .15s ease;
  box-sizing: border-box;
}
.activate-input::placeholder {
  color: var(--text-soft); opacity: 0.5;
  letter-spacing: 0.04em; text-transform: none;
}
.activate-input:focus { border-color: var(--accent); }
.activate-input.invalid { border-color: #c14a3a; }
.activate-error {
  min-height: 18px; margin-top: 8px;
  font-size: 12px; color: #c14a3a; letter-spacing: 0.01em;
  opacity: 0; transform: translateY(-2px); transition: opacity .2s, transform .2s;
}
.activate-error.visible { opacity: 1; transform: translateY(0); }
.activate-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 18px;
}
.activate-actions .text-btn { padding: 10px 18px; }
.activate-actions .primary {
  background: var(--accent); color: white;
}
.activate-actions .primary:hover { background: var(--accent-ink); }
.activate-actions .primary:disabled { opacity: 0.45; cursor: not-allowed; }

/* ───── SAVED INDICATOR ─────────────────────────────── */
.saved-indicator {
  display: inline-flex; align-items: center; justify-content: flex-end; gap: 7px;
  min-width: 186px;
  padding: 0; background: none; border: 0;
  font-family: 'Inter', sans-serif; font-size: 12px; line-height: 1.4;
  color: var(--text-soft); letter-spacing: 0.01em;
  user-select: none; cursor: default;
}
.saved-indicator .save-symbol {
  width: 16px; display: inline-block; flex: none; text-align: center;
  font-family: Arial, sans-serif; font-size: 16px; line-height: 1;
}
.saved-indicator .label {
  white-space: nowrap; opacity: 1;
}
.saved-indicator[data-state="error"] { color: var(--now); }
.color-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

/* ───── CANVAS ─────────────────────────────────────────── */
.canvas-wrapper { flex: 1; position: relative; overflow: hidden; cursor: crosshair; }
.canvas-wrapper.panning { cursor: grabbing; }
.canvas-wrapper.over-node { cursor: pointer; }
.canvas-wrapper.dragging-node { cursor: grabbing; }
#canvas { display: block; width: 100%; height: 100%; outline: none; }

.status-badge {
  position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%);
  z-index: 12; background: var(--panel-bg); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 7px 14px; border-radius: 40px; font-size: 12px;
  border: 1px solid var(--dot); color: var(--text-soft); pointer-events: none;
  letter-spacing: 0.01em; opacity: 0.85;
  transition: opacity .4s ease;
}
.status-badge.fade { opacity: 0; }

.path-style-panel {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 15; background: var(--panel-bg); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 8px 18px; border-radius: 48px; border: 1px solid var(--dot);
  display: flex; gap: 18px; align-items: center;
  box-shadow: 0 6px 22px rgba(0,0,0,0.04);
  transition: border-color .2s, box-shadow .2s;
}
.path-style-panel.editing-section {
  border-color: var(--accent);
  box-shadow: 0 6px 22px rgba(0,0,0,0.06), 0 0 0 3px var(--accent-light);
}
.style-scope {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  padding: 5px 11px; border-radius: 30px;
  background: var(--node-fill); color: var(--text);
  border: 1px solid var(--dot);
  cursor: default;
  font-weight: 500;
  white-space: nowrap;
}
.path-style-panel.editing-section .style-scope {
  background: var(--accent); color: white; border-color: var(--accent);
}
.style-group { display: flex; gap: 6px; align-items: center; }
.style-label { font-size: 12px; opacity: 0.6; margin-right: 2px; letter-spacing: 0.04em; text-transform: uppercase; }
.style-option {
  background: transparent; border: 1px solid transparent; border-radius: 30px;
  padding: 6px 13px; font-size: 13px; cursor: pointer; color: var(--text);
  transition: .12s; line-height: 1;
}
.style-option:hover { background: var(--accent-light); }
.style-option.active {
  background: var(--accent); color: white; border-color: var(--accent);
}

/* ───── REFLECTION SIDEBAR ─────────────────────────────── */
.reflection-sidebar {
  position: absolute; right: 0; top: 0; bottom: 0; width: 360px;
  background: var(--panel-bg); backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--dot);
  padding: 26px 26px 24px;
  box-shadow: -8px 0 36px rgba(0,0,0,0.04);
  transform: translateX(100%);
  transition: transform .32s cubic-bezier(0.2,0.9,0.4,1);
  z-index: 40; color: var(--text); overflow-y: auto;
}
.reflection-sidebar.visible { transform: translateX(0); }
.sidebar-close {
  position: absolute; top: 16px; right: 18px; background: none;
  border: none; font-size: 20px; cursor: pointer; color: var(--text);
  opacity: 0.5; padding: 6px; line-height: 1; border-radius: 50%;
}
.sidebar-close:hover { opacity: 1; background: var(--accent-light); }

.sidebar-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  opacity: 0.55; margin-top: 6px; margin-bottom: 4px;
}
.sidebar-meta .pos-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}

.sidebar-title-input {
  width: 100%; font-size: 36px; font-weight: 300;
  margin-bottom: 26px; line-height: 1.05;
  background: transparent; border: none;
  border-bottom: 1px dashed var(--dot);
  padding: 4px 0 10px; color: var(--text); outline: none;
}
.sidebar-title-input:focus { border-bottom-color: var(--accent); }
.sidebar-title-input::placeholder { color: var(--text-soft); opacity: 0.6; }

.sidebar-section { margin-bottom: 22px; }
.sidebar-section label {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.16em; margin-bottom: 8px; opacity: 0.55;
}
.sidebar-section textarea {
  width: 100%; background: var(--node-fill);
  border: 1px solid var(--dot); border-radius: 16px;
  padding: 13px 15px; font-size: 14.5px; color: var(--text);
  resize: vertical; outline: none; line-height: 1.55;
  transition: border-color .15s, box-shadow .15s;
}
.sidebar-section textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.emotion-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.emotion-tag {
  background: transparent; border: 1px solid var(--dot); border-radius: 30px;
  padding: 6px 12px; font-size: 12.5px; cursor: pointer;
  color: var(--text-soft); transition: all .12s; user-select: none;
}
.emotion-tag:hover { background: var(--accent-light); color: var(--text); }
.emotion-tag.active {
  background: var(--accent); color: white; border-color: var(--accent);
}

.label-pos-seg { width: 100%; }
.label-pos-seg button {
  flex: 1; background: transparent; border: none; border-radius: 11px;
  padding: 8px 6px; font-size: 12.5px; cursor: pointer; color: var(--text);
  transition: .12s;
}
.label-pos-seg button:hover { background: var(--accent-light); }
.label-pos-seg button.active { background: var(--accent); color: white; }

.sidebar-actions { display: flex; gap: 8px; margin-top: 14px; }
.sidebar-btn {
  flex: 1; background: transparent; border: 1px solid var(--dot);
  color: var(--text); padding: 11px; border-radius: 40px; font-size: 13.5px;
  cursor: pointer; transition: .15s; font-weight: 450;
}
.sidebar-btn:hover { background: var(--accent-light); }
.sidebar-btn.danger:hover { background: rgba(180,60,60,0.12); color: #aa3a3a; border-color: rgba(180,60,60,0.3); }
.sidebar-btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.sidebar-btn.primary:hover { background: var(--accent-ink); }
.sidebar-btn.is-now {
  background: var(--accent); color: white; border-color: var(--accent);
  position: relative;
}
.sidebar-btn.is-filled {
  background: var(--path-color); color: var(--node-fill); border-color: var(--path-color);
}
.sidebar-btn.is-filled:hover { background: var(--path-color); opacity: 0.9; }
.sidebar-btn.is-now::before {
  content: ''; position: absolute; left: 14px; top: 50%; width: 7px; height: 7px;
  border-radius: 50%; background: white; transform: translateY(-50%);
  box-shadow: 0 0 0 0 rgba(255,255,255,0.7);
  animation: pulseDot 1.6s infinite;
}
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.65); }
  70% { box-shadow: 0 0 0 8px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

/* ───── ONBOARDING ─────────────────────────────────────── */
.onboarding {
  position: absolute; inset: 0; z-index: 80; display: flex;
  align-items: center; justify-content: center; pointer-events: auto;
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  backdrop-filter: blur(2px);
  transition: opacity .35s ease;
}
.onboarding.hide { opacity: 0; pointer-events: none; }
.ob-card {
  width: min(540px, 90vw); padding: 36px 40px 30px;
  background: var(--panel-bg); border: 1px solid var(--dot);
  border-radius: 28px; backdrop-filter: blur(16px);
  box-shadow: 0 24px 48px rgba(0,0,0,0.08);
  text-align: left;
}
.ob-step-counter {
  display: flex; gap: 6px; margin-bottom: 20px;
}
.ob-step-counter .pip {
  width: 22px; height: 3px; background: var(--dot);
  border-radius: 2px; transition: background .25s;
}
.ob-step-counter .pip.active { background: var(--accent); }
.ob-step-counter .pip.done { background: var(--accent); opacity: 0.5; }

.ob-headline {
  font-size: 38px; line-height: 1.1; margin-bottom: 14px;
  font-weight: 400; letter-spacing: -0.005em;
}
.ob-body {
  font-size: 16px; line-height: 1.6; color: var(--text-soft);
  margin-bottom: 26px; max-width: 42ch;
}
.ob-body em { color: var(--text); font-style: italic; }
.ob-actions {
  display: flex; gap: 8px; align-items: center;
}
.ob-actions .skip {
  margin-right: auto; font-size: 13px; color: var(--text-soft);
  background: none; border: none; cursor: pointer; padding: 8px 4px;
}
.ob-actions .skip:hover { color: var(--text); }

.ob-illust {
  height: 80px; margin: -10px 0 22px; opacity: 0.85;
}

/* ───── EXPORT MODAL ───────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 16, 12, 0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  visibility: hidden; opacity: 0; transition: opacity .22s, visibility .22s;
}
.modal-overlay.visible { visibility: visible; opacity: 1; }

.preview-container {
  width: min(92vw, 1100px); height: min(90vh, 820px);
  background: var(--panel-bg); border: 1px solid var(--dot);
  backdrop-filter: blur(20px);
  border-radius: 28px; padding: 18px;
  display: flex; flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}
.preview-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 8px 12px;
}
.preview-toolbar-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.seg-export { padding: 3px; background: var(--node-fill); border: 1px solid var(--dot); border-radius: 14px; display: flex; gap: 4px; }
.seg-export button { background: transparent; border: none; border-radius: 11px; padding: 8px 14px; font-size: 12.5px; cursor: pointer; color: var(--text); }
.seg-export button:hover { background: var(--accent-light); }
.seg-export button.active { background: var(--accent); color: white; }
.preview-stage { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.preview-toolbar h3 {
  font-size: 14px; font-weight: 500; opacity: 0.75; letter-spacing: 0.04em;
  text-transform: uppercase; margin: 0;
}
.preview-toolbar input {
  width: 220px; padding: 9px 14px; border-radius: 24px;
  border: 1px solid var(--dot); background: var(--node-fill);
  color: var(--text); font-size: 13px; outline: none;
}
.preview-toolbar input:focus { border-color: var(--accent); }
.preview-actions { display: flex; gap: 6px; align-items: center; }

.preview-paper {
  background: var(--bg); border-radius: 6px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.18);
  position: relative; overflow: hidden; margin: 0 auto;
  /* width / height set in JS so it matches the selected A4 aspect */
}
#previewCanvas { display: block; width: 100%; height: 100%; }

/* ───── TWEAKS PANEL ───────────────────────────────────── */
.tweaks-panel {
  position: fixed; bottom: 24px; right: 24px;
  width: 280px; z-index: 150;
  background: var(--panel-bg); border: 1px solid var(--dot);
  border-radius: 20px; padding: 18px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px rgba(0,0,0,0.12);
  display: none;
  font-size: 13px;
}
.tweaks-panel.visible { display: block; }
.tweaks-panel header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.tweaks-panel h4 {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.16em; opacity: 0.55; margin: 0;
}
.tweaks-panel .close-x {
  background: none; border: none; cursor: pointer; font-size: 16px;
  color: var(--text); opacity: 0.5; padding: 0;
}
.tweaks-panel .close-x:hover { opacity: 1; }

.tweak-row { margin-bottom: 14px; }
.tweak-row:last-child { margin-bottom: 0; }
.tweak-label {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.12em; opacity: 0.6; margin-bottom: 7px;
}
.seg {
  display: flex; gap: 4px; padding: 3px;
  background: var(--node-fill); border: 1px solid var(--dot);
  border-radius: 14px;
}
.seg button {
  flex: 1; background: transparent; border: none; border-radius: 11px;
  padding: 8px 6px; font-size: 12.5px; cursor: pointer; color: var(--text);
  transition: .12s;
}
.seg button:hover { background: var(--accent-light); }
.seg button.active { background: var(--accent); color: white; }

/* ───── PAPER TEXTURE OVERLAY (sketch only) ────────────── */
.paper-overlay {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  opacity: 0.55;
  background-image:
    radial-gradient(rgba(0,0,0,0.025) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,0.018) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
  mix-blend-mode: multiply;
}
.theme-night .paper-overlay { mix-blend-mode: screen; opacity: 0.35; }
.variant-refined .paper-overlay { display: none; }

.lang-switch {
  position: absolute; top: 22px; right: 24px; z-index: 36;
  background: var(--panel-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--dot); border-radius: 48px;
  padding: 4px;
  box-shadow: 0 6px 22px rgba(0,0,0,0.04);
}
.lang-switch > .text-btn {
  padding: 8px 14px; font-size: 13px;
}
.lang-switch .dropdown-content {
  left: auto; right: 0; transform: none; min-width: 140px;
}
.canvas-fog {
  position: absolute; left: 0; right: 0; pointer-events: none; z-index: 2;
  height: 100px;
}
.canvas-fog.top { top: 0; background: linear-gradient(var(--bg), transparent); }
.canvas-fog.bottom { bottom: 0; background: linear-gradient(transparent, var(--bg)); }

/* node label tooltip rendered onto canvas — none here */

/* tiny "now" floating chip */
.now-chip {
  position: absolute; z-index: 8; pointer-events: none;
  padding: 4px 10px; font-size: 11px;
  background: var(--accent); color: white;
  border-radius: 30px; letter-spacing: 0.08em; text-transform: uppercase;
  transform: translate(-50%, -160%);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: none;
}
.now-chip.visible { display: block; }

/* placeholder-aware emoji-free glyph for buttons */
.glyph-arrow::before { content: '←'; }

