/* ==========================================================================
   一词 · Yīcí — Atmospheric Lyrics Flow PWA
   Zero fake glass · Pure cinema color-field atmosphere · 1:1 Vertical Swipe
   ========================================================================== */

:root {
  --bg-base: #0D1A2B;
  --ink: #FFFFFF;
  --ink-secondary: rgba(255, 255, 255, 0.72);
  --ink-muted: rgba(255, 255, 255, 0.48);
  --surface: rgba(255, 255, 255, 0.10);
  --surface-hover: rgba(255, 255, 255, 0.16);
  --hairline: rgba(255, 255, 255, 0.14);
  --accent-star: #F6CA59;

  /* Luminous Pleco 4-tone colors (WCAG-AA on deep cinema backgrounds) */
  --tone-1: #FF8C7A;
  --tone-2: #6BE3A4;
  --tone-3: #7AC0FF;
  --tone-4: #D3A8FF;
  --tone-5: rgba(255, 255, 255, 0.56);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", sans-serif;
  --font-cjk: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", -apple-system, sans-serif;
  --font-mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  background: #0A0B0D;
  color: var(--ink);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.ico-inline {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* ==================== FULL-BLEED RESPONSIVE SHELL (MOBILE & NATIVE WEB) ==================== */
.app-shell {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-base);
  transition: background 650ms var(--spring);
  user-select: none;
  -webkit-user-select: none;
}

/* ==================== ATMOSPHERIC COLOR-FIELD BACKGROUND ==================== */
.atmo-glow {
  position: absolute;
  inset: -28%;
  z-index: 0;
  pointer-events: none;
  filter: blur(82px);
  opacity: 0.78;
  transition: background 800ms ease, transform 900ms var(--spring);
  will-change: transform;
}

.atmo-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, transparent 42%, rgba(0, 0, 0, 0.42) 100%);
}

/* ==================== FLOATING FEEDBACK TOAST ==================== */
.yici-toast {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 66px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 45;
  padding: 7px 14px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.94);
  color: #111214;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  max-width: calc(100% - 40px);
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 240ms var(--spring);
}

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

/* ==================== TOP QUIET HEADER ==================== */
.top-bar {
  position: relative;
  z-index: 12;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 22px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.deck-trigger {
  height: 36px;
  padding: 0 12px 0 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  transition: transform 110ms ease, background 150ms ease;
}

.deck-trigger:hover { background: rgba(255, 255, 255, 0.14); }
.deck-trigger:active { transform: scale(0.95); }

.deck-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #FFFFFF;
}

.deck-sep { opacity: 0.42; }

.deck-count {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.62);
  font-variant-numeric: tabular-nums;
}

.deck-chev { opacity: 0.6; }

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.slow-pill {
  height: 34px;
  padding: 0 11px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
  transition: transform 100ms ease, background 160ms ease, color 160ms ease;
}

.slow-pill:active { transform: scale(0.93); }
.slow-pill.active {
  background: #FFFFFF;
  color: #111214;
}

.icon-pill {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.88);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 100ms ease, background 150ms ease;
}

.icon-pill:hover { background: rgba(255, 255, 255, 0.16); }
.icon-pill:active { transform: scale(0.91); }

/* ==================== FULL-BLEED LYRICS FLOW STAGE ==================== */
.lyrics-stage {
  position: relative;
  z-index: 8;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 26px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  cursor: grab;
  touch-action: none;
}

.lyrics-stage::-webkit-scrollbar { display: none; }
.lyrics-stage:active { cursor: grabbing; }

.app-shell.expand-open .lyrics-stage {
  touch-action: pan-y;
}

.lyrics-flow {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  transition: transform 340ms var(--spring), opacity 240ms ease;
  will-change: transform, opacity;
}

.app-shell.drawer-open .lyrics-flow {
  opacity: 0.24;
  filter: blur(8px);
  transform: scale(0.96);
}

/* Ghost Previous / Next Lines (Apple Music depth cues) */
.ghost-line {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--font-cjk);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.18);
  filter: blur(1.2px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 260ms ease, max-height 300ms var(--spring), margin 300ms var(--spring), color 160ms ease, filter 160ms ease;
  max-height: 36px;
}

.ghost-line:hover {
  color: rgba(255, 255, 255, 0.36);
  filter: blur(0.4px);
}

.ghost-prev { margin-bottom: 24px; }
.ghost-next { margin-top: 28px; }

.app-shell.expand-open .ghost-line {
  max-height: 0;
  opacity: 0;
  margin: 0;
  pointer-events: none;
}

/* Active Center Sentence Block */
.active-subline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.active-context {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.56);
  letter-spacing: -0.01em;
}

.active-marks {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-star);
  letter-spacing: 0.06em;
}

/* Tap-to-translate Word Micro-Gloss */
.token-gloss {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 7px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.13);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 13px;
  animation: glossPop 190ms var(--spring);
}

.token-gloss[hidden] { display: none; }

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

.tg-zh { font-family: var(--font-cjk); font-weight: 700; font-size: 15px; color: #FFFFFF; }
.tg-py { color: rgba(255, 255, 255, 0.72); }
.tg-vi { color: rgba(255, 255, 255, 0.94); font-weight: 600; }

/* Main Luminous Lyrics Typography */
.lyric-main {
  font-family: var(--font-cjk);
  font-size: clamp(36px, 10.6vw, 48px);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  margin-bottom: 16px;
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: strict;
  transition: font-size 220ms ease;
}

.lyric-main.is-short {
  font-size: clamp(64px, 18vw, 84px);
  line-height: 1.06;
  letter-spacing: -0.03em;
}

.lyric-main.is-long {
  font-size: clamp(29px, 8.2vw, 37px);
  line-height: 1.28;
}

.lyric-main.is-english {
  font-family: var(--font-sans);
  font-size: clamp(32px, 8.8vw, 44px);
  line-height: 1.16;
  letter-spacing: -0.03em;
}

/* Interactive Sentence Tokens + Live Lyrics Highlight */
.tok-word {
  display: inline;
  cursor: pointer;
  border-radius: 6px;
  transition: opacity 200ms ease, text-shadow 200ms ease, background 140ms ease;
}

.tok-word:hover {
  background: rgba(255, 255, 255, 0.14);
}

.lyric-main.is-playing .tok-word {
  opacity: 0.34;
}

.lyric-main.is-playing .tok-word.lit {
  opacity: 1;
  text-shadow: 0 0 28px rgba(255, 255, 255, 0.45);
}

/* Pleco Tone Color Classes */
.tone-1 { color: var(--tone-1); }
.tone-2 { color: var(--tone-2); }
.tone-3 { color: var(--tone-3); }
.tone-4 { color: var(--tone-4); }
.tone-5 { color: var(--tone-5); }

.lyric-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: filter 260ms var(--spring), opacity 220ms ease;
}

.lyric-meta.blind-hidden {
  filter: blur(11px);
  opacity: 0.38;
  cursor: pointer;
}

.lyric-reading {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.68);
}

.lyric-meaning {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.36;
  letter-spacing: -0.015em;
  color: rgba(255, 255, 255, 0.96);
}

.blind-hint {
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.56);
}
.blind-hint[hidden] { display: none; }

/* ==================== INLINE DIALOGUE REPLY & SRS EXPANSION ==================== */
.inline-expand {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-top: 0;
  transition: grid-template-rows 340ms var(--spring), opacity 240ms ease, margin-top 300ms var(--spring);
}

.app-shell.expand-open .inline-expand {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 20px;
}

.expand-inner {
  overflow: hidden;
  padding-left: 15px;
  border-left: 2px solid rgba(255, 255, 255, 0.36);
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.expand-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.56);
}

.expand-listen {
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.expand-listen:active { transform: scale(0.94); }

.reply-zh {
  font-family: var(--font-cjk);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.32;
  color: #FFFFFF;
  margin-bottom: 2px;
}

.reply-py {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.64);
  margin-bottom: 3px;
}

.reply-vi {
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.4;
}

.expand-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.expand-tokens:empty { display: none; }

.tok-chip {
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.09);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: transform 100ms ease, background 140ms ease;
}

.tok-chip:active { transform: scale(0.95); background: rgba(255, 255, 255, 0.18); }
.tok-chip strong { font-family: var(--font-cjk); font-size: 14px; color: #FFFFFF; }
.tok-chip span { font-size: 11px; color: rgba(255, 255, 255, 0.68); }

.expand-tip {
  font-size: 12.5px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.64);
}
.expand-tip:empty { display: none; }

.inline-srs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.srs-chip {
  padding: 7px 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.10);
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.86);
  white-space: nowrap;
  transition: transform 100ms ease, background 150ms ease, color 150ms ease;
}

.srs-chip:active { transform: scale(0.95); }
.srs-chip.active {
  background: #FFFFFF;
  color: #111214;
}

/* ==================== BOTTOM MINIMAL LYRIC CONTROLS ==================== */
.bottom-bar {
  position: relative;
  z-index: 12;
  padding: 10px 24px calc(env(safe-area-inset-bottom, 0px) + 22px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
  width: 100%;
}

.bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.desktop-shortcuts {
  display: none;
}

.play-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #FFFFFF;
  color: #101216;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  transition: transform 110ms ease;
}

.play-btn:active { transform: scale(0.9); }

.waveform {
  flex: 1;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
}

.waveform span {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.24);
  transition: height 180ms ease, background 180ms ease;
}

.waveform.playing span {
  background: rgba(255, 255, 255, 0.92);
  animation: lyricWave 480ms ease-in-out infinite alternate;
}

.waveform.playing span:nth-child(2n) { animation-delay: 90ms; }
.waveform.playing span:nth-child(3n) { animation-delay: 190ms; }
.waveform.playing span:nth-child(5n) { animation-delay: 55ms; }

@keyframes lyricWave {
  from { height: 5px; }
  to { height: 24px; }
}

.bottom-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.reply-pill {
  height: 42px;
  padding: 0 16px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.13);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 100ms ease, background 160ms ease, color 160ms ease;
}

.reply-pill:active { transform: scale(0.94); }
.reply-pill.active {
  background: #FFFFFF;
  color: #111214;
}

.save-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.11);
  color: rgba(255, 255, 255, 0.85);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 110ms ease, background 160ms ease, color 160ms ease;
}

.save-btn:active { transform: scale(0.9); }
.save-btn.saved {
  background: rgba(246, 202, 89, 0.2);
  color: var(--accent-star);
}
.save-btn.saved svg { fill: currentColor; }

/* Small screen height adjustments (iPhone SE 667px) */
@media (max-height: 700px) {
  .top-bar { padding: 14px 18px 4px; }
  .lyrics-stage { padding: 4px 20px 6px; }
  .ghost-prev { margin-bottom: 14px; font-size: 18px; }
  .ghost-next { margin-top: 16px; font-size: 18px; }
  .lyric-main { font-size: 34px; margin-bottom: 12px; }
  .lyric-main.is-short { font-size: 62px; }
  .lyric-meaning { font-size: 18px; }
  .bottom-bar { padding: 8px 18px 16px; }
  .play-btn { width: 50px; height: 50px; }
  .reply-pill { height: 38px; padding: 0 13px; font-size: 12.5px; }
  .save-btn { width: 38px; height: 38px; }
}

/* ==================== HONEST NATIVE DARK FROSTED DRAWER ==================== */
.drawer-scrim {
  position: absolute;
  inset: 0;
  z-index: 24;
  background: rgba(0, 0, 0, 0.44);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.app-shell.drawer-open .drawer-scrim {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(78%, 620px);
  z-index: 30;
  background: rgba(18, 20, 25, 0.88);
  backdrop-filter: blur(36px) saturate(160%);
  -webkit-backdrop-filter: blur(36px) saturate(160%);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 30px 30px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 340ms var(--spring);
}

.drawer[hidden] { display: none; }
.drawer.open { transform: translateY(0); }

.drawer-head {
  padding: 10px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  flex-shrink: 0;
}

.drawer-grab {
  width: 100%;
  padding: 2px 0 10px;
  display: flex;
  justify-content: center;
}

.drawer-grab span {
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.25);
}

.drawer-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.drawer-close {
  padding: 6px 13px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12.5px;
  font-weight: 600;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  -webkit-overflow-scrolling: touch;
}

/* Drawer Components */
.d-block { margin-bottom: 20px; }
.d-block:last-child { margin-bottom: 0; }

.d-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.54);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 12px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  text-align: center;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.15;
}

.stat-lbl {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.54);
  margin-top: 3px;
}

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.filter-chip {
  padding: 7px 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.86);
  white-space: nowrap;
  transition: transform 100ms ease, background 140ms ease;
}

.filter-chip:active { transform: scale(0.95); }
.filter-chip.active {
  background: #FFFFFF;
  color: #111214;
}

.deck-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.deck-item {
  width: 100%;
  padding: 13px 15px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: background 140ms ease;
}

.deck-item.active {
  background: #FFFFFF;
  color: #111214;
}

.di-name { font-size: 14.5px; font-weight: 700; line-height: 1.25; }
.di-desc { font-size: 12px; opacity: 0.64; margin-top: 2px; line-height: 1.35; }
.di-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  opacity: 0.72;
  white-space: nowrap;
}

/* Mood Swatches */
.mood-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mood-tile {
  padding: 10px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.mood-tile.active {
  border-color: #FFFFFF;
  background: rgba(255, 255, 255, 0.14);
}

.mood-tile-nancy {
  grid-column: 1 / -1;
  flex-direction: row;
  justify-content: flex-start;
  padding: 11px 14px;
  gap: 12px;
  text-align: left;
}

.mt-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mt-copy strong {
  font-size: 13.5px;
  font-weight: 700;
}

.mt-copy small {
  font-size: 11px;
  opacity: 0.68;
  font-weight: 500;
}

.mood-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Settings Toggles */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
}

.tr-title { font-size: 13.5px; font-weight: 600; }
.tr-sub { font-size: 11.5px; color: rgba(255, 255, 255, 0.56); margin-top: 2px; }

.toggle-btn {
  padding: 6px 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.toggle-btn.on {
  background: #FFFFFF;
  color: #111214;
}

.widget-note {
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.68);
  margin-bottom: 12px;
}

.widget-note code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
}

.action-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-btn {
  height: 42px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.action-btn.primary {
  background: #FFFFFF;
  color: #111214;
}

/* Quick Quiz inside Drawer */
.quiz-hero {
  text-align: center;
  padding: 8px 0 18px;
}

.quiz-term {
  font-family: var(--font-cjk);
  font-size: 38px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 10px;
}

.quiz-speak {
  padding: 8px 16px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.quiz-opts {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.quiz-opt {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  transition: transform 100ms ease, background 150ms ease, border-color 150ms ease;
}

.quiz-opt:active { transform: scale(0.98); }
.quiz-opt.correct { background: rgba(45, 190, 120, 0.24); border-color: #45D48E; }
.quiz-opt.wrong { background: rgba(235, 82, 70, 0.24); border-color: #F46C61; }

.nancy-ribbon,
.nancy-bow {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   NANCY PINK CUTE EDITION ([data-mood="nancy"])
   Strawberry milk polka-dot desk · Plush pink ribbon card · Candy-berry 3D keys
   ========================================================================== */
[data-mood="nancy"] {
  --ink: #3B1F29;
  --ink-secondary: #6B4452;
  --ink-muted: #986B7B;
  --accent-star: #E69A00;
  --font-sans: "Nunito", -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "PingFang SC", sans-serif;
  --font-display: "Baloo 2", "Nunito", -apple-system, "PingFang SC", sans-serif;

  /* Crisp Pleco 4-tone colors tuned for white plush card */
  --tone-1: #D9385A;
  --tone-2: #1D7C52;
  --tone-3: #2865C4;
  --tone-4: #8A45C7;
  --tone-5: #986B7B;
}

[data-mood="nancy"] body {
  background-color: #FFF2F7;
  background-image:
    radial-gradient(circle at 14% 10%, rgba(255, 174, 208, 0.36) 0%, transparent 42%),
    radial-gradient(circle at 86% 16%, rgba(255, 224, 178, 0.30) 0%, transparent 40%),
    radial-gradient(#F6BED4 1.65px, transparent 1.65px);
  background-size: 100% 100%, 100% 100%, 26px 26px;
  color: #3B1F29;
}

[data-mood="nancy"] .app-shell {
  background-color: #FFF2F7;
  background-image:
    radial-gradient(circle at 18% 8%, rgba(255, 174, 208, 0.34) 0%, transparent 44%),
    radial-gradient(circle at 85% 18%, rgba(255, 224, 178, 0.30) 0%, transparent 42%),
    radial-gradient(#F6BED4 1.55px, transparent 1.55px);
  background-size: 100% 100%, 100% 100%, 24px 24px;
  color: #3B1F29;
}

[data-mood="nancy"] .atmo-glow,
[data-mood="nancy"] .atmo-vignette {
  display: none;
}

[data-mood="nancy"] .yici-toast {
  background: #E33E7B;
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(227, 62, 123, 0.3);
}

/* Top Bar — Plush Candy Pills */
[data-mood="nancy"] .deck-trigger {
  background: #FFFFFF;
  color: #3B1F29;
  border: 1.5px solid #F6BFD5;
  box-shadow: 0 3px 0 #F6C6DA;
  font-weight: 800;
}
[data-mood="nancy"] .deck-trigger:hover { background: #FFF8FB; }
[data-mood="nancy"] .deck-dot { background: #FF6CA5; }
[data-mood="nancy"] .deck-count { color: #B85A7D; }
[data-mood="nancy"] .deck-chev { color: #E33E7B; opacity: 1; }

[data-mood="nancy"] .slow-pill,
[data-mood="nancy"] .icon-pill {
  background: #FFFFFF;
  color: #9A4163;
  border: 1.5px solid #F6BFD5;
  box-shadow: 0 3px 0 #F6C6DA;
}
[data-mood="nancy"] .slow-pill.active {
  background: #E33E7B;
  color: #FFFFFF;
  border-color: #B6225A;
  box-shadow: 0 3px 0 #B6225A;
}

/* Cozy White Plush Notebook Card inside Lyrics Stage */
[data-mood="nancy"] .lyrics-stage {
  padding: 12px 18px 10px;
}

[data-mood="nancy"] .lyrics-flow {
  position: relative;
  min-height: 0;
  background: #FFFFFF;
  border: 2px solid #F6BFD5;
  border-radius: 32px;
  padding: 44px 22px 26px;
  box-shadow:
    0 16px 36px rgba(176, 56, 104, 0.10),
    0 5px 0 #F6C6DA;
  margin: auto 0;
}

/* Signature Nancy Polka-Dot Pink Header Strip + Bow Sticker */
[data-mood="nancy"] .nancy-ribbon {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 26px;
  border-radius: 30px 30px 0 0;
  background-color: #FF85B3;
  background-image: radial-gradient(rgba(255, 255, 255, 0.72) 2.6px, transparent 2.6px);
  background-size: 16px 14px;
  background-position: 6px 5px;
  border-bottom: 2px dashed rgba(255, 255, 255, 0.72);
  pointer-events: none;
}

[data-mood="nancy"] .nancy-bow {
  display: block;
  position: absolute;
  top: -15px;
  right: -4px;
  pointer-events: none;
  z-index: 6;
  transform: rotate(9deg);
}

[data-mood="nancy"] .ghost-line {
  color: rgba(152, 107, 123, 0.34);
  filter: blur(0.8px);
  font-size: 18px;
}
[data-mood="nancy"] .ghost-prev { margin-bottom: 16px; }
[data-mood="nancy"] .ghost-next { margin-top: 18px; }

[data-mood="nancy"] .active-context {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  background: #FFE4EF;
  color: #C72E69;
  font-size: 12px;
  font-weight: 800;
}

[data-mood="nancy"] .token-gloss {
  background: #FFF9DF;
  border: 1.5px solid #F2D479;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
[data-mood="nancy"] .tg-zh { color: #3B1F29; }
[data-mood="nancy"] .tg-py { color: #B85A7D; font-weight: 700; }
[data-mood="nancy"] .tg-vi { color: #6B4452; }

[data-mood="nancy"] .lyric-main {
  color: #3B1F29;
  font-size: clamp(32px, 9.2vw, 40px);
}
[data-mood="nancy"] .lyric-main.is-short {
  font-size: clamp(58px, 16vw, 76px);
}
[data-mood="nancy"] .lyric-main.is-long {
  font-size: clamp(27px, 7.6vw, 33px);
}
[data-mood="nancy"] .tok-word:hover {
  background: #FFE4EF;
}
[data-mood="nancy"] .lyric-main.is-playing .tok-word {
  opacity: 0.32;
}
[data-mood="nancy"] .lyric-main.is-playing .tok-word.lit {
  opacity: 1;
  color: #E33E7B;
  text-shadow: none;
}

[data-mood="nancy"] .lyric-reading {
  color: #E33E7B;
  font-weight: 700;
}

[data-mood="nancy"] .lyric-meaning {
  font-family: var(--font-display);
  color: #3B1F29;
  font-weight: 700;
}

[data-mood="nancy"] .blind-hint {
  color: #C72E69;
}

/* Inline Reply Box — Cute Dashed Pink Card inside Notebook */
[data-mood="nancy"] .expand-inner {
  padding: 14px 14px 12px;
  border-left: none;
  border: 2px dashed #F6BFD5;
  border-radius: 20px;
  background: #FFF8FB;
}

[data-mood="nancy"] .expand-head {
  color: #B85A7D;
  font-weight: 800;
}

[data-mood="nancy"] .expand-listen {
  background: #FFE4EF;
  color: #C72E69;
  border: 1px solid #F6BFD5;
}

[data-mood="nancy"] .reply-zh { color: #3B1F29; }
[data-mood="nancy"] .reply-py { color: #E33E7B; font-weight: 700; }
[data-mood="nancy"] .reply-vi { color: #5D3946; font-weight: 600; }

[data-mood="nancy"] .tok-chip {
  background: #FFF9DF;
  border: 1.5px solid #F2D479;
}
[data-mood="nancy"] .tok-chip strong { color: #3B1F29; }
[data-mood="nancy"] .tok-chip span { color: #7C5C24; }

[data-mood="nancy"] .expand-tip { color: #6B4452; }

[data-mood="nancy"] .srs-chip {
  background: #FFFFFF;
  color: #6B4452;
  border: 1.5px solid #F6BFD5;
}
[data-mood="nancy"] .srs-chip.active {
  background: #EAFAF1;
  color: #1D6543;
  border-color: #A8E4C3;
}

/* Bottom Controls — Chunky Candy-Berry 3D Play Button */
[data-mood="nancy"] .play-btn {
  background: linear-gradient(180deg, #FF74AA 0%, #E33E7B 100%);
  color: #FFFFFF;
  border: 1.5px solid #C82C67;
  box-shadow:
    0 4px 0 #B6225A,
    0 10px 22px rgba(227, 62, 123, 0.30),
    inset 0 2px 0 rgba(255, 255, 255, 0.38);
}
[data-mood="nancy"] .play-btn:active {
  transform: translateY(3px) scale(0.97);
  box-shadow: 0 1px 0 #B6225A;
}

[data-mood="nancy"] .waveform span {
  background: #F4B9D1;
}
[data-mood="nancy"] .waveform.playing span {
  background: #E33E7B;
}

[data-mood="nancy"] .reply-pill {
  background: #FFFFFF;
  color: #C72E69;
  border: 1.5px solid #F6BFD5;
  box-shadow: 0 3px 0 #F6C6DA;
  font-weight: 800;
}
[data-mood="nancy"] .reply-pill.active {
  background: #E33E7B;
  color: #FFFFFF;
  border-color: #B6225A;
  box-shadow: 0 3px 0 #B6225A;
}

[data-mood="nancy"] .save-btn {
  background: #FFFFFF;
  color: #C9859E;
  border: 1.5px solid #F6BFD5;
  box-shadow: 0 3px 0 #F6C6DA;
}
[data-mood="nancy"] .save-btn.saved {
  background: #FFF9DF;
  border-color: #F2D479;
  color: #E69A00;
  box-shadow: 0 3px 0 #EED178;
}

/* Nancy Plush White Drawers (Decks / Quiz / Settings) */
[data-mood="nancy"] .drawer-scrim {
  background: rgba(59, 31, 41, 0.28);
}
[data-mood="nancy"] .drawer {
  background: rgba(255, 255, 255, 0.96);
  border-top: 2px solid #F6BFD5;
  color: #3B1F29;
  box-shadow: 0 -14px 40px rgba(176, 56, 104, 0.14);
}
[data-mood="nancy"] .drawer-head { border-bottom-color: #FFE4EF; }
[data-mood="nancy"] .drawer-grab span { background: #F6BFD5; }
[data-mood="nancy"] .drawer-title { font-family: var(--font-display); color: #3B1F29; }
[data-mood="nancy"] .drawer-close { background: #FFE4EF; color: #C72E69; font-weight: 800; }
[data-mood="nancy"] .d-label { color: #986B7B; font-weight: 800; }

[data-mood="nancy"] .stat-card {
  background: #FFF5F9;
  border: 1.5px solid #F6BFD5;
}
[data-mood="nancy"] .stat-val { color: #E33E7B; }
[data-mood="nancy"] .stat-lbl { color: #8B5D6D; }

[data-mood="nancy"] .filter-chip {
  background: #FFF5F9;
  color: #6B4452;
  border: 1.5px solid #F6BFD5;
}
[data-mood="nancy"] .filter-chip.active {
  background: #E33E7B;
  color: #FFFFFF;
  border-color: #B6225A;
}

[data-mood="nancy"] .deck-item {
  background: #FFF8FB;
  border: 1.5px solid #F6BFD5;
  color: #3B1F29;
}
[data-mood="nancy"] .deck-item.active {
  background: #E33E7B;
  border-color: #B6225A;
  color: #FFFFFF;
}

[data-mood="nancy"] .mood-tile {
  background: #FFF8FB;
  border-color: #F6BFD5;
  color: #6B4452;
}
[data-mood="nancy"] .mood-tile.active {
  border-color: #E33E7B;
  background: #FFE4EF;
  color: #B6225A;
}

[data-mood="nancy"] .toggle-row {
  background: #FFF8FB;
  border: 1.5px solid #F6BFD5;
}
[data-mood="nancy"] .tr-sub { color: #8B5D6D; }
[data-mood="nancy"] .toggle-btn {
  background: #FFE4EF;
  color: #C72E69;
}
[data-mood="nancy"] .toggle-btn.on {
  background: #E33E7B;
  color: #FFFFFF;
}

[data-mood="nancy"] .widget-note { color: #6B4452; }
[data-mood="nancy"] .widget-note code {
  background: #FFE4EF;
  color: #B6225A;
}

[data-mood="nancy"] .action-btn {
  background: #FFE4EF;
  color: #B6225A;
  border: 1.5px solid #F6BFD5;
  font-weight: 800;
}
[data-mood="nancy"] .action-btn.primary {
  background: linear-gradient(180deg, #FF74AA 0%, #E33E7B 100%);
  color: #FFFFFF;
  border-color: #B6225A;
  box-shadow: 0 3px 0 #B6225A;
}

[data-mood="nancy"] .quiz-speak {
  background: #FFE4EF;
  color: #C72E69;
  border: 1.5px solid #F6BFD5;
}
[data-mood="nancy"] .quiz-opt {
  background: #FFF8FB;
  border-color: #F6BFD5;
  color: #3B1F29;
}
[data-mood="nancy"] .quiz-opt.correct {
  background: #EAFAF1;
  border-color: #54C488;
  color: #1D6543;
}
[data-mood="nancy"] .quiz-opt.wrong {
  background: #FFE5EB;
  border-color: #E33E7B;
  color: #B6225A;
}

@media (max-height: 700px) and (max-width: 767px) {
  [data-mood="nancy"] .lyrics-flow {
    padding: 38px 18px 20px;
  }
  [data-mood="nancy"] .nancy-bow {
    width: 48px;
    height: 36px;
    top: -11px;
  }
}

/* ==================== NATIVE DESKTOP / TABLET WEB LAYOUT (>= 768px) ==================== */
@media (min-width: 768px) {
  .top-bar {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 26px 40px 8px;
  }

  .deck-trigger {
    height: 40px;
    padding: 0 16px 0 13px;
    font-size: 14px;
  }

  .slow-pill {
    height: 38px;
    padding: 0 14px;
    font-size: 12.5px;
  }

  .icon-pill {
    width: 38px;
    height: 38px;
  }

  .lyrics-stage {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 16px 40px;
    transition: max-width 340ms var(--spring);
  }

  .app-shell.expand-open .lyrics-stage {
    max-width: 1080px;
  }

  .ghost-line {
    font-size: 26px;
    max-height: 42px;
  }
  .ghost-prev { margin-bottom: 30px; }
  .ghost-next { margin-top: 34px; }

  .lyric-main {
    font-size: clamp(48px, 4.8vw, 68px);
    margin-bottom: 20px;
  }
  .lyric-main.is-short {
    font-size: clamp(84px, 8vw, 112px);
  }
  .lyric-main.is-long {
    font-size: clamp(36px, 3.6vw, 50px);
  }
  .lyric-main.is-english {
    font-size: clamp(44px, 4.4vw, 62px);
  }

  .lyric-reading { font-size: 21px; }
  .lyric-meaning { font-size: 25px; }

  /* Balanced 2-column reading spread on wide desktop when Đáp lại is open */
  .app-shell.expand-open .active-block {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
    gap: 44px;
    align-items: center;
  }

  .app-shell.expand-open .inline-expand {
    margin-top: 0;
  }

  .bottom-bar {
    max-width: 740px;
    margin: 0 auto;
    padding: 12px 40px 26px;
  }

  .desktop-shortcuts {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.44);
  }

  .desktop-shortcuts kbd {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.84);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    margin-right: 3px;
  }

  /* Centered macOS / Web Floating Modal instead of full-width mobile bottom sheet */
  .drawer {
    left: 50%;
    top: 50%;
    right: auto;
    bottom: auto;
    width: min(520px, calc(100vw - 48px));
    max-height: min(82vh, 660px);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 32px 90px rgba(0, 0, 0, 0.55);
    opacity: 0;
    transform: translate(-50%, -46%) scale(0.97);
    transition: transform 280ms var(--spring), opacity 200ms ease;
  }

  .drawer.open {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  .drawer-grab { display: none; }
  .drawer-head { padding: 18px 22px 14px; }

  /* Nancy Pink Native Web Desk Staging (>= 768px) */
  [data-mood="nancy"] .lyrics-stage {
    max-width: 740px;
  }
  [data-mood="nancy"] .app-shell.expand-open .lyrics-stage {
    max-width: 1020px;
  }
  [data-mood="nancy"] .lyrics-flow {
    padding: 58px 46px 40px;
    border-radius: 36px;
  }
  [data-mood="nancy"] .nancy-ribbon {
    height: 30px;
    border-radius: 34px 34px 0 0;
  }
  [data-mood="nancy"] .nancy-bow {
    width: 72px;
    height: 55px;
    top: -18px;
    right: -6px;
  }
  [data-mood="nancy"] .lyric-main {
    font-size: clamp(44px, 4.2vw, 56px);
  }
  [data-mood="nancy"] .lyric-main.is-short {
    font-size: clamp(76px, 7vw, 96px);
  }
  [data-mood="nancy"] .lyric-main.is-long {
    font-size: clamp(32px, 3.2vw, 44px);
  }
  [data-mood="nancy"] .desktop-shortcuts {
    color: #986B7B;
  }
  [data-mood="nancy"] .desktop-shortcuts kbd {
    background: #FFFFFF;
    color: #B6225A;
    border: 1px solid #F6BFD5;
    box-shadow: 0 2px 0 #F6C6DA;
  }
  [data-mood="nancy"] .drawer {
    border: 2px solid #F6BFD5;
    box-shadow: 0 26px 70px rgba(176, 56, 104, 0.22);
  }
}

