/**
 * Mental Math Trainer — Vertical Stacked Column Stylesheet (style.css)
 * Pure, mobile-first column arithmetic speedrun interface.
 * Strictly uses variables.css design tokens.
 */

.hidden, section.hidden { display: none !important; }
.text-center { text-align: center; } .font-bold { font-weight: 700; } .font-mono { font-family: var(--font-mono); }
.text-danger { color: var(--danger); } .text-emerald { color: var(--secondary); } .text-amber { color: var(--accent); }
.text-indigo { color: var(--primary); } .text-muted { color: var(--text-muted); } .w-full { width: 100%; }

/* Navbar */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--surface-border); width: 100%;
}

.trainer-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 54px;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 0 0.75rem;
}

.nav-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color var(--duration-fast);
  flex-shrink: 0;
}
.nav-back-link:hover { color: var(--text); }
.back-arrow { font-size: 1.2rem; line-height: 1; }

.nav-title-group { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.nav-icon { font-size: 1.15rem; }
.nav-page-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
}

.nav-actions-right { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }

.icon-btn, .audio-toggle {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text);
  touch-action: manipulation;
}

/* Card Shell */
.trainer-wrapper {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 1rem 0.75rem 2.5rem;
  box-sizing: border-box;
}

.trainer-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1rem;
  box-shadow: var(--shadow-lg);
  box-sizing: border-box;
  width: 100%;
}

/* Setup View */
.setup-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

.selector-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 1.25rem;
  width: 100%;
}

.select-field {
  width: 100%;
  min-width: 0;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.3rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  outline: none;
  transition: border-color var(--duration-fast);
}
.select-field:focus { border-color: var(--primary); }

.counter-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem 0 1.5rem;
}

.counter-btn {
  width: 42px;
  height: 42px;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.counter-btn:active { background: var(--surface-border); }

.counter-input {
  width: 76px;
  height: 42px;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
}

.btn-large-action {
  width: 100%;
  padding: 0.9rem;
  font-size: 1.1rem;
  font-weight: 800;
  border-radius: var(--radius-lg);
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform var(--duration-fast), opacity var(--duration-fast);
}
.btn-large-action:active { transform: scale(0.98); }

/* Play View HUD */
.play-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--surface-border);
  width: 100%;
}

.hud-pill { font-size: 0.95rem; font-weight: 700; color: var(--text-muted); }
.hud-timer { font-size: 1.25rem; font-weight: 800; color: var(--secondary); font-family: var(--font-mono); }

.btn-abort {
  background: #DC2626;
  color: #FFFFFF;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  border: none;
  touch-action: manipulation;
  transition: background var(--duration-fast), transform var(--duration-fast);
}
.btn-abort:active { background: #B91C1C; transform: scale(0.96); }

/* Vertical Column Math (Hitung Susun) */
.vertical-calc-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 160px;
  margin: 0.5rem auto 1.25rem;
}

.vertical-calc {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-mono);
  width: fit-content;
  min-width: 160px;
  max-width: 240px;
  margin: 0 auto;
}

.vcalc-row {
  width: 100%;
  text-align: right;
  line-height: 1.15;
  font-weight: 700;
  font-size: clamp(2.2rem, 8vw, 3rem);
  letter-spacing: 0.05em;
  color: var(--text);
}

.vcalc-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.vcalc-op {
  font-size: clamp(1.8rem, 6.5vw, 2.4rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  padding-right: 1rem;
  user-select: none;
}

.vcalc-divider {
  width: 100%;
  height: 3px;
  background: var(--text);
  margin: 0.25rem 0 0.4rem;
  border-radius: 2px;
}

.vcalc-answer-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 1.2em;
  width: 100%;
}

.vcalc-input {
  color: var(--primary);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: clamp(2.2rem, 8vw, 3rem);
  border-bottom: 3px solid var(--primary);
  min-width: 45px;
  text-align: right;
  padding-right: 2px;
}

/* Touch Numpad — Calculator Grid Style */
.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 280px;
  width: 100%;
  margin: 0.5rem auto 0;
}
.numpad-btn {
  height: 52px;
  background: #0d121d;
  color: var(--text);
  border: none;
  font-size: 1.45rem;
  font-weight: 700;
  font-family: var(--font-mono);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--duration-fast);
}
.numpad-btn:active { background: var(--primary); color: #fff; }
.numpad-btn-fn { color: var(--text-muted); font-size: 1.15rem; }

/* Results View */
.results-xp-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  color: var(--accent);
  text-align: center;
  margin-bottom: 1rem;
}

.results-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.result-metric-card {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.25rem;
  text-align: center;
}

.metric-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  text-transform: uppercase;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.85rem 0;
  font-size: 0.85rem;
}

.results-table th, .results-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--surface-border);
  text-align: left;
}

.results-table th {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.fastest-row { background: rgba(245, 158, 11, 0.1); font-weight: 700; }
.results-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }

@media (max-width: 480px) {
  .hide-mobile { display: none !important; }
}

@media (max-width: 360px) {
  .trainer-wrapper { padding: 0.75rem 0.4rem 2rem; }
  .trainer-card { padding: 1rem 0.65rem; }
  .numpad-btn { height: 44px; font-size: 1.2rem; }
  .vcalc-row, .vcalc-input { font-size: clamp(1.8rem, 8vw, 2.4rem); }
}
