/* =========================================================
   STYLE.CSS — Tema 8-bit retro math arcade untuk Kwadran V
   ========================================================= */

:root {
  --bg-deep: #0b0e1a;
  --bg-panel: #141a2e;
  --bg-panel-2: #1b2340;
  --bg-panel-3: #202a4d;
  --line: #2a3358;
  --line-soft: #232c4e;

  --gold: #ffb238;
  --gold-dim: #b97d1e;
  --pink: #ec4899;
  --cyan: #22d3ee;
  --blue: #3aa0ff;
  --violet: #8b5cf6;
  --coral: #ff6f61;
  --teal: #17b6a7;
  --green: #22c55e;

  --ink: #eaf0ff;
  --muted: #8b93bd;
  --muted-2: #5b628c;

  --font-pixel: 'Press Start 2P', monospace;
  --font-mono: 'VT323', monospace;

  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 19px;
  min-height: 100vh;
}

body {
  background-image:
    radial-gradient(circle at 15% 10%, rgba(139, 92, 246, 0.08), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(34, 211, 238, 0.08), transparent 40%),
    linear-gradient(var(--bg-deep), var(--bg-deep));
}

h1, h2, h3, h4 { font-family: var(--font-pixel); line-height: 1.5; }

button { font-family: var(--font-mono); cursor: pointer; }
input, select { font-family: var(--font-mono); }

/* ---------------- SCREENS ---------------- */

.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ---------------- BUTTONS ---------------- */

.btn {
  font-family: var(--font-pixel);
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--bg-panel-2);
  color: var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--gold) 0%, #e8871a 100%);
  color: #241300;
  border-color: #8a5410;
  box-shadow: 0 4px 0 #8a5410;
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 0 #8a5410; }
.btn-primary:active:not(:disabled) { box-shadow: 0 2px 0 #8a5410; }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--cyan);
}
.btn-ghost:hover { background: var(--bg-panel-2); }

.btn-big { font-size: 13px; padding: 16px 22px; width: 100%; max-width: 420px; }
.btn-sm { font-size: 9px; padding: 8px 10px; }
.btn-mini { font-size: 9px; padding: 6px 10px; border-radius: 6px; }
.btn-block { width: 100%; margin-top: 14px; }

/* ---------------- LANDING ---------------- */

.landing-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 20px 60px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}

.landing-tag {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--pink);
  background: rgba(236, 72, 153, 0.12);
  border: 1px solid var(--pink);
  padding: 8px 14px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.landing-emblem {
  font-size: 46px;
  background: var(--bg-panel-2);
  border: 3px solid var(--gold);
  border-radius: 16px;
  width: 88px; height: 88px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 24px rgba(255, 178, 56, 0.35);
  margin-bottom: 6px;
}

.landing-title {
  font-size: 44px;
  color: var(--gold);
  text-shadow: 3px 3px 0 var(--pink), 6px 6px 0 rgba(0,0,0,0.4);
  margin: 6px 0;
}
.landing-title span { color: var(--cyan); }

.landing-sub { color: var(--cyan); font-size: 22px; margin: 0; }
.landing-desc { color: var(--muted); font-size: 20px; margin: 0 0 10px; max-width: 480px; }

.landing-badges {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  width: 100%; max-width: 480px; margin-bottom: 14px;
}
.badge {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--ink);
  text-align: left;
}

.landing-deco { margin-top: 26px; font-size: 24px; opacity: 0.6; letter-spacing: 14px; }

/* ---------------- SETUP SCREEN ---------------- */

.setup-wrap { max-width: 900px; margin: 0 auto; padding: 26px 20px 60px; }
.section-title { color: var(--gold); font-size: 16px; margin: 18px 0; }
.setup-block { margin-bottom: 26px; }
.setup-label { color: var(--cyan); font-size: 18px; margin-bottom: 10px; }

.player-count-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.count-btn {
  font-family: var(--font-pixel); font-size: 11px;
  padding: 12px 4px; border-radius: 8px;
  background: var(--bg-panel-2); border: 2px solid var(--line); color: var(--ink);
}
.count-btn.selected { border-color: var(--pink); background: rgba(236,72,153,0.18); color: var(--pink); }

.player-forms { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

.player-form-card {
  background: var(--bg-panel);
  border: 2px solid var(--pf-color, var(--line));
  border-radius: var(--radius);
  padding: 14px;
}
.player-form-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.player-form-num { font-family: var(--font-pixel); font-size: 11px; color: var(--pf-color); background: rgba(255,255,255,0.06); padding: 4px 8px; border-radius: 6px; }
.player-form-emoji-preview { font-size: 22px; }

.pf-name-input {
  width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg-deep); color: var(--ink); font-size: 16px; margin-bottom: 10px;
}
.pf-label { font-size: 12px; color: var(--muted); margin: 6px 0 4px; }
.pf-avatars, .pf-colors { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }

.avatar-btn {
  font-size: 16px; padding: 4px 6px; border-radius: 6px;
  background: var(--bg-panel-2); border: 1px solid var(--line);
}
.avatar-btn.selected { border-color: var(--gold); background: rgba(255,178,56,0.15); }

.color-btn {
  width: 24px; height: 24px; border-radius: 6px; border: 2px solid transparent;
}
.color-btn.selected { border-color: #fff; transform: scale(1.15); }

/* ---------------- TOPBAR (in-game) ---------------- */

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; background: var(--bg-panel);
  border-bottom: 2px solid var(--line);
  flex-wrap: wrap; gap: 10px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-emblem { font-size: 26px; }
.topbar-title { font-family: var(--font-pixel); font-size: 14px; color: var(--gold); }
.topbar-sub { font-size: 14px; color: var(--muted); }
.topbar-right { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- BOARD LAYOUT ---------------- */

.board-layout {
  display: grid; grid-template-columns: 1fr 360px; gap: 16px;
  padding: 16px; max-width: 1400px; margin: 0 auto;
}

.board-panel {
  background: var(--bg-panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.board-panel-topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }
.crt-label { font-size: 14px; color: var(--cyan); }
.hover-coord { font-size: 14px; color: var(--muted); }

#board-svg {
  width: 100%; height: auto; aspect-ratio: 1 / 1;
  background: #0a0d1a;
  border-radius: 8px;
  border: 2px solid var(--line-soft);
}

.board-motivation { text-align: center; color: var(--pink); font-size: 15px; }

.grid-line { stroke: #1c2340; stroke-width: 1; }
.grid-axis { stroke: var(--cyan); stroke-width: 2.5; }
.grid-label { fill: var(--ink); font-size: 10.5px; font-family: var(--font-mono); text-anchor: middle; font-weight: bold; }
.grid-label-y { text-anchor: end; }
.origin-marker { fill: var(--gold); stroke: #fff; stroke-width: 1; }
.origin-label { fill: var(--gold); font-size: 11px; }
.axis-arrow { fill: var(--cyan); }
.axis-name { fill: var(--cyan); font-family: var(--font-pixel); font-size: 13px; }

.hit-point { fill: transparent; cursor: crosshair; }
.hit-point:hover { fill: rgba(34, 211, 238, 0.22); stroke: var(--cyan); stroke-width: 1.5; }

/* cursor tracker: lingkaran yang mengikuti posisi kursor pemain */
.cursor-layer { pointer-events: none; }
.cursor-indicator {
  fill: rgba(255, 178, 56, 0.12);
  stroke: var(--gold);
  stroke-width: 2;
  stroke-dasharray: 4 3;
  transition: cx 0.05s linear, cy 0.05s linear, opacity 0.15s ease;
}
.cursor-indicator.hidden { opacity: 0; }

/* garis pemandu: dari posisi pion aktif mengikuti kursor secara live */
.cursor-tracker-line {
  stroke-width: 2;
  stroke-dasharray: 6 5;
  opacity: 0.75;
  transition: opacity 0.15s ease;
}
.cursor-tracker-line.hidden { opacity: 0; }

.campus-badge { cursor: default; }
.campus-text { font-family: var(--font-mono); font-size: 12px; font-weight: bold; }

.pawn { transition: transform 0.4s ease; }
.pawn-active circle { filter: drop-shadow(0 0 6px currentColor); animation: pawnGlow 1.2s infinite alternate; }
@keyframes pawnGlow { from { opacity: 1; } to { opacity: 0.55; } }

.trajectory-line { stroke: var(--gold); stroke-width: 2; stroke-dasharray: 6 5; opacity: 0.85; }

/* ---------------- SIDEBAR ---------------- */

.sidebar { display: flex; flex-direction: column; gap: 12px; }
.sidebar-card {
  background: var(--bg-panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.sidebar-card-title { font-size: 13px; color: var(--cyan); margin-bottom: 8px; }

.round-card { background: linear-gradient(90deg, var(--bg-panel-2), var(--bg-panel)); border-color: var(--violet); }
.round-row { display: flex; justify-content: space-between; font-family: var(--font-pixel); font-size: 10px; color: var(--violet); flex-wrap: wrap; gap: 6px; }

.active-player-card { border-color: var(--pc-color, var(--line)); }
.active-player-row { display: flex; justify-content: space-between; align-items: center; }
.active-player-name { font-size: 17px; color: var(--pc-color, var(--ink)); font-weight: bold; }
.active-player-pos { font-size: 14px; color: var(--muted); margin-top: 4px; }

.attempts-badge { display: flex; gap: 4px; }
.attempt-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.attempt-dot.on { background: var(--green); }
.attempt-dot.off { background: var(--line); }

.card-display { min-height: 120px; }
.card-empty { color: var(--muted); font-size: 15px; text-align: center; padding: 16px 0; }
.card-display.shuffling .card-face,
.card-display.shuffling .card-empty { animation: cardShuffle 0.5s infinite; }
@keyframes cardShuffle { 0% { transform: rotate(0deg) scale(1); } 50% { transform: rotate(6deg) scale(1.03); } 100% { transform: rotate(-4deg) scale(0.98); } }

.card-face { border-radius: 8px; padding: 12px; text-align: center; border: 2px solid var(--line); }
.card-face-title { font-family: var(--font-pixel); font-size: 13px; margin-bottom: 8px; }
.card-face-param { font-size: 16px; margin-bottom: 8px; }
.card-face-instruction { font-size: 13px; color: var(--muted); margin-top: 8px; }
.card-face-icon { font-size: 30px; margin-bottom: 6px; }
.card-face-desc { font-size: 14px; color: var(--muted); }

.card-translasi { border-color: var(--pink); background: rgba(236,72,153,0.08); }
.card-translasi .card-face-title { color: var(--pink); }
.card-refleksi { border-color: var(--blue); background: rgba(58,160,255,0.08); }
.card-refleksi .card-face-title { color: var(--blue); }
.card-rotasi { border-color: var(--violet); background: rgba(139,92,246,0.08); }
.card-rotasi .card-face-title { color: var(--violet); }
.card-dilatasi { border-color: var(--teal); background: rgba(23,182,167,0.08); }
.card-dilatasi .card-face-title { color: var(--teal); }
.card-booster { border-color: var(--gold); background: rgba(255,178,56,0.1); }

.td-hint { font-size: 13px; color: var(--muted); margin: 6px 0 4px; }
.td-opt { font-size: 15px; margin: 2px 0; }

.typed-answer-row {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  margin-top: 10px; flex-wrap: wrap;
}
.typed-answer-row span { color: var(--muted); font-size: 16px; }
.typed-answer-input {
  width: 52px; padding: 6px 4px; text-align: center;
  border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg-deep); color: var(--ink); font-size: 15px;
}
.typed-answer-input:focus { outline: none; border-color: var(--gold); }

.teacher-hint { margin-top: 8px; font-size: 12px; color: var(--gold); border-top: 1px dashed var(--line); padding-top: 6px; }

.booster-list { display: flex; flex-direction: column; gap: 6px; }
.booster-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; background: var(--bg-panel-2); border-radius: 6px; padding: 6px 10px; }

.history-log { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow-y: auto; }
.log-row { font-size: 13px; color: var(--muted); border-left: 2px solid var(--line); padding-left: 8px; }
.log-empty { font-size: 13px; color: var(--muted-2); }

.accuracy-bar-wrap { background: var(--bg-panel-2); border-radius: 6px; overflow: hidden; height: 10px; }
.accuracy-bar { height: 100%; background: linear-gradient(90deg, var(--teal), var(--green)); width: 0%; transition: width 0.4s ease; }
.accuracy-text { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ---------------- MODALS ---------------- */

.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(5,7,15,0.78);
  align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--bg-panel); border: 2px solid var(--gold);
  border-radius: 12px; max-width: 560px; width: 100%;
  max-height: 88vh; overflow-y: auto;
  box-shadow: 0 0 40px rgba(255,178,56,0.15);
  padding: 18px 20px 22px;
}
.modal-box-narrow { max-width: 440px; text-align: center; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-header h3 { color: var(--gold); font-size: 14px; margin: 0; }
.modal-close { background: transparent; border: none; color: var(--muted); font-size: 18px; }

.howto-block { margin-bottom: 16px; }
.howto-block h4 { color: var(--cyan); font-size: 13px; margin-bottom: 6px; }
.howto-block p { font-size: 16px; color: var(--ink); margin: 4px 0; line-height: 1.5; }
.mono { font-family: var(--font-mono); font-size: 15px; color: var(--muted); }

.feedback { text-align: center; }
.feedback-icon { font-size: 40px; margin-bottom: 6px; }
.feedback h3 { font-size: 15px; margin: 6px 0; }
.feedback-correct h3 { color: var(--green); }
.feedback-wrong h3 { color: var(--coral); }
.feedback-booster h3 { color: var(--gold); }
.attempts-left-text { color: var(--gold); font-size: 15px; }

.explain-box { background: var(--bg-panel-2); border-radius: 8px; padding: 10px 14px; margin-top: 10px; text-align: left; }
.explain-title { color: var(--cyan); font-size: 13px; margin-bottom: 6px; font-family: var(--font-pixel); }
.answer-line { color: var(--gold) !important; margin-top: 6px; }

.target-choice-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.target-choice-btn { text-align: left; }
.modal-btn-row { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }

.quiz-question { font-size: 17px; color: var(--cyan); }
.quiz-options { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.quiz-option-btn {
  text-align: left; padding: 10px 12px; border-radius: 8px;
  border: 2px solid var(--line); background: var(--bg-panel-2); color: var(--ink); font-size: 15px;
}
.quiz-option-btn:hover:not(:disabled) { border-color: var(--gold); }
.quiz-letter { font-family: var(--font-pixel); font-size: 10px; color: var(--gold); margin-right: 8px; }
.quiz-feedback { margin-top: 10px; font-size: 15px; }
.quiz-correct { color: var(--green); }
.quiz-wrong { color: var(--coral); }

.campus-info-card h3 { color: var(--gold); font-size: 14px; }
.campus-info-card p { font-size: 15px; }
.campus-fact { color: var(--cyan); margin-top: 10px; }

.settings-body { text-align: left; }
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 15px; }
.setting-row-col { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 15px; }
.setting-row-col select { background: var(--bg-panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }

/* ---------------- VICTORY ---------------- */

.victory-wrap { max-width: 640px; margin: 0 auto; padding: 60px 20px; text-align: center; }
.victory-emblem { font-size: 56px; }
.victory-wrap h2 { color: var(--gold); font-size: 22px; margin: 10px 0; }
.victory-player { font-size: 18px; margin-bottom: 6px; }
.victory-campus { font-size: 22px; color: var(--cyan); margin-bottom: 20px; }
.victory-stats-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.victory-stat-row {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 14px;
}
.vs-name { font-weight: bold; }
.vs-cat { color: var(--pink); }
.victory-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------------- TOAST ---------------- */

#toast-container { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-panel); border: 2px solid var(--cyan); color: var(--ink);
  padding: 10px 18px; border-radius: 8px; font-size: 14px; opacity: 0; transform: translateY(-10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-warn { border-color: var(--coral); }
.toast-success { border-color: var(--green); }

/* ---------------- CONFETTI ---------------- */

#confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 300; }
.confetti-piece {
  position: absolute; top: -20px; width: 8px; height: 14px; opacity: 0.9;
  animation-name: confettiFall; animation-timing-function: ease-in; animation-fill-mode: forwards;
}
@keyframes confettiFall {
  to { transform: translateY(105vh) rotate(360deg); opacity: 0.2; }
}

/* ---------------- RESPONSIVE ---------------- */

@media (max-width: 980px) {
  .board-layout { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .landing-title { font-size: 32px; }
  .landing-badges { grid-template-columns: 1fr; }
  html, body { font-size: 17px; }
  .btn { font-size: 10px; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
