/* Wakatta — shared phone + player mockup, matched to the real iOS player. */

.ji { font-family: var(--jp); }
.ji-m { font-family: var(--jp-mincho); }

.phone {
  width: 320px;
  border-radius: 46px;
  background: #1a1714;
  padding: 11px;
  box-shadow: 0 40px 80px -20px rgba(40,28,16,0.5), 0 0 0 2px rgba(255,255,255,0.04) inset;
  position: relative;
}
.phone .screen {
  border-radius: 36px;
  overflow: hidden;
  background: var(--paper);
  position: relative;
  height: 660px;
}
.phone .notch {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 120px; height: 30px; background: #1a1714; border-radius: 0 0 18px 18px; z-index: 20;
}
.phone.float { animation: floaty 6s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@media (prefers-reduced-motion: reduce) { .phone.float { animation: none; } }

.statusbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 26px 6px; font-size: 13px; font-weight: 700; color: var(--ink);
}

/* ── player header (iOS: round buttons + episode title + show · chevron) ── */
.ph-head { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px 6px; }
.ph-head .rnd {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface); box-shadow: 0 2px 8px rgba(74,57,38,.12);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); font-size: 19px; cursor: pointer;
}
.ph-head .rnd.aa { font-family: var(--serif); font-weight: 600; font-size: 18px; }
.ph-head .right { display: flex; gap: 8px; flex-shrink: 0; }
.ph-head .meta { flex: 1; text-align: center; line-height: 1.2; padding-top: 3px; min-width: 0; }
.ph-head .ep { font-family: var(--jp); font-size: 16px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-head .show { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-top: 2px; }

/* ── transcript: per-line timestamp + word tokens (furigana above, romaji below) ── */
.tl { padding: 4px 8px 10px; }
.seg { display: flex; gap: 6px; padding: 9px 8px; border-radius: 16px; margin: 1px 0; }
.seg .ts { flex-shrink: 0; width: 30px; padding-top: 16px; font-size: 11px; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.seg.active { background: var(--shu-soft); }
.seg.active .ts { color: var(--shu); }
.toks { flex: 1; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 3px 11px; }
.tok { display: inline-flex; flex-direction: column; align-items: center; }
.tok .base { font-family: var(--jp); font-size: 23px; font-weight: 500; color: var(--ink); line-height: 1.5; }
.tok .base rt { font-family: var(--jp); font-weight: 400; color: var(--ink-3); font-size: .42em; }
.tok .roma { font-family: var(--sans); font-size: 10px; color: var(--ink-3); margin-top: 1px; }
.seg.dim .tok .base { color: var(--ink-3); }
.seg.dim .tok .base rt { color: var(--ink-3); opacity: .8; }
.tok.tap { cursor: pointer; border-radius: 6px; transition: color .12s ease; }
.tok.tap:hover .base { color: var(--shu); }
.tok.played .base { color: var(--shu); }                 /* karaoke: words already spoken */
.tok.lit .base { color: var(--shu); font-weight: 600; }  /* the current word */
.tl.fg-off .base rt { opacity: 0; }
.tl.no-roma .roma { display: none; }
.tok .pun { font-family: var(--jp); font-size: 23px; color: var(--ink); }
.seg.dim .pun { color: var(--ink-3); }

/* ── player dock (iOS: big "I got lost" + flag, Explain/Auto/speed, transport) ── */
.ph-dock {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface); border-top: 1px solid var(--line); padding: 12px 14px 16px;
}
.lost-row { display: flex; gap: 8px; margin-bottom: 11px; }
.lost-big {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--shu); color: #fff; border-radius: 15px; padding: 14px;
  font-weight: 800; font-size: 16px; box-shadow: 0 6px 18px var(--shu-glow); cursor: pointer;
}
.lost-big svg { width: 19px; height: 19px; }
.lost-flag {
  width: 54px; border-radius: 15px; background: var(--shu-soft); color: var(--shu);
  display: flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer;
}
.opt-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.opt-row .explain {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ai-soft); color: var(--ai); border-radius: 999px;
  padding: 8px 14px; font-weight: 700; font-size: 13px; cursor: pointer;
}
.opt-row .rt { display: flex; align-items: center; gap: 14px; }
.opt-row .auto { display: inline-flex; align-items: center; gap: 5px; color: var(--shu); font-weight: 700; font-size: 13px; }
.opt-row .speed { display: inline-flex; align-items: center; gap: 4px; background: var(--paper-deep); color: var(--ink-2); border-radius: 999px; padding: 6px 11px; font-weight: 700; font-size: 12.5px; }
.scrub { height: 5px; border-radius: 3px; background: var(--paper-deep); position: relative; margin: 4px 4px 12px; }
.scrub > i { display: block; width: 42%; height: 100%; border-radius: 3px; background: var(--shu); }
.scrub > b { position: absolute; left: 42%; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: #fff; transform: translate(-50%,-50%); box-shadow: 0 1px 4px rgba(40,28,16,.3); }
.controls { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; }
.controls .t { font-size: 11px; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; width: 28px; }
.controls .ic { color: var(--shu); font-size: 17px; cursor: pointer; }
.controls .skip { color: var(--shu); font-weight: 800; font-size: 13px; display: inline-flex; align-items: center; gap: 1px; cursor: pointer; }
.controls .skip small { font-size: 10px; }
.controls .play {
  width: 60px; height: 60px; border-radius: 50%; background: var(--shu); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 23px;
  box-shadow: 0 6px 18px var(--shu-glow); cursor: pointer;
}

/* player overlay scrolls the transcript between a fixed header and dock */
#playerOverlay { flex-direction: column; }
#playerOverlay.on { display: flex; }
#playerOverlay .tl { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: none; }
#playerOverlay .tl::-webkit-scrollbar { display: none; }
#playerOverlay .ph-dock { position: static; }

/* word-lookup card — the real "tap a word" sheet (JMdict + save to SRS) */
.wordcard { margin: 6px 14px 0; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-card), inset 0 0 0 1px var(--line); padding: 15px 16px 14px; }
.wordcard .wc-top { display: flex; align-items: baseline; gap: 10px; }
.wordcard .head { font-family: var(--jp-mincho); font-size: 28px; font-weight: 600; color: var(--ink); line-height: 1; }
.wordcard .read { font-family: var(--jp); font-size: 13px; color: var(--ink-3); }
.wordcard .tags { display: flex; gap: 6px; margin: 10px 0 8px; flex-wrap: wrap; }
.wordcard .tag { font-size: 10.5px; font-weight: 800; letter-spacing: .3px; border-radius: 999px; padding: 3px 9px; }
.wordcard .tag.pos { background: var(--shu-soft); color: var(--shu-deep); }
.wordcard .tag.jlpt { background: var(--ai-soft); color: var(--ai); }
.wordcard .gloss { font-family: var(--serif); font-size: 16px; color: var(--ink); line-height: 1.45; margin: 2px 0 0; }
.wordcard .ctx { font-size: 11.5px; color: var(--ink-2); line-height: 1.5; margin-top: 9px; }
.wordcard .ctx .spark { color: var(--ai); font-weight: 700; }
.wordcard .save { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 13px; background: var(--shu); color: #fff; border-radius: 12px; padding: 11px; font-weight: 800; font-size: 14px; box-shadow: 0 6px 16px var(--shu-glow); }

/* ── bottom sheets (word lookup, AI explain, lost moments, reading settings) ── */
.ph-scrim { position: absolute; inset: 0; background: rgba(28,20,12,0.45); opacity: 0; pointer-events: none; transition: opacity .28s ease; z-index: 30; }
.ph-scrim.show { opacity: 1; pointer-events: auto; }
.ph-sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 31; background: var(--surface); border-radius: 26px 26px 0 0; padding: 14px 22px 26px; box-shadow: var(--shadow-sheet); transform: translateY(110%); transition: transform .34s cubic-bezier(.22,1,.36,1); }
.ph-sheet.show { transform: translateY(0); }
.ph-sheet .grip { width: 38px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 16px; }
.ph-sheet .who { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.ph-sheet .who .av { width: 34px; height: 34px; border-radius: 10px; background: var(--ai); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; }
.ph-sheet .who .nm { font-weight: 800; font-size: 14px; }
.ph-sheet .who .sb { font-size: 11.5px; color: var(--ink-3); }
.ph-sheet .sent { font-family: var(--jp); background: var(--paper); border-radius: 14px; padding: 14px 16px; font-size: 17px; line-height: 1.85; }
.ph-sheet .pill { display: inline-flex; font-family: var(--jp); background: var(--ai-soft); color: var(--ai); padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; margin: 14px 0 12px; }
.ph-sheet .body { font-family: var(--serif); font-size: 16px; line-height: 1.55; color: var(--ink); margin: 0; }
.ph-sheet .body b { color: var(--ai); font-weight: 600; }
.ph-sheet .src { font-size: 11px; color: var(--ai); margin-top: 14px; opacity: .8; }
.ph-sheet .chips { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.ph-sheet .chips span { border: 1.4px solid var(--line-strong); color: var(--ink-2); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 13px; }
/* reading-settings sheet (Aa) */
.ph-sheet .set-title { font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.set-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row .sl { flex: 1; }
.set-row .sl b { font-weight: 700; font-size: 14px; }
.set-row .sl span { display: block; font-size: 11.5px; color: var(--ink-3); }
.toggle { width: 46px; height: 28px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .18s ease; flex-shrink: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .18s ease; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle.on { background: var(--shu); }
.toggle.on::after { left: 21px; }
