/* Spell · Speaking Well — Night Library
   Mobile first. Satu tema gelap: tinta malam, perkamen, emas, dan ungu sihir. */

:root {
  --night: #15121D;
  --night-2: #1C1826;
  --surface: #1F1A2C;
  --surface-2: #2B2540;
  --line: #3B3452;
  --line-2: #4A4066;
  --ink: #EEE8F6;
  --ink-2: #C5BDD6;
  --muted: #9A91AD;
  --gold: #E2B95F;
  --gold-hi: #F0CF7E;
  --gold-lo: #D9A944;
  --gold-soft: rgba(226, 185, 95, .14);
  --magic: #9C7BFF;
  --magic-lo: #6E4BE0;
  --magic-hi: #B9A6FF;
  --parchment: #EFE4CC;
  --parchment-ink: #2E2436;
  --parchment-muted: #7A6A55;
  --seal: #8E2F3A;
  --grammar: #FF8A78;
  --word: #FFB561;
  --pron: #B9A6FF;
  --translate: #5FD4C4;
  --unclear: #A49CB8;
  --ok: #9BE0B8;

  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --story: "IM Fell English", Georgia, "Times New Roman", serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --gutter: 24px;
  --tabbar-h: 84px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--night); }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font: 400 16px/1.6 var(--ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(120% 55% at 50% -10%, #2E2445 0%, rgba(21, 18, 29, 0) 60%),
    var(--night);
  background-attachment: fixed;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
}
body.chamber-mode { padding-bottom: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--gold); }
a:hover { color: var(--gold-hi); }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 600; line-height: 1.15; letter-spacing: .01em; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.stars {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(1px 1px at 12% 14%, #EEE8F6 50%, transparent 51%),
    radial-gradient(1px 1px at 82% 9%, #EEE8F6 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 64% 22%, #E2B95F 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 38%, #EEE8F6 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 46%, #EEE8F6 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 6% 62%, #9C7BFF 50%, transparent 51%);
  background-size: 400px 520px;
  animation: twinkle 7s ease-in-out infinite;
}

/* ---------- Kerangka ---------- */
.page { max-width: 560px; margin: 0 auto; padding: calc(20px + var(--safe-t)) var(--gutter) 48px; display: flex; flex-direction: column; gap: 36px; }
.eyebrow { font: 600 11px var(--ui); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.story { font-family: var(--story); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.section { display: flex; flex-direction: column; gap: 16px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head h2 { font-size: 19px; }
.section-head .link { font: 600 13px var(--ui); text-decoration: none; }
.logo { height: 30px; width: auto; filter: invert(.93) sepia(.25) saturate(1.4) hue-rotate(5deg); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; border-radius: 16px; border: 1px solid var(--line-2);
  background: transparent; color: var(--ink); font: 600 15px var(--ui);
  text-decoration: none; cursor: pointer; transition: transform .1s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn:hover { color: var(--ink); background: rgba(255, 255, 255, .04); }
.btn.gold { border: 0; background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); color: #2A1E0C; font-weight: 700; box-shadow: 0 10px 30px rgba(226, 185, 95, .22); }
.btn.gold:hover { color: #2A1E0C; filter: brightness(1.05); }
.btn.parchment { border: 0; background: var(--parchment); color: var(--parchment-ink); font-weight: 700; }
.btn.sm { min-height: 40px; padding: 0 14px; border-radius: 12px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn .ic { width: 20px; height: 20px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; flex: none; }
.icon-btn:hover { background: rgba(255, 255, 255, .05); color: var(--ink); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.parch { background: var(--parchment); color: var(--parchment-ink); border-radius: 6px; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding: 14px 8px var(--safe-b);
  display: flex; justify-content: space-around; align-items: center;
  background: linear-gradient(180deg, rgba(21, 18, 29, 0), var(--night) 32%);
}
body.chamber-mode .tabbar { display: none; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 58px; min-height: 48px; color: var(--muted); text-decoration: none; font: 600 11px var(--ui); }
.tab[aria-current="page"] { color: var(--gold); }
.tab:hover { color: var(--ink-2); }
.tab-wand {
  width: 64px; height: 64px; margin-top: -30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #B9A2FF, var(--magic-lo) 70%);
  display: flex; align-items: center; justify-content: center; color: #fff; text-decoration: none;
  box-shadow: 0 0 0 6px rgba(156, 123, 255, .12), 0 10px 26px rgba(110, 75, 224, .5);
}
.tab-wand:hover { color: #fff; }
.tab-wand .ic { width: 28px; height: 28px; stroke-width: 2; }

/* ---------- Common Room ---------- */
.home-head { display: flex; align-items: center; justify-content: space-between; }
.vial { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 999px; background: rgba(156, 123, 255, .12); border: 1px solid rgba(156, 123, 255, .3); color: var(--ink); text-decoration: none; font: 700 15px var(--ui); font-variant-numeric: tabular-nums; }
.vial:hover { color: var(--ink); }
.vial .bubble { animation: bubble 2.4s ease-in infinite; }
.greet h1 { font-size: 30px; }
.candles { display: flex; align-items: flex-end; gap: 7px; }
.candle .flame { transform-origin: 50% 100%; animation: flicker 1.6s ease-in-out infinite; }

.tarot-wrap { perspective: 1200px; }
.tarot { position: relative; display: block; width: 100%; height: 300px; border: 0; padding: 0; background: none; cursor: pointer; color: inherit; text-align: left; }
.tarot-inner { position: relative; width: 100%; height: 100%; transition: transform .7s cubic-bezier(.3, .7, .2, 1); transform-style: preserve-3d; }
.tarot.flipped .tarot-inner { transform: rotateY(180deg); }
.tarot-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 22px; }
.tarot-back { background: linear-gradient(160deg, var(--surface-2), var(--night-2)); border: 1px solid var(--line-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.tarot-back::before { content: ""; position: absolute; inset: 12px; border: 1px solid rgba(226, 185, 95, .45); border-radius: 14px; }
.tarot-back .glint { animation: glint 3s ease-in-out infinite; }
.tarot-front { transform: rotateY(180deg); background: var(--parchment); color: var(--parchment-ink); border: 1px solid var(--gold); padding: 26px 24px; display: flex; flex-direction: column; gap: 12px; }
.tarot-front .t { font: 400 30px/1.15 var(--story); }
.tarot-front .p { font: italic 400 17px/1.5 var(--story); color: #5A4A5E; }

.notice { display: flex; gap: 12px; padding: 16px; border-radius: 16px; background: var(--gold-soft); border: 1px solid rgba(226, 185, 95, .3); font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.notice.warn { background: rgba(255, 138, 120, .1); border-color: rgba(255, 138, 120, .35); }
.notice .ic { color: var(--gold); }

/* ---------- Ruang mantra ---------- */
.chamber { position: relative; min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding-top: var(--safe-t); }
body.chamber-mode { background: radial-gradient(70% 45% at 30% 75%, #3B2A66 0%, rgba(21, 18, 29, 0) 70%), #100E16; background-attachment: fixed; }
body.chamber-mode.tavern { background: radial-gradient(80% 30% at 50% 4%, rgba(226, 150, 70, .26) 0%, rgba(21, 18, 29, 0) 70%), radial-gradient(120% 50% at 50% -5%, #2E2445 0%, #15121D 60%), #15121D; }
.chamber-top { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.chamber-top .mid { flex: 1; min-width: 0; text-align: center; }
.chamber-top .mid .t { font: 400 19px var(--story); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer { width: 44px; text-align: right; font: 600 15px var(--display); font-variant-numeric: tabular-nums; color: var(--gold); }
.topic-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 12px 24px 0; }
.topic-chips span { padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .05); font-size: 12.5px; color: var(--muted); }

.scroll-text { flex: 1; min-height: 160px; padding: 28px 28px 8px; font: 400 23px/1.65 var(--story); overflow-y: auto; }
.scroll-text .ph { color: var(--muted); font-style: italic; font-size: 19px; }
.w { animation: ink .6s ease both; }
.interim { color: #7A7190; font-style: italic; }
.idw { font-style: italic; color: var(--translate); padding: 0 4px; border-radius: 4px; background: rgba(95, 212, 196, .12); box-shadow: inset 0 -2px 0 rgba(95, 212, 196, .6); }

.wand-zone { position: relative; height: 300px; flex: none; }
.wand-btn { position: absolute; inset: 0; border: 0; background: none; padding: 0; cursor: pointer; }
.wand-btn svg { width: 100%; max-width: 390px; height: 300px; display: block; margin: 0 auto; }
.wand-fx { opacity: 0; transition: opacity .4s ease; }
.casting .wand-fx { opacity: 1; }
.wand-tip { fill: #4A4066; transition: fill .3s ease; }
.casting .wand-tip { fill: #FFFFFF; }
.wand-glow { transform-origin: 112px 58px; transform: scale(.85); transition: transform .25s ease; }
.casting .wand-glow { animation: voice 1.3s ease-in-out infinite; }
.casting.surge .wand-glow { animation: none; transform: scale(1.35); }
.wand-halo { transform-origin: 112px 58px; animation: halo 2.6s ease-out infinite; }
.spark { transform-origin: 112px 58px; animation: spark 1.6s ease-out infinite; }
.wand-hint { position: absolute; left: 0; right: 0; top: 118px; text-align: center; font: 600 12.5px var(--ui); color: var(--muted); pointer-events: none; padding: 0 24px; }
.wand-dock { position: absolute; left: var(--gutter); right: var(--gutter); bottom: calc(26px + var(--safe-b)); display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none; }
.wand-dock > * { pointer-events: auto; }
.id-btn { min-width: 58px; height: 48px; border-radius: 999px; border: 1.5px solid var(--translate); background: rgba(16, 14, 22, .6); color: var(--translate); font: 600 16px var(--display); letter-spacing: .1em; cursor: pointer; }
.id-btn.on { border: 0; background: var(--translate); color: #10241F; box-shadow: 0 0 0 8px rgba(95, 212, 196, .15); }
.seal-btn { min-height: 48px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--parchment); color: var(--parchment-ink); font: 700 14px var(--ui); cursor: pointer; }
.seal-btn[disabled] { opacity: .4; cursor: default; }

/* ---------- Penanda koreksi ---------- */
.mk { position: relative; display: inline; border: 0; margin: 0; padding: 0 2px; font: inherit; color: inherit; cursor: pointer; border-radius: 4px; background: color-mix(in srgb, var(--c) 12%, transparent); }
.mk::after { content: ""; position: absolute; left: 4%; right: 4%; bottom: -.28em; height: .5em; border-bottom: 2px solid var(--c); border-radius: 0 0 50% 50% / 0 0 100% 100%; }
.mk.grammar { --c: var(--grammar); }
.mk.word { --c: var(--word); }
.mk.pron { --c: var(--pron); }
.mk.translate { --c: var(--translate); }
.mk.unclear { --c: var(--unclear); }
.mk.unclear::after { border-bottom-style: dashed; }
.parch .mk.grammar { --c: #C2402F; }
.parch .mk.word { --c: #C9771F; }
.parch .mk.pron { --c: #5B3FD1; }
.parch .mk.translate { --c: #1F8A7C; }
.parch .mk.unclear { --c: #7A6A55; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ---------- Rekap ---------- */
.reward { display: flex; align-items: center; gap: 20px; position: relative; }
.reward .big { font: 600 40px/1 var(--display); }
.gold-text { background: linear-gradient(90deg, #B8862E, #F3D58F, #B8862E); -webkit-background-clip: text; background-clip: text; color: transparent; }
.orb { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle, #fff, var(--magic-hi) 60%, transparent 70%); animation: fly 1.6s cubic-bezier(.5, 0, .4, 1) 3 both; pointer-events: none; }
.scroll { position: relative; padding: 30px 22px 26px; box-shadow: 0 24px 50px rgba(0, 0, 0, .45); animation: unroll 1s cubic-bezier(.2, .7, .2, 1) both; }
.scroll::before, .scroll::after { content: ""; position: absolute; left: -6px; right: -6px; height: 18px; border-radius: 9px; background: linear-gradient(180deg, #D9C9A3, #B9A47C); }
.scroll::before { top: -10px; }
.scroll::after { bottom: -10px; }
.scroll .txt { font: 400 19px/1.85 var(--story); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stat { text-align: center; padding: 12px 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.stat b { display: block; font: 700 18px var(--ui); font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--muted); }
.insights { display: flex; flex-direction: column; gap: 10px; }
.insight { display: flex; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; line-height: 1.55; }
.insight b { display: block; font-size: 15px; margin-bottom: 2px; }
.insight p { color: var(--ink-2); }
.insight .dot { width: 28px; height: 28px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.insight.good .dot { color: var(--ok); background: rgba(155, 224, 184, .12); }
.insight.warn .dot { color: var(--word); background: rgba(255, 181, 97, .14); }
.insight.focus .dot { color: var(--gold); background: var(--gold-soft); }

/* ---------- Sheet Counter-spell ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(8, 6, 14, .62); animation: fade .2s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--night-2); border-top: 1px solid var(--line-2); border-radius: 26px 26px 0 0;
  padding: 12px 22px calc(28px + var(--safe-b)); display: flex; flex-direction: column; gap: 18px;
  box-shadow: 0 -20px 50px rgba(0, 0, 0, .5); transform: translateY(105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.sheet.open { transform: none; }
.sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); align-self: center; }
.cs-head { display: flex; align-items: center; justify-content: space-between; }
.cs-type { font: 600 11px var(--ui); letter-spacing: .16em; text-transform: uppercase; }
.flip-wrap { perspective: 1000px; }
.flip { position: relative; min-height: 160px; transition: transform .7s cubic-bezier(.3, .7, .2, 1); transform-style: preserve-3d; }
.flip.turned { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 6px; padding: 18px; display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.flip-face.said { background: var(--surface-2); border: 1px solid var(--line-2); }
.flip-face.right { transform: rotateY(180deg); background: var(--parchment); color: var(--parchment-ink); }
.flip-face .lbl { font: 600 10.5px var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.flip-face.right .lbl { color: var(--parchment-muted); }
.flip-face .s { font: 400 20px/1.5 var(--story); }
.strike { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.fix-ink { text-decoration: underline; text-decoration-color: #B8862E; text-underline-offset: 4px; }
.dispelled .fix-ink { background: linear-gradient(90deg, #B8862E, #E8C46A, #B8862E); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700; text-decoration: none; }
.stamp { position: absolute; right: 16px; bottom: 14px; padding: 4px 10px; border: 2px solid var(--seal); border-radius: 6px; color: var(--seal); font: 700 13px var(--display); letter-spacing: .12em; animation: stamp .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.cs-msg { font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.cs-src { font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.cs-src button { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 12.5px; padding: 6px 0; }
.cs-nav { display: flex; gap: 8px; justify-content: center; }
.cs-nav button { width: 10px; height: 10px; border-radius: 50%; border: 0; padding: 0; background: var(--line-2); cursor: pointer; }
.cs-nav button[aria-current="true"] { background: var(--gold); }
.retry-words { display: flex; flex-wrap: wrap; gap: 6px; font: 400 17px var(--story); }
.retry-words span { padding: 3px 10px; border-radius: 9px; }
.retry-words .ok { background: rgba(155, 224, 184, .14); color: var(--ok); }
.retry-words .near { background: rgba(255, 181, 97, .16); color: #FFC98C; text-decoration: underline wavy; text-underline-offset: 5px; }
.retry-words .miss { background: rgba(255, 138, 120, .16); color: var(--grammar); text-decoration: line-through; }

/* ---------- Practice ---------- */
.door { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 18px; align-items: center; color: var(--ink); text-decoration: none; transition: transform .25s ease; }
.door:hover { transform: translateX(4px); color: var(--ink); }
.door.locked { opacity: .55; pointer-events: none; }
.arch { position: relative; height: 118px; border-radius: 48px 48px 8px 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.arch::after { content: ""; position: absolute; inset: 6px; border-radius: 42px 42px 4px 4px; border: 1px solid rgba(226, 185, 95, .45); }
.arch .in { position: absolute; inset: 0; opacity: .55; transition: opacity .3s; }
.door:hover .arch .in { opacity: 1; }
.door .t { font: 600 20px var(--display); }
.door .d { font: 400 16px/1.45 var(--story); color: var(--ink-2); }
.soon { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); font: 600 10.5px var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); vertical-align: middle; }
.quest-row { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.quest-row:hover { color: var(--ink); border-color: var(--line-2); }
.numeral { width: 46px; height: 54px; border-radius: 23px 23px 6px 6px; flex: none; display: flex; align-items: center; justify-content: center; font: 600 17px var(--display); background: var(--surface-2); color: var(--gold); border: 1px solid rgba(226, 185, 95, .4); }
.numeral.done { background: var(--gold); color: #2A1E0C; border: 0; }

/* ---------- Quest ---------- */
.quest-scene { position: relative; height: 112px; display: flex; align-items: flex-end; justify-content: center; gap: 14px; padding-bottom: 6px; flex: none; }
.lantern { position: absolute; top: 0; width: 26px; height: 62px; transform-origin: 50% 0; animation: sway 4s ease-in-out infinite; }
.lantern .flame { animation: flickerOpacity 1.4s ease-in-out infinite; }
.npc-face { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 35% 30%, #3A3152, #221D2F 75%); border: 2px solid var(--gold); box-shadow: 0 0 0 4px rgba(226, 185, 95, .15), 0 0 18px rgba(226, 185, 95, .35); font: 600 26px var(--display); color: var(--gold); flex: none; }
.runes { display: flex; gap: 10px; justify-content: center; }
.runes i { width: 10px; height: 10px; transform: rotate(45deg); border-radius: 2px; background: var(--line); }
.runes i.done { background: var(--gold); }
.runes i.now { background: var(--gold); opacity: .85; animation: pulse 1.6s ease-in-out infinite; }
.dialog { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px 24px; display: flex; flex-direction: column; gap: 18px; }
.npc { align-self: flex-start; max-width: min(88%, 420px); background: var(--parchment); color: var(--parchment-ink); border-radius: 4px 18px 18px 18px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; animation: enter .45s ease both; }
.npc .say { font: 400 19px/1.45 var(--story); }
.npc .tr { font: italic 400 15.5px var(--story); color: #6E5E6C; }
.npc .tools { display: flex; gap: 16px; }
.npc .tools button { border: 0; background: none; padding: 4px 0; cursor: pointer; font: 600 12.5px var(--ui); color: var(--parchment-muted); display: inline-flex; align-items: center; gap: 5px; }
.me { align-self: flex-end; max-width: min(92%, 460px); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 18px 4px 18px 18px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; animation: enter .45s ease both; }
.me .say { font: 400 19px/1.6 var(--story); }
.me .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font: 600 12.5px var(--ui); color: var(--muted); }
.me.flawless { border-color: rgba(226, 185, 95, .55); box-shadow: 0 0 24px rgba(226, 185, 95, .15); }
.me .flaw { color: var(--gold); }
.hint-box { border: 1px dashed rgba(226, 185, 95, .45); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; animation: enter .4s ease both; }
.hint-box .h { font: 600 10.5px var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.hint-box button { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; font: italic 400 17px var(--story); color: var(--ink-2); }
.quest-dock { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 10px var(--gutter) calc(24px + var(--safe-b)); flex: none; }
.quest-dock .side { display: flex; }
.quest-dock .side.r { justify-content: flex-end; }
.quest-dock .hint { grid-column: 1 / -1; text-align: center; font: 600 12.5px var(--ui); color: var(--muted); min-height: 18px; }
.wand-round { width: 72px; height: 72px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 35% 30%, #B9A2FF, var(--magic-lo) 70%); animation: breathe 2.6s ease-in-out infinite; }
.wand-round .ic { width: 30px; height: 30px; stroke-width: 2; }
.wand-round.casting { animation: none; box-shadow: 0 0 0 10px rgba(156, 123, 255, .2), 0 0 0 22px rgba(156, 123, 255, .08), 0 10px 30px rgba(110, 75, 224, .6); }
.wand-round[disabled] { opacity: .4; cursor: default; animation: none; }
.pill { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); font: 600 13.5px var(--ui); cursor: pointer; }
.pill.on { border-color: transparent; background: var(--gold-soft); color: var(--gold); }

.qseal { position: relative; width: 150px; height: 150px; display: flex; align-items: center; justify-content: center; }
.qseal .ray { position: absolute; inset: 0; animation: spin 18s linear infinite; }
.qseal .wax { animation: stamp .7s cubic-bezier(.2, 1.6, .4, 1) .2s both; }
.rune-row { display: flex; justify-content: space-between; padding: 0 6px; }
.rune-btn { width: 30px; height: 30px; transform: rotate(45deg); border-radius: 6px; border: 0; padding: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.rune-btn span { transform: rotate(-45deg); font: 600 12px var(--display); }

/* ---------- Grimoire ---------- */
.rank { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.rank-ring { position: relative; width: 170px; height: 170px; }
.rank-ring svg { position: absolute; inset: 0; }
.rank-ring .arc { transition: stroke-dashoffset 1.2s cubic-bezier(.3, .7, .2, 1); }
.rank-ring .in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ranks { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.ranks span { padding: 5px 10px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--muted); }
.ranks .done { border-color: transparent; background: var(--gold-soft); color: var(--gold); }
.ranks .now { border-color: transparent; background: var(--gold); color: #2A1E0C; font-weight: 700; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.list-row:hover { color: var(--ink); border-color: var(--line-2); }
.list-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row .t { font: 600 15px var(--ui); }
.list-row .s { font-size: 12.5px; color: var(--muted); }
.list-row .m { font: 700 13px var(--ui); color: var(--magic-hi); }
.badge { width: 40px; height: 40px; border-radius: 12px; flex: none; background: var(--surface-2); color: var(--gold); display: flex; align-items: center; justify-content: center; font: 600 16px var(--display); }
.word-row .en { font: 400 20px var(--story); }
.word-row .id { font-size: 13px; color: var(--translate); }
.round-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: transparent; color: var(--gold); cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font: 600 13px var(--ui); color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.setting:last-child { border-bottom: 0; }
.empty { text-align: center; padding: 26px 18px; color: var(--muted); font: italic 400 17px/1.55 var(--story); }

/* ---------- Toast & efek ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); z-index: 60; transform: translateX(-50%); width: max-content; max-width: min(92vw, 460px); padding: 12px 16px; border-radius: 14px; background: var(--parchment); color: var(--parchment-ink); font: 500 14px/1.5 var(--ui); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: enter .25s ease both; }
body.chamber-mode .toast { bottom: calc(110px + var(--safe-b)); }
.burst { position: absolute; pointer-events: none; z-index: 70; }
.burst i { position: absolute; left: 0; top: 0; color: var(--gold); font-style: normal; font-size: 14px; animation: burst .9s ease-out forwards; }

@keyframes twinkle { 0%, 100% { opacity: .5 } 50% { opacity: .28 } }
@keyframes flicker { 0%, 100% { transform: scaleY(1) rotate(-2deg) } 50% { transform: scaleY(.86) rotate(2deg) } }
@keyframes flickerOpacity { 0%, 100% { opacity: 1 } 50% { opacity: .7 } }
@keyframes bubble { 0% { transform: translateY(0); opacity: 0 } 25% { opacity: .9 } 100% { transform: translateY(-16px); opacity: 0 } }
@keyframes glint { 0%, 100% { opacity: .35 } 50% { opacity: .9 } }
@keyframes ink { from { opacity: 0; filter: blur(3px); transform: translateY(6px) } to { opacity: 1; filter: none; transform: none } }
@keyframes voice { 0%, 100% { transform: scale(.85) } 20% { transform: scale(1.12) } 45% { transform: scale(.95) } 70% { transform: scale(1.2) } }
@keyframes spark { 0% { opacity: 0; transform: translate(0, 0) scale(.4) } 20% { opacity: 1 } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1) } }
@keyframes halo { 0% { opacity: .55; transform: scale(.6) } 100% { opacity: 0; transform: scale(2.2) } }
@keyframes fly { 0% { transform: translate(0, 0) scale(1); opacity: 0 } 15% { opacity: 1 } 100% { transform: translate(var(--dx), var(--dy)) scale(.4); opacity: 0 } }
@keyframes unroll { from { clip-path: inset(0 0 100% 0) } to { clip-path: inset(0 0 0 0) } }
@keyframes stamp { from { transform: scale(2.2) rotate(-14deg); opacity: 0 } to { transform: scale(1) rotate(-6deg); opacity: 1 } }
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes sway { 0%, 100% { transform: rotate(-3deg) } 50% { transform: rotate(3deg) } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(226, 185, 95, .6) } 50% { box-shadow: 0 0 0 6px rgba(226, 185, 95, 0) } }
@keyframes enter { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 6px rgba(156, 123, 255, .12), 0 10px 26px rgba(110, 75, 224, .45) } 50% { box-shadow: 0 0 0 12px rgba(156, 123, 255, .06), 0 10px 30px rgba(110, 75, 224, .6) } }
@keyframes fade { from { opacity: 0 } }
@keyframes burst { from { opacity: 1; transform: translate(0, 0) scale(.6) } to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.2) } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (min-width: 768px) {
  .sheet { left: 50%; right: auto; width: 520px; transform: translate(-50%, 105%); }
  .sheet.open { transform: translate(-50%, 0); }
}

/* ---------- Kelas: gerbang, PIN, Great Hall, meja Headmaster ---------- */
body.gate { padding-bottom: 0; }
body.gate .tabbar { display: none; }
.ava { border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; background: radial-gradient(circle at 35% 30%, #3A3152, #221D2F 75%); border: 2px solid rgba(226, 185, 95, .45); font-family: var(--display); font-weight: 600; color: var(--gold); line-height: 1; }
.ava.glow { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(226, 185, 95, .15), 0 0 18px rgba(226, 185, 95, .35); }
.orbit-wrap { position: relative; width: 132px; height: 132px; display: flex; align-items: center; justify-content: center; }
.orbit { position: absolute; left: 50%; top: 50%; width: 0; height: 0; animation: spin 9s linear infinite; }
.orbit i { position: absolute; color: var(--gold); font-style: normal; font-size: 12px; }
.orbit i:nth-child(1) { transform: translate(70px, -6px); }
.orbit i:nth-child(2) { transform: translate(-78px, 10px); }
.orbit i:nth-child(3) { transform: translate(-6px, 72px); }

.letter { position: relative; width: 100%; padding: 56px 24px 28px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 60px rgba(0, 0, 0, .45); animation: enter .8s ease both; }
.seal-wrap { position: absolute; left: 50%; top: -30px; width: 64px; height: 64px; margin-left: -32px; }
.seal-wrap svg { width: 64px; height: 64px; }
.seal-wrap .half, .seal-wrap .mark { transition: transform .8s cubic-bezier(.3, .7, .2, 1), opacity .6s ease; transform-origin: 32px 32px; }
.seal-wrap.broken .half.l { transform: translate(-10px, 6px) rotate(-18deg); }
.seal-wrap.broken .half.r { transform: translate(10px, 6px) rotate(18deg); }
.seal-wrap.broken .mark { opacity: 0; }
.code-input { height: 56px; border-radius: 12px; border: 1.5px solid #B7A27C; background: #F7F0DF; text-align: center; font: 600 21px var(--display); letter-spacing: .14em; color: var(--parchment-ink); text-transform: uppercase; width: 100%; }
.field { height: 54px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 18px; font: 400 19px var(--story); color: var(--ink); width: 100%; }
select.field, input[type="datetime-local"].field { font: 500 15px var(--ui); padding: 0 12px; }
.pin-field { font: 600 24px var(--display); letter-spacing: .5em; }
.field:focus-visible, .code-input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.pin-candles { display: flex; justify-content: center; gap: 26px; height: 64px; align-items: flex-end; }
.pin-candles svg { width: 24px; height: 56px; }
.pin-candles .lit { animation: stamp .4s cubic-bezier(.2, 1.6, .4, 1) both; transform-origin: 12px 20px; }
.pin-candles .flame { transform-origin: 50% 100%; animation: flicker 1.5s ease-in-out infinite; }
.pin-candles.shake { animation: shake .45s ease; }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.key { height: 60px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 24px var(--display); cursor: pointer; }
.key:active { transform: scale(.95); background: var(--surface-2); }
.key.soft { border-color: transparent; background: transparent; color: var(--muted); font: 500 20px var(--ui); }

.glasses { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; align-items: end; }
.glass-col { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.glass-col .small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-num { font: 600 13px var(--display); color: var(--muted); text-align: center; }
.glass { position: relative; }
.glass .cap { position: absolute; left: 0; right: 0; height: 5px; border-radius: 3px; background: var(--gold); }
.glass .cap.top { top: 0; } .glass .cap.bot { bottom: 0; }
.glass .bulb { position: absolute; left: 4px; right: 4px; height: calc(50% - 6px); background: rgba(238, 232, 246, .08); overflow: hidden; }
.glass .bulb.up { top: 6px; clip-path: polygon(0 0, 100% 0, 56% 100%, 44% 100%); }
.glass .bulb.down { bottom: 6px; clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%); }
.glass .sand { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, #B9A6FF, #7C5CF0); transition: height 1s ease; }
.glass .stream { position: absolute; left: 50%; top: calc(50% - 6px); width: 1.5px; height: 12px; margin-left: -.75px; background: #B9A6FF; animation: flickerOpacity 1s linear infinite; }
.glass-col.me .rank-num { color: var(--gold); }
.list-row.is-me { border-color: rgba(226, 185, 95, .45); }
.tag-hm { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); font: 600 10.5px var(--ui); letter-spacing: .06em; vertical-align: middle; }
.spark-btn { flex: none; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--surface-2); color: var(--ink); font: 600 13px var(--ui); cursor: pointer; }
.spark-btn.sent { background: var(--gold-soft); color: var(--gold); cursor: default; }
.owl { display: flex; gap: 16px; padding: 16px; border-radius: 16px; align-items: flex-start; }

.owl-letter { position: relative; display: flex; flex-direction: column; gap: 6px; width: 100%; border: 0; text-align: left; padding: 56px 22px 22px; border-radius: 18px; cursor: pointer; overflow: hidden; }
.owl-letter::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 64px; background: linear-gradient(to bottom right, transparent 49.5%, #C9B48E 50%, transparent 51%) left / 50% 100% no-repeat, linear-gradient(to bottom left, transparent 49.5%, #C9B48E 50%, transparent 51%) right / 50% 100% no-repeat; }
.owl-seal { position: absolute; left: 50%; top: 30px; width: 48px; height: 48px; margin-left: -24px; transition: transform .5s ease, opacity .5s ease; }
.owl-seal svg { width: 48px; height: 48px; }
.owl-open { display: none; flex-direction: column; gap: 6px; }
.owl-closed { display: flex; flex-direction: column; gap: 4px; }
.owl-letter.opened .owl-seal { transform: translateY(-12px) rotate(25deg) scale(.6); opacity: 0; }
.owl-letter.opened .owl-open { display: flex; animation: enter .4s ease both; }
.owl-letter.opened .owl-closed { display: none; }

.seats { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 8px; }
.seats span { aspect-ratio: 1; border-radius: 50%; background: var(--surface-2); }
.seats .taken { background: var(--gold); box-shadow: 0 0 8px rgba(226, 185, 95, .4); }
.seats .invited { background: none; border: 1.5px dashed var(--gold); }

@keyframes shake { 0%, 100% { transform: none } 20% { transform: translateX(-8px) } 40% { transform: translateX(8px) } 60% { transform: translateX(-5px) } 80% { transform: translateX(5px) } }

/* Pengulangan & filler: wajar saat bicara, jadi hanya diredupkan, bukan ditandai salah. */
.rep { opacity: .42; }

/* ---------- Echo & Crystal Ball ---------- */
.door-hero { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.door-hero .arch { width: 104px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: st; display: flex; flex-direction: column; gap: 12px; }
.steps li { counter-increment: st; display: flex; gap: 14px; align-items: baseline; color: var(--ink-2); font-size: 15px; }
.steps li::before { content: counter(st); flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(226, 185, 95, .5); color: var(--gold); font: 600 13px var(--display); transform: translateY(-1px); }
.runes i.tried { background: var(--line-2); }

.echo-stage { flex: 1; min-height: 0; overflow-y: auto; padding: 18px var(--gutter) 24px; display: flex; flex-direction: column; gap: 18px; }
.echo-card { padding: 22px 22px 16px; border-radius: 20px; display: flex; flex-direction: column; gap: 12px; transition: box-shadow .3s; animation: enter .4s ease both; }
.echo-card.speaking { box-shadow: 0 0 0 3px rgba(226, 185, 95, .45), 0 0 34px rgba(226, 185, 95, .3); }
.echo-text { margin: 0; font: 400 25px/1.4 var(--story); transition: filter .5s, opacity .5s; }
.echo-text.veiled { filter: blur(9px); opacity: .55; user-select: none; }
.echo-id { margin: 0; font: italic 400 16px/1.45 var(--story); color: #6E5E6C; }
.echo-tools { display: flex; gap: 18px; flex-wrap: wrap; }
.echo-tools button { border: 0; background: none; padding: 6px 0; cursor: pointer; font: 600 13px var(--ui); color: var(--parchment-muted); display: inline-flex; align-items: center; gap: 5px; }
.echo-tools button[aria-pressed="true"] { color: var(--parchment-ink); }
.echo-tip { margin: 0; padding: 0 4px; font-size: 14px; line-height: 1.55; color: var(--muted); }
.echo-tip:not(:empty)::before { content: "✦ "; color: var(--gold); }
.echo-result { display: flex; flex-direction: column; gap: 14px; }
.echo-heard { margin: 0; font: 400 20px/1.5 var(--story); color: var(--ink-2); }
.echo-score { display: flex; align-items: baseline; gap: 12px; animation: enter .35s ease both; }
.echo-score b { font: 700 34px/1 var(--display); color: var(--ink-2); }
.echo-score span { font: 600 14px var(--ui); color: var(--muted); }
.echo-score.clear b { color: var(--gold); }
.echo-score.clear span { color: var(--gold); }

.score-ring { --p: 0; flex: none; width: 104px; height: 104px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;
  background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--surface-2) 0); }
.score-ring.teal { background: conic-gradient(var(--translate) calc(var(--p) * 1%), var(--surface-2) 0); }
.score-ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--night); }
.score-ring b, .score-ring span { position: relative; }
.score-ring b { font: 700 22px/1.1 var(--display); }
.score-ring span { font-size: 11.5px; color: var(--muted); }
.echo-row { width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.echo-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.echo-row .t { font: 400 17px/1.4 var(--story); }
.echo-row .s { font-size: 12.5px; color: var(--muted); }
.echo-row .ic { color: var(--muted); flex: none; }
.pct { flex: none; min-width: 52px; height: 32px; padding: 0 8px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font: 700 13px var(--ui); background: var(--surface-2); color: var(--ink-2); }
.pct.clear { background: var(--gold-soft); color: var(--gold); }
.pct.skip { color: var(--muted); }

.crystal-stage { flex: 1; min-height: 0; overflow-y: auto; padding: 8px var(--gutter) 16px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.ball { border: 0; background: none; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; -webkit-tap-highlight-color: transparent; }
.glass-orb { position: relative; width: 168px; height: 168px; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 60%, rgba(95, 212, 196, .35), rgba(43, 37, 64, .9) 62%, #1A1625 100%);
  box-shadow: inset 0 0 30px rgba(95, 212, 196, .25), 0 0 0 1px rgba(95, 212, 196, .35), 0 0 40px rgba(95, 212, 196, .18); transition: box-shadow .4s; }
.mist { position: absolute; inset: -30%; background: radial-gradient(closest-side, rgba(220, 230, 240, .55), transparent 70%) 30% 40% / 60% 50% no-repeat, radial-gradient(closest-side, rgba(185, 166, 255, .45), transparent 70%) 70% 65% / 55% 45% no-repeat; animation: mist 9s ease-in-out infinite; transition: opacity .8s; }
.mist.m2 { animation-duration: 13s; animation-direction: reverse; opacity: .8; }
.shine { position: absolute; left: 26%; top: 14%; width: 38px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .35); filter: blur(4px); transform: rotate(-24deg); }
.stand { width: 112px; height: 22px; margin-top: -6px; border-radius: 6px 6px 14px 14px; background: linear-gradient(#3A2718, #241710); border-top: 2px solid var(--gold); }
.ball.speaking .glass-orb { box-shadow: inset 0 0 40px rgba(95, 212, 196, .5), 0 0 0 2px rgba(95, 212, 196, .6), 0 0 70px rgba(95, 212, 196, .45); }
.ball.speaking .mist { animation-duration: 3s; }
.ball.cleared .mist { opacity: .12; }
.ball-tools { display: flex; align-items: center; gap: 14px; }
.cq { margin: 4px 0 0; font: 400 22px/1.35 var(--story); text-align: center; }
.opts { width: 100%; display: flex; flex-direction: column; gap: 10px; transition: opacity .3s; }
.opts.waiting { opacity: .5; }
.opts button { min-height: 54px; padding: 12px 18px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 600 15.5px var(--ui); text-align: left; cursor: pointer; transition: background .2s, border-color .2s; }
.opts button.ok { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); }
.opts button.ok::after { content: "  ✦"; }
.opts button.no { border-color: rgba(255, 138, 120, .6); background: rgba(255, 138, 120, .12); color: var(--grammar); }
.opts button:disabled:not(.ok):not(.no) { opacity: .5; }
.vision { width: 100%; padding: 18px 20px; border-radius: 18px; display: flex; flex-direction: column; gap: 10px; animation: enter .45s ease both; }
.link-btn { align-self: flex-start; border: 0; background: none; padding: 4px 0; cursor: pointer; font: 600 13px var(--ui); color: var(--parchment-muted); display: inline-flex; align-items: center; gap: 5px; }
.crystal-dock { padding: 10px var(--gutter) calc(20px + var(--safe-b)); flex: none; }
.crystal-dock:has(#next[hidden]) { display: none; }
@keyframes mist { 0%, 100% { transform: translate(0, 0) rotate(0) } 33% { transform: translate(6%, -4%) rotate(40deg) } 66% { transform: translate(-5%, 5%) rotate(-30deg) } }
.pct.miss { background: rgba(255, 138, 120, .12); color: var(--grammar); }

/* ---------- Spell AI ---------- */
.ai-note { margin: -8px 0 0; font: 600 12.5px var(--ui); color: var(--muted); }
.ai-card { display: flex; flex-direction: column; gap: 16px; }
.meter { display: flex; flex-direction: column; gap: 7px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--ink-2); }
.meter-head b { font: 700 14px var(--ui); color: var(--ink); font-variant-numeric: tabular-nums; }
.meter-bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--magic), var(--gold)); transition: width .6s ease; }
.parch + .heard, .scroll ~ .heard { margin-top: -8px; }
.me .relisten { color: var(--magic-hi); }
.retry-words .ctx { opacity: .45; background: none; color: var(--ink-2); text-decoration: none; }

/* ---------- Counter-spell: kartu bisa diketuk, tombol bertumpuk ---------- */
.flip { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.flip:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 16px; }
.cs-actions { display: flex; flex-direction: column; gap: 10px; }
.cs-actions .btn { width: 100%; }

/* ---------- Caption langsung: tombol buka/tutup yang jelas ---------- */
.heard { display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: var(--muted); }
.heard summary { list-style: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; cursor: pointer; }
.heard summary::-webkit-details-marker { display: none; }
.heard-src { font-weight: 600; }
.heard-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); font: 600 12.5px var(--ui); }
.heard-toggle .chev { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.heard[open] .heard-toggle { background: var(--surface-2); color: var(--ink); }
.heard[open] .heard-toggle .chev { transform: rotate(180deg); }
.heard:not([open]) .when-open, .heard[open] .when-closed { display: none; }
.heard-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, .04); border-left: 2px solid var(--line-2); animation: enter .25s ease both; }
.heard-body p { margin: 0; font: italic 400 16.5px/1.5 var(--story); color: var(--ink-2); }
.heard-body .btn { align-self: flex-start; }

/* ---------- Kartu "A more natural way" ---------- */
.better { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(226, 185, 95, .18), rgba(156, 123, 255, .14));
  border: 1px solid rgba(226, 185, 95, .55); box-shadow: 0 8px 24px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .06); }
.better-head { display: flex; align-items: center; gap: 8px; font: 600 11px var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.better-mark { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--gold); color: #2A1E0C; font-size: 12px; letter-spacing: 0; }
.better p { margin: 0; font: 400 19px/1.5 var(--story); color: var(--ink); }
.better-hear { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--gold); color: #2A1E0C; font: 600 13px var(--ui); cursor: pointer; }
.better-hear .ic { stroke: #2A1E0C; }
.me .better { margin-top: 4px; }

/* ---------- Indikator Spell AI di Quest ---------- */
.ai-orb { position: relative; flex: none; min-width: 44px; height: 44px; padding: 0 10px; border-radius: 999px; border: 1px solid rgba(226, 185, 95, .45); background: rgba(226, 185, 95, .1); color: var(--gold); font: 600 14px var(--ui); display: inline-flex; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.ai-orb b { font-weight: 700; font-variant-numeric: tabular-nums; }
.ai-orb .dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--word); }
.ai-orb[aria-expanded="true"] { background: var(--gold); color: #2A1E0C; }
.ai-pop { position: absolute; z-index: 20; top: calc(64px + var(--safe-t)); right: var(--gutter); width: min(340px, calc(100% - 2 * var(--gutter))); padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: 0 18px 40px rgba(0, 0, 0, .5); display: flex; flex-direction: column; gap: 14px; animation: enter .2s ease both; }
.ai-pop-head { display: flex; align-items: center; justify-content: space-between; }
.ai-pop-head .icon-btn { width: 32px; height: 32px; }
.ai-pop-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.ai-pop-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; color: var(--ink-2); }
.ai-pop-list .why { flex-basis: 100%; color: var(--muted); font-size: 12px; }

/* Ruang latihan setinggi layar: hanya isi percakapan yang di-scroll, tongkat selalu terlihat. */
.chamber { height: 100dvh; min-height: 0; }

/* ---------- Teman ngobrol (Reply) ---------- */
.reply-btn { min-height: 48px; padding: 0 18px; border-radius: 999px; border: 1px solid rgba(226, 185, 95, .6); background: rgba(226, 185, 95, .12); color: var(--gold); font: 600 15px var(--ui); cursor: pointer; animation: enter .3s ease both; }
#thread { display: flex; flex-direction: column; gap: 16px; }
#thread:not(:empty) { margin-bottom: 16px; }
.turn-me { margin: 0; color: var(--ink-2); }
.ai-say { align-self: flex-start; max-width: 92%; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 4px 18px 18px 18px; background: var(--parchment); color: var(--parchment-ink); font: 400 19px/1.5 var(--story); animation: enter .4s ease both; transition: box-shadow .3s; }
.ai-say.speaking { box-shadow: 0 0 0 3px rgba(226, 185, 95, .4), 0 0 26px rgba(226, 185, 95, .25); }
.ai-say .who { font: 600 10.5px var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--parchment-muted); }
.ai-say .tr { font: italic 400 15.5px/1.45 var(--story); color: #6E5E6C; }
.ai-say .tools { display: flex; gap: 16px; }
.ai-say .tools button { border: 0; background: none; padding: 4px 0; cursor: pointer; font: 600 12.5px var(--ui); color: var(--parchment-muted); display: inline-flex; align-items: center; gap: 5px; }
.ai-say.thinking .txt { display: inline-flex; gap: 6px; padding: 6px 0; }
.ai-say.thinking .txt i { width: 8px; height: 8px; border-radius: 50%; background: var(--parchment-muted); animation: pulseDot 1.2s ease-in-out infinite; }
.ai-say.thinking .txt i:nth-child(2) { animation-delay: .2s; }
.ai-say.thinking .txt i:nth-child(3) { animation-delay: .4s; }
@keyframes pulseDot { 0%, 100% { opacity: .25; transform: translateY(0) } 50% { opacity: 1; transform: translateY(-3px) } }
.convo { display: flex; flex-direction: column; gap: 12px; }
.convo .c-me { margin: 0; align-self: flex-end; max-width: 92%; padding: 12px 16px; border-radius: 18px 4px 18px 18px; background: var(--surface-2); border: 1px solid var(--line-2); font: 400 17px/1.5 var(--story); color: var(--ink-2); }
.convo .ai-say { font-size: 17px; }
.better-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.better-try { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(226, 185, 95, .6); background: transparent; color: var(--gold); font: 600 13px var(--ui); cursor: pointer; }
.better-try .ic { stroke: var(--gold); }
.better-try.on { background: var(--magic); border-color: transparent; color: #fff; }
.better-try.on .ic { stroke: #fff; }
.better-result:empty { display: none; }
.better-result .retry-words { font-size: 16px; }
.better .better-result p { font: 500 13.5px/1.5 var(--ui); }
.better .better-result p.muted { color: var(--muted); }

/* Batas giliran bicara (setelah dibalas AI) di dalam satu jawaban */
.turn-sep { display: block; height: 1px; margin: 14px 0 12px; background: linear-gradient(90deg, transparent, currentColor 15%, currentColor 85%, transparent); opacity: .35; }
.heard-body p { white-space: pre-line; }

/* ---------- About (landing) ---------- */
.about-link { display: inline-flex; align-items: center; gap: 4px; font: 600 14px var(--ui); color: var(--ink-2); text-decoration: none; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line-2); }
.about-link .ic { width: 16px; height: 16px; }
.about { padding-top: calc(16px + var(--safe-t)); padding-bottom: calc(40px + var(--safe-b)); }
.about-top { display: flex; align-items: center; justify-content: space-between; }
.about-hero { display: flex; flex-direction: column; gap: 14px; text-align: center; align-items: center; padding: 8px 0 4px; }
.about-hero h1 { margin: 0; font-size: 32px; line-height: 1.2; }
.about-hero .story { margin: 0; font-size: 18px; line-height: 1.55; color: var(--ink-2); }
.about-cta { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.steps li b { color: var(--ink); }
.feats { display: grid; gap: 12px; }
@media (min-width: 560px) { .feats { grid-template-columns: 1fr 1fr; } }
.feat { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.feat-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--gold-soft); color: var(--gold); }
.feat-ic .ic { width: 20px; height: 20px; stroke: var(--gold); }
.feat h3 { margin: 2px 0 4px; font: 600 16px var(--display); color: var(--ink); }
.feat p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.whys { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.whys li { padding-left: 22px; position: relative; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.whys li::before { content: "✦"; position: absolute; left: 0; top: 0; color: var(--gold); }
.whys b { color: var(--ink); }
.about-join { padding: 22px; border-radius: 20px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.about-join .story { margin: 0; font-size: 18px; color: var(--parchment-ink); }
.about-foot { text-align: center; font-size: 13px; color: var(--muted); }
.about-foot a { color: var(--gold); font-weight: 600; }

/* ---------- Hapus kata di caption (ketuk 2x) ---------- */
#ink [data-k], .me .say [data-k] { cursor: pointer; border-radius: 6px; -webkit-user-select: none; user-select: none; touch-action: manipulation; transition: opacity .25s, transform .25s, background .2s; }
#ink [data-k]:active, .me .say [data-k]:active { background: rgba(255, 138, 120, .18); }
#ink [data-k].gone, .me .say [data-k].gone { opacity: 0; transform: scale(.6); text-decoration: line-through; }
.undo-chip { position: relative; z-index: 3; align-self: center; margin: -6px auto 6px; display: inline-flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); font: 500 13.5px var(--ui); color: var(--ink-2); box-shadow: 0 8px 20px rgba(0, 0, 0, .35); animation: enter .2s ease both; }
.undo-chip button { border: 0; border-radius: 999px; padding: 6px 12px; background: var(--gold); color: #2A1E0C; font: 700 13px var(--ui); cursor: pointer; }
#ink [data-k].hid, .me .say [data-k].hid { display: none; }
.undo-chip.q { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(100% + 6px); margin: 0; white-space: nowrap; }
.quest-dock { position: relative; }

/* ---------- Spark ---------- */
.spark-help { border: 0; background: none; padding: 6px 0; cursor: pointer; font: 600 13px var(--ui); color: var(--gold); }
.spark-note { margin-top: -6px; }
.spark-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; text-decoration: none; color: var(--ink); background: linear-gradient(135deg, rgba(226, 185, 95, .16), rgba(156, 123, 255, .12)); border: 1px solid rgba(226, 185, 95, .45); animation: enter .4s ease both; }
.spark-card .grow { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.spark-card b { font: 600 15px var(--ui); }
.spark-card .grow span { font-size: 13px; color: var(--ink-2); }
.spark-card .ic { color: var(--gold); flex: none; }
.spark-burst { flex: none; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--gold); color: #2A1E0C; font-size: 18px; box-shadow: 0 0 18px rgba(226, 185, 95, .45); }

/* ---------- Avatar ---------- */
.ava.img { padding: 0; overflow: hidden; background: var(--surface-2); }
.ava.img img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.ava-pickable { position: relative; border: 0; background: none; padding: 0; cursor: pointer; color: inherit; flex: none; }
.ava-edit { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); padding: 2px 10px; border-radius: 999px; background: var(--gold); color: #2A1E0C; font: 700 11px var(--ui); white-space: nowrap; box-shadow: 0 4px 10px rgba(0, 0, 0, .35); }
.greet-row { display: flex; align-items: center; gap: 16px; }
.greet-row h1 { margin: 0; }
.me-ava { margin-bottom: 6px; }
.av-pick { position: fixed; inset: 0; z-index: 60; background: var(--night); display: flex; flex-direction: column; gap: 16px; padding: calc(18px + var(--safe-t)) var(--gutter) calc(18px + var(--safe-b)); animation: enter .25s ease both; }
.av-pick.out { opacity: 0; transition: opacity .2s; }
.av-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.av-head h2 { margin: 4px 0 0; font-size: 24px; }
.av-tabs { align-self: flex-start; }
.av-grid { --cols: 4; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 12px; padding: 6px 4px 24px; }
@media (min-width: 560px) { .av-grid { --cols: 6; } }
.av-opt { position: relative; display: block; flex: none; width: calc((100% - (var(--cols) - 1) * 12px) / var(--cols)); border: 0; padding: 0; border-radius: 50%; background: var(--surface-2); cursor: pointer; overflow: hidden; box-shadow: 0 0 0 2px var(--line); transition: transform .15s, box-shadow .15s; }
.av-opt::before { content: ""; display: block; padding-top: 100%; }
.av-opt img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.av-opt:hover { transform: scale(1.04); }
.av-opt.on { box-shadow: 0 0 0 3px var(--night), 0 0 0 5px var(--gold); }

/* ---------- Grimoire: avatar + cincin rank berdampingan ---------- */
.rank2 { display: flex; align-items: center; gap: 18px; }
.rank-ava { position: relative; width: 124px; height: 124px; display: flex; align-items: center; justify-content: center; }
.rank-ava svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.rank-ava .arc { transition: stroke-dashoffset 1.2s cubic-bezier(.3, .7, .2, 1); filter: drop-shadow(0 0 6px rgba(226, 185, 95, .55)); }
.rank-ava .tip { filter: drop-shadow(0 0 4px rgba(240, 207, 126, .9)); }
.rank-ava .ava { border-color: transparent; }
.rank-ava .ava-edit { bottom: 2px; }
.rank-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rank-name { font: 600 26px/1.15 var(--display); color: var(--ink); }
.rank-next { font: italic 400 15.5px/1.35 var(--story); color: var(--ink-2); margin-top: 2px; }
.rank-path { position: relative; height: 54px; margin: 6px 22px 0; }
.rank-track { position: absolute; left: 0; right: 0; top: 7px; height: 3px; border-radius: 3px; background: var(--surface-2); }
.rank-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); box-shadow: 0 0 8px rgba(226, 185, 95, .5); }
.rank-node { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rank-node b { width: 17px; height: 17px; transform: rotate(45deg); border-radius: 3px; background: var(--night); border: 2px solid var(--line-2); }
.rank-node.done b { background: var(--gold); border-color: var(--gold); }
.rank-node.now b { background: var(--gold); border-color: var(--gold-hi); box-shadow: 0 0 0 4px rgba(226, 185, 95, .2), 0 0 12px rgba(226, 185, 95, .6); }
.rank-node em { font: 600 11.5px var(--ui); font-style: normal; color: var(--muted); white-space: nowrap; margin-top: 2px; }
.rank-node.now em, .rank-node.done em { color: var(--ink); }
.rank-node small { font-size: 10.5px; color: var(--muted); }
.rank-node.now small { color: var(--gold); font-weight: 700; }

/* ---------- Wall of Wonders ---------- */
.wlist { display: flex; flex-direction: column; gap: 10px; }
.wgroup { margin: 8px 0 -2px; font: 600 12px var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.wcard { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.wcard.own { border-color: rgba(226, 185, 95, .55); }
.wbody { flex: 1; min-width: 0; }
.wname { margin: 0; font: 600 14px var(--ui); color: var(--ink); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wago { font-weight: 400; font-size: 12px; color: var(--muted); }
.wtext { margin: 4px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.wtag { font: 700 10px var(--ui); letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; }
.wtag.you { background: var(--gold-soft); color: var(--gold); }
.wtag.new { background: rgba(156, 123, 255, .18); color: var(--magic-hi); }
.wcandles { display: flex; gap: 5px; margin-top: 8px; }
.wcandles i { width: 6px; height: 16px; border-radius: 2px; background: var(--line); }
.wcandles i.l { background: var(--parchment); box-shadow: 0 -3px 6px rgba(240, 207, 126, .45); }
.wchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.wchip { min-height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); font: 500 12.5px var(--ui); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.wchip.on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }
.wchip.static { cursor: default; min-height: 28px; display: inline-flex; align-items: center; }
.wnote { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
