/* Font faces follow yoru-and-akari Console Design System2:
   Geist for UI, Geist Mono for numbers/console text, and
   Zen Kaku Gothic New for Japanese lyric accents. */
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&family=Zen+Kaku+Gothic+New:wght@400;500;700&display=swap");

/* ============================================================
   tokens (subset of yoru-and-akari Console DS, lifted from
   LyricLens desktop src/tokens.css). Two themes via [data-theme].
   ============================================================ */
:root {
  --font-ui: "Geist";
  --font-mono: "Geist Mono";
  --font-jp: "Zen Kaku Gothic New";

  --text-2xs: 10px;
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 19px;
  --text-2xl: 23px;
  --text-3xl: 28px;

  --tracking-tight: 0;
  --tracking-caps: 0.08em;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px;

  --radius-sm: 9px; --radius-md: 12px; --radius-lg: 16px;
  --radius-xl: 22px; --radius-pill: 999px;

  --hit-min: 44px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 140ms;
  --dur-base: 220ms;
  --dur-slow: 420ms;
}

[data-theme="akari"] {
  --bg-base: #E8ECF3;
  --bg-surface: #EFF2F8;
  --bg-elevated: #F6F8FC;
  --bg-sunken: #DEE3EC;
  --bg-tint: #F1F4FB;

  --glass-bg: hsla(220, 30%, 98%, 0.62);
  --glass-border: hsla(225, 30%, 55%, 0.18);
  /* tab-bar foggy glass (lighter than base glass so blur reads) */
  --tabbar-fog: hsla(220, 30%, 96%, 0.42);
  --tabbar-rim: hsla(220, 35%, 100%, 0.55);
  --tabbar-rim-bottom: hsla(220, 30%, 60%, 0.15);

  --ink-1: #0E1525;
  --ink-2: #394560;
  --ink-3: #6B7793;
  --ink-4: #A1ABBF;
  --ink-on-primary: #FFFFFF;

  --line-1: rgba(14, 21, 37, 0.06);
  --line-2: rgba(14, 21, 37, 0.10);

  --primary-100: #DCE3FE;
  --primary-300: #92A8FB;
  --primary-500: #4F6CE8;
  --primary-700: #2E44B0;

  --ember-100: #FFE4D6;
  --ember-500: #F06A20;

  --frost-100: #DBF2F0;
  --frost-500: #1EA8A0;

  --warning-500: #D89A3A;

  --error-100: #FADBDB;
  --error-500: #D45D5D;
  --error-700: #A23F3F;

  --neo-hi: rgba(255, 255, 255, 0.95);
  --neo-lo: rgba(143, 158, 191, 0.45);
  --neo-lo-soft: rgba(143, 158, 191, 0.28);

  --shadow-raised: -4px -4px 12px var(--neo-hi), 4px 4px 14px var(--neo-lo-soft);
  --shadow-lifted: -6px -6px 18px var(--neo-hi), 8px 8px 22px var(--neo-lo);
  --shadow-pop: 0 10px 30px -8px rgba(20,28,51,0.22), 0 2px 6px rgba(20,28,51,0.06);
  --shadow-inset: inset 3px 3px 6px var(--neo-lo-soft), inset -3px -3px 6px var(--neo-hi);
  --shadow-focus: 0 0 0 3px rgba(79, 108, 232, 0.28);

  --page-wash:
    radial-gradient(120% 80% at 80% -10%, rgba(79, 108, 232, 0.07), transparent 60%),
    radial-gradient(90% 70% at 0% 100%, rgba(240, 106, 32, 0.05), transparent 55%),
    var(--bg-base);
}

[data-theme="yoru"] {
  --bg-base: #0B1020;
  --bg-surface: #131A2E;
  --bg-elevated: #1B2340;
  --bg-sunken: #080D1B;
  --bg-tint: #182146;

  --glass-bg: hsla(225, 35%, 14%, 0.62);
  --glass-border: hsla(220, 40%, 70%, 0.10);
  --tabbar-fog: hsla(225, 35%, 12%, 0.42);
  --tabbar-rim: hsla(220, 40%, 90%, 0.12);
  --tabbar-rim-bottom: hsla(0, 0%, 0%, 0.25);

  --ink-1: #E6EAF6;
  --ink-2: #A8B2CC;
  --ink-3: #6B7691;
  --ink-4: #434D67;
  --ink-on-primary: #0B1020;

  --line-1: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.10);

  --primary-100: #1F2A55;
  --primary-300: #3D52AE;
  --primary-500: #7A95FA;
  --primary-700: #B4C3FC;

  --ember-100: #2A1408;
  --ember-500: #F07830;

  --frost-100: #0A2624;
  --frost-500: #38C8C0;

  --warning-500: #ECB85F;

  --error-100: #3A1A1A;
  --error-500: #F08484;
  --error-700: #F5B0B0;

  --neo-hi: rgba(255, 255, 255, 0.05);
  --neo-lo: rgba(0, 0, 0, 0.55);
  --neo-lo-soft: rgba(0, 0, 0, 0.35);

  --shadow-raised: -3px -3px 10px var(--neo-hi), 5px 5px 16px var(--neo-lo-soft);
  --shadow-lifted: -4px -4px 14px var(--neo-hi), 8px 8px 24px var(--neo-lo);
  --shadow-pop: 0 14px 36px -10px rgba(0,0,0,0.6), 0 2px 6px rgba(0,0,0,0.4);
  --shadow-inset: inset 3px 3px 7px var(--neo-lo-soft), inset -2px -2px 5px var(--neo-hi);
  --shadow-focus: 0 0 0 3px rgba(122, 149, 250, 0.35);

  --page-wash:
    radial-gradient(120% 80% at 80% -10%, rgba(122, 149, 250, 0.10), transparent 60%),
    radial-gradient(90% 70% at 0% 100%, rgba(240, 120, 48, 0.06), transparent 55%),
    var(--bg-base);
}

body[data-font-size="small"] {
  --text-2xs: 9px;
  --text-xs: 10px;
  --text-sm: 11px;
  --text-base: 12px;
  --text-md: 13px;
  --text-lg: 15px;
  --text-xl: 18px;
  --text-2xl: 21px;
  --text-3xl: 26px;
}

body[data-font-size="large"] {
  --text-2xs: 11px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 21px;
  --text-2xl: 26px;
  --text-3xl: 31px;
}

/* ============================================================
   page chrome (outside the phone — for controlling the mock)
   ============================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--page-wash);
  color: var(--ink-2);
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  overflow: hidden;
  display: block;
  touch-action: manipulation;
}

.control-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  background: #1B2030;
  border-radius: 14px;
  font-size: 12px;
}
.control-rail .label {
  color: #9AA3BD;
  margin-right: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 10px;
}
.control-rail button {
  background: transparent;
  color: #C2CADD;
  border: 1px solid #3A4258;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
}
.control-rail button.active {
  background: #4F6CE8;
  color: white;
  border-color: #4F6CE8;
}
.control-rail .sep {
  width: 1px;
  height: 20px;
  background: #3A4258;
  margin: 0 4px;
}

/* ============================================================
   phone frame
   ============================================================ */
.phone-shell {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  position: relative;
}
.phone-shell::before {
  /* notch */
  content: none;
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 28px;
  background: #000;
  border-radius: 16px;
  z-index: 10;
}

.phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 0;
  overflow: hidden;
  background: var(--page-wash);
  display: grid;
  grid-template-rows: 1fr;
  font-family: var(--font-ui);
  color: var(--ink-2);
  position: relative;
}

/* ============================================================
   screens (no app bar — notch breathing room lives in .screen padding)
   ============================================================ */
.screen {
  overflow-y: auto;
  overflow-x: hidden;
  /* iOS-style: top content shares the notch row, sitting in the
     gutters either side of the central black pill (notch is ~110px
     wide, leaving ~122px on each side). status strip's mono digits
     vertical-center on the notch ellipse.
     bottom clears the floating tab bar (64 + 16 + 22). */
  padding: calc(18px + env(safe-area-inset-top, 0px)) 18px calc(110px + env(safe-area-inset-bottom, 0px));
  scrollbar-width: thin;
  scrollbar-color: var(--ink-4) transparent;
}
.screen[hidden] { display: none; }

/* Review tab uses flex column so the deck absorbs all remaining
   vertical space — cards then fill that height and only their inner
   content scrolls. No more max-height magic numbers. */
.screen[data-tab="review"] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.screen[data-tab="review"][hidden] { display: none; }

/* Non-review tabs don't have a status strip riding in the notch row,
   so the first control would otherwise fall behind the notch pill
   (which occupies ~6–34px inside the phone screen). Give them a
   taller top inset to clear it. */
.screen[data-tab="notebook"],
.screen[data-tab="settings"] {
  padding-top: 46px;
  padding-top: calc(46px + env(safe-area-inset-top, 0px));
}

/* Hide chrome's default overlay scrollbar and use a hairline of our
   own — the wide white default rail is bright noise against yoru's
   midnight surface, and Android Compose's default is a similarly
   thin auto-fading indicator. Firefox is already covered above
   via `scrollbar-width: thin`. */
.screen::-webkit-scrollbar,
.deck-card::-webkit-scrollbar {
  width: 3px;
}
.screen::-webkit-scrollbar-thumb,
.deck-card::-webkit-scrollbar-thumb {
  background: var(--ink-4);
  border-radius: 4px;
}
.screen::-webkit-scrollbar-track,
.deck-card::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- review screen ---------- */
.status-strip {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  /* sit in the gutters of the notch row: 18px screen padding + 0 here.
     internal padding kept tight so digits sit near the screen edges
     where the gutter space actually is. */
  padding: 0 4px;
  margin-bottom: 14px;
  min-height: 28px;
  font-size: var(--text-xs);
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.status-strip > span { display: inline-flex; align-items: baseline; gap: 8px; }
.status-strip strong {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--ink-1);
  font-feature-settings: "tnum", "ss01", "zero";
  letter-spacing: 0;
  line-height: 1;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--bg-sunken);
  border-radius: var(--radius-md);
  padding: 3px;
  box-shadow: var(--shadow-inset);
  margin-bottom: 14px;
  height: 38px;
}
.segmented button {
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  cursor: pointer;
  border-radius: calc(var(--radius-md) - 3px);
  font-family: inherit;
  transition: all var(--dur-fast) var(--ease-out);
}
.segmented button.active {
  background: var(--bg-surface);
  color: var(--ink-1);
  font-weight: var(--weight-semibold);
  box-shadow: var(--shadow-raised);
}

/* selected song chip — shown when "按歌过" mode is active */
.song-chip {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--primary-100);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  color: var(--primary-700);
  margin-bottom: 12px;
  font-weight: var(--weight-medium);
}
/* Chip only appears when BOTH (a) mode=by-song and (b) user has
   actually picked a song. This double-guard gives us:
     - initial by-song click → sheet opens, chip hidden (no pick yet)
     - user picks a song → chip appears
     - user switches back to random → chip hides even though the
       songPicked state persists, so re-entering by-song later still
       remembers the last pick */
body[data-review-mode="by-song"][data-song-picked] .song-chip { display: inline-flex; }
.song-chip .x {
  margin-left: 4px;
  cursor: pointer;
  opacity: 0.6;
  border: none;
  background: transparent;
  color: currentColor;
  font: inherit;
  min-width: 22px;
  min-height: 22px;
  padding: 0;
}

/* card deck — single-face cards in a horizontal scroll-snap swiper.
   Each card holds the whole entry (front+back collapsed into one
   scrollable column). Swipe left/right moves between cards.
   In review tab, .deck takes flex:1 so it absorbs every remaining
   pixel under the segmented and above the actions; each card then
   fills the deck height. No hard-coded max-height anymore. */
.deck {
  /* let cards run edge-to-edge inside .screen's 18px padding */
  margin: 0 -18px 14px;
  padding: 0 18px 8px;
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1 1 auto;
  min-height: 0;
}
.deck::-webkit-scrollbar { display: none; }
.deck-card {
  flex: 0 0 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-4) transparent;
}

.card-source {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--ink-3);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-source .ember-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--ember-500);
}
.card-source .grow { flex: 1; }
.card-source-song {
  font-family: var(--font-jp);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.card-source-time {
  font-family: var(--font-mono);
  flex: 0 0 auto;
}

.line-original {
  font-family: var(--font-jp);
  font-size: var(--text-2xl);
  line-height: 1.35;
  font-weight: var(--weight-semibold);
  color: var(--ink-1);
  letter-spacing: var(--tracking-tight);
  margin: 0;
}
.line-translation {
  font-size: var(--text-md);
  font-style: italic;
  color: var(--ink-2);
  line-height: 1.5;
  margin: -2px 0 6px;
}

/* divider hairline between hero and analysis sections */
.card-divider {
  border: none;
  height: 1px;
  background: var(--line-1);
  margin: 2px 0;
}

.card-section { display: flex; flex-direction: column; gap: 6px; }
.eyebrow {
  display: block;
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: var(--weight-semibold);
}

.card-foot {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--ink-4);
  padding-top: 8px;
  border-top: 1px solid var(--line-1);
  margin-top: auto;
}
.card-foot > span:not(.mastery-tag) { font-family: var(--font-mono); }

.point-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: var(--text-base);
  color: var(--ink-2);
  line-height: 1.5;
}
.point-badge {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.point-vocabulary { background: var(--primary-100); color: var(--primary-700); }
.point-grammar    { background: var(--frost-100);   color: var(--frost-500); }
.point-culture    { background: var(--ember-100);   color: var(--ember-500); }

.llm-note {
  font-style: italic;
  color: var(--ink-3);
  font-size: var(--text-base);
  line-height: 1.55;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-tint);
}

.user-note {
  background: var(--primary-100);
  border-left: 2px solid var(--primary-500);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--ink-1);
  font-size: var(--text-base);
  line-height: 1.5;
}

/* review action row — three recall verdicts, evenly weighted.
   Color map: ember (warm "回去再看") · neutral · primary ("记住了").
   These three feed the `mastery` field on NotebookEntry
   (schema v1.1 candidate — needs main repo sync). */
.review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.btn {
  height: 48px;
  border-radius: var(--radius-md);
  border: none;
  font-family: inherit;
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: box-shadow var(--dur-fast) var(--ease-out);
  padding: 0 6px;
}
.btn:active { box-shadow: var(--shadow-inset); }
.btn-recall-no {
  background: var(--error-100);
  color: var(--error-700);
  box-shadow: var(--shadow-raised);
}
.btn-recall-meh {
  background: var(--bg-surface);
  color: var(--ink-2);
  box-shadow: var(--shadow-raised);
}
.btn-recall-yes {
  background: var(--primary-500);
  color: var(--ink-on-primary);
  box-shadow: var(--shadow-raised);
}

/* mastery indicator — shared by deck card-foot and notebook entry-foot.
   Pure color + dot (no emoji / no lucide for now). Values map 1:1 to
   the three recall verdicts plus an implicit "新加" for entries that
   have never been reviewed. */
.mastery-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
}
.mastery-tag .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  flex: 0 0 auto;
}
.mastery-yes { color: var(--frost-500); }
.mastery-meh { color: var(--ink-3); }
.mastery-no  { color: var(--error-500); }
.mastery-new { color: var(--ink-4); }

/* ---------- notebook screen ---------- */
.search-input {
  width: 100%;
  height: 44px;
  background: var(--bg-sunken);
  border: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-inset);
  padding: 0 16px;
  font-family: inherit;
  font-size: var(--text-md);
  color: var(--ink-1);
  margin-bottom: 12px;
  outline: none;
}
.search-input::placeholder { color: var(--ink-4); }
.search-input:focus { box-shadow: var(--shadow-inset), var(--shadow-focus); }

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border: none;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-raised);
}
.chip.active {
  box-shadow: var(--shadow-inset);
  color: var(--primary-700);
}

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.entry {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
  padding: 14px 16px;
}
.entry-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-1);
  font-size: var(--text-xs);
}
.entry-meta-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.entry-meta strong {
  font-family: var(--font-jp);
  color: var(--ink-1);
  font-weight: var(--weight-semibold);
  font-size: var(--text-md);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-meta .artist {
  font-family: var(--font-jp);
  color: var(--ink-3);
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-meta .ts {
  font-family: var(--font-mono);
  color: var(--ink-3);
  flex: 0 0 auto;
  margin-left: 8px;
}

.entry-body {
  margin-bottom: 12px;
}
.entry-original {
  font-family: var(--font-jp);
  font-size: var(--text-lg);
  line-height: 1.4;
  font-weight: var(--weight-medium);
  color: var(--ink-1);
  margin-bottom: 4px;
}
.entry-translation {
  font-size: var(--text-base);
  font-style: italic;
  color: var(--ink-2);
}

.entry-points {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-1);
  margin-bottom: 10px;
}

.entry-user-note {
  background: var(--primary-100);
  border-left: 2px solid var(--primary-500);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-1);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin-bottom: 10px;
}

.entry-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--ink-3);
}
.entry-foot .ghost-mini {
  background: transparent;
  border: none;
  color: var(--primary-500);
  font-size: var(--text-xs);
  cursor: pointer;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.entry-foot .ghost-mini:disabled {
  color: var(--ink-4);
  cursor: default;
}

/* ---------- settings screen ---------- */
.settings-group {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
  margin-bottom: 18px;
  overflow: hidden;
}
.group-eyebrow {
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: var(--weight-semibold);
  padding: 14px 16px 6px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  min-height: 48px;
  border-top: 1px solid var(--line-1);
}
.settings-row:first-of-type { border-top: none; }
.settings-row-main {
  flex: 1;
  min-width: 0;
}
.settings-row-title {
  font-size: var(--text-md);
  color: var(--ink-1);
  font-weight: var(--weight-medium);
}
.settings-row-caption {
  font-size: var(--text-xs);
  color: var(--ink-3);
  margin-top: 2px;
  font-family: var(--font-ui);
}
.settings-row-caption.mono-value { font-family: var(--font-mono); }

.segmented.small {
  height: 30px;
  padding: 2px;
  margin: 0;
  width: auto;
  display: inline-grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(40px, auto));
}
.segmented.small button {
  padding: 0 10px;
  font-size: var(--text-xs);
}
/* theme segmented uses sun/moon icons — needs explicit centering
   so the svg sits in the middle of the pill (button text-align center
   wouldn't bite an svg child). */
.settings-theme-seg button {
  display: grid;
  place-items: center;
  padding: 0;
  min-width: 44px;
  color: var(--ink-3);
}
.settings-theme-seg button.active { color: var(--primary-500); }

.settings-mini-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--bg-surface);
  color: var(--ink-2);
  border: none;
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  cursor: pointer;
  box-shadow: var(--shadow-raised);
}
.settings-mini-btn.primary {
  background: var(--primary-500);
  color: var(--ink-on-primary);
}
.settings-mini-btn:active { box-shadow: var(--shadow-inset); }

/* ============================================================
   bottom floating tab bar (glass)
   ============================================================ */
/* foggy glass — heavier blur, lower opacity than the base glass token,
   plus an inner top highlight + outer drop to read as "frosted slab" */
.tab-bar {
  position: absolute;
  left: 16px; right: 16px; bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  height: 64px;
  background: var(--tabbar-fog, var(--glass-bg));
  -webkit-backdrop-filter: blur(26px) saturate(160%);
          backdrop-filter: blur(26px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 6px;
  box-shadow:
    var(--shadow-pop),
    inset 0 1px 0 var(--tabbar-rim, hsla(220, 35%, 100%, 0.45)),
    inset 0 -1px 0 var(--tabbar-rim-bottom, hsla(220, 35%, 100%, 0.10));
}
.tab-btn {
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-family: inherit;
  font-size: var(--text-xs);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
  position: relative;
}
/* active: stay flat (no surface raise) so the glass keeps its character;
   a small primary dot above the icon + primary tint on icon & label. */
.tab-btn.active {
  color: var(--primary-500);
}
.tab-btn.active::before {
  content: "";
  position: absolute;
  top: 6px;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--primary-500);
}
.tab-btn svg { stroke-width: 1.75; }
.tab-btn span {
  font-weight: var(--weight-medium);
  letter-spacing: 0.02em;
}

/* ============================================================
   song-picker bottom sheet (mock open state)
   ============================================================ */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 20;
  display: none;
}
body[data-sheet="song-picker"] .sheet-backdrop { display: block; }

.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--bg-elevated);
  border-radius: 24px 24px 0 0;
  z-index: 21;
  padding: 14px 18px 26px;
  box-shadow: var(--shadow-pop);
  transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease-out);
  max-height: 70%;
  overflow-y: auto;
}
body[data-sheet="song-picker"] .sheet { transform: translateY(0); }

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--ink-4);
  border-radius: 999px;
  margin: 0 auto 14px;
  opacity: 0.6;
}
.sheet-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--ink-1);
  margin-bottom: 4px;
}
.sheet-sub {
  font-size: var(--text-xs);
  color: var(--ink-3);
  margin-bottom: 14px;
  font-family: var(--font-ui);
}
.song-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 0;
  border-top: 1px solid var(--line-1);
  border-right: none;
  border-bottom: none;
  border-left: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.song-row:first-of-type { border-top: none; }
.song-row .song-title {
  font-family: var(--font-jp);
  font-size: var(--text-base);
  color: var(--ink-1);
  font-weight: var(--weight-medium);
}
.song-row .song-meta {
  font-family: var(--font-jp);
  font-size: var(--text-xs);
  color: var(--ink-3);
  margin-top: 2px;
}
.song-row .count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-3);
  background: var(--bg-sunken);
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: var(--shadow-inset);
}

/* small note next to control rail */
.hint {
  color: #9AA3BD;
  font-size: 11px;
  max-width: 460px;
  text-align: center;
  line-height: 1.6;
}
.hint code {
  background: rgba(255,255,255,0.06);
  padding: 1px 6px;
  border-radius: 4px;
  color: #E6EAF6;
  font-family: var(--font-mono);
  font-size: 10px;
}

button:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

button:disabled {
  opacity: 0.48;
  cursor: default;
}

.point-pronunciation,
.point-tone,
.point-general {
  background: var(--bg-sunken);
  color: var(--ink-3);
}

.empty-state {
  flex: 1 1 auto;
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 26px 22px;
  color: var(--ink-3);
}

.empty-state strong {
  display: block;
  color: var(--ink-1);
  font-size: var(--text-lg);
  margin-bottom: 8px;
}

.empty-state p {
  margin: 0 0 16px;
  font-size: var(--text-sm);
  line-height: 1.6;
}

.empty-state .settings-mini-btn {
  min-height: 38px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  max-width: min(340px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--ink-1);
  box-shadow: var(--shadow-pop);
  font-size: var(--text-sm);
  z-index: 40;
}

@media (min-width: 720px) {
  body {
    background: #2A2F40;
    color: #E6EAF6;
    min-height: 100vh;
    padding: 24px 16px 80px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .phone-shell {
    width: 390px;
    height: 780px;
    background: #000;
    border-radius: 44px;
    padding: 8px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04) inset;
  }

  .phone-shell::before {
    content: "";
  }

  .phone-screen {
    border-radius: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
