/* =====================================================================
   game-ui.css - Gaya bersama seluruh website ExtraCourse
   Mengikuti tampilan Monitor Kelas: hijau, kartu putih bersudut 14px,
   header lengket dengan logo EC, navigasi bawah, mode gelap otomatis.
   Dipakai halaman siswa (dashboard, game, peringkat, masuk) & admin.
   ===================================================================== */

:root {
    --bg: #f3f5f4;
    --surface: #ffffff;
    --soft: #eef2f0;
    --text: #17201c;
    --muted: #66706b;
    --line: #e2e7e4;
    --line-strong: #cfd7d3;
    --accent: #1f6f4a;
    --accent-dark: #185a3c;
    --accent-ink: #ffffff;
    --accent-soft: #e1f0e8;
    --ok: #1f8a55;
    --ok-soft: #e3f4ea;
    --bad: #c0392b;
    --bad-soft: #fbe5e2;
    --warn: #a86400;
    --warn-soft: #fff0d4;
    --info: #2a5db0;
    --info-soft: #e3ecfa;
    --gold: #b7791f;
    --shadow: 0 1px 2px rgba(23, 32, 28, 0.06);
    --radius: 14px;
    --radius-sm: 12px;
    --control-h: 46px;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111513;
        --surface: #1a201d;
        --soft: #222a26;
        --text: #e8ece9;
        --muted: #9aa49f;
        --line: #2b332f;
        --line-strong: #3a443f;
        --accent: #5cc493;
        --accent-dark: #4fb383;
        --accent-ink: #0f1a14;
        --accent-soft: #1c3328;
        --ok: #5cc493;
        --ok-soft: #173326;
        --bad: #ef7a6c;
        --bad-soft: #3d1f1b;
        --warn: #f0b24a;
        --warn-soft: #3a2c12;
        --info: #7ea6f0;
        --info-soft: #1b2a44;
        --gold: #f0b24a;
        --shadow: none;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden], .hidden { display: none !important; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Header (semua halaman) ----------
   <header class="topbar"><div class="topbar-inner">
       <a href="..." class="back">← Game</a> atau <span class="logo">EC</span>
       <h1>Judul</h1> <span class="spacer"></span> ...tombol ikon
   </div></header>                                                      */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.topbar-inner {
    max-width: 640px;
    margin: 0 auto;
    padding: 12px 16px 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
}
.topbar h1 { margin: 0; font-size: 17px; line-height: 1.25; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.logo {
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--accent);
    color: var(--accent-ink);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.5px;
    text-decoration: none;
}
a.logo:active { transform: scale(0.95); }
a.logo:hover { background: var(--accent-dark); }
.brand { flex: 1; min-width: 0; line-height: 1.25; }
.brand b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Tombol kembali di header game */
.topbar a.back, .topbar-inner > a:first-child:not(.logo) {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 40px;
    padding: 0 14px 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
}
.topbar a.back:active, .topbar-inner > a:first-child:active { transform: scale(0.97); }
.iconbtn {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    display: grid;
    place-items: center;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
}
.iconbtn:active { transform: scale(0.95); }

/* ---------- Navigasi bawah (Beranda / Game / Peringkat) ---------- */
body.has-tabs { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
nav.tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
nav.tabs .in { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 420px; margin: 0 auto; }
nav.tabs a {
    position: relative;
    z-index: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
}
nav.tabs a .ico { width: 22px; height: 22px; }
nav.tabs a.on { color: var(--accent); }
nav.tabs a.on::before {
    content: "";
    position: absolute;
    top: 2px;
    width: 48px;
    height: 30px;
    border-radius: 99px;
    background: var(--accent-soft);
    z-index: -1;
}

/* ---------- Kerangka ---------- */
.stack { display: grid; gap: 16px; min-width: 0; }

.app {
    max-width: 640px;
    margin: 0 auto;
    padding: 4px 16px 40px;
    display: grid;
    gap: 16px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    min-width: 0;
}
.card > h2 { margin: 0 0 12px; font-size: 16px; line-height: 1.3; font-weight: 700; }
/* Label kecil di atas isi kartu (huruf biasa, bukan kapital). Dipakai Beranda,
   Peringkat, dan rekap. Poster peringkat punya gaya sendiri. */
.kicker { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.note { margin: 0; color: var(--muted); font-size: 13.5px; }

/* Judul bagian di luar kartu */
.sec { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 2px -6px; font-weight: 700; font-size: 15px; }
.sec small { font-weight: 500; color: var(--muted); font-size: 12.5px; }
.pagehead { margin: 4px 2px 0; }
.pagehead h2 { margin: 0; font-size: 21px; line-height: 1.2; font-weight: 700; letter-spacing: -0.3px; }
.pagehead p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }

.empty { padding: 22px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); font-size: 14px; }

/* ---------- Tombol ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--control-h);
    padding: 8px 18px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
    font-size: 15px;
    line-height: 1.25;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn:active { transform: scale(0.98); }
.btn:disabled { background: var(--line-strong); border-color: var(--line-strong); color: var(--muted); cursor: not-allowed; transform: none; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.secondary:hover { background: var(--soft); }
.btn.secondary:disabled { color: var(--muted); background: var(--surface); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--accent); border-color: transparent; padding: 0 10px; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.ghost:disabled { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: var(--line); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.block { width: 100%; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions > .btn { flex: 1 1 0; min-width: 0; }

/* Tombol hapus baris: kotak kecil dengan tanda × */
.icon-btn {
    flex: 0 0 auto;
    width: var(--control-h);
    height: var(--control-h);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}
.icon-btn:hover { color: var(--bad); background: var(--bad-soft); }

/* ---------- Isian ---------- */
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.input, select.input {
    width: 100%;
    height: var(--control-h);
    padding: 0 12px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 16px; /* 16px: mencegah zoom otomatis di iPhone */
    font-weight: 400;
    min-width: 0;
    outline: 0;
}
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input:disabled { background: var(--soft); color: var(--muted); }
.input.is-ok { border-color: var(--ok); background: var(--ok-soft); }
.input.is-bad { border-color: var(--bad); background: var(--bad-soft); }

/* Kotak cari besar (seperti Monitor Kelas) */
.search {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 48px;
    padding: 0 6px 0 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1.5px solid var(--line);
    box-shadow: var(--shadow);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search .ico { color: var(--muted); }
.search:focus-within .ico { color: var(--accent); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 16px; }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: var(--control-h);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

.settings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }

/* ---------- Pilih soal (paket guru / kata sendiri) ---------- */
.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: var(--soft);
    border-radius: var(--radius-sm);
}
.segmented button {
    height: 40px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(23, 32, 28, 0.12); }

.source-note { margin: 12px 0; color: var(--muted); font-size: 13.5px; }

.pack-list { display: grid; gap: 8px; }
.pack-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 56px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    text-align: left;
    cursor: pointer;
}
.pack-item:hover { border-color: var(--line-strong); background: var(--soft); }
.pack-item.selected { border: 2px solid var(--accent); padding: 9px 13px; background: var(--accent-soft); }
.pack-item.selected .tag { background: var(--surface); }
.pack-item .t { font-weight: 700; }
.pack-item .n { color: var(--muted); font-size: 13px; white-space: nowrap; }
.pack-msg { padding: 14px; border-radius: var(--radius-sm); background: var(--soft); color: var(--muted); font-size: 14px; }
.pack-msg a { color: var(--accent); font-weight: 600; }

/* Isian kata sendiri */
.word-rows { display: grid; gap: 8px; }
.word-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) var(--control-h); gap: 8px; }
.word-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) var(--control-h); gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
/* Kalimat sendiri: satu kolom */
.word-row.f1, .word-head.f1 { grid-template-columns: minmax(0, 1fr) var(--control-h); }
/* Kata kerja: Arti, V1, V2, V3 */
.word-row.f4, .word-head.f4 { grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr)) var(--control-h); }

.word-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.word-tools .count { color: var(--muted); font-size: 13px; }

/* Daftar kata (tampil, tidak bisa diubah) */
.word-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.word-table td { padding: 9px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.word-table tr:last-child td { border-bottom: 0; }
.word-table td:first-child { width: 2.2em; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.word-table td:nth-child(2) { font-weight: 600; width: 45%; }
.word-table th { padding: 8px 4px; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; }
.word-table.cols td:nth-child(2) { width: auto; }
.word-table.one td:nth-child(2) { width: auto; font-weight: 400; }
.word-table.cols td { overflow-wrap: anywhere; }
.word-scroll { max-height: 280px; overflow-y: auto; margin-top: 12px; border-top: 1px solid var(--line); }

/* ---------- Saat bermain ---------- */
.play-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.badge {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

.progress { height: 6px; border-radius: 999px; background: var(--soft); overflow: hidden; margin-bottom: 16px; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.3s ease; }

.prompt-label { margin: 0; text-align: center; color: var(--muted); font-size: 13.5px; }
.prompt-word {
    margin: 6px 0 16px;
    text-align: center;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.3px;
    overflow-wrap: anywhere;
}
.answer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

.feedback { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14.5px; }
.feedback:empty { display: none; }
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.feedback.info { background: var(--accent-soft); color: var(--accent); }

/* Daftar soal sekaligus (Kuis Kosakata) */
.quiz-list { display: grid; gap: 10px; }
.quiz-item { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; align-items: center; }
.quiz-item .q { font-weight: 600; overflow-wrap: anywhere; }
.quiz-item .key { grid-column: 2; margin-top: -6px; font-size: 13px; color: var(--bad); }

/* Isian V1 V2 V3 saat bermain */
.verb-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.verb-fields .field { font-size: 12.5px; }
.verb-fields .key { min-height: 1.2em; font-size: 13px; font-weight: 600; color: var(--bad); }
.prompt-hint { margin: -10px 0 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* Susun Kalimat: kotak kata */
.sentence-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    align-content: flex-start;
    gap: 8px;
    min-height: 112px;
    padding: 12px;
    border: 2px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--soft);
}
.sentence-box.filled { border-style: solid; border-color: var(--line); background: var(--surface); }
.sentence-box.is-ok { border: 2px solid var(--ok); background: var(--ok-soft); }
.sentence-box.is-bad { border: 2px solid var(--bad); background: var(--bad-soft); }
.sentence-box .placeholder { color: var(--muted); font-size: 14px; }
.sentence-box .last { display: inline-flex; align-items: center; gap: 4px; }
.sentence-box .end { font-size: 18px; font-weight: 700; }
.tile-pool { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; margin-top: 16px; }
.tile {
    min-height: var(--control-h);
    padding: 6px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    overflow-wrap: anywhere;
}
.tile:hover { border-color: var(--accent); }
.tile:disabled { cursor: default; }
/* Kata yang sudah dipakai: kotak kosong bergaris putus-putus (posisi kata lain tetap). Tidak bisa diketuk. */
.tile.used { background: transparent; border: 1.5px dashed var(--line-strong); color: transparent; pointer-events: none; user-select: none; }
.sentence-box .tile { background: var(--surface); border-color: var(--line); color: var(--text); }
.sentence-box.is-ok .tile, .sentence-box.is-bad .tile { border-color: var(--line); color: var(--text); }

/* Cocokkan Pasangan */
.match-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.match-tile {
    min-height: 58px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    overflow-wrap: anywhere;
    box-shadow: var(--shadow);
    transition: background 0.15s, border-color 0.15s;
}
.match-tile:hover { border-color: var(--line-strong); }
.match-tile.selected { border: 2px solid var(--accent); padding: 7px 11px; background: var(--accent-soft); color: var(--accent); }
.match-tile.matched { border-color: transparent; background: var(--ok-soft); color: var(--ok); opacity: 0.45; cursor: default; box-shadow: none; }
.match-tile.flash-ok { opacity: 1; }
.match-tile.flash-bad { border: 2px solid var(--bad); padding: 7px 11px; background: var(--bad-soft); color: var(--bad); animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Pilihan Ganda Cepat */
.countdown { height: 4px; border-radius: 999px; background: var(--soft); overflow: hidden; margin: -4px 0 16px; }
.countdown > span { display: block; height: 100%; width: 100%; background: var(--warn); }
.countdown > span.out { background: var(--bad); }
.choice-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.choice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: background 0.15s, border-color 0.15s;
}
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice:disabled { cursor: default; }
.choice .key {
    flex: none;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--soft);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}
.choice .t { min-width: 0; overflow-wrap: anywhere; }
.choice.is-ok { border: 2px solid var(--ok); padding: 7px 11px; background: var(--ok-soft); color: var(--ok); }
.choice.is-bad { border: 2px solid var(--bad); padding: 7px 11px; background: var(--bad-soft); color: var(--bad); animation: shake 0.3s; }
.choice.is-ok .key, .choice.is-bad .key { background: transparent; color: inherit; }

/* Tantangan Harian */
.daily-intro h2 { margin: 2px 0 10px; font-size: 22px; }
.daily-date { margin: 0; color: var(--accent); font-size: 13.5px; font-weight: 700; }
.daily-rules { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.daily-streak { margin-top: 14px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.daily-streak b { font-size: 16px; }
.sub-bad { color: var(--bad); font-size: 13px; font-weight: 400; }

/* Hasil akhir */
.result { text-align: center; }
.result .big { font-size: 40px; font-weight: 700; line-height: 1.1; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.result .sub { margin: 4px 0 0; color: var(--muted); }
/* Baris poin di kartu hasil (diisi game-scores.js setelah skor tersimpan) */
.score-line { display: inline-grid; gap: 2px; margin: 12px auto 0; padding: 8px 16px; border-radius: var(--radius-sm); background: var(--soft); color: var(--muted); max-width: 100%; }
.score-line b { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.3; }
.score-line small { font-size: 12.5px; line-height: 1.35; }
.score-line.gain { background: var(--ok-soft); color: var(--ok); }
.score-line.gain b { color: var(--ok); font-size: 22px; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; }
.score-line.full { background: var(--ok); color: var(--accent-ink); }
.score-line.full b { color: var(--accent-ink); }
.score-line.trial { background: var(--warn-soft); color: var(--warn); }
.score-line.trial b { color: var(--warn); }
.score-line.offline { background: var(--warn-soft); color: var(--warn); }
.score-line.offline b { color: var(--warn); }
.score-line.err { background: var(--bad-soft); color: var(--bad); }
.score-line.err b { color: var(--bad); }
.score-line.wait b { color: var(--muted); font-weight: 600; }

/* ---------- Halaman game lebar (PC: dua kolom saat memilih soal) ---------- */
.app.wide, .topbar-inner.wide { max-width: 960px; }
.narrow { width: 100%; max-width: 640px; margin: 0 auto; }
.setup-grid { display: grid; gap: 16px; align-items: start; }
.only-wide { display: none; }
@media (min-width: 860px) {
    .setup-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
    .setup-grid .side { position: sticky; top: 76px; }
    .only-wide { display: block; }
}

/* Cari & filter paket */
.pack-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-bottom: 10px; }
.pack-tools input { grid-column: 1 / -1; }
.pack-tools select.input { padding: 0 8px; }
.pack-list.scroll { max-height: 360px; overflow-y: auto; padding: 2px; margin: -2px; }
.pack-item .info { min-width: 0; }
.pack-item .t { display: block; overflow-wrap: anywhere; }
.pack-count { margin-top: 8px; color: var(--muted); font-size: 12.5px; }
/* Titik merah: paket belum pernah dimainkan */
.new-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 999px; background: var(--bad); vertical-align: 2px; }

/* Tag */
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}
.tag.all { background: var(--info-soft); color: var(--info); }
.tag.lvl { background: var(--accent-soft); color: var(--accent); }
/* Mode coba guru: status paket miliknya (Draf/Terjadwal/Nonaktif) */
.tag.st { background: transparent; color: var(--muted); border: 1px dashed var(--line-strong); }
/* Poin paket minggu ini */
.tag.full { background: var(--ok); color: var(--accent-ink); }
.tag.part { background: var(--warn-soft); color: var(--warn); }
.pack-points { margin: 10px 0 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--soft); color: var(--muted); font-size: 13.5px; }
.pack-points.full { background: var(--ok-soft); color: var(--ok); font-weight: 600; }

/* Pratinjau paket */
.preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.preview-head h2 { margin: 0; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.preview-head .n { color: var(--muted); font-size: 13px; white-space: nowrap; padding-top: 2px; }
.preview-empty { margin: 0; padding: 28px 8px; text-align: center; color: var(--muted); font-size: 14px; }

/* Pengaturan permainan */
.opts { display: grid; gap: 12px; }
.opt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; }
.timer-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timer-row .input { width: 88px; text-align: center; }
.timer-row .unit { color: var(--muted); font-size: 15px; }

/* ---------- Kartu angka (dashboard, peringkat) ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 6px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat b { font-size: 22px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); line-height: 1.25; }
.stat.accent b { color: var(--accent); }

/* Baris daftar yang bisa diketuk (daftar game, riwayat) */
.list { display: grid; gap: 8px; }
.item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    width: 100%;
    padding: 14px 14px 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
    text-align: left;
}
a.item:active, button.item:active { transform: scale(0.99); }
a.item:hover { border-color: var(--line-strong); }
.item .name { display: block; font-weight: 700; font-size: 15.5px; }
.item .desc { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.item .go { color: var(--muted); display: grid; place-items: center; }

/* ---------- Layar kecil ---------- */
@media (max-width: 520px) {
    .card { padding: 16px; }
    .settings { grid-template-columns: 1fr 1fr; }
    .settings .wide { grid-column: 1 / -1; }
    .quiz-item { grid-template-columns: 1fr; gap: 6px; }
    .quiz-item .key { grid-column: 1; margin-top: 0; }
    .prompt-word { font-size: 26px; }
    .choice-grid { grid-template-columns: 1fr; }
    .pack-list.scroll { max-height: 300px; }
    /* Kata kerja di HP: Arti satu baris penuh, lalu V1 V2 V3 */
    .word-head.f4 { display: none; }
    .word-row.f4 { grid-template-columns: repeat(3, minmax(0, 1fr)) var(--control-h); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
    .word-row.f4 [data-f="arti"] { grid-column: 1 / 4; }
    .word-row.f4 .icon-btn { grid-column: 4; grid-row: 1; }
    .verb-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Mode coba (akun guru) ----------
   Bilah di bawah header halaman game; disisipkan oleh game-scores.js. */
.trial-bar {
    padding: 8px 16px;
    background: var(--warn-soft);
    color: var(--warn);
    font-size: 13.5px;
    font-weight: 600;
    text-align: center;
}
