/* Math Trainer — layout and UI chrome.
 * Colors/fonts come from config.js via CSS variables set in src/main.js. */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font, system-ui, sans-serif);
  background: var(--bg, #fff8e7);
  color: var(--text, #3f2d0c);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

.screen { display: none; min-height: 100dvh; flex-direction: column; align-items: center; padding: 16px; }
.screen.active { display: flex; }

h1 { font-size: clamp(26px, 6vw, 38px); margin: 8px 0 4px; text-align: center; }
#subtitle { opacity: 0.75; margin-bottom: 18px; text-align: center; }

#difficulties { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 16px; }
.diff {
  font: inherit; font-size: 14px; font-weight: 600;
  background: var(--panel); color: var(--text);
  border: 2px solid transparent; border-radius: 10px; padding: 10px 16px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.diff.selected { border-color: var(--primary); }
#best-score { min-height: 20px; font-size: 14px; opacity: 0.85; margin-bottom: 14px; }

.big-btn {
  font-family: inherit; font-size: 18px; font-weight: 800; letter-spacing: 1px;
  border: 0; border-radius: 14px; padding: 15px 40px;
  background: var(--primary); color: #fff; cursor: pointer; transition: transform 0.1s;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}
.big-btn:active { transform: scale(0.96); }

/* game screen */
#hud {
  width: min(94vw, 480px);
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px; font-size: 15px; font-weight: 600;
}
#hud-streak { color: var(--streak); }

#progress-track {
  width: min(94vw, 480px); height: 8px; border-radius: 4px;
  background: rgba(128,128,128,0.2); overflow: hidden; margin-bottom: 6px;
}
#progress-fill { height: 100%; width: 0; background: var(--primary); border-radius: 4px; transition: width 0.3s; }

#timer-bar {
  width: min(94vw, 480px); height: 5px; border-radius: 3px;
  background: rgba(128,128,128,0.15); overflow: hidden; margin-bottom: 10px;
}
#timer-fill { height: 100%; width: 100%; background: var(--wrong); border-radius: 3px; }

#question-card {
  width: min(94vw, 480px);
  background: var(--panel); border-radius: 20px; padding: 34px 20px 22px;
  text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,0.08); margin-bottom: 16px;
}
#question { font-size: clamp(34px, 9vw, 52px); font-weight: 800; letter-spacing: 1px; }
#feedback { min-height: 26px; margin-top: 10px; font-size: 17px; font-weight: 700; }
#feedback.good { color: var(--correct); }
#feedback.bad-text { color: var(--wrong); }

#answers { width: min(94vw, 480px); }
#answers .choice {
  font-family: inherit; font-size: 26px; font-weight: 800;
  width: calc(50% - 6px); margin: 3px; padding: 20px 0;
  background: var(--btn-bg); color: var(--text);
  border: 2px solid var(--btn-border); border-radius: 16px; cursor: pointer;
  transition: transform 0.08s;
}
#answers .choice:active { transform: scale(0.97); }
#answers .choice.right { background: var(--correct); border-color: var(--correct); color: #fff; }
#answers .choice.bad { background: var(--wrong); border-color: var(--wrong); color: #fff; }

/* number pad (input mode) */
#pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pad-key {
  font-family: inherit; font-size: 24px; font-weight: 700;
  padding: 16px 0; background: var(--btn-bg); color: var(--text);
  border: 2px solid var(--btn-border); border-radius: 14px; cursor: pointer;
}
.pad-key.ok { grid-column: span 2; background: var(--primary); border-color: var(--primary); color: #fff; }

/* summary overlay */
#summary-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10;
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.25s, visibility 0.25s;
}
#summary-overlay.open { opacity: 1; visibility: visible; pointer-events: auto; }
.sum-card {
  background: var(--panel); border-radius: 20px;
  padding: 28px 24px; width: min(92vw, 340px); text-align: center;
  transform: scale(0.85); transition: transform 0.25s; box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
#summary-overlay.open .sum-card { transform: scale(1); }
#sum-title { font-size: 24px; margin-bottom: 8px; }
#sum-stars { font-size: 34px; letter-spacing: 6px; color: var(--primary); margin-bottom: 10px; }
#sum-score { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
#sum-accuracy { font-size: 14px; opacity: 0.85; margin-bottom: 8px; }
#sum-best { min-height: 20px; font-size: 14px; color: var(--primary); font-weight: 700; margin-bottom: 16px; }

#mute-btn {
  position: fixed; right: 14px; top: 14px; width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: rgba(128,128,128,0.2); font-size: 20px; cursor: pointer; z-index: 5;
}

/* embed mode */
body.embed .screen { padding: 8px; }
body.embed h1, body.embed #subtitle { display: none; }
body.embed #mute-btn { right: 6px; top: 6px; width: 34px; height: 34px; font-size: 16px; }
