/* ==== Font (di-host sendiri, lisensi OFL: static/fonts/OFL.txt) ====
 * Plus Jakarta Sans untuk antarmuka; Literata untuk teks kartu dan lembar. */
@font-face { font-family: "Plus Jakarta Sans"; src: url("../fonts/plus-jakarta-sans-latin-wght.7660bd9909fb.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Literata"; src: url("../fonts/literata-latin-wght.90beffc9c5fb.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; }

/* ==== Tema ====
 * Semua warna lewat custom property. :root = tema Hangat (bawaan, juga tanpa JS).
 * Tema lain dipasang static/js/theme.js lewat html[data-theme]; selektor sengaja
 * [data-theme] (bukan html[...]) agar swatch di pemilih tema ikut memakai warnanya.
 * --print-accent/--print-tint: aksen yang tetap terbaca di kertas putih. */
:root,
[data-theme="hangat"] {
  color-scheme: light;
  --bg: #fdf8f1;
  --ink: #2b2420;
  --muted: #7b6f66;
  --accent: #bd4c2f;
  --accent-dark: #a33f28;
  --on-accent: #fff;
  --card: #fffdf9;
  --line: #eadfd2;
  --ok: #237347;
  --warn: #8a5d00;
  --err: #b23b3b;
  --accent-soft: #fbe9e3;
  --accent-line: #f1c4b6;
  --accent-glow: rgba(226, 103, 76, 0.6);
  --shadow: rgba(43, 36, 32, 0.55);
  --input-bg: #fff;
  --tip-bg: #fdf3ee;
  --msg-bg: #fff3e0;
  --msg-line: #f3d3a7;
  --msg-err-bg: #fdecec;
  --msg-err-line: #f2b8b8;
  --msg-ok-bg: #e9f6ef;
  --msg-ok-line: #b6e0c7;
  --cardback-from: #bd4c2f;
  --cardback-to: #a33f28;
  --cardback-ink: #fff;
  --cardback-mark: #2b2420;
  --sheet-bg: #fff;
  --sheet-ink: #1f1a17;
  --sheet-rule: #1f1a17;
  --sheet-line: #9c948e;
  --sheet-th-bg: #f4eee8;
  --print-accent: #c4513a;
  --print-tint: #fdf1eb;
}
:root {
  --radius: 18px;
  --tap: 44px;
  --font-ui: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-read: "Literata", Georgia, "Times New Roman", serif;
  /* Warna sampul dek/paket (game/covers.py). Sama di semua tema; teks putih di atasnya
   * lulus kontras AA (>= 4.5:1). */
  --cover-1: #a8442f;
  --cover-2: #2f6f62;
  --cover-3: #5e4a8b;
  --cover-4: #7a5410;
  --cover-5: #1f5f8b;
  --cover-6: #8f3552;
  --cover-7: #3b6a2c;
  --cover-8: #4a3f39;
  --cover-ink: #fff;
  /* Batas kontrol interaktif (input, select, chip): >= 3:1 terhadap latarnya di semua tema. */
  --control-line: var(--muted);
  font-family: var(--font-ui);
}

[data-theme="laut"] {
  --bg: #f2f7fa;
  --ink: #15303e;
  --muted: #546b78;
  --accent: #1f7fa6;
  --accent-dark: #145f7f;
  --card: #fbfdfe;
  --line: #d3e2eb;
  --accent-soft: #e1eff6;
  --accent-line: #a8cfe1;
  --accent-glow: rgba(31, 127, 166, 0.5);
  --shadow: rgba(21, 48, 62, 0.5);
  --tip-bg: #eaf4f8;
  --msg-bg: #e8f3f8;
  --msg-line: #b5d6e5;
  --cardback-from: #145f7f;
  --cardback-to: #1f7b99;
  --ok: #24734a;
  --warn: #8a5d00;
  --cardback-mark: #ffdb8f;
  --sheet-th-bg: #edf4f8;
  --print-accent: #145f7f;
  --print-tint: #eaf3f8;
}

[data-theme="hutan"] {
  --bg: #f3f6ef;
  --ink: #1e291d;
  --muted: #5a6757;
  --accent: #3d7a4a;
  --accent-dark: #2d5e38;
  --card: #fbfcf9;
  --line: #d9e2d1;
  --accent-soft: #e4efe0;
  --accent-line: #b3cfad;
  --accent-glow: rgba(61, 122, 74, 0.5);
  --shadow: rgba(30, 41, 29, 0.5);
  --tip-bg: #edf4e9;
  --msg-bg: #f1f5e6;
  --msg-line: #cfdcb0;
  --cardback-from: #2d5e38;
  --cardback-to: #4f8140;
  --ok: #24734a;
  --warn: #8a5d00;
  --cardback-mark: #f6e7a6;
  --sheet-th-bg: #eef3ea;
  --print-accent: #2d5e38;
  --print-tint: #edf4e9;
}

[data-theme="lavender"] {
  --bg: #f8f5fc;
  --ink: #2a2236;
  --muted: #6a6177;
  --accent: #7d5bbe;
  --accent-dark: #61449c;
  --card: #fdfcff;
  --line: #e3dbef;
  --accent-soft: #eee7f9;
  --accent-line: #ccbcea;
  --accent-glow: rgba(125, 91, 190, 0.5);
  --shadow: rgba(42, 34, 54, 0.5);
  --tip-bg: #f3eefb;
  --msg-bg: #f3eefb;
  --msg-line: #d6c8ee;
  --cardback-from: #61449c;
  --cardback-to: #8a60c2;
  --ok: #24734a;
  --warn: #8a5d00;
  --cardback-mark: #ffd8ee;
  --sheet-th-bg: #f2eef8;
  --print-accent: #61449c;
  --print-tint: #f3eefb;
}

[data-theme="malam"] {
  color-scheme: dark;
  --bg: #171a21;
  --ink: #ece6dd;
  --muted: #a8a096;
  --accent: #f08a6c;
  --accent-dark: #f6a58c;
  --on-accent: #1d1310;
  --card: #20242d;
  --line: #363c48;
  --ok: #6cc995;
  --warn: #e8b44f;
  --err: #f28b8b;
  --accent-soft: #3a2a28;
  --accent-line: #6b4038;
  --accent-glow: rgba(240, 138, 108, 0.35);
  --shadow: rgba(0, 0, 0, 0.7);
  --input-bg: #12151b;
  --tip-bg: #2a2524;
  --msg-bg: #2b2620;
  --msg-line: #5a4a33;
  --msg-err-bg: #3a2224;
  --msg-err-line: #6e3a3d;
  --msg-ok-bg: #1f3328;
  --msg-ok-line: #3e6b51;
  --cardback-from: #43293f;
  --cardback-to: #a8513f;
  --cardback-ink: #fff3ea;
  --cardback-mark: #ffc48a;
  --sheet-bg: #1d2129;
  --sheet-ink: #ece6dd;
  --sheet-rule: #cfc7bc;
  --sheet-line: #6d6a68;
  --sheet-th-bg: #272c36;
  --print-accent: #c4513a;
  --print-tint: #fdf1eb;
}

/* Kontras tinggi: semua pasangan teks/latar >= 7:1 (lulus WCAG AA, umumnya AAA). */
[data-theme="kontras"] {
  --bg: #fff;
  --ink: #000;
  --muted: #333;
  --accent: #0b3d91;
  --accent-dark: #002a6e;
  --card: #fff;
  --line: #1a1a1a;
  --ok: #0a5a2a;
  --warn: #6b4100;
  --err: #a00000;
  --accent-soft: #dde7f7;
  --accent-line: #0b3d91;
  --accent-glow: rgba(0, 0, 0, 0);
  --shadow: rgba(0, 0, 0, 0.45);
  --tip-bg: #eef3fb;
  --msg-bg: #fff;
  --msg-line: #000;
  --msg-err-bg: #fff;
  --msg-err-line: #a00000;
  --msg-ok-bg: #fff;
  --msg-ok-line: #0a5a2a;
  --cardback-from: #0b3d91;
  --cardback-to: #04245c;
  --cardback-ink: #fff;
  --cardback-mark: #ffd400;
  --sheet-rule: #000;
  --sheet-line: #555;
  --sheet-th-bg: #eef3fb;
  --print-accent: #0b3d91;
  --print-tint: #eef3fb;
}

/* ==== Dasar ==== */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.55; }
html { scroll-padding-top: 76px; }

/* Header tetap di atas saat digulir, dipisah garis tipis dari isi halaman. */
.site-header { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
a { color: var(--accent-dark); }
h1, h2 { line-height: 1.2; overflow-wrap: break-word; }
:focus-visible { outline: 3px solid var(--accent-dark); outline-offset: 2px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 4px 12px; padding: 8px 20px; max-width: 1040px; margin: 0 auto; }
.topbar nav { display: flex; gap: 2px 4px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.topbar nav > a:not(.btn), .topbar nav .link, .theme-picker > summary { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 7px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 600; }
.topbar nav .link { color: var(--accent-dark); }
.topbar nav > a:not(.btn):hover, .theme-picker > summary:hover { color: var(--accent-dark); }
.brand { display: inline-flex; align-items: center; min-height: var(--tap); font-size: 1.5rem; font-weight: 800; text-decoration: none; color: var(--ink); letter-spacing: -0.02em; }
.brand-block { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.brand-tagline { font-size: 0.88rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
@media (max-width: 860px) { .brand-tagline { display: none; } }
.brand span, .card-logo span { color: var(--accent); }
.nav-toggle { display: none; }
.inline { display: inline; margin: 0; }
.link { background: none; border: 0; padding: 0; color: var(--accent-dark); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; min-height: var(--tap); }

/* Pemilih tema: hanya tampil bila JavaScript aktif (tanpa JS tema bawaan berlaku). */
.theme-picker { display: none; position: relative; }
.js .theme-picker { display: block; }
.theme-picker > summary { cursor: pointer; list-style: none; gap: 8px; }
.theme-picker > summary::-webkit-details-marker { display: none; }
.theme-picker > summary::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line); background: linear-gradient(135deg, var(--accent) 50%, var(--card) 50%); }
.theme-picker > summary::after { content: "▾"; font-size: 0.8em; color: var(--muted); }
.theme-picker[open] > summary::after { content: "▴"; }
.theme-options { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 250px; margin: 0; padding: 8px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px -20px var(--shadow); }
.theme-options legend { float: left; width: 100%; padding: 4px 8px 6px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.theme-option { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 4px 8px; border: 2px solid transparent; border-radius: 10px; cursor: pointer; font-weight: 600; }
.theme-option:hover { background: var(--accent-soft); }
.theme-option:has(input:checked) { border-color: var(--accent); }
.theme-option:has(input:focus-visible) { outline: 3px solid var(--accent-dark); outline-offset: 1px; }
.theme-option input { margin: 0; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.theme-option input:focus-visible { outline: none; }
.theme-option small { display: block; font-size: 0.8rem; font-weight: 600; line-height: 1.3; color: var(--muted); }
.swatch { flex: none; display: inline-block; width: 32px; height: 24px; border-radius: 7px; border: 1px solid var(--line); background: linear-gradient(135deg, var(--bg) 0 45%, var(--accent) 45% 72%, var(--ink) 72%); }
.swatch-auto { display: inline-flex; overflow: hidden; background: none; }
.swatch-half { flex: 1; background: linear-gradient(135deg, var(--bg) 0 50%, var(--accent) 50%); }

.page { max-width: 1040px; margin: 0 auto; padding: 12px 20px 48px; }
.page-narrow { max-width: 520px; }
.center { text-align: center; }
.muted { color: var(--muted); }

.btn { display: inline-block; min-height: var(--tap); background: var(--accent); color: var(--on-accent); border: 0; border-radius: 999px; padding: 12px 22px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--accent-dark); }
.btn-small { display: inline-flex; align-items: center; justify-content: center; padding: 7px 16px; font-size: 0.9rem; color: var(--on-accent) !important; }
.btn-ghost, .btn-ghost.btn-small { background: transparent; color: var(--accent-dark) !important; border: 2px solid var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }

/* Judul halaman & seksi */
.page-head { padding: 20px 0 8px; }
.page-head h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); margin: 0 0 8px; letter-spacing: -0.02em; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 34rem; margin: 0 0 20px; }
.lead-left { font-size: 1.1rem; color: var(--muted); max-width: 40rem; margin: 0 0 16px; }
.section-title { font-size: 1.25rem; margin: 36px 0 14px; letter-spacing: -0.01em; }
.small { font-size: 0.88rem; }
.prose { max-width: 40rem; }
.prose p { margin: 0 0 10px; }
.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; }
.price { font-size: 1.3rem; font-weight: 800; margin: 0 0 12px; }
.price .muted { font-size: 0.95rem; font-weight: 500; }
/* Harga promo: harga normal dicoret + harga promo + periode (bukan hanya warna). */
.price-old { font-weight: 500; color: var(--muted); text-decoration: line-through; }
.price-period { display: block; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.price .price-period { font-size: 0.95rem; }
.btn-big { padding: 14px 28px; font-size: 1.05rem; }

/* Beranda: satu kartu untuk dicoba + satu tindakan utama */
.hero-try { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "copy demo" "action demo"; align-items: center; gap: 8px 48px; padding: 28px 0 8px; }
.hero-try-plain { grid-template-columns: 1fr; grid-template-areas: "copy" "action"; }
.hero-copy { grid-area: copy; align-self: end; }
.hero-copy h1 { font-size: clamp(2rem, 5.5vw, 3.2rem); line-height: 1.08; margin: 0 0 14px; letter-spacing: -0.03em; max-width: 14ch; }
.hero-action { grid-area: action; align-self: start; }
.hero-note { margin: 10px 0 0; color: var(--muted); font-size: 0.92rem; }
.demo { grid-area: demo; perspective: 1200px; }
.card.demo-card { width: min(300px, 72vw); max-height: none; }
.demo-card .card-face { border-radius: 14px; padding: 28px 24px; }
.demo-card .demo-back { color: var(--cover-ink); justify-content: space-between; align-items: flex-start; text-align: left; }
.demo-brand { font-weight: 800; letter-spacing: -0.02em; opacity: 0.9; }
.demo-brand span { opacity: 0.75; }
.demo-title { font-family: var(--font-read); font-size: 1.9rem; font-weight: 700; line-height: 1.15; }
.demo-hint { font-size: 0.9rem; font-weight: 600; opacity: 0.9; }
/* Tanpa JavaScript kartu contoh langsung terbuka. */
html:not(.js) .demo-card { transform: rotateY(180deg); }
@media (max-width: 720px) {
  .hero-try { grid-template-columns: 1fr; grid-template-areas: "copy" "demo" "action"; gap: 18px; padding-top: 16px; }
  .hero-copy h1 { max-width: none; }
  .demo { justify-self: center; }
  .hero-action { text-align: center; }
}

/* Filter chip */
.filters { display: flex; flex-direction: column; gap: 8px; margin: 0 0 22px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.chip { display: inline-flex; align-items: center; min-height: var(--tap); padding: 7px 16px; border-radius: 999px; border: 1px solid var(--control-line); background: var(--card); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.92rem; }
.chip.active, .chip:hover { border-color: var(--accent); color: var(--accent-dark); }
.chip.active { background: var(--accent-soft); }
.chips-quiet .chip { min-height: 36px; padding: 4px 12px; font-size: 0.85rem; background: transparent; }

/* Rak dek/paket: sampul kartu + tiga baris fakta, tanpa kotak di sekelilingnya */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 32px 22px; list-style: none; margin: 0; padding: 0; }
.shelf-item { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.shelf-info { display: flex; flex-direction: column; flex: 1; }
.shelf-name { font-size: 1.08rem; margin: 0 0 4px; line-height: 1.25; }
.shelf-tagline { color: var(--muted); font-size: 0.93rem; margin: 0 0 8px; }
.shelf-meta { margin: 0 0 4px; font-size: 0.93rem; }
.owned { margin: 0 0 6px; color: var(--ok); font-weight: 700; font-size: 0.9rem; }
.owned::before { content: "✓ "; }
.shelf-action { margin-top: auto; padding-top: 8px; }
.empty { grid-column: 1 / -1; color: var(--muted); }

/* Sampul = query container: teks diskalakan terhadap lebar sampul (cqi), bukan layar, jadi
 * tetap proporsional di rak dua kolom (HP) maupun empat kolom (desktop). */
.cover { container-type: inline-size; position: relative; display: flex; flex-direction: column; justify-content: space-between; aspect-ratio: 3 / 4; padding: 14px 14px 12px; border-radius: 6px; color: var(--cover-ink); text-decoration: none; overflow: hidden; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12), 0 10px 22px -16px var(--shadow); }
.cover::after { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 3px; pointer-events: none; }
.cover-brand { font-size: clamp(0.7rem, 7cqi, 1.05rem); font-weight: 800; letter-spacing: -0.01em; opacity: 0.85; }
.cover-brand span { opacity: 0.75; }
.cover-title { font-family: var(--font-read); font-size: clamp(1rem, 13cqi, 2.6rem); font-weight: 700; line-height: 1.12; overflow-wrap: break-word; }
.cover-mode { font-size: clamp(0.68rem, 6.5cqi, 0.95rem); font-weight: 600; opacity: 0.85; }
.cover-sheet { border-radius: 3px; }
a.cover { transition: transform 0.18s ease; }
a.cover:hover { transform: translateY(-3px); }
.cover-large { width: 100%; max-width: 280px; padding: 20px 18px 16px; }
.cover-tone-1 { --tone: var(--cover-1); background: var(--tone); }
.cover-tone-2 { --tone: var(--cover-2); background: var(--tone); }
.cover-tone-3 { --tone: var(--cover-3); background: var(--tone); }
.cover-tone-4 { --tone: var(--cover-4); background: var(--tone); }
.cover-tone-5 { --tone: var(--cover-5); background: var(--tone); }
.cover-tone-6 { --tone: var(--cover-6); background: var(--tone); }
.cover-tone-7 { --tone: var(--cover-7); background: var(--tone); }
.cover-tone-8 { --tone: var(--cover-8); background: var(--tone); }

/* Halaman dek terkunci / paket */
.deck-page { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 40px; padding: 24px 0 8px; align-items: start; }
.deck-page-body h1 { margin: 0 0 8px; font-size: clamp(1.7rem, 4.5vw, 2.3rem); letter-spacing: -0.02em; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, auto)); justify-content: start; gap: 10px 32px; margin: 0 0 18px; }
.facts dt { font-size: 0.85rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; }
.facts-wide { grid-column: 1 / -1; }
.facts-wide dd { font-weight: 500; }
.note { background: var(--msg-bg); border: 1px solid var(--msg-line); border-radius: 10px; padding: 12px 14px; margin: 14px 0; max-width: 40rem; }
.buy-box { margin: 22px 0 10px; }
.contents { max-width: 44rem; }
@media (max-width: 720px) {
  .deck-page { grid-template-columns: 1fr; gap: 20px; padding-top: 12px; }
  .deck-page-cover .cover-large { max-width: 190px; }
  .facts { grid-template-columns: repeat(2, minmax(0, auto)); }
}

/* Portal */
.portal-block { margin-bottom: 8px; }
.owned-list { list-style: none; margin: 0; padding: 0; max-width: 40rem; }
.owned-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.owned-name { font-weight: 600; }
.empty-state { max-width: 36rem; }
.empty-state p { margin: 0 0 12px; }
.game-sub { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 18px 0; }
/* Form backoffice: label di atas kontrol, error tertulis (bukan hanya warna). */
.form-stack { max-width: 34rem; }
.form-stack > div { margin: 0 0 14px; }
.form-stack label { display: block; font-weight: 700; margin: 0 0 4px; }
.form-stack input, .form-stack select { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--control-line); border-radius: 10px; font: inherit; color: var(--ink); background: var(--input-bg); }
.form-stack .helptext { display: block; margin-top: 4px; font-size: 0.88rem; color: var(--muted); }
.form-stack .errorlist { margin: 4px 0; padding: 0; list-style: none; color: var(--err); font-weight: 700; }
.form-stack textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--control-line); border-radius: 10px; font: inherit; color: var(--ink); background: var(--input-bg); }
.form-stack input[type=checkbox] { width: 22px; height: 22px; min-height: 22px; vertical-align: middle; accent-color: var(--accent); }
.form-stack-wide { max-width: 52rem; }
/* JSON (blok lembar kerja, audit before/after): monospace, baris panjang dibungkus. */
.form-stack textarea[spellcheck=false], .code-block { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88rem; }
.code-block { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 32rem; overflow: auto; margin: 8px 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--input-bg); }
/* Tombol aksi POST berdampingan (bayar / batalkan order). */
.inline-form { display: inline-block; margin: 0 8px 8px 0; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; max-width: 100%; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table td a { display: inline-flex; align-items: center; min-height: var(--tap); white-space: nowrap; }
.status { font-weight: 700; white-space: nowrap; }
.status-paid, .status-partially_refunded { color: var(--ok); }
.status-pending { color: var(--warn); }
.status-expired, .status-failed, .status-refunded, .status-charged_back, .status-reversed { color: var(--err); }

.messages { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.msg { background: var(--msg-bg); border: 1px solid var(--msg-line); padding: 10px 14px; border-radius: 12px; }
.msg-error { background: var(--msg-err-bg); border-color: var(--msg-err-line); }
.msg-success { background: var(--msg-ok-bg); border-color: var(--msg-ok-line); }

.auth form p, .auth form div { margin-bottom: 12px; }
.auth input[type=email], .auth input[type=password], .auth input[type=text] { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--control-line); border-radius: 10px; font: inherit; color: var(--ink); background: var(--input-bg); }
.auth button[type=submit] { min-height: var(--tap); margin: 0 6px 8px 0; background: var(--accent); color: var(--on-accent); border: 0; border-radius: 999px; padding: 11px 20px; font: inherit; font-weight: 700; cursor: pointer; }
.auth .helptext a, .auth li > a { display: inline-flex; align-items: center; min-height: var(--tap); }
/* Radio/checkbox allauth: input + <label for> bersebelahan; label dijadikan area sentuh >= 44px. */
.auth input[type=radio], .auth input[type=checkbox] { width: 22px; height: 22px; margin: 0 8px 0 0; vertical-align: middle; accent-color: var(--accent); }
.auth input[type=radio] + label, .auth input[type=checkbox] + label { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 6px; min-height: var(--tap); padding: 4px 0; vertical-align: middle; max-width: calc(100% - 40px); overflow-wrap: anywhere; cursor: pointer; }

/* Game */
.game { max-width: 560px; margin: 0 auto; }
.game-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.game-head h1 { margin: 0; font-size: 1.5rem; }
/* Kategori kartu: satu baris chip yang bisa digeser menyamping (pengganti dropdown). */
.cat-chips { display: flex; gap: 8px; margin: 14px -2px 0; padding: 2px 2px 6px; overflow-x: auto; scrollbar-width: thin; scroll-snap-type: x proximity; }
.cat-chips .chip { flex: none; font: inherit; font-size: 0.9rem; font-weight: 600; white-space: nowrap; cursor: pointer; scroll-snap-align: start; gap: 6px; }
.chip-count { font-size: 0.78rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.active .chip-count { color: var(--accent-dark); }
.card-stage { perspective: 1200px; margin: 24px 0; touch-action: pan-y; transform: translateX(var(--drag, 0px)); transition: transform 0.26s ease, opacity 0.26s ease; }
/* Geser & pindah kartu (static/js/game.js): keluar ke samping, masuk dari sisi lain. */
.card-stage.dragging, .card-stage.no-slide { transition: none; }
.card-stage.slide-out-left { transform: translateX(-60%); opacity: 0; }
.card-stage.slide-out-right, .card-stage.slide-in-right { transform: translateX(60%); opacity: 0; }
.card-stage.slide-in-left { transform: translateX(-60%); opacity: 0; }
.game { overflow-x: clip; }
.swipe-hint { margin: 6px 0 0; text-align: center; font-size: 0.85rem; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .swipe-hint { display: none; } }
.card { position: relative; display: block; width: 100%; aspect-ratio: 3 / 4; max-height: 70vh; max-height: 70svh; border: 0; padding: 0; background: none; color: inherit; font: inherit; cursor: pointer; transform-style: preserve-3d; transition: transform 0.65s cubic-bezier(0.2, 0.7, 0.2, 1); }
.card.instant { transition: none; }
.card.open { transform: rotateY(180deg); }
.card-face { position: absolute; inset: 0; border-radius: 16px; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 34px; overflow: hidden; backface-visibility: hidden; box-shadow: 0 24px 50px -28px var(--shadow); }
.card-back { background: linear-gradient(145deg, var(--cardback-from), var(--cardback-to)); color: var(--cardback-ink); }
.card-back .card-logo { font-size: 2.6rem; font-weight: 800; color: var(--cardback-ink); letter-spacing: -0.02em; }
.card-back .card-logo span { color: var(--cardback-mark); }
/* Sisi belakang kartu memakai warna sampul dek (sama dengan di katalog). */
.card-back.has-tone { background: var(--tone); color: var(--cover-ink); }
.card-back.has-tone .card-logo { color: var(--cover-ink); }
.card-back.has-tone .card-logo span { color: inherit; opacity: 0.75; }
.card-hint { margin-top: 10px; font-weight: 600; opacity: 0.9; text-align: center; }
.card-front { background: var(--card); border: 1px solid var(--line); transform: rotateY(180deg); color: var(--ink); }
.card-category { position: absolute; top: 22px; left: 26px; right: 26px; text-align: left; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-dark); }
.card-text { font-family: var(--font-read); font-size: clamp(1.25rem, 4.5vw, 1.7rem); font-weight: 600; line-height: 1.3; text-align: center; overflow-wrap: break-word; max-width: 100%; }
.game-controls { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.counter { font-weight: 700; color: var(--muted); }
.guide { margin-top: 10px; color: var(--muted); }
.guide summary { display: inline-flex; align-items: center; min-height: var(--tap); cursor: pointer; font-weight: 700; color: var(--accent-dark); }
.card-prefix { font-size: 0.95rem; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.card-or { margin: 12px 0; font-size: 0.85rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-dark); }
.game[data-mode="would_rather"] .card-text { font-size: clamp(1.1rem, 4vw, 1.45rem); }
.scoreboard { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.scoreboard .center { grid-column: 1 / -1; }
.player { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.player input { width: 100%; min-height: var(--tap); text-align: center; font: inherit; font-weight: 700; color: var(--ink); background: var(--input-bg); border: 1px solid var(--control-line); border-radius: 10px; padding: 6px; }
.player .btn { max-width: 100%; text-align: center; }
.score { font-size: 2rem; font-weight: 800; }
.questions { margin: 0; padding-left: 22px; }
.questions li { padding: 4px 0; }
.session-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.sessions li.done strong::before { content: "✓ "; color: var(--ok); }

/* Lembar kerja (layar). Cetak: lihat @media print di bawah. */
.sheet-page { max-width: 840px; }
.sheet-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.sheet-toolbar .link { display: inline-flex; align-items: center; }
.sheet { background: var(--sheet-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px 40px; color: var(--sheet-ink); font-family: var(--font-read); }
/* Isi lembar memakai Literata; judul, label, dan elemen merek tetap font antarmuka. */
.sheet-brand, .sheet-head h1, .sheet-h, .sheet-label, .pair-head, .sheet-table th, .dot, .sheet-foot { font-family: var(--font-ui); }
.sheet-brand { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; margin: 0; }
.sheet-logo { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; color: var(--sheet-ink); }
.sheet-logo span { color: var(--accent); }
.sheet-kind { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sheet-head { position: relative; border-bottom: 1.5px solid var(--sheet-rule); padding-bottom: 12px; margin-bottom: 18px; }
.sheet-head::after { content: ""; position: absolute; left: 0; bottom: -3px; width: 88px; height: 5px; border-radius: 3px; background: var(--accent); }
.sheet-head h1 { margin: 8px 0 6px; }
.sheet-h { font-size: 1.15rem; margin: 24px 0 6px; }
.sheet-h::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 3px; background: var(--accent); vertical-align: 0.05em; }
.sheet-text { margin: 6px 0; }
.sheet-tip { border: 1px solid var(--accent-line); background: var(--tip-bg); padding: 10px 14px; margin: 12px 0; border-radius: 10px; font-size: 0.92rem; }
.sheet-block { margin: 14px 0; break-inside: avoid; }
.sheet-label { font-weight: 700; margin: 0 0 6px; }
.write-line { border-bottom: 1px solid var(--sheet-line); height: 30px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.pair-head { margin: 0; font-weight: 800; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 4px 0; }
.box { flex: none; width: 16px; height: 16px; border: 1.5px solid var(--sheet-rule); border-radius: 3px; margin-top: 3px; }
.choices { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.choices li { border: 1.5px dashed var(--sheet-line); border-radius: 999px; padding: 6px 14px; }
.scale { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.92rem; }
.dot { width: 30px; height: 30px; border: 1.5px solid var(--sheet-rule); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.draw { border: 1.5px dashed var(--sheet-line); border-radius: 12px; }
.draw-small { height: 110px; }
.draw-medium { height: 200px; }
.draw-large { height: 320px; }
.sheet-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.sheet-table th, .sheet-table td { border: 1px solid var(--sheet-line); padding: 6px 8px; text-align: left; height: 32px; vertical-align: top; }
.sheet-table thead th { background: var(--sheet-th-bg); }
.sheet-foot { margin-top: 24px; font-size: 0.75rem; color: var(--muted); text-align: center; }

.footer { text-align: center; padding: 30px 20px; font-size: 0.9rem; color: var(--muted); border-top: 1px solid var(--line); }
.footer p { margin: 4px 0; }

/* ==== Layar sempit ==== */
@media (max-width: 640px) {
  /* Tanpa JS: navigasi membungkus di bawah logo. Dengan JS: tombol Menu. */
  .topbar { flex-wrap: wrap; padding: 6px 14px; }
  /* Menu terbuka bisa lebih tinggi dari layar: header ikut bisa digulir. */
  .site-header { max-height: 100vh; max-height: 100svh; overflow-y: auto; }
  .topbar nav { justify-content: flex-start; }
  .js .nav-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 16px; border: 1px solid var(--control-line); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
  .js .nav-toggle::before { content: "☰"; font-size: 1.05em; }
  .js .nav-toggle[aria-expanded="true"]::before { content: "✕"; }
  .js .nav-toggle[aria-expanded="false"] + nav { display: none; }
  .js .topbar nav { flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0; padding: 4px 0 10px; border-top: 1px solid var(--line); }
  .js .topbar nav > a:not(.btn), .js .topbar nav .link, .js .theme-picker > summary { display: flex; width: 100%; padding: 0 4px; border-bottom: 1px solid var(--line); border-radius: 0; text-align: left; }
  .js .topbar nav .btn-small { align-self: flex-start; margin: 8px 0 4px; }
  .js .topbar nav .inline { display: block; }
  .js .theme-options { position: static; width: auto; margin-top: 6px; box-shadow: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 2px; }
  .js .theme-options legend { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .page { padding: 8px 14px 40px; }
  .messages { padding: 0 14px; }
  /* Rak dua kolom di HP: sampul tidak selebar layar dengan teks kecil di tengahnya. */
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px; }
  .shelf-name { font-size: 1rem; }
  .shelf-tagline, .shelf-meta { font-size: 0.88rem; }
  .cover { padding: 11px 11px 10px; }
  .cover::after { inset: 5px; }
  /* Chip filter digulir menyamping agar tidak memakan layar pertama. */
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .chips > li { flex: none; }
  .chip { white-space: nowrap; }
  .panel { padding: 16px; }
  .table { font-size: 0.82rem; }
  .table-wrap .table:not(.table-kv) { min-width: 520px; }
  /* Tabel dua kolom (label: nilai) muat di layar sempit; teks panjang turun baris. */
  .table-kv { width: 100%; }
  .table-kv th[scope="row"] { width: 42%; }
  .table-kv td { white-space: normal; overflow-wrap: anywhere; }
  .card-face { padding: 26px 22px; border-radius: 22px; }
  .card-category { top: 16px; left: 20px; right: 20px; }
  .game-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .game-controls .counter { grid-column: 1 / -1; grid-row: 1; text-align: center; }
  .game-controls .btn { padding: 10px 12px; }
  .player { padding: 10px; }
  .player .btn { width: 100%; }
}

/* Lembar kerja: satu kolom dan padding kecil hanya di LAYAR sempit; cetak tetap dua kolom. */
@media screen and (max-width: 560px) {
  .sheet { padding: 20px 16px; border-radius: 14px; }
  .pair { grid-template-columns: 1fr; gap: 10px; }
  .sheet-table th, .sheet-table td { min-width: 4.5em; }
}

/* HP landscape: kartu menyesuaikan tinggi layar, tidak melewatinya. */
@media (orientation: landscape) and (max-height: 520px) {
  .card-stage { margin: 12px 0; }
  .card { aspect-ratio: auto; height: 78vh; height: 78svh; max-height: none; }
  .card-face { padding: 22px 28px; }
  .card-back .card-logo { font-size: 2rem; }
  .card-text { font-size: clamp(1.1rem, 6svh, 1.5rem); }
  .game[data-mode="would_rather"] .card-text { font-size: clamp(1.05rem, 5svh, 1.3rem); }
  .card-or { margin: 6px 0; }
}

/* ==== Cetak ==== */
@media print {
  @page {
    size: A4;
    margin: 14mm 14mm 16mm;
    @bottom-center {
      content: "Seirama · halaman " counter(page) " dari " counter(pages);
      font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
      font-size: 8pt;
      font-weight: 600;
      color: #6b625b;
    }
  }
  /* Kertas selalu putih dengan teks gelap di tema apa pun; hanya aksen yang ikut tema. */
  :root,
  :root[data-theme] {
    color-scheme: light;
    font-size: 11pt;
    --bg: #fff;
    --ink: #1f1a17;
    --muted: #5c544e;
    --card: #fff;
    --line: #d6cec6;
    --accent: var(--print-accent);
    --accent-dark: var(--print-accent);
    --tip-bg: var(--print-tint);
    --sheet-bg: #fff;
    --sheet-ink: #1f1a17;
    --sheet-rule: #1f1a17;
    --sheet-line: #9c948e;
    --sheet-th-bg: var(--print-tint);
    --ok: #2f6f4b;
    --warn: #7a5200;
    --err: #9b2c2c;
  }
  body { background: #fff; color: var(--ink); }
  .site-header, .topbar, .footer, .messages, .no-print, .theme-picker, .nav-toggle { display: none !important; }
  .page.sheet-page { max-width: none; padding: 0; }
  .sheet { border: 0; padding: 0; border-radius: 0; background: none; }
  .table-wrap { overflow: visible; }
  .sheet-logo span, .sheet-head::after, .sheet-h::before, .sheet-tip, .sheet-table thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sheet-head, .sheet-tip, .sheet-block, .sheet-table tr, .checklist li { break-inside: avoid; }
  .sheet-head h1, .sheet-h, .sheet-label, .pair-head { break-after: avoid; }
  .sheet-text, .sheet-tip { orphans: 3; widows: 3; }
  .sheet-table thead { display: table-header-group; }
  .sheet-foot { margin-top: 18px; }
}

/* Gerak dikurangi: tanpa animasi kartu, geser, dan sampul. Di akhir file agar menang
 * atas deklarasi transition di atas. */
@media (prefers-reduced-motion: reduce) {
  a.cover, .card, .card-stage { transition: none; }
  a.cover:hover { transform: none; }
}
