/* Game Product Knowledge Dekoruma — versi tim (web HP, mobile-first).
   Tema diport dari prototipe: teal + krem + oranye, font Nunito. LIGHT ONLY. */

:root {
  --bg: #faf6ef;
  --surface: #ffffff;
  --surface-alt: #f1e9dc;
  --text: #173a3d;
  --dim: #5f7372;
  --border: #e3d9c8;
  --accent: #0e7c86;
  --accent-dark: #0a636b;
  --accent-tint: #e6f4f5;
  --play: #f07300;
  --play-dark: #d16500;
  --play-disabled: #a8a29e;
  --gold: #f2a93b;
  --sale: #d64541;
  --green: #1d9e63;
  --green-bg: #dcf2e3;
  --red-bg: #fbe3e1;
  --amber-bg: #fdf0cd;
  --radius: 16px;
  --nav-h: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; }

button { font: inherit; cursor: pointer; }
input, select { font: inherit; }

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: calc(var(--nav-h) + 24px);
}

#app.no-nav { padding-bottom: 24px; }

/* ---------- header ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar h1 {
  font-size: 17px;
  font-weight: 800;
  margin: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .avatar-chip {
  background: rgba(255,255,255,.22);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.demo-banner {
  background: var(--amber-bg);
  color: #7a5a00;
  border-bottom: 1px solid var(--gold);
  font-size: 13px;
  padding: 8px 16px;
  text-align: center;
}

/* ---------- layout ---------- */

.screen { padding: 16px 16px 8px; }

.screen h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 4px 0 4px;
}

.screen .subtitle {
  color: var(--dim);
  font-size: 14px;
  margin: 0 0 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.card h3 { margin: 0 0 8px; font-size: 16px; font-weight: 800; }

/* ---------- buttons ---------- */

.btn {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  margin-bottom: 10px;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 800;
}

.btn-primary:disabled {
  background: #8fb9bd;
  border-color: #8fb9bd;
}

.btn-secondary { font-weight: 700; }

/* Tombol utama kartu materi: oranye, abu-abu saat resmi sudah dimainkan. */
.btn-play {
  background: var(--play);
  border-color: var(--play);
  color: #fff;
  font-weight: 900;
  font-size: 17px;
}

.btn-play:disabled {
  background: var(--play-disabled);
  border-color: var(--play-disabled);
  color: #fff;
  cursor: default;
  transform: none;
}

.btn-practice {
  background: #fff;
  border: 2px solid var(--accent);
  color: var(--accent-dark);
  font-weight: 800;
}

.btn-small {
  width: auto;
  display: inline-block;
  padding: 8px 12px;
  font-size: 14px;
  margin-bottom: 0;
}

.btn-danger {
  background: #fff;
  border-color: var(--sale);
  color: var(--sale);
  font-weight: 700;
}

.btn-danger-solid {
  background: var(--sale);
  border-color: var(--sale);
  color: #fff;
  font-weight: 800;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.back-btn.bottom { margin: 16px 0 8px; width: 100%; justify-content: center; }

.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- bottom nav ---------- */

.bottomnav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  height: var(--nav-h);
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottomnav button {
  flex: 1;
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--dim);
  padding: 6px 0;
}

.bottomnav button .ico { font-size: 20px; line-height: 1; }

.bottomnav button.active { color: var(--accent); font-weight: 800; }

.bottomnav .badge-dot {
  position: absolute;
  top: 6px;
  margin-left: 22px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sale);
}

/* ---------- home: hero + menu ---------- */

.hero {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(14, 124, 134, .25);
}

.hero-greet {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.hero-sub {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, .85);
  margin: 2px 0 14px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
}

.hero-num { font-size: 21px; font-weight: 900; line-height: 1.2; }
.hero-lbl { font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, .85); }

.hero-progress {
  height: 8px;
  background: rgba(255, 255, 255, .25);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 14px;
}

.hero-progress-fill {
  height: 100%;
  background: var(--play);
  border-radius: 999px;
}

.hero-progress-lbl {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, .85);
  margin-top: 6px;
  text-align: center;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.menu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 4px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 72px;
  color: var(--text);
}

.menu-card .m-ico { font-size: 24px; line-height: 1; }
.menu-card .m-lbl { font-size: 12px; font-weight: 800; text-align: center; }

/* ---------- home / lists ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
}

.stat .num { font-size: 20px; font-weight: 900; }
.stat .lbl { font-size: 12px; color: var(--dim); font-weight: 600; }

.product-row {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 10px;
  color: var(--text);
}

.product-row img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  flex-shrink: 0;
}

.product-row .p-name { font-weight: 800; font-size: 15px; }
.product-row .p-meta { font-size: 13px; color: var(--dim); }
.product-row .p-stars { font-size: 14px; letter-spacing: 2px; }

.module-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  color: var(--text);
}

.module-row .chev { font-size: 20px; color: var(--dim); }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
}

.filter-chip.active { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-dark); }

.stars { color: var(--gold); letter-spacing: 2px; }
.stars .empty { color: #ddd5c3; }

.chip {
  display: inline-block;
  background: var(--accent-tint);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 800;
  margin-right: 6px;
}

.chip-red { background: var(--red-bg); color: var(--sale); }
.chip-green { background: var(--green-bg); color: var(--green); }
.chip-gold { background: var(--amber-bg); color: #7a5a00; }

/* ---------- material card ---------- */

.material-photo {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  margin-bottom: 12px;
}

.material-photo img { max-height: 260px; object-fit: contain; }

.price-line { font-size: 15px; margin: 4px 0; }
.price-before { text-decoration: line-through; color: var(--dim); font-size: 14px; }
.price-after { font-size: 22px; font-weight: 900; color: var(--text); }
.discount-badge {
  background: var(--sale);
  color: #fff;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 13px;
  font-weight: 800;
  margin-left: 6px;
}

.spec-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec-table td { padding: 6px 4px; border-bottom: 1px solid var(--surface-alt); vertical-align: top; }
.spec-table td:first-child { color: var(--dim); width: 38%; }

.feature-list { margin: 0; padding-left: 20px; }
.feature-list li { margin-bottom: 6px; }

/* ---------- quiz ---------- */

.quiz-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 8px;
}

.q-progress {
  height: 6px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.q-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.timer-bar {
  height: 8px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}

.timer-bar .fill {
  height: 100%;
  background: var(--gold);
  transition: width 0.2s linear;
}

.timer-bar .fill.low { background: var(--sale); }

.timer-text { font-weight: 800; color: var(--gold); }

.quiz-photo {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  margin-bottom: 12px;
}

.quiz-photo img { max-height: 220px; object-fit: contain; }

.question { font-size: 18px; font-weight: 800; margin: 0 0 14px; }

.option-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}

.option-btn:active { border-color: var(--accent); }

.option-btn:disabled { opacity: 1; cursor: default; }
.option-btn.picked { border-color: var(--accent); background: var(--accent-tint); }

/* Umpan balik jawaban: benar = hijau, salah = merah + jawaban benar ikut hijau. */
.option-btn.correct { border-color: #1d9e63; background: #dcf2e3; color: #1d9e63; }
.option-btn.wrong { border-color: #d64541; background: #fbe3e1; color: #d64541; }
.option-btn.correct::after { content: ' ✓'; font-weight: 900; }
.option-btn.wrong::after { content: ' ✗'; font-weight: 900; }

.quiz-exit {
  margin-top: 18px;
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 11px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ---------- results ---------- */

.result-hero { text-align: center; padding: 8px 0 4px; }
.result-hero .big-score { font-size: 36px; font-weight: 900; }
.result-hero .big-stars { font-size: 28px; letter-spacing: 4px; }

.review-item { border-top: 1px solid var(--surface-alt); padding: 10px 0; }
.review-item:first-child { border-top: 0; }
.review-item.review-ok { background: var(--green-bg); border-radius: 12px; padding: 10px; margin-bottom: 8px; border-top: 0; }
.review-item.review-no { background: var(--red-bg); border-radius: 12px; padding: 10px; margin-bottom: 8px; border-top: 0; }
.review-item .q { font-weight: 800; font-size: 15px; }
.review-item .a { font-size: 14px; margin-top: 4px; }
.review-item .ok { color: var(--green); font-weight: 800; }
.review-item .no { color: var(--sale); font-weight: 800; }
.review-item .exp { font-size: 14px; color: var(--dim); margin-top: 4px; }

/* ---------- leaderboard ---------- */

.lb-ribbon {
  margin: 4px 0 10px;
  text-align: center;
}

.lb-ribbon span {
  display: inline-block;
  background: linear-gradient(135deg, #e2574c 0%, var(--sale) 55%, #b23330 100%);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 10px 34px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 50%, 100% 100%, 0 100%, 12px 50%);
  box-shadow: 0 3px 8px rgba(214, 69, 65, .35);
}

.tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 14px;
  font-weight: 700;
}
.tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Podium 2-1-3 */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 14px;
}

.podium-slot {
  flex: 1;
  min-width: 0;
  max-width: 170px;
  text-align: center;
}

.podium-crown {
  font-size: 22px;
  line-height: 1;
  display: block;
  margin-bottom: 2px;
}

.podium-avatar {
  font-size: 30px;
  line-height: 1;
  display: block;
  margin-bottom: 4px;
}

.podium-name {
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-base {
  border-radius: 12px 12px 0 0;
  padding: 8px 4px 10px;
  margin-top: 6px;
}

.podium-base .podium-rank { font-size: 16px; font-weight: 900; }
.podium-base .podium-pts { font-size: 12px; font-weight: 800; white-space: nowrap; }

.podium-1 .podium-base {
  min-height: 62px;
  background: linear-gradient(180deg, #f7c95e, var(--gold));
  color: #4a3400;
}

.podium-2 .podium-base {
  min-height: 48px;
  background: linear-gradient(180deg, #dfe7ea, #b8c7cd);
  color: #33474f;
}

.podium-3 .podium-base {
  min-height: 40px;
  background: linear-gradient(180deg, #e8b48a, #cd8a52);
  color: #4a2c12;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fffdf8;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 15px;
}

.lb-row.lb-r1 {
  background: linear-gradient(90deg, #fdf0cd, #fbe9b8);
  border-color: var(--gold);
}

.lb-row.lb-r2 {
  background: linear-gradient(90deg, #e9f2f5, #d8e9ef);
  border-color: #9fb8c4;
}

.lb-row.lb-r3 {
  background: linear-gradient(90deg, #fbeadd, #f6dcc9);
  border-color: #d08a4e;
}

.lb-row.me {
  border: 2px solid var(--gold);
  background: #fff8e1;
  box-shadow: 0 0 0 2px rgba(242, 169, 59, .25);
}

.lb-row .rank { font-weight: 900; width: 28px; text-align: center; flex-shrink: 0; }

.medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .18);
}

.medal-1 { background: linear-gradient(135deg, #f7c95e, #dd921f); }
.medal-2 { background: linear-gradient(135deg, #ccd6da, #93a7af); }
.medal-3 { background: linear-gradient(135deg, #dda06c, #b06f36); }

.lb-row .who { flex: 1; min-width: 0; }
.lb-row .who .nm { display: block; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row .who .nm-flex { display: flex; align-items: center; gap: 6px; overflow: visible; }
.lb-row .who .nm-flex .nm-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row .who .nm-flex .kamu-badge { margin-left: 0; flex-shrink: 0; }
.lb-row .who .st { display: block; font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row .pts { font-weight: 900; white-space: nowrap; }

.coin { color: var(--gold); margin-right: 2px; }

.kamu-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-left: 6px;
  vertical-align: 2px;
}

/* ---------- battle ---------- */

.battle-card { border-left: 4px solid var(--gold); }
.battle-card .vs { font-weight: 800; font-size: 16px; }
.battle-card .meta { font-size: 13px; color: var(--dim); margin: 4px 0 8px; }

.winner-banner {
  background: var(--green-bg);
  border: 1px solid var(--green);
  color: #14532d;
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  font-weight: 800;
  font-size: 17px;
  margin-bottom: 12px;
}

.h2h { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.h2h .side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-align: center; }
.h2h .side.winner { border-color: var(--green); background: var(--green-bg); }
.h2h .side .nm { font-weight: 800; font-size: 14px; }
.h2h .side .sc { font-size: 26px; font-weight: 900; }
.h2h .side .tm { font-size: 13px; color: var(--dim); }

/* ---------- forms ---------- */

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 800; margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
}

.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.avatar-grid button {
  font-size: 28px;
  padding: 10px 0;
  border: 2px solid var(--border);
  background: #fff;
  border-radius: 12px;
}
.avatar-grid button.selected { border-color: var(--accent); background: var(--accent-tint); }
.avatar-grid.dimmed { opacity: .4; }

/* ---------- avatar (emoji atau foto) ---------- */
.avatar-img {
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
  flex: none;
  background: var(--surface-alt);
}
.avatar-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex: none;
}
.av-xs { width: 22px; height: 22px; font-size: 16px; }
.av-sm { width: 28px; height: 28px; font-size: 20px; }
.av-md { width: 40px; height: 40px; font-size: 28px; }
.av-lg { width: 48px; height: 48px; font-size: 32px; }
.av-xl { width: 72px; height: 72px; font-size: 48px; }

.photo-preview { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.profile-avatar-current { margin-bottom: 12px; }

.topbar .avatar-chip { display: inline-flex; align-items: center; gap: 6px; }

.notice {
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 14px;
  margin-bottom: 12px;
}

.notice-info { background: var(--accent-tint); }
.notice-warn { background: var(--amber-bg); }
.notice-error { background: var(--red-bg); color: var(--sale); }
.notice-ok { background: var(--green-bg); color: #14532d; }

.empty { text-align: center; color: var(--dim); padding: 24px 8px; font-size: 14px; }

.loading { text-align: center; color: var(--dim); padding: 32px 8px; }

.footer-note {
  text-align: center;
  color: var(--dim);
  font-size: 12px;
  padding: 16px 8px 4px;
}

.credit-note {
  text-align: center;
  color: var(--dim);
  font-size: 11px;
  padding: 0 8px 16px;
}

.help-list { margin: 0; padding-left: 20px; }
.help-list li { margin-bottom: 10px; }
