/* Game Product Knowledge Dekoruma — versi tim (web HP, mobile-first). */

:root {
  --red: #d32f2f;
  --red-dark: #b71c1c;
  --ink: #212121;
  --muted: #757575;
  --line: #e0e0e0;
  --bg: #fafafa;
  --card: #ffffff;
  --gold: #f9a825;
  --green: #2e7d32;
  --green-bg: #e8f5e9;
  --amber-bg: #fff8e1;
  --blue-bg: #e3f2fd;
  --radius: 14px;
  --nav-h: 60px;
}

* { box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  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(--red);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

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

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

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

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

.screen h2 {
  font-size: 20px;
  margin: 4px 0 4px;
}

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

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

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

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

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

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

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

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

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

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

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

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

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  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(--line);
  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;
  color: var(--muted);
  padding: 6px 0;
}

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

.bottomnav button.active { color: var(--red); font-weight: 700; }

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

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

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

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

.stat .num { font-size: 20px; font-weight: 700; }
.stat .lbl { font-size: 12px; color: var(--muted); }

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

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

.product-row .p-name { font-weight: 600; font-size: 15px; }
.product-row .p-meta { font-size: 13px; color: var(--muted); }
.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(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}

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

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

.filter-chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}

.filter-chip.active { background: var(--blue-bg); border-color: #1976d2; }

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

.chip {
  display: inline-block;
  background: var(--blue-bg);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 6px;
}

.chip-red { background: #ffebee; color: var(--red-dark); }
.chip-green { background: var(--green-bg); color: var(--green); }
.chip-gold { background: var(--amber-bg); color: #6d4c00; }

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

.material-photo {
  background: #fff;
  border: 1px solid var(--line);
  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(--muted); font-size: 14px; }
.price-after { font-size: 22px; font-weight: 700; color: var(--red); }
.discount-badge {
  background: var(--red);
  color: #fff;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 13px;
  font-weight: 700;
  margin-left: 6px;
}

.spec-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec-table td { padding: 6px 4px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.spec-table td:first-child { color: var(--muted); 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: 600;
  margin-bottom: 8px;
}

.timer-bar {
  height: 8px;
  background: #eee;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}

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

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

.quiz-photo {
  background: #fff;
  border: 1px solid var(--line);
  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: 600; margin: 0 0 14px; }

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

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

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

.quiz-exit {
  margin-top: 18px;
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 11px;
  font-size: 14px;
  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: 800; }
.result-hero .big-stars { font-size: 28px; letter-spacing: 4px; }

.review-item { border-top: 1px solid #f0f0f0; padding: 10px 0; }
.review-item:first-child { border-top: 0; }
.review-item .q { font-weight: 600; font-size: 15px; }
.review-item .a { font-size: 14px; margin-top: 4px; }
.review-item .ok { color: var(--green); font-weight: 600; }
.review-item .no { color: var(--red); font-weight: 600; }
.review-item .exp { font-size: 14px; color: var(--muted); margin-top: 4px; }

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

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

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

.lb-row.me { border-color: var(--red); background: #fff5f5; }
.lb-row .rank { font-weight: 800; width: 26px; text-align: center; }
.lb-row .who { flex: 1; min-width: 0; }
.lb-row .who .nm { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row .who .st { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row .pts { font-weight: 700; white-space: nowrap; }

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

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

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

.h2h { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.h2h .side { background: var(--card); border: 1px solid var(--line); 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: 600; font-size: 14px; }
.h2h .side .sc { font-size: 26px; font-weight: 800; }
.h2h .side .tm { font-size: 13px; color: var(--muted); }

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

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  border: 1px solid #cfcfcf;
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
}

.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(--line);
  background: #fff;
  border-radius: 12px;
}
.avatar-grid button.selected { border-color: var(--red); background: #ffebee; }

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

.notice-info { background: var(--blue-bg); }
.notice-warn { background: var(--amber-bg); }
.notice-error { background: #ffebee; color: var(--red-dark); }
.notice-ok { background: var(--green-bg); }

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

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

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

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