/* ============================================================
   WHY STUDIO MATH LEARNING — Game Styles
   game-styles.css
   Shared across all games.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem 1rem 3rem;
  -webkit-font-smoothing: antialiased;
}

#app { width: 100%; max-width: 540px; }

.screen { display: none; }
.screen.active { display: block; }

/* --- Start screen ----------------------------------------- */
#start-screen { text-align: center; padding: 2.5rem 0; }

#game-title {
  font-size: 26px;
  font-weight: 700;
  color: #1a2744;
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
}

#start-screen p {
  font-size: 15px;
  color: #5f6b7a;
  margin-bottom: 1.75rem;
  line-height: 1.65;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.ws-game-pills {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.ws-game-pill {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.start-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 320px;
  margin: 0 auto 1.5rem;
  text-align: left;
}

.start-fields label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b7a99;
  margin-bottom: 5px;
}

.start-fields input {
  width: 100%;
  padding: 11px 14px;
  font-size: 16px;
  border: 1.5px solid #dde2ea;
  border-radius: 10px;
  background: #fff;
  color: #1a2744;
  font-family: inherit;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
}

.start-fields input:focus {
  outline: none;
  border-color: #b85c3a;
}

#start-error {
  display: none;
  font-size: 13px;
  color: #A32D2D;
  margin-bottom: 0.75rem;
  text-align: center;
}

.start-btn {
  background: #1a2744;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 44px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: background 0.15s;
}

.start-btn:hover { background: #0f1a30; }

/* --- Game screen ------------------------------------------ */
#top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

#fact-type-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
}

#progress-text { font-size: 13px; color: #6b7a99; }

#prog-bar {
  height: 5px;
  background: #dde2ea;
  border-radius: 3px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

#prog-fill {
  height: 100%;
  background: #1a2744;
  border-radius: 3px;
  transition: width 0.3s;
}

#question-area {
  background: #fff;
  border: 1px solid #dde2ea;
  border-radius: 16px;
  padding: 1.75rem 1.5rem;
  text-align: center;
  margin-bottom: 1.25rem;
}

#q-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9ba8bc;
  margin-bottom: 1rem;
}

#visual-container {
  margin-bottom: 1.4rem;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#input-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 0.75rem;
}

#q-text-inline {
  font-size: 28px;
  font-weight: 700;
  color: #1a2744;
}

#answer-input {
  width: 80px;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  padding: 8px 4px;
  border: 2px solid #dde2ea;
  border-radius: 10px;
  background: #f5f7fa;
  color: #1a2744;
  font-family: inherit;
  -moz-appearance: textfield;
  transition: border-color 0.15s, background 0.15s;
}

#answer-input:focus { outline: none; border-color: #b85c3a; background: #fff; }
#answer-input::-webkit-inner-spin-button,
#answer-input::-webkit-outer-spin-button { -webkit-appearance: none; }
#answer-input.correct { border-color: #639922; background: #EAF3DE; color: #27500A; }
#answer-input.wrong   { border-color: #A32D2D; background: #FCEBEB; color: #501313; }

#q-hint {
  font-size: 13px;
  color: #9ba8bc;
  min-height: 18px;
  font-style: italic;
  margin-bottom: 0.25rem;
}

#check-btn {
  display: block;
  width: 100%;
  padding: 13px;
  background: #1a2744;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  margin-top: 0.75rem;
  transition: background 0.15s;
}

#check-btn:hover { background: #0f1a30; }
#check-btn:disabled { background: #9ba8bc; cursor: default; }

#feedback-row {
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  min-height: 26px;
  color: #1a2744;
  margin: 0.75rem 0;
  line-height: 1.4;
}

#next-btn {
  display: none;
  width: 100%;
  padding: 13px;
  background: #f0f4f8;
  border: 1.5px solid #dde2ea;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  color: #1a2744;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

#next-btn:hover { background: #dde2ea; }

/* --- Results screen --------------------------------------- */
#results-screen { padding: 0.25rem 0; }

#results-screen h2 {
  font-size: 22px;
  font-weight: 700;
  color: #1a2744;
  margin-bottom: 1.25rem;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: #fff;
  border: 1px solid #dde2ea;
  border-radius: 10px;
  padding: 0.9rem 0.75rem;
  text-align: center;
}

.stat-num {
  font-size: 28px;
  font-weight: 700;
  color: #1a2744;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ba8bc;
  margin-top: 4px;
}

.result-section { margin-bottom: 1.5rem; }

.result-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.title-know     { color: #3B6D11; }
.title-slow     { color: #854F0B; }
.title-practice { color: #A32D2D; }

.fact-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.fact-chip {
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
}

.chip-know     { background: #EAF3DE; color: #27500A; }
.chip-slow     { background: #FAEEDA; color: #633806; }
.chip-practice { background: #FCEBEB; color: #501313; }

/* --- Submit section --------------------------------------- */
#submit-section {
  background: #fff;
  border: 1px solid #dde2ea;
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

#submit-section label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b7a99;
  margin-bottom: 6px;
}

#submit-name {
  width: 100%;
  padding: 10px 14px;
  font-size: 16px;
  border: 1.5px solid #dde2ea;
  border-radius: 10px;
  background: #f5f7fa;
  font-family: inherit;
  color: #1a2744;
  margin-bottom: 1rem;
}

#submit-name:focus { outline: none; border-color: #b85c3a; }

#submit-btn {
  width: 100%;
  padding: 13px;
  background: #b85c3a;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

#submit-btn:hover { background: #8f4429; }
#submit-btn:disabled { background: #d4a090; cursor: default; }

#submit-status {
  text-align: center;
  font-size: 14px;
  margin-top: 0.75rem;
  min-height: 20px;
  line-height: 1.4;
}

.status-ok  { color: #27500A; }
.status-err { color: #A32D2D; }

.again-btn {
  width: 100%;
  padding: 13px;
  background: #f0f4f8;
  border: 1.5px solid #dde2ea;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  color: #1a2744;
  cursor: pointer;
  margin-top: 0.75rem;
  font-family: inherit;
  transition: background 0.15s;
}

.again-btn:hover { background: #dde2ea; }

/* --- Rekenrek renderer ------------------------------------ */
.rek-container {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.rek-plus { font-size: 22px; font-weight: 400; color: #9ba8bc; }
.rek-wire-wrap { display: flex; flex-direction: column; gap: 10px; }

.rek-wire {
  position: relative;
  display: flex;
  align-items: center;
  height: 24px;
}

.rek-wire-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: #1a2744;
  top: 50%;
  transform: translateY(-50%);
  z-index: 0;
}

.rek-beads {
  display: flex;
  align-items: center;
  gap: 2px;
  position: relative;
  z-index: 1;
}

.bead { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; }
.bead-gap { width: 8px; flex-shrink: 0; }
.bead-red-on     { background: #c0392b; }
.bead-white-on   { background: #f5f0e8; border: 1.5px solid #c8b89a; }
.bead-red-off    { background: #c0392b; opacity: 0.15; }
.bead-white-off  { background: #f5f0e8; border: 1.5px solid #dde2ea; opacity: 0.2; }
.bead-red-sub    { background: #c0392b; opacity: 0.25; outline: 2px dashed #c0392b; outline-offset: -3px; }
.bead-white-sub  { background: #f5f0e8; border: 1.5px dashed #c8b89a; opacity: 0.3; }

/* --- Number line renderer --------------------------------- */
.nl-wrap {
  width: 100%;
  padding: 0 8px;
}

.nl-svg { width: 100%; overflow: visible; display: block; }
