/* base.css — calm twilight ink (dark default) + light override, layout */

:root, [data-theme="dark"] {
  --paper:      #1e2229;   /* softened twilight ink (lighter than before) */
  --paper-2:    #262b34;
  --ink:        #ece8de;   /* warm off-white */
  --ink-soft:   #b0ac9f;
  --ink-faint:  #797668;
  --stone:      #9aaea0;   /* moonlit sage */
  --sage:       rgba(154, 174, 160, 0.15);
  --sage-line:  rgba(154, 174, 160, 0.36);
  --line:       rgba(236, 232, 222, 0.13);
  --line-soft:  rgba(236, 232, 222, 0.06);
  --card:       rgba(255, 255, 255, 0.05);
  --card-2:     rgba(255, 255, 255, 0.09);
  --card-solid: #272c35;
  --yin-c:      #4a6b78;   /* taiji dark half */
  --yang-c:     #c9a45e;   /* taiji light half (warm gold, on-theme for dark) */
  --danger:     #c06a55;
  --radius:     14px;
  --radius-sm:  9px;
  --shadow:     0 8px 34px rgba(0, 0, 0, 0.40);
  --ease:       cubic-bezier(.22, .68, 0, .98);
}

[data-theme="light"] {
  --paper:      #f4f1ea;
  --paper-2:    #efeae0;
  --ink:        #2b2b28;
  --ink-soft:   #6b6a63;
  --ink-faint:  #9a988e;
  --stone:      #8a9a8f;
  --sage:       rgba(60, 80, 70, 0.12);
  --sage-line:  rgba(60, 80, 70, 0.28);
  --line:       rgba(43, 43, 40, 0.12);
  --line-soft:  rgba(43, 43, 40, 0.07);
  --card:       rgba(255, 255, 255, 0.55);
  --card-2:     rgba(255, 255, 255, 0.75);
  --card-solid: #fbf9f4;
  --yin-c:      #3f6b7a;
  --yang-c:     #b5563f;
  --danger:     #b5563f;
  --shadow:     0 6px 28px rgba(43, 43, 40, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* overflow-x: clip on the root keeps horizontal scroll away WITHOUT breaking
   position:sticky (which overflow-x:hidden on body would). */
html { overflow-x: clip; }
html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-weight: 400;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}
body.is-dragging { user-select: none; -webkit-user-select: none; }

h1, h2, h3 { font-family: 'Noto Serif SC', 'Inter', serif; font-weight: 400; }

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
select { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; }

/* ── header ── */
.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px 8px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.25s var(--ease);
}
.brand:hover { opacity: 0.7; }
.brand-glyph { font-size: 1.5rem; color: var(--ink); opacity: 0.9; }
.brand-word { color: var(--ink-soft); font-weight: 300; letter-spacing: 0.06em; }

.view-tabs { display: flex; gap: 4px; margin-left: auto; }
.view-tab {
  padding: 7px 15px;
  border-radius: 999px;
  color: var(--ink-faint);
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  transition: all 0.35s var(--ease);
}
.view-tab.active { color: var(--ink); background: var(--sage); }
.view-tab:hover { color: var(--ink-soft); }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  color: var(--ink-faint);
  font-size: 1.1rem;
  display: grid; place-items: center;
  transition: all 0.3s var(--ease);
}
.icon-btn:hover { color: var(--ink); background: var(--sage); }

/* ── main / views ── */
/* bottom padding clears the fixed capture bar + momentum strip */
main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 8px 20px 150px; }
.view { animation: fade-in 0.5s var(--ease); }
.view[hidden] { display: none; }

@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── momentum footer ── */
.momentum {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--paper) 55%, transparent);
  font-size: 0.85rem;
  color: var(--ink-soft);
  pointer-events: none;
}

/* ── whisper toast ── */
.whisper {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%) translateY(10px);
  background: var(--card-solid);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: all 0.4s var(--ease);
  z-index: 60;
  pointer-events: none;
  max-width: 80vw;
  text-align: center;
  box-shadow: var(--shadow);
}
.whisper.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.whisper[hidden] { display: none; }

@media (max-width: 520px) {
  main { padding: 8px 14px 150px; }
  .app-header { padding: 14px 14px 6px; }
  .brand { font-size: 1.2rem; }
}
