:root {
  --bg: #14110d;
  --bg-2: #1d1812;
  --panel: #1f1a14;
  --panel-2: #2b241b;
  --line: #4a3d28;
  --text: #f3ead8;
  --text-2: #d9cfba;
  --muted: #ab9d82;
  --accent: #f6c453;
  --accent-ink: #2a1d00;
  --win: #3ecf8e;
  --win-bg: rgba(62, 207, 142, 0.14);
  --lose: #ff6b6b;
  --lose-bg: rgba(255, 107, 107, 0.14);
  --none: #b3aa98;
  --none-bg: rgba(179, 170, 152, 0.14);
  --radius: 14px;
  --font-title: "Cinzel", Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(900px 320px at 50% 105%, rgba(196, 110, 40, .22), transparent 70%) fixed,
    radial-gradient(1200px 600px at 50% -10%, #1b2030 0%, var(--bg) 62%) fixed,
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h2, h3 { font-family: var(--font-title); letter-spacing: .02em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ---------- tombol ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: .7em 1.1em;
  border-radius: 10px;
  cursor: pointer;
  min-height: 44px;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { background: #3a3024; border-color: #8a6d36; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: #c99a2e; }
.btn-primary:hover { background: #ffd36e; border-color: #e0ad38; }
.btn-danger { background: #5c2418; border-color: #93412a; }
.btn-danger:hover { background: #6e2b1d; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(255,255,255,.06); border-color: transparent; }
.btn-lg { font-size: 1.1rem; padding: .85em 1.4em; }
.row-buttons { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }

/* ---------- layar ---------- */
.screen { display: none; }
.screen.is-active { display: block; animation: fade-in .3s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- menu utama ---------- */
.screen-menu.is-active { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px 140px; position: relative; }
.menu-sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.menu-castle { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 34vh; }
.star { position: absolute; width: 3px; height: 3px; background: #fff; border-radius: 50%; opacity: .7; animation: twinkle 3s infinite ease-in-out; }
.s1 { top: 12%; left: 14%; } .s2 { top: 22%; left: 78%; animation-delay: .6s; } .s3 { top: 8%; left: 52%; animation-delay: 1.2s; }
.s4 { top: 36%; left: 6%; animation-delay: 1.8s; } .s5 { top: 30%; left: 90%; animation-delay: .9s; } .s6 { top: 46%; left: 64%; animation-delay: 2.1s; }
@keyframes twinkle { 50% { opacity: .15; } }

.menu-card {
  position: relative; z-index: 1;
  width: min(460px, 100%);
  background: rgba(31, 26, 20, .94);
  border: 1px solid rgba(246, 196, 83, .45);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  text-align: center;
}
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; color: var(--accent); margin: 0 0 .4rem; font-weight: 700; }
.game-title { font-family: var(--font-title); font-weight: 800; font-size: clamp(2rem, 8vw, 2.8rem); margin: 0 0 .4rem; line-height: 1.05; }
.game-title span { color: var(--accent); text-shadow: 0 0 24px rgba(246,196,83,.35); }
.menu-by { color: var(--text-2); font-size: .9rem; margin: 0 0 1.2rem; }
.menu-form { display: grid; gap: .8rem; }
.menu-buttons { display: grid; gap: .55rem; margin-top: .2rem; }
.fs-note { margin: .4rem 0 0; }
.menu-fs { position: fixed; top: 12px; right: 12px; z-index: 5; background: rgba(31,26,20,.94); border-color: rgba(246,196,83,.45); }

.field { display: grid; gap: .3rem; text-align: left; font-size: .9rem; color: var(--text-2); }
.field input {
  font: inherit; font-size: 1rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: .6em .8em; min-height: 44px; width: 100%;
}
.field input[aria-invalid="true"] { border-color: var(--lose); }
.form-msg { min-height: 1.4em; margin: 0; font-weight: 600; font-size: .9rem; color: var(--lose); }

/* ---------- halaman biasa ---------- */
.screen-page.is-active { max-width: 920px; margin: 0 auto; padding: 16px 16px 64px; }
.page-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.page-head h2 { margin: 0; font-size: 1.5rem; }
.page-body { background: var(--panel); border: 1px solid rgba(246, 196, 83, .45); border-radius: var(--radius); padding: 20px; }
.prose p, .prose li { color: var(--text-2); }
.prose strong { color: var(--text); }
.controls-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 1rem; }
.controls-grid h3 { font-size: 1.1rem; color: var(--accent); }
.controls-list { padding-left: 1.1rem; margin: 0; }
.controls-list li { margin-bottom: .4rem; }
kbd {
  display: inline-block; min-width: 1.8em; padding: .05em .45em; border-radius: 6px; text-align: center;
  background: var(--bg); border: 1px solid var(--line); border-bottom-width: 3px; font: 600 .85em var(--font-body); color: var(--text);
}

/* ---------- tabel dan label hasil (dipakai rekap) ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin: .5rem 0; }
.data-table th, .data-table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.data-table th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.tag { display: inline-block; padding: .1em .55em; border-radius: 999px; font-size: .85em; font-weight: 700; }
.tag-win { background: var(--win-bg); color: var(--win); }
.tag-lose { background: var(--lose-bg); color: var(--lose); }
.tag-none { background: var(--none-bg); color: var(--none); }

/* ---------- area game 3D ---------- */
.game-root { position: fixed; inset: 0; z-index: 10; background: #000; overflow: hidden; user-select: none; -webkit-user-select: none; }
.canvas-wrap, .canvas-wrap canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; outline: none; }
.g-panel {
  background: rgba(20, 16, 11, .78);
  border: 1px solid rgba(246, 196, 83, .45);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
  color: var(--text);
  font-weight: 600;
}
.txt-win { color: var(--win); }
.txt-lose { color: var(--lose); }

/* HUD */
.hud { position: absolute; inset: 0; pointer-events: none; padding: 12px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px; z-index: 4; }
.hud > * { pointer-events: auto; }
.hud-left { padding: 8px 12px; justify-self: start; min-width: 220px; }
.hud-stage { margin: 0 0 4px; font-size: .9rem; color: var(--accent); }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-label { font-size: .8rem; color: var(--text-2); }
.bar-num { font-size: .85rem; min-width: 2.2em; text-align: right; font-variant-numeric: tabular-nums; }
.bar-track { position: relative; flex: 1; height: 12px; background: rgba(0,0,0,.55); border-radius: 6px; overflow: hidden; border: 1px solid rgba(255,255,255,.12); }
.bar-fill { height: 100%; width: 100%; transition: width .2s ease; }
.bar-player { background: linear-gradient(90deg, #2fae6f, #5be3a0); }
.bar-boss { background: linear-gradient(90deg, #a8321f, #ff7a45); }
.hud-center { padding: 8px 14px; width: min(420px, 38vw); text-align: center; }
.boss-name { margin: 0 0 4px; font-family: var(--font-title); font-size: .95rem; }
.bar-boss-track { height: 14px; }
.bar-mark { position: absolute; top: -2px; bottom: -2px; left: 20%; width: 2px; background: var(--accent); }
.hud-right { justify-self: end; display: grid; gap: 8px; justify-items: end; }
.hud-tools { display: flex; gap: 8px; align-items: stretch; }
.prob-mini { padding: 6px 10px; display: grid; font-size: .78rem; gap: 2px; }
.btn-icon { min-width: 44px; min-height: 44px; padding: 0 .8em; font-weight: 800; }
.mini-table { list-style: none; margin: 0; padding: 6px 10px; display: grid; gap: 3px; font-size: .78rem; }
.mini-table li { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.pb-win { color: var(--win); }
.pb-hidden { color: var(--text-2); font-weight: 600; text-align: center; }
.pb-lose { color: var(--lose); }

.prompt {
  position: absolute; left: 50%; top: 22%; transform: translateX(-50%); margin: 0; z-index: 3;
  font-size: clamp(1.1rem, 3vw, 1.6rem); font-weight: 800; color: #fff; text-align: center;
  background: rgba(150, 20, 20, .7); border: 1px solid rgba(255,160,120,.6); padding: .35em 1em; border-radius: 10px;
  animation: pulse .5s ease-in-out infinite alternate; pointer-events: none;
}
@keyframes pulse { to { transform: translateX(-50%) scale(1.05); } }
.lock-hint {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); margin: 0; z-index: 3; pointer-events: none;
  background: rgba(20, 16, 11,.8); border: 1px solid rgba(246,196,83,.45); padding: .5em 1em; border-radius: 10px; font-weight: 600;
}
.dmg-layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.dmg { position: absolute; left: 0; top: 0; font-weight: 900; font-size: 1.15rem; text-shadow: 0 2px 0 #000, 0 0 6px #000; }
.dmg-boss { color: #fff3c4; }
.dmg-player { color: #ff7070; }

/* Resi Bayang */
.resi-box { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(640px, calc(100vw - 32px)); display: flex; gap: 12px; align-items: center; padding: 12px 14px; z-index: 4; }
.resi-box p { margin: 0; }
.resi-name { color: #b99cff; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }
.portrait {
  flex: none; width: 52px; height: 58px; border-radius: 6px; position: relative;
  background: linear-gradient(#28143f, #3a1f5c); border: 2px solid #0a0710;
}
.portrait::before { content: ""; position: absolute; left: 9px; right: 9px; top: 14px; height: 26px; background: #050408; }
.portrait i { position: absolute; top: 23px; width: 7px; height: 5px; background: #fff; box-shadow: 0 0 6px #fff; }
.portrait i:first-child { left: 17px; }
.portrait i:last-child { right: 17px; }
.resi-line { display: flex; gap: 12px; align-items: flex-start; margin: .8rem 0; padding: 10px; background: rgba(58, 31, 92, .35); border-radius: 10px; }
.recap-explain { margin: .6rem 0; padding: .6rem .8rem; border-left: 3px solid var(--accent); background: rgba(246, 196, 83, .08); border-radius: 0 8px 8px 0; }
.resi-line p { margin: 0 0 .3rem; font-weight: 500; color: var(--text-2); }

/* overlay */
.overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; background: rgba(10, 8, 5, .35); overflow-y: auto; }
.overlay-side { place-items: center start; background: transparent; }
.overlay-scroll { place-items: start center; background: rgba(10, 8, 5, .7); }
.overlay h2 { font-size: 1.5rem; }
.intro-panel, .pause-panel, .result-panel { width: min(640px, 100%); padding: 20px 22px; font-weight: 500; }
.char-panel { width: min(360px, 100%); padding: 18px 20px; font-weight: 500; }
.choice { border: 0; padding: 0; margin: 0 0 .8rem; }
.choice legend { font-weight: 700; margin-bottom: .4rem; }
.choice-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { padding: .5em .8em; font-size: .9rem; display: inline-flex; align-items: center; gap: 6px; }
.chip-btn[aria-pressed="true"] { border-color: var(--accent); background: #4a3a22; box-shadow: 0 0 0 2px rgba(246,196,83,.35); }
.sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(255,255,255,.4); display: inline-block; }
.cond { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 .8rem; }
.cond div { background: rgba(0,0,0,.3); border-radius: 8px; padding: 8px 10px; }
.cond dt { font-size: .8rem; color: var(--muted); }
.cond dd { margin: 0; font-weight: 600; }
.prob-box { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; align-items: center; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.4); border: 1px solid rgba(246,196,83,.4); font-weight: 700; }
.pb-sep { color: var(--muted); }
.intro-controls { background: rgba(0,0,0,.3); border-radius: 10px; padding: 10px 14px; margin-top: .8rem; }
.intro-controls h3 { font-size: 1rem; color: var(--accent); margin-bottom: .3rem; }
.intro-controls ul { margin: 0; padding-left: 1.1rem; font-size: .9rem; color: var(--text-2); }
.pause-buttons { display: grid; gap: 8px; }
.result-line { color: var(--text-2); font-weight: 500; }
.result-panel h2 { font-family: var(--font-body); font-weight: 900; font-size: 2rem; }

/* Serangan Penentu */
.decisive { position: absolute; left: 50%; top: 10%; transform: translateX(-50%); z-index: 4; display: grid; justify-items: center; gap: 12px; width: min(720px, calc(100vw - 32px)); text-align: center; pointer-events: none; }
.decisive-title { margin: 0; font-family: var(--font-title); font-weight: 800; font-size: clamp(1.6rem, 5vw, 2.6rem); color: var(--accent); text-shadow: 0 0 20px rgba(246,196,83,.6), 0 3px 0 #000; }
.decisive .prob-box { background: rgba(14, 11, 7, .8); }
.decisive-result { margin: 4vh 0 0; font-weight: 900; font-size: clamp(2.4rem, 9vw, 5rem); text-shadow: 0 4px 0 #000, 0 0 30px currentColor; animation: pop .35s ease-out; }
.decisive.is-win .decisive-result { color: var(--win); }
.decisive.is-lose .decisive-result { color: var(--lose); }
.decisive-u { margin: 0; background: rgba(14, 11, 7,.8); padding: .3em .8em; border-radius: 8px; font-weight: 600; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* rekap */
.recap-panel { width: min(900px, 100%); padding: 20px 22px; font-weight: 500; margin: 16px 0; }
.recap-head { border-bottom: 1px solid var(--line); padding-bottom: .6rem; margin-bottom: .6rem; }
.recap-head p { margin: .2rem 0; }
.reflection { padding-left: 1.2rem; color: var(--text-2); }
.reflection li { margin-bottom: .3rem; }
.note { background: rgba(0,0,0,.35); border-left: 4px solid var(--accent); padding: .6rem .9rem; border-radius: 6px; }
.dialog { background: var(--panel); color: var(--text); border: 1px solid rgba(246,196,83,.45); border-radius: 14px; padding: 20px; width: min(440px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(6, 5, 3, .7); }
.dialog p { margin-top: 0; font-weight: 600; }

/* tombol suara selalu tersedia */
.sound-btn { position: absolute; top: 12px; right: 12px; z-index: 7; font-size: 1.1rem; background: rgba(20, 16, 11,.8); border-color: rgba(246,196,83,.45); }
.hud-right { margin-right: 56px; }

/* kontrol sentuh */
.touch { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.touch > * { pointer-events: auto; touch-action: none; }
.look-zone { position: absolute; right: 0; top: 0; bottom: 0; width: 55%; }
.joy { position: absolute; left: 0; bottom: 0; width: 45%; height: 60%; }
.joy-base { position: absolute; left: 32px; bottom: 32px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.08); border: 2px solid rgba(246,196,83,.5); }
.joy-knob { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(246,196,83,.7); }
.touch-buttons { position: absolute; right: 16px; bottom: 16px; display: grid; grid-template-columns: repeat(2, 64px); gap: 10px; }
.tbtn {
  width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(246,196,83,.6); background: rgba(20, 16, 11,.75);
  color: var(--text); font: 700 .75rem var(--font-body); touch-action: none; user-select: none; -webkit-user-select: none;
}
.tbtn-big { grid-column: 1 / -1; justify-self: end; width: 84px; height: 84px; font-size: .9rem; background: rgba(150, 40, 30, .8); }
.tbtn.is-down { background: var(--accent); color: var(--accent-ink); }
.rotate-hint { display: none; }
@media (orientation: portrait) {
  .game-root.is-touch #touch:not([hidden]) ~ .rotate-hint {
    display: block; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 8; margin: 0;
    width: min(320px, 86vw); text-align: center; padding: 14px; border-radius: 12px; font-weight: 700;
    background: rgba(20, 16, 11,.92); border: 1px solid rgba(246,196,83,.6); pointer-events: none;
  }
}

/* kustomisasi karakter */
.char-panel { max-height: calc(100vh - 32px); overflow-y: auto; }
.char-options .choice { margin-bottom: .6rem; }
.char-options .chip-btn { min-height: 38px; padding: .35em .65em; font-size: .82rem; }
.char-actions { margin-top: .4rem; position: sticky; bottom: -18px; background: rgba(20, 16, 11,.95); padding: 8px 0; }

/* layar penuh */
.fs-corner { position: absolute; top: 12px; right: 64px; z-index: 7; background: rgba(20, 16, 11,.8); border-color: rgba(246,196,83,.45); font-size: 1.1rem; }
.hud-right { margin-right: 108px; }

/* ramuan */
.hud-buff { margin: 6px 0 0; font-size: .78rem; color: #ffb347; }
.dmg-heal { color: #5bff9a; }
.dmg-buff { color: #ffb347; }
.dmg-spell { color: #9fd8ff; font-size: 1.5rem; }
.prompt-good { background: rgba(20, 110, 60, .75); border-color: rgba(120,255,170,.6); animation: none; }

/* percakapan gaya visual novel */
.vn { position: absolute; inset: 0; z-index: 6; display: flex; align-items: flex-end; justify-content: center; padding: 16px; background: linear-gradient(transparent 55%, rgba(6, 5, 3,.55)); cursor: pointer; }
.vn-box { position: relative; width: min(820px, 100%); display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px 14px; font-weight: 500; }
.vn-portrait { flex: none; width: 84px; height: 92px; border-radius: 10px; position: relative; border: 2px solid #0a0710; overflow: hidden; }
.vn-portrait i { position: absolute; top: 44px; width: 10px; height: 8px; }
.vn-portrait i:first-child { left: 24px; }
.vn-portrait i:last-child { right: 24px; }
.pt-resi { background: linear-gradient(#28143f, #3a1f5c); }
.pt-resi::before { content: ""; position: absolute; left: 14px; right: 14px; top: 24px; height: 44px; background: #050408; }
.pt-resi i { background: #fff; box-shadow: 0 0 8px #fff; }
.pt-arca { background: linear-gradient(#7d8a78, #5c6658); }
.pt-arca::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 16px; background: #a88f4a; }
.pt-arca::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 10px; height: 18px; background: #3b423a; }
.pt-arca i { background: #ffb02e; box-shadow: 0 0 10px #ff8a00; }
.pt-player { background: linear-gradient(var(--shirt) 0 0) bottom / 100% 18px no-repeat, var(--skin); }
.pt-player::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 26px; background: var(--hair); }
.pt-player i { background: #0c0b10; }
.vn-body { flex: 1; min-width: 0; }
.vn-name { display: inline-block; margin: 0 0 6px; padding: .15em .7em; border-radius: 6px; font-weight: 800; font-size: .9rem; background: #4a3a22; }
.name-arca { background: #6b3a1e; color: #ffd8a8; }
.name-resi { background: #3a1f5c; color: #d9c6ff; }
.name-player { background: #1f4f7a; color: #cfe8ff; }
.vn-text { margin: 0; font-size: 1.05rem; line-height: 1.5; min-height: 3em; color: var(--text); }
.vn-hint { margin: 6px 0 0; font-size: .75rem; color: var(--muted); }
.vn-skip { position: absolute; top: -52px; right: 0; min-height: 40px; padding: .4em .9em; background: rgba(20, 16, 11,.85); }

/* Quick Time Event */
.qte { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); z-index: 6; display: grid; justify-items: center; gap: 8px; text-align: center; }
.qte-label { margin: 0; font-family: var(--font-title); font-weight: 800; font-size: clamp(1.4rem, 4vw, 2.2rem); color: #fff; text-shadow: 0 3px 0 #000, 0 0 18px rgba(246,196,83,.8); }
.qte-btn { position: relative; width: 120px; height: 120px; border-radius: 50%; border: 3px solid var(--accent); background: rgba(150, 40, 30, .85); color: #fff; font: 900 1.1rem var(--font-body); cursor: pointer; touch-action: none; animation: qte-pulse .5s ease-in-out infinite alternate; }
.qte-btn svg { position: absolute; inset: -10px; width: calc(100% + 20px); height: calc(100% + 20px); transform: rotate(-90deg); pointer-events: none; }
.qte-ring { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; }
.qte.is-pressed .qte-btn { background: var(--accent); color: var(--accent-ink); animation: none; transform: scale(1.12); }
.qte.is-missed .qte-btn { opacity: .5; animation: none; }
.qte-feedback { margin: 0; min-height: 1.4em; font-weight: 800; color: #fff; text-shadow: 0 2px 0 #000; }
@keyframes qte-pulse { to { transform: scale(1.07); } }
.decisive-note { margin: 0; max-width: 560px; font-size: .85rem; font-weight: 600; background: rgba(14, 11, 7,.85); padding: .35em .8em; border-radius: 8px; border: 1px solid rgba(246,196,83,.35); }

/* zona aman kanan bawah: badge hosting (misalnya "Powered by Netlify") bisa muncul di sana,
   jadi tombol dan teks penting dijaga di atas zona ini */
:root { --safe-bottom: 72px; }
.touch-buttons {
  bottom: var(--safe-bottom); right: 14px;
  grid-template-columns: 76px 62px 62px; grid-template-areas: "atk jump crouch" "atk dodge spell";
  align-items: center;
}
.tbtn { width: 62px; height: 62px; }
.tbtn-big { grid-area: atk; width: 76px; height: 76px; justify-self: center; }
.tbtn[data-touch="jump"] { grid-area: jump; }
.tbtn[data-touch="crouch"] { grid-area: crouch; }
.tbtn[data-touch="dodge"] { grid-area: dodge; }
.tbtn[data-touch="spell"] { grid-area: spell; font-size: .7rem; }
.tbtn-spell.is-ready { background: rgba(60, 90, 200, .85); border-color: #9fd8ff; box-shadow: 0 0 14px rgba(120,200,255,.7); }
.tbtn-spell:not(.is-ready) { opacity: .45; }
.hud-spell { margin: 4px 0 0; font-size: .78rem; color: #9fd8ff; }
.letterbox i { position: absolute; left: 0; right: 0; height: 0; background: #000; z-index: 3; transition: height .5s ease; pointer-events: none; }
.letterbox i:first-child { top: 0; }
.letterbox i:last-child { bottom: 0; }
.letterbox.is-on i { height: 9vh; }
.decisive-sub { margin: 0; font-weight: 700; color: #fff; text-shadow: 0 2px 0 #000; max-width: 560px; }
.decisive-title.slam { animation: title-slam .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes title-slam { from { transform: scale(2.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.resi-box { bottom: var(--safe-bottom); }
.vn { padding-bottom: var(--safe-bottom); }
.overlay { padding-bottom: calc(var(--safe-bottom) + 8px); }
.screen-page.is-active { padding-bottom: calc(var(--safe-bottom) + 16px); }
.teacher-rows { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: .6rem; }
.teacher-row { background: rgba(0,0,0,.25); border-radius: 10px; padding: 10px 12px; }
.teacher-preview { margin: .4rem 0 0; font-size: .8rem; font-weight: 600; }

/* tabel mini dan kotak peluang HUD yang ringkas */
.prob-mini { font-size: .72rem; }
.mini-table { display: flex; gap: 4px; padding: 4px 6px; font-size: .68rem; }
.mini-table li { display: grid; gap: 1px; justify-items: center; }
.mini-table .tag { padding: 0 .4em; font-size: .62rem; }

/* layar pendek (HP landscape): HUD ringkas agar tidak menutupi tombol sentuh dan area kamera */
@media (max-height: 500px) {
  .hud { padding: 6px; gap: 6px; }
  .hud-left { padding: 4px 8px; min-width: 0; }
  .hud-stage { font-size: .72rem; }
  .bar-track { height: 9px; }
  .hud-center { padding: 4px 8px; width: min(240px, 28vw); }
  .boss-name { font-size: .75rem; margin-bottom: 2px; }
  .hud-right { gap: 4px; margin-right: 50px; }
  .prob-mini { font-size: .58rem; padding: 3px 6px; gap: 0; }
  .btn-icon { min-width: 44px; min-height: 44px; }
  .mini-table { display: flex; gap: 2px; padding: 2px 4px; font-size: .55rem; }
  .mini-table .tag { font-size: .52rem; }
  .mini-table li { display: grid; gap: 1px; justify-items: center; }
  .mini-table .tag { padding: 0 .35em; }
  .sound-btn { top: 6px; right: 6px; }
  .fs-corner { top: 6px; right: 56px; }
  .hud-right { margin-right: 100px; }
  .vn { padding: 8px; }
  .vn-box { padding: 10px 12px; gap: 10px; }
  .vn-portrait { width: 60px; height: 66px; }
  .vn-portrait i { top: 30px; }
  .vn-portrait i:first-child { left: 16px; }
  .vn-portrait i:last-child { right: 16px; }
  .vn-text { font-size: .9rem; min-height: 2.6em; }
  .vn-skip { top: -46px; }
  .qte { bottom: 6%; }
  .qte-btn { width: 92px; height: 92px; }
  .decisive-note { font-size: .7rem; }
  .decisive-title { font-size: 1.3rem; }
  :root { --safe-bottom: 64px; }
  .tbtn { width: 54px; height: 54px; font-size: .7rem; }
  .tbtn-big { width: 66px; height: 66px; }
  .touch-buttons { grid-template-columns: 66px 54px 54px; gap: 6px; right: 12px; }
  .joy-base { left: 24px; bottom: 20px; }
  .resi-box { padding: 8px 10px; font-size: .85rem; }
  .decisive { top: 4%; gap: 6px; }
  .decisive .prob-box { font-size: .8rem; padding: 6px 8px; }
  .intro-panel, .pause-panel, .result-panel, .char-panel { padding: 12px 14px; }
  .overlay h2 { font-size: 1.15rem; }
  .cond { grid-template-columns: 1fr 1fr; }
  .overlay { place-items: start center; }
}

@media (max-width: 760px) {
  .hud-left { min-width: 0; }
  .cond { grid-template-columns: 1fr; }
  .overlay-side { place-items: end center; }
}

/* ---------- perbaikan audit: tata letak HUD, tombol pojok, rekap ---------- */
/* baris grid HUD setinggi isinya, agar tidak ada panel yang jatuh ke tengah layar */
.hud { align-content: start; }

/* tombol Layar Penuh dan Suara: ukuran tetap, berjarak, tidak saling menimpa */
.sound-btn, .fs-corner { width: 44px; min-width: 44px; height: 44px; padding: 0; }
.fs-corner { right: 64px; }

/* tabel mini: latar lebih pekat dan warna status lebih terang agar terbaca di atas cahaya obor */
.mini-table { background: rgba(16, 13, 9, .92); }
.hud .tag-lose { color: #ff9a9a; }
.hud .tag-none { color: #d2c9b6; }
.prob-mini .pb-lose { color: #ff9a9a; }

/* ukuran huruf HUD minimal 12px di laptop */
.prob-mini { font-size: .78rem; }
.mini-table { font-size: .75rem; }
.mini-table .tag { font-size: .75rem; }

/* teks khusus pembaca layar */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* panel pilih karakter selalu muat di layar (bisa digulir di dalamnya) */
.char-panel { max-height: calc(100vh - 24px - var(--safe-bottom)); }

/* rekap: panel tidak melebihi lebar layar; hanya tabel yang digeser ke samping */
.overlay { grid-template-columns: minmax(0, 1fr); }
.recap-panel { min-width: 0; max-width: 100%; }
.recap-head p { overflow-wrap: anywhere; }

/* layar pendek (HP landscape) */
@media (max-height: 500px) {
  .hud-right { margin-right: 0; margin-top: 50px; }
  .sound-btn { right: 6px; }
  .fs-corner { right: 56px; }
  .prob-mini { font-size: .7rem; }
  .mini-table { font-size: .7rem; gap: 3px; }
  .mini-table .tag { font-size: .68rem; }
  .decisive-note { font-size: .75rem; }
  .overlay { padding-top: 56px; }
  .overlay-side { padding-top: 12px; }
}

/* portrait (HP dan tablet): bar boss turun ke baris kedua, panel kanan di bawah tombol pojok */
@media (orientation: portrait) and (max-width: 900px) {
  .hud { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "left right" "center center"; }
  .hud-left { grid-area: left; min-width: 0; }
  .hud-center { grid-area: center; justify-self: stretch; width: auto; }
  .hud-right { grid-area: right; margin-right: 0; margin-top: 52px; max-width: 58vw; }
  .hud-tools { flex-wrap: wrap; justify-content: flex-end; }
  .mini-table { flex-wrap: wrap; justify-content: flex-end; }
  .overlay { padding-top: 64px; }
  .overlay-side { padding-top: 12px; }
  .joy-base { left: 14px; width: 104px; height: 104px; }
  .joy-knob { left: 27px; top: 27px; }
  .touch-buttons { right: 10px; grid-template-columns: 64px 54px 54px; gap: 6px; }
  .tbtn { width: 54px; height: 54px; }
  .tbtn-big { width: 64px; height: 64px; }
}

/* ---------- adapt: perangkat sentuh (laptop dengan mouse tidak terpengaruh) ---------- */
@media (pointer: coarse) {
  /* tombol Jeda, Suara, dan Layar Penuh minimal 48px */
  .btn-icon { min-width: 48px; min-height: 48px; }
  .sound-btn, .fs-corner { width: 48px; min-width: 48px; height: 48px; }
  .fs-corner { right: calc(68px + env(safe-area-inset-right)); }
  .sound-btn { right: calc(12px + env(safe-area-inset-right)); }
  .hud-right { margin-right: 116px; }
  /* zona aman poni dan lubang kamera saat HP landscape */
  .hud {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .touch { inset: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
}
@media (pointer: coarse) and (max-height: 500px) {
  .hud { padding-left: max(6px, env(safe-area-inset-left)); padding-right: max(6px, env(safe-area-inset-right)); padding-top: max(6px, env(safe-area-inset-top)); }
  .sound-btn { right: calc(6px + env(safe-area-inset-right)); }
  .fs-corner { right: calc(60px + env(safe-area-inset-right)); }
  .hud-right { margin-right: 0; margin-top: 54px; }
  /* tabel mini pindah ke bawah panel HP agar sisi kanan (dekat tombol aksi) tidak menumpuk */
  .hud { grid-template-columns: 1fr auto 1fr; grid-template-areas: "left center ." "table table tools"; row-gap: 6px; }
  .hud-left { grid-area: left; }
  .hud-center { grid-area: center; }
  .hud-right { display: contents; }
  .hud-tools { grid-area: tools; justify-self: end; }
  .mini-table { grid-area: table; justify-self: start; }
  /* tombol aksi diberi jarak agar ibu jari tidak salah pencet */
  .touch-buttons { gap: 10px; }
  /* kotak peluang Serangan Penentu lebih mudah dibaca */
  .decisive .prob-box { font-size: .875rem; }
  .decisive-note { font-size: .8125rem; }
}
@media (pointer: coarse) and (orientation: portrait) and (max-width: 900px) {
  .hud-right { margin-right: 0; margin-top: 56px; }
}

/* ---------- harden: kasus pinggir ---------- */
.start-hint { margin: -.2rem 0 0; text-align: center; }
/* nama siswa yang panjang turun baris di label percakapan */
.vn-name { max-width: 100%; overflow-wrap: anywhere; }
/* HP dan tablet portrait: area gulir overlay dimulai di bawah tombol Suara dan Layar Penuh,
   pita atas diberi warna latar yang sama agar teks tidak lewat di bawah tombol */
@media (orientation: portrait) and (max-width: 900px) {
  .overlay { top: 68px; padding-top: 8px; box-shadow: 0 -68px 0 rgba(10, 8, 5, .35); }
  .overlay-scroll { box-shadow: 0 -68px 0 rgba(10, 8, 5, .7); }
  .overlay-side { padding-top: 8px; box-shadow: none; }
  .char-panel { max-height: calc(100vh - 92px - var(--safe-bottom)); }
}

/* ---------- identitas Kerajaan Swarnadwipa: batu, emas kusam, api obor ---------- */
/* tombol sekunder: batu gelap bergaris emas tipis; primer: lempeng emas; bahaya: bata terbakar */
.btn { border-color: rgba(246, 196, 83, .3); }
.btn-primary {
  background: linear-gradient(#ffd77a, #e9b43f); border-color: #b8862a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -2px 0 rgba(120, 80, 10, .35);
}
.btn-primary:hover { background: linear-gradient(#ffe08f, #f0bf52); border-color: #c99a2e; }
.btn-primary:disabled { background: linear-gradient(#c9a65a, #b38b3a); }
.btn-ghost { border-color: transparent; }
.btn-danger { border-color: #93412a; }

/* ikon SVG garis emas (suara dan layar penuh) */
.icon { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

/* kotak peluang di pembuka tahap: prasasti berbingkai emas ganda dengan persen besar */
.intro-panel .prob-box {
  border-color: rgba(246, 196, 83, .75); outline: 1px solid rgba(246, 196, 83, .3); outline-offset: 3px;
  background: rgba(0, 0, 0, .35); padding: 12px 14px; margin: 4px;
}
.intro-panel .pb-pct, .decisive .pb-pct { font-family: var(--font-title); font-weight: 800; font-size: 1.45em; line-height: 1; }
.pb-frac { white-space: nowrap; }
/* layar sempit: menang dan kalah bertumpuk, pemisah disembunyikan */
@media (max-width: 480px) {
  .prob-box { flex-direction: column; gap: 4px; }
  .prob-box .pb-sep { display: none; }
}
.prob-hint { margin: .55rem 0 0; font-size: .85rem; font-weight: 600; color: var(--text-2); text-align: center; }

/* hasil tahap: judul pahatan Cinzel, catatan rapi */
.result-panel h2 { font-family: var(--font-title); font-weight: 800; letter-spacing: .03em; }
.result-trig { margin: -.4rem 0 0; color: var(--muted); font-size: .875rem; }

/* rekap: keterangan judul kolom */
.col-legend { margin: 0 0 .8rem; padding-left: 1.1rem; }
.col-legend li { margin-bottom: .2rem; }
.col-legend strong { color: var(--text-2); }

/* Cara Bermain: kolom tombol dan aksi agar mudah dipindai */
.controls-list.keys { list-style: none; padding: 0; }
.controls-list.keys li { display: grid; grid-template-columns: 8.5em 1fr; gap: .6rem; align-items: baseline; padding: .3rem 0; border-bottom: 1px solid rgba(246, 196, 83, .12); margin: 0; }
.controls-list.keys li > span { color: var(--text); font-weight: 600; }
.tips-title { margin-top: 1.2rem; font-size: 1.1rem; color: var(--accent); }

/* pilih karakter: bilah Acak/Pilih pekat selebar panel agar tidak menimpa pilihan */
.char-actions {
  z-index: 1; background: var(--panel); margin: .4rem -20px 0; padding: 10px 20px;
  border-top: 1px solid rgba(246, 196, 83, .35);
}
@media (max-height: 500px) {
  .char-actions { bottom: -12px; margin-left: -14px; margin-right: -14px; padding: 8px 14px; }
  .decisive .pb-pct { font-size: 1.15em; }
}

/* ---------- masuk dan daftar (email dan kata sandi) ---------- */
.auth-loading { margin: .4rem 0 1rem; }
.auth-panel { display: grid; gap: .8rem; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); border: 1px solid rgba(246, 196, 83, .3); }
.auth-tab {
  appearance: none; border: 0; border-radius: 9px; padding: .6em; min-height: 44px; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--text-2); background: transparent;
}
.auth-tab[aria-selected="true"] { background: var(--panel-2); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(246, 196, 83, .45); }
.show-pass { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--text-2); text-align: left; min-height: 32px; cursor: pointer; }
.show-pass input { width: 18px; height: 18px; accent-color: var(--accent); }
.btn-lupa { justify-self: center; font-size: .9rem; min-height: 40px; }
.akun-line { margin: 0; font-size: .85rem; color: var(--text-2); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .2rem .5rem; overflow-wrap: anywhere; }
.akun-line strong { color: var(--text); }
.btn-keluar { min-height: 36px; padding: .3em .7em; font-size: .85rem; text-decoration: underline; }
.menu-shared { margin-top: .55rem; }
.latihan-note { margin: .6rem 0 0; padding: .5rem .7rem; border-radius: 10px; font-size: .85rem; font-weight: 600; color: #ffd27a; background: rgba(246, 196, 83, .1); border: 1px solid rgba(246, 196, 83, .35); }
.save-msg { margin: .4rem 0 0; }
.latihan-note > p { margin: 0 0 .5rem; }
.latihan-note .btn { width: 100%; min-height: 40px; font-size: .85rem; }

/* HP: kartu menu turun di bawah tombol Layar Penuh agar judul tidak tertutup */
@media (max-width: 480px) {
  .screen-menu.is-active { padding-top: 72px; }
}

/* ---------- LKPD digital: gambar asli halaman + kolom isian di atasnya ---------- */
.lk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; margin: 0 0 .5rem; }
.lk-status { font-weight: 700; color: var(--accent); }
.lk-zoom { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.lk-zoom .btn { min-height: 40px; min-width: 40px; padding: .3em .6em; }
.lk-zoom #lk-zoom-nilai { min-width: 3.2em; text-align: center; color: var(--text-2); }
.lk-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 .4rem; font-size: .8rem; }
.lk-main-judul { font-weight: 700; color: var(--text-2); margin-right: 2px; }
.lk-chip { padding: .2em .6em; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.lk-chip.is-win { color: var(--win); background: var(--win-bg); border-color: rgba(62, 207, 142, .5); }
.lk-chip.is-lose { color: var(--lose); background: var(--lose-bg); border-color: rgba(255, 107, 107, .5); }
.lk-chip.is-none { color: var(--none); background: var(--none-bg); }
.lk-chip.is-last { color: var(--accent); border-color: rgba(246, 196, 83, .5); }
.lk-hint { margin: 0 0 .6rem; }
.lk-viewport { overflow-x: auto; overflow-y: hidden; touch-action: pan-x pan-y; padding: 6px 0; background: #2b241b; border-radius: 8px; }
.lk-sheet {
  position: relative; margin: 0 auto; aspect-ratio: 1240 / 1754; background: #faf6ee;
  font-family: Arial, "Helvetica Neue", Helvetica, "Liberation Sans", sans-serif;
  /* 22 piksel pada lebar asli 1240, sama dengan ukuran huruf di PDF unduhan */
  font-size: calc(var(--sw, 800) * .017742px); color: #1d3f8f; color-scheme: light;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .45);
}
.lk-sheet-img { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; pointer-events: none; }
.lk-f {
  position: absolute; box-sizing: border-box; margin: 0; border: 0; border-radius: 2px; background: transparent;
  color: #1d3f8f; font: inherit; line-height: 1.25; padding: .1em .25em; outline: none;
}
.lk-f-uraian { resize: none; overflow-y: auto; scrollbar-width: thin; }
.lk-f-sel { text-align: center; }
.lk-f-statis { position: absolute; display: grid; place-items: center; color: #1a1a1a; font-weight: 700; pointer-events: none; }
.lk-f-kotak { border: 2px solid #8a6d2f; background: #fffdf9; border-radius: 3px; text-align: left; padding-left: .5em; }
.lk-f-kotak:focus, .lk-f-kotak:focus-visible { box-shadow: 0 0 0 2px #b8862a; background: #fff6d6; }
.lk-f-kotak[readonly]:focus { background: #fffdf9; box-shadow: none; }
.lk-f:focus, .lk-f:focus-visible { outline: none; box-shadow: inset 0 0 0 2px #b8862a; background: rgba(255, 246, 214, .55); }
.lk-f[readonly] { cursor: default; }
.lk-f[readonly]:focus { box-shadow: none; background: transparent; }
.lk-f-ceklis { position: absolute; display: grid; place-items: center; padding: 0; border: 0; border-radius: 2px; background: transparent; color: #1d3f8f; cursor: pointer; touch-action: manipulation; }
.lk-f-ceklis svg { width: 1.9em; height: 1.9em; opacity: 0; }
.lk-f-ceklis[aria-pressed="true"] svg { opacity: 1; }
.lk-f-ceklis:not(:disabled):hover { background: rgba(184, 134, 42, .1); }
.lk-f-ceklis:focus-visible, .lk-hotspot:focus-visible { outline: none; box-shadow: inset 0 0 0 2px #8a5a00; }
.lk-f-ceklis:disabled { cursor: default; }
.lk-sheet :focus-visible { outline: 2px solid #8a5a00; outline-offset: 0; }
.lk-f-strip { position: absolute; display: grid; place-items: center; }
.lk-row-off { position: absolute; pointer-events: none; background: repeating-linear-gradient(135deg, rgba(120, 110, 95, .1) 0 6px, transparent 6px 12px); }
.lk-f-identitas { font-size: 1.15em; padding: 0 .3em; }
.lk-f-titik { font-weight: 700; padding: 0 .05em .3em; line-height: 1; }
.lk-f-titik.is-tengah { text-align: center; }
.lk-hotspot { position: absolute; padding: 0; border: 0; border-radius: 4px; background: transparent; cursor: pointer; }
.lk-hotspot:not(:disabled):hover { box-shadow: 0 0 0 2px #b8862a; background: rgba(184, 134, 42, .1); }
.lk-hotspot:disabled { cursor: default; }
.lk-sheet .lk-kosong { box-shadow: inset 0 0 0 2px #c0392b; background: rgba(192, 57, 43, .08); }
.lk-akhir { margin-top: .8rem; }
.lk-akhir h3 { font-size: 1.15rem; color: var(--accent); margin-bottom: .3rem; }
.lk-akhir .row-buttons { margin-top: .6rem; }
.lk-nav-msg:empty { display: none; }
.lk-nav-msg { margin: .6rem 0 0; }
.lk-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .8rem; flex-wrap: wrap; }
.lk-dots { display: flex; gap: 4px; }
.lk-dots .btn { min-width: 44px; padding: .4em; }
.lk-dots .btn[aria-current="true"] { border-color: var(--accent); color: var(--accent); }
.lk-page-no { text-align: center; margin: .4rem 0 0; }
.screen-lkpd.papan-buka.is-active { padding-bottom: calc(var(--papan-h, 0px) + 24px); }
.dialog-wide { width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px); }
.dialog-wide h3 { color: var(--accent); }
.dialog-wide h4 { margin: 1rem 0 .4rem; color: var(--accent); }
.lk-hasil-id { display: grid; gap: .3rem; margin: 0 0 .6rem; }
.lk-hasil-id div, .lk-hasil-jawab div { display: grid; grid-template-columns: 7.5em 1fr; gap: .6rem; }
.lk-hasil-id dt, .lk-hasil-jawab dt { color: var(--muted); }
.lk-hasil-id dd, .lk-hasil-jawab dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.lk-hasil-jawab { display: grid; gap: .6rem; margin: 0; }
.lk-hasil-jawab div { padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.materi h3 { font-size: 1.15rem; color: var(--accent); margin: 1.2rem 0 .4rem; }
.materi h3:first-child { margin-top: 0; }
.materi h4 { margin: 1rem 0 .4rem; color: var(--text); }
.materi ul { padding-left: 1.2rem; }
.materi .data-table { margin: .4rem 0 .8rem; }
.materi-rumus { margin: .5rem 0; padding: .6rem .9rem; border-left: 3px solid var(--accent); background: rgba(246, 196, 83, .08); font-weight: 700; font-size: 1.05rem; }
#ubah-alasan { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .6em .75em; resize: vertical; }

/* Papan rumus, tata letak seperti keyboard GeoGebra */
.papan-toggle { position: fixed; left: 12px; bottom: 12px; z-index: 40; display: inline-flex; align-items: center; gap: .45rem; min-height: 46px; box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
.papan-toggle svg { width: 22px; height: 22px; }
.papan {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; color: #1b1f24; background: #eceff3;
  border-top: 1px solid #c9ced6; padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 18px rgba(0, 0, 0, .35);
  color-scheme: light;
}
.papan-inner { max-width: 760px; margin: 0 auto; }
.papan-head { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.papan-tabs { display: flex; gap: 2px; }
.papan-tab { appearance: none; border: 0; border-radius: 6px; padding: .3em .75em; min-height: 38px; background: transparent; color: #4a4f57; font: 600 .9rem var(--font-body); cursor: pointer; }
.papan-tab[aria-selected="true"] { background: #fff; color: #1b1f24; box-shadow: inset 0 -3px 0 #6557d2; }
.papan-tab:focus-visible, .papan-key:focus-visible { outline: 2px solid #6557d2; outline-offset: 1px; }
.papan-x { font-size: 1rem; }
.papan-status { flex: 1; min-width: 0; font-size: .75rem; line-height: 1.25; color: #4a4f57; text-align: center; }
.papan-keys { display: grid; gap: 5px; }
.papan-row { display: grid; gap: 5px; }
.papan-key {
  appearance: none; border: 0; border-radius: 6px; min-height: 42px; padding: 0 2px; background: #fff; color: #1b1f24;
  font: 500 1.05rem/1 var(--font-body); box-shadow: 0 1px 0 #b3b9c2; cursor: pointer; touch-action: manipulation; white-space: nowrap; overflow: hidden;
}
.papan-key.is-fn { background: #dde1e8; }
.papan-key[aria-pressed="true"] { background: #6557d2; color: #fff; }
.papan-key:active { background: #cfd4dc; }
@media (max-width: 700px) {
  .screen-lkpd.is-active { padding-left: 8px; padding-right: 8px; }
  .lk-zoom { margin-left: 0; }
}
@media (max-width: 480px) {
  .lk-dots { order: 3; width: 100%; justify-content: center; }
  .lk-nav .btn:not(.lk-dots .btn) { flex: 1; }
  .papan-key { min-height: 40px; font-size: .95rem; }
  .papan-tab { padding: .3em .55em; }
  .papan-head { flex-wrap: wrap; }
  .papan-status { order: 5; flex-basis: 100%; }
  .papan-status:empty { display: none; }
  #papan-hp { margin-left: auto; }
}

/* ---------- pesan tanpa internet ---------- */
.offline {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; gap: 1rem; padding: 24px;
  background: var(--bg); text-align: center; font-size: 1.1rem; font-weight: 600;
}
.offline .btn { justify-self: center; }

@media (max-width: 480px) {
  .page-body { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

.sens-field { margin: .2rem 0; }
.sens-field input[type="range"] { width: 100%; padding: 0; border: 0; background: transparent; accent-color: var(--accent); min-height: 32px; }
