/* ---------- Look ----------
 * Evening purple (her favourite colour) with letters on warm paper. iOS system
 * fonts only: New York for the letters and headings, SF for everything else. */
:root {
  --bg: #22113a;
  --bg-deep: #1a0c2c;
  --card: #2f1a4a;
  --card-2: #3b2459;
  --line: rgba(255, 255, 255, 0.09);
  --ink: #f8f1fd;
  --ink-2: #d5c4e6;
  --ink-3: #a993c2;
  --accent: #cfaef5;
  --accent-2: #a77ddd;
  --accent-ink: #24123a;
  --gold: #ecc77c;
  --rose: #f5a9c8;
  --good: #9fe0bd;
  --bad: #f4a6a6;
  --paper: #fcf7ee;
  --paper-2: #f3eadb;
  --paper-ink: #2d1f39;
  --paper-muted: #6e5b80;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Helvetica Neue", sans-serif;
  --script: "Snell Roundhand", "Apple Chancery", "Brush Script MT", cursive;
  --tab-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --top-pad: calc(max(env(safe-area-inset-top, 0px), 12px) + 10px);
  --radius: 18px;
  color-scheme: dark;
}

/* On the iPhone home screen the page sits under the status bar. Since iOS 26.1 the
   system shades that bar itself, and a Face ID phone's bar is never under 44px even
   if the inset reads 0, so content starts below it (same fix as Belt Road and Dugout). */
body.ios-app { --top-pad: calc(env(safe-area-inset-top, 0px) + 10px); }
body.ios-app.ios-tall { --top-pad: calc(max(env(safe-area-inset-top, 0px), 44px) + 10px); }

* { box-sizing: border-box; }
html, body {
  margin: 0;
  /* Locked to the screen; only #view and sheets scroll. One pixel taller than the
     screen so iOS 26+ corrects its short starting viewport (otherwise the tab bar
     floats above the bottom edge). */
  height: 100%;
  height: calc(100vh + 1px);
  height: calc(100dvh + 1px);
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#topstrip {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: calc(var(--top-pad) - 10px);
  background: var(--bg);
  transform: translateZ(0);
}

#view {
  position: fixed;
  top: 0; left: 0; right: 0;
  bottom: calc(var(--tab-h) + var(--safe-b));
  max-width: 620px;
  margin: 0 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: var(--top-pad) 18px 32px;
  outline: none;
}
body.no-tabs #view { bottom: 0; padding-bottom: calc(var(--safe-b) + 24px); }
body.has-mini #view { padding-bottom: 96px; }

/* ---------- Tab bar (opaque, own layer: a blurred fixed bar judders on iOS) ---------- */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex;
  background: var(--bg-deep);
  border-top: 1px solid var(--line);
  transform: translateZ(0);
}
#tabbar a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-3);
  text-decoration: none;
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
}
#tabbar svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#tabbar a.on { color: var(--accent); }
#tabbar a.on svg { stroke-width: 2.1; }

/* ---------- Shared pieces ---------- */
.page-head { margin: 6px 0 18px; }
.page-head h1 { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
.page-head .sub { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; }
.eyebrow { margin: 0; font-size: 12.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.section-title { margin: 28px 0 10px; font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.card { background: var(--card); border-radius: var(--radius); }
.muted { color: var(--ink-2); }
.empty { color: var(--ink-2); text-align: center; padding: 36px 20px; font-size: 15px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 16px;
}
.btn:active { transform: scale(0.98); }
.btn.ghost { background: var(--card-2); color: var(--ink); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.55; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); color: var(--ink-2);
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.row-btn {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--card); color: var(--ink); text-align: left; font-size: 16px; font-weight: 600;
}
.row-btn .chev { margin-left: auto; color: var(--ink-3); font-size: 22px; line-height: 1; }
.row-btn small { display: block; font-weight: 500; color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--card-2); color: var(--ink-2); }

/* ---------- Today ---------- */
.today-head { position: relative; margin: 4px 0 20px; padding-right: 48px; }
.today-head h1 .md { white-space: nowrap; }
.today-head h1 { font-family: var(--serif); font-weight: 600; font-size: 31px; line-height: 1.15; margin: 6px 0 0; }
.today-head .icon-btn { position: absolute; top: 0; right: 0; }

.stage { position: relative; display: flex; justify-content: center; margin: 4px 0 22px; perspective: 1200px; }
.stage::before {
  content: ""; position: absolute; inset: -30px -40px; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(167, 125, 221, 0.32), rgba(167, 125, 221, 0) 75%);
}

/* The envelope: back, letter peeking out, pocket, flap, wax seal. */
.envelope {
  position: relative; width: min(100%, 330px); aspect-ratio: 3 / 2.05;
  display: block; border-radius: 10px; margin-bottom: 40px;
}
.env-back, .env-pocket, .env-flap, .env-letter { position: absolute; left: 0; right: 0; }
.env-back { inset: 0; border-radius: 10px; background: #e7d9c2; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4); }
.env-letter {
  left: 7%; right: 7%; top: 8%; height: 80%;
  background: var(--paper); border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) 0.45s;
}
.env-letter::before, .env-letter::after {
  content: ""; position: absolute; left: 12%; right: 12%; height: 3px; border-radius: 3px; background: #e6dccb;
}
.env-letter::before { top: 22%; }
.env-letter::after { top: 34%; right: 30%; }
.env-pocket {
  inset: 0; border-radius: 10px;
  background: linear-gradient(160deg, #f1e6d3, #e3d3ba);
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
}
.env-pocket::after {
  content: attr(data-to);
  position: absolute; left: 0; right: 0; bottom: 7%;
  text-align: center; font-family: var(--script); font-size: 28px; line-height: 1; color: #6a4a8c;
}
.env-flap {
  top: 0; height: 58%;
  background: linear-gradient(180deg, #ddcbb0, #d5c1a3);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: 50% 0;
  transition: transform 0.55s cubic-bezier(0.5, 0, 0.3, 1);
  border-radius: 10px 10px 0 0;
}
.env-seal {
  position: absolute; left: 50%; top: 52%; width: 62px; height: 62px; margin: -31px 0 0 -31px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9a6fd0, #5d3592 55%, #3f2066);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35), inset 0 0 0 4px rgba(255, 255, 255, 0.08);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.25s, transform 0.25s;
}
.env-seal svg { width: 28px; height: 28px; fill: #f3e6ff; opacity: 0.92; }
.envelope.special .env-seal { background: radial-gradient(circle at 35% 30%, #f6dc98, #c8963c 55%, #946821); }
.envelope.special .env-seal svg { fill: #fff6df; }
.env-hint {
  position: absolute; left: 0; right: 0; bottom: -40px; text-align: center;
  color: var(--ink-2); font-size: 14px; font-weight: 600; letter-spacing: 0.02em;
}
.envelope:not(.opening) .env-seal { animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.06); } }
.envelope.opening .env-seal { opacity: 0; transform: scale(0.6); }
.envelope.opening .env-flap { transform: rotateX(180deg); z-index: 0; }
.envelope.opening .env-letter { transform: translateY(-46%); }
.envelope.opening .env-hint { opacity: 0; }
.envelope.special::after {
  content: ""; position: absolute; inset: -6px; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 1.5px rgba(236, 199, 124, 0.7), 0 0 24px rgba(236, 199, 124, 0.25);
}

/* The open letter */
.letter {
  position: relative; width: 100%;
  background: var(--paper); color: var(--paper-ink);
  border-radius: 14px; padding: 26px 24px 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 120px);
}
.letter.appear { animation: rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(26px) scale(0.98); } }
.letter.special { box-shadow: 0 0 0 2px rgba(236, 199, 124, 0.85), 0 18px 40px rgba(0, 0, 0, 0.35); }
.letter-tag { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--paper-muted); }
.letter-title { margin: 0 0 10px; font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.2; }
.letter-text { font-family: var(--serif); font-size: 19px; line-height: 1.6; }
.letter-text p { margin: 0 0 14px; }
.letter-text p:last-child { margin-bottom: 0; }
.letter-media { display: block; width: 100%; margin: 18px 0 4px; border-radius: 10px; overflow: hidden; background: var(--paper-2); position: relative; }
.letter-media img { width: 100%; height: auto; min-height: 120px; object-fit: cover; }
.letter-media .play-badge { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.letter-caption { margin: 8px 2px 0; font-size: 14px; color: var(--paper-muted); font-style: italic; font-family: var(--serif); }
.letter-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding-top: 12px; border-top: 1px solid #ece2d2; }
.letter-foot .day { font-size: 13px; color: var(--paper-muted); font-weight: 600; }
.heart-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; margin: -8px -10px -8px 0; border-radius: 999px; color: #a25a7c; font-weight: 700; font-size: 14px; }
.heart-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; }
.heart-btn.on svg { fill: #e0679c; stroke: #e0679c; }
.heart-btn.pop svg { animation: pop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes pop { 40% { transform: scale(1.35); } }

.play-badge { width: 58px; height: 58px; border-radius: 50%; background: rgba(20, 8, 34, 0.62); display: flex; align-items: center; justify-content: center; }
.play-badge svg { width: 24px; height: 24px; fill: #fff; margin-left: 3px; }

.count {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 26px 0 12px; padding: 16px 18px; border-radius: var(--radius); background: var(--card);
}
.count b { font-family: var(--serif); font-size: 34px; font-weight: 600; color: var(--gold); line-height: 1; }
.count span { color: var(--ink-2); font-size: 15px; }
.today-msg { text-align: center; padding: 30px 10px; }
.today-msg h2 { font-family: var(--serif); font-size: 26px; font-weight: 600; margin: 0 0 8px; }
.today-msg p { margin: 0; color: var(--ink-2); }

/* ---------- Calendar of every note ---------- */
.chips { display: flex; gap: 8px; margin: 0 0 16px; }
.chip { padding: 8px 16px; border-radius: 999px; background: var(--card); color: var(--ink-2); font-weight: 650; font-size: 14.5px; }
.chip.on { background: var(--accent); color: var(--accent-ink); }
.month { margin: 0 0 22px; }
.month h3 { margin: 0 0 8px; font-family: var(--serif); font-weight: 600; font-size: 20px; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.month-grid .dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-3); padding-bottom: 2px; }
.dcell {
  position: relative; aspect-ratio: 1; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums;
  background: var(--card); color: var(--ink);
}
.dcell.future { background: transparent; color: var(--ink-3); font-weight: 500; }
.dcell.sealed { background: var(--card-2); }
.dcell.sealed::after { content: ""; position: absolute; bottom: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.dcell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.dcell.special { box-shadow: inset 0 0 0 1.5px var(--gold); }
.dcell.special.future { color: var(--gold); }
.dcell.today.special { box-shadow: inset 0 0 0 2px var(--gold); }
.dcell .h { position: absolute; top: 3px; right: 4px; width: 11px; height: 11px; fill: #e0679c; }
.dcell.blank { background: transparent; }
.heart-list { display: grid; gap: 10px; }
.heart-item { display: block; width: 100%; text-align: left; padding: 14px 16px; border-radius: 14px; background: var(--paper); color: var(--paper-ink); }
.heart-item b { display: block; font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--paper-muted); margin-bottom: 4px; }
.heart-item span { font-family: var(--serif); font-size: 16.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Sheets (full-screen layers) ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--bg);
  animation: sheet-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.closing { animation: sheet-out 0.22s ease-in forwards; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
.sheet-head {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: var(--top-pad) 14px 10px;
}
.sheet-head h2 { flex: 1; margin: 0; font-size: 17px; font-weight: 700; text-align: center; }
.sheet-head .spacer { width: 40px; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 6px 18px calc(var(--safe-b) + 28px); }
.sheet.dark { background: #0d0614; }

/* ---------- Photos ---------- */
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 0 -14px; }
.pgrid button { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--card); border-radius: 4px; }
.pgrid img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.3s; }
.pgrid img.ready { opacity: 1; }
.viewer { position: fixed; inset: 0; z-index: 70; background: #07030b; display: flex; flex-direction: column; animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.viewer-top { flex: none; display: flex; align-items: center; justify-content: space-between; padding: var(--top-pad) 14px 8px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.viewer-stage { flex: 1; position: relative; overflow: hidden; touch-action: none; }
.viewer-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: transform 0.25s ease; }
.viewer-cap { flex: none; min-height: 64px; padding: 12px 22px calc(var(--safe-b) + 18px); text-align: center; font-family: var(--serif); font-size: 17px; color: var(--ink); }
.viewer-cap small { display: block; margin-top: 4px; font-family: var(--sans); font-size: 12.5px; color: var(--ink-3); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.viewer .icon-btn { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* ---------- Songs ---------- */
.yt-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 14px 16px; margin: 0 0 18px; border-radius: var(--radius);
  background: linear-gradient(135deg, #4a2a73, #33194f); color: var(--ink);
}
.yt-card .yt-ico { flex: none; width: 44px; height: 44px; border-radius: 12px; background: rgba(255, 255, 255, 0.12); display: flex; align-items: center; justify-content: center; }
.yt-card .yt-ico svg { width: 22px; height: 22px; fill: #fff; margin-left: 2px; }
.yt-card b { display: block; font-size: 16px; }
.yt-card small { color: var(--ink-2); font-size: 13.5px; }
.songs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.song { width: 100%; display: flex; align-items: center; gap: 14px; padding: 8px; border-radius: 14px; text-align: left; }
.song:active, .song.on { background: var(--card); }
.song img, .song .ph { flex: none; width: 58px; height: 58px; border-radius: 10px; object-fit: cover; background: var(--card-2); }
.song .t { flex: 1; min-width: 0; }
.song .t b { display: block; font-size: 16.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .t small { color: var(--ink-3); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.song.on .t b { color: var(--accent); }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; margin-right: 6px; vertical-align: -1px; }
.eq i { width: 3px; background: var(--accent); border-radius: 1px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.3s; }
.eq i:nth-child(3) { animation-delay: -0.6s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.paused .eq i { animation-play-state: paused; }

/* Mini player above the tabs */
#mini {
  position: fixed; left: 10px; right: 10px; z-index: 45;
  bottom: calc(var(--tab-h) + var(--safe-b) + 8px);
  max-width: 600px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 8px;
  border-radius: 16px; background: #3a2259;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transform: translateZ(0);
}
#mini .icon-btn { background: rgba(255, 255, 255, 0.1); color: #fff; }
#mini .icon-btn svg { fill: currentColor; stroke: none; width: 20px; height: 20px; }
#mini img { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; background: var(--card-2); }
#mini .t { flex: 1; min-width: 0; font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mini .t small { display: block; font-weight: 500; color: var(--ink-2); font-size: 12.5px; }
#mini .bar { position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
#mini .bar i { display: block; height: 100%; width: 0; background: var(--accent); }

/* Now playing */
.np { position: fixed; inset: 0; z-index: 65; display: flex; flex-direction: column; background: #150a22; overflow: hidden; animation: sheet-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
.np.closing { animation: sheet-out 0.22s ease-in forwards; }
.np-bg { position: absolute; inset: -60px; width: calc(100% + 120px); height: calc(100% + 120px); max-width: none; object-fit: cover; filter: blur(50px) saturate(1.3) brightness(0.45); transform: translateZ(0); }
.np > *:not(.np-bg) { position: relative; }
.np-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: var(--top-pad) 14px 6px; }
.np-head .icon-btn { background: rgba(255, 255, 255, 0.12); color: #fff; }
.np-head .icon-btn.on { background: #fff; color: #2a1442; }
.np-mode-label { font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); }
.np-art { flex: 1; display: flex; align-items: center; justify-content: center; padding: 10px 32px; min-height: 0; }
.np-art img { width: min(100%, 340px); aspect-ratio: 1; object-fit: cover; border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); }
.np-meta { flex: none; display: flex; align-items: center; gap: 12px; padding: 4px 24px 0; }
.np-meta .thumb { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; }
.np-meta h2 { flex: 1; margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.2; }
.np-meta .watch { flex: none; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); font-size: 13.5px; font-weight: 700; }
.np-lyrics {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 0 26px;
  -webkit-mask-image: linear-gradient(transparent 0, #000 12%, #000 80%, transparent 100%);
  mask-image: linear-gradient(transparent 0, #000 12%, #000 80%, transparent 100%);
}
.ly { margin: 0 0 18px; font-size: 25px; font-weight: 750; line-height: 1.28; color: rgba(255, 255, 255, 0.34); transition: color 0.35s, transform 0.35s; transform-origin: 0 50%; cursor: pointer; }
.ly.past { color: rgba(255, 255, 255, 0.5); }
.ly.on { color: #fff; }
.ly-gap { height: 18px; }
.ly-pad { height: 32%; min-height: 120px; }
.ly-pad.end { height: 60%; }
.np-none { color: rgba(255, 255, 255, 0.6); text-align: center; padding: 40px 0; }
.np-seek { flex: none; padding: 12px 24px 0; }
.np-seek input { width: 100%; margin: 0; accent-color: #fff; height: 28px; }
.np-times { display: flex; justify-content: space-between; font-size: 12.5px; color: rgba(255, 255, 255, 0.65); font-variant-numeric: tabular-nums; margin-top: -2px; }
.np-ctrls { flex: none; display: flex; align-items: center; justify-content: center; gap: 34px; padding: 8px 0 calc(var(--safe-b) + 22px); }
.np-ctrls button { color: #fff; display: flex; align-items: center; justify-content: center; }
.np-ctrls svg { fill: #fff; }
.np-ctrls .skip svg { width: 36px; height: 36px; }
.np-ctrls .pp { width: 72px; height: 72px; border-radius: 50%; background: #fff; }
.np-ctrls .pp svg { width: 30px; height: 30px; fill: #241236; }
.np-load { font-size: 13px; color: rgba(255, 255, 255, 0.7); text-align: center; min-height: 18px; margin-top: 4px; }
.np.lyrics-mode .np-art { display: none; }
.np:not(.lyrics-mode) .np-lyrics { display: none; }
.np:not(.lyrics-mode) .np-meta .thumb { display: none; }

/* YouTube */
.yt-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.yt-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Videos ---------- */
.vlist { display: grid; gap: 14px; }
.vcard { display: block; width: 100%; text-align: left; border-radius: var(--radius); overflow: hidden; background: var(--card); }
.vcard .poster { position: relative; aspect-ratio: 16 / 9; background: var(--card-2); }
.vcard .poster img { width: 100%; height: 100%; object-fit: cover; }
.vcard .poster .play-badge { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.vcard .poster .len { position: absolute; right: 10px; bottom: 10px; padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.6); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.vcard .cap { padding: 12px 16px 14px; }
.vcard .cap b { display: block; font-size: 16px; font-weight: 650; }
.vcard .cap small { color: var(--ink-3); font-size: 13px; }
.lv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lv { text-align: left; }
.lv .art { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--card-2); }
.lv .art img { width: 100%; height: 100%; object-fit: cover; }
.lv .art .play-badge { position: absolute; right: 8px; bottom: 8px; width: 40px; height: 40px; }
.lv .art .play-badge svg { width: 16px; height: 16px; }
.lv b { display: block; margin-top: 8px; font-size: 14.5px; font-weight: 650; line-height: 1.25; }
.video-wrap { width: 100%; border-radius: 12px; overflow: hidden; background: #000; }
.video-wrap video { display: block; width: 100%; max-height: 72vh; background: #000; }
.loading { padding: 40px 0; text-align: center; color: var(--ink-2); font-size: 15px; }

/* ---------- Play ---------- */
.game-card {
  position: relative; display: block; width: 100%; text-align: left;
  padding: 22px 20px; margin: 0 0 14px; border-radius: 22px; overflow: hidden; color: var(--ink);
}
.game-card.trivia { background: linear-gradient(135deg, #6a3fa3, #3d1f66); }
.game-card.memory { background: linear-gradient(135deg, #a3527f, #5a2350); }
.game-card h2 { margin: 0 0 6px; font-family: var(--serif); font-size: 26px; font-weight: 600; }
.game-card p { margin: 0; color: rgba(255, 255, 255, 0.82); font-size: 15px; max-width: 75%; }
.game-card .deco { position: absolute; right: -6px; bottom: -14px; font-size: 92px; line-height: 1; opacity: 0.22; }
.pack { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; margin: 0 0 10px; border-radius: 16px; background: var(--card); text-align: left; }
.pack .em { flex: none; width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; background: var(--card-2); }
.pack b { display: block; font-size: 17px; }
.pack small { color: var(--ink-2); font-size: 13.5px; }
.pack .chev { margin-left: auto; color: var(--ink-3); font-size: 22px; }
.seg { display: flex; gap: 8px; margin: 0 0 16px; }

.quiz-progress { height: 6px; border-radius: 6px; background: var(--card); overflow: hidden; margin: 4px 0 22px; }
.quiz-progress i { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }
.quiz-q { font-family: var(--serif); font-size: 25px; font-weight: 600; line-height: 1.3; margin: 0 0 22px; }
.opts { display: grid; gap: 10px; }
.opt {
  width: 100%; min-height: 56px; padding: 14px 18px; border-radius: 16px; text-align: left;
  background: var(--card); color: var(--ink); font-size: 17px; font-weight: 600;
  display: flex; align-items: center; gap: 12px;
  transition: background 0.2s, transform 0.2s;
}
.opt:active { transform: scale(0.99); }
.opt .mk { margin-left: auto; font-size: 18px; }
.opt.right { background: #2f6a50; color: #fff; }
.opt.wrong { background: #7c3046; color: #fff; }
.opt.dim { opacity: 0.55; }
.fact { margin: 18px 0 0; padding: 14px 16px; border-radius: 14px; background: var(--card-2); color: var(--ink-2); font-size: 15px; animation: rise 0.35s ease-out; }
.fact b { color: var(--ink); }
.quiz-next { margin-top: 18px; }
.score { text-align: center; padding: 30px 0 10px; }
.score .big { font-family: var(--serif); font-size: 64px; font-weight: 600; line-height: 1; color: var(--gold); }
.score h2 { font-family: var(--serif); font-size: 26px; font-weight: 600; margin: 14px 0 6px; }
.score p { color: var(--ink-2); margin: 0 0 24px; }
.score .actions { display: grid; gap: 10px; }

.mem-stats { display: flex; justify-content: space-between; color: var(--ink-2); font-size: 15px; font-weight: 600; margin: 0 0 14px; font-variant-numeric: tabular-nums; }
.mem-grid { display: grid; gap: 8px; }
.mem-grid.c3 { grid-template-columns: repeat(3, 1fr); }
.mem-grid.c4 { grid-template-columns: repeat(4, 1fr); }
.mcard { position: relative; aspect-ratio: 1; perspective: 800px; }
.mcard .in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 0.45s cubic-bezier(0.3, 0.9, 0.3, 1); }
.mcard.up .in, .mcard.done .in { transform: rotateY(180deg); }
.mcard .face, .mcard .back { position: absolute; inset: 0; border-radius: 12px; -webkit-backface-visibility: hidden; backface-visibility: hidden; overflow: hidden; }
.mcard .back { background: linear-gradient(135deg, #6a3fa3, #3d1f66); display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08); }
.mcard .back svg { width: 34%; fill: rgba(255, 255, 255, 0.35); }
.mcard .face { transform: rotateY(180deg); background: var(--card-2); visibility: hidden; transition: visibility 0s linear 0.2s; }
.mcard .back { transition: visibility 0s linear 0.2s; }
.mcard.up .face, .mcard.done .face { visibility: visible; }
.mcard.up .back, .mcard.done .back { visibility: hidden; }
.mcard .face img { width: 100%; height: 100%; object-fit: cover; }
.mcard.done .face { box-shadow: 0 0 0 3px var(--gold); }
.mcard.done { animation: matched 0.5s ease-out; }
@keyframes matched { 50% { transform: scale(1.06); } }

/* ---------- Gate: install, unlock, notifications ---------- */
#gate {
  position: fixed; inset: 0; z-index: 90;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(120% 70% at 50% 0%, #4a2875 0%, #24123b 55%, #170a26 100%);
  padding: var(--top-pad) 26px calc(var(--safe-b) + 30px);
}
.gate-inner { max-width: 420px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 20px 0; }
.gate-icon { width: 96px; height: 96px; border-radius: 22px; margin: 0 auto 26px; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45); }
.gate h1 { font-family: var(--serif); font-size: 36px; font-weight: 600; line-height: 1.12; text-align: center; margin: 0 0 10px; }
.gate .lead { text-align: center; color: var(--ink-2); font-size: 17px; margin: 0 0 26px; }
.gate input[type="text"] {
  width: 100%; height: 56px; padding: 0 18px; border-radius: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.07);
  font-size: 18px; text-align: center; letter-spacing: 0.02em;
}
.gate input[type="text"]:focus { outline: none; border-color: var(--accent); background: rgba(255, 255, 255, 0.1); }
.gate form { display: grid; gap: 12px; }
.gate .err { color: #ffc1cf; text-align: center; font-size: 15px; margin: 6px 0 0; min-height: 22px; }
.gate .fine { text-align: center; color: var(--ink-3); font-size: 13.5px; margin: 18px 0 0; }
.steps { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 12px; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 16px; background: rgba(255, 255, 255, 0.07); font-size: 16px; }
.steps li::before { content: counter(s); flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.steps svg { width: 22px; height: 22px; vertical-align: -5px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gate .actions { display: grid; gap: 10px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(36, 18, 58, 0.25); border-top-color: var(--accent-ink); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Settings ---------- */
.set-group { border-radius: var(--radius); background: var(--card); overflow: hidden; margin: 0 0 18px; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 15px 16px; border-top: 1px solid var(--line); }
.set-row:first-child { border-top: 0; }
.set-row .l { flex: 1; min-width: 0; }
.set-row .l small { display: block; color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.set-row .btn { min-height: 38px; padding: 0 16px; font-size: 14.5px; }
.diag { font: 12px/1.5 ui-monospace, Menlo, monospace; color: var(--ink-3); white-space: pre-wrap; word-break: break-word; }

.toast {
  position: fixed; left: 50%; z-index: 95; bottom: calc(var(--tab-h) + var(--safe-b) + 18px);
  transform: translateX(-50%); max-width: calc(100% - 40px);
  padding: 12px 18px; border-radius: 14px; background: #f8f1fd; color: #2a1442; font-weight: 650; font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); animation: rise 0.3s ease-out;
}

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