:root {
  --bg: #fffaf1;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-soft: #fffaf1;
  --text: #24324a;
  --muted: #69788f;
  --accent: #ff8a38;
  --accent-dark: #d86418;
  --accent-soft: #fff1e3;
  --blue: #2c6bb1;
  --blue-soft: #ebf4ff;
  --pink-soft: #fff0f4;
  --ok: #239968;
  --bad: #cc4f4f;
  --line: #e6edf8;
  --shadow: 0 22px 48px rgba(41, 74, 131, 0.11);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Nunito', Arial, sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}

.page-glow {
  position: fixed;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}

.page-glow-left {
  top: -100px;
  left: -120px;
  background: rgba(255, 207, 145, 0.34);
}

.page-glow-right {
  top: 180px;
  right: -120px;
  background: rgba(157, 214, 255, 0.28);
}

.app {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.hero-shell,
.panel {
  background: var(--panel);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  border: 1px solid rgba(230, 237, 248, 0.9);
}

.hero-shell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 28px;
  padding: 28px 34px 24px;
  margin-bottom: 18px;
  min-height: 420px;
}

.hero-copy {
  flex: 1 1 0;
  max-width: 620px;
  padding: 0;
  text-align: left;
}

.hero-art {
  flex: 0 0 430px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  align-self: stretch;
}

.hero-image {
  width: 100%;
  max-width: 420px;
  height: auto;
  display: block;
  object-fit: contain;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
.eyebrow,
button,
.tag,
.hero-badge,
.label,
.limit-label {
  font-family: 'Baloo 2', 'Nunito', sans-serif;
}

h1 {
  font-size: clamp(3.6rem, 7vw, 5.7rem);
  line-height: 0.9;
  margin-bottom: 18px;
  letter-spacing: 0.01em;
  max-width: 560px;
}

h1 br {
  display: block;
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.25rem);
  margin-bottom: 10px;
}

h3 {
  font-size: 1.55rem;
  margin-bottom: 6px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.hero-text {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
  margin-bottom: 26px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 0;
  max-width: 560px;
}

.hero-badge {
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
  font-size: 1rem;
}

.panel {
  padding: 24px;
  margin-bottom: 18px;
}

.mode-switch-panel,
.settings,
.status,
.retry-panel,
#rowsModePanel,
#summaryPanel,
#quizPanel {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,251,246,0.98));
}

.practice-mode-box,
.multiplier-grid,
.row-selector {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.practice-mode-option,
.multiplier-option,
.timer-option,
.limit-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.practice-mode-option,
.multiplier-option,
.row-select-btn {
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--blue-soft);
}

.practice-mode-option,
.multiplier-option,
.timer-option,
.limit-box,
.status-item,
.row-card {
  border: 1px solid var(--line);
}

.practice-mode-option input,
.multiplier-option input,
.timer-option input,
.limit-option input {
  width: 20px;
  height: 20px;
}

.mode-box {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.timer-option {
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--accent-soft);
}

.limit-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 20px;
  background: #f7fbff;
}

.limit-label,
.label,
.row-card-label {
  color: var(--muted);
}

.settings-actions,
.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr);
  gap: 18px;
  align-items: start;
}

.status {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.status-item {
  background: rgba(255,255,255,0.82);
  border-radius: 22px;
  padding: 14px 16px;
}

.label {
  display: block;
  font-size: 0.98rem;
  margin-bottom: 4px;
}

.status-item strong {
  font-size: 1.55rem;
}

.question-top,
.row-practice-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
}

.round-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  background: #ffe4d9;
  color: var(--bad);
  font-weight: 700;
}

.question {
  font-size: clamp(1.9rem, 5vw, 3rem);
  margin: 12px 0 18px;
}

input[type="text"] {
  width: 100%;
  padding: 16px 18px;
  font-size: 1.15rem;
  border-radius: 20px;
  border: 2px solid #d9e3f2;
  background: white;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(44, 107, 177, 0.12);
}

button {
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(35, 50, 74, 0.12);
}

.primary {
  background: linear-gradient(180deg, #ff9d53, var(--accent));
  color: white;
}

.primary:hover {
  background: linear-gradient(180deg, #f58a44, var(--accent-dark));
}

.secondary {
  background: var(--blue-soft);
  color: var(--blue);
}

.row-select-btn {
  border: 2px solid transparent;
  color: var(--blue);
  font-weight: 700;
}

.row-select-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.feedback {
  min-height: 28px;
  margin-top: 16px;
  font-weight: 700;
}

.timed-hint,
.rows-intro,
.row-summary,
.retry-note,
.hero-text {
  color: var(--muted);
  line-height: 1.6;
}

.message {
  min-height: 24px;
  margin-top: 14px;
  font-weight: 700;
  color: var(--bad);
}

.retry-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.row-sequence {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 14px;
}

.row-card {
  min-height: 144px;
  padding: 14px;
  border-radius: 22px;
  background: #fcfdff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.row-card.fixed,
.row-card.revealed-correct {
  background: #eefaf2;
  border-color: #c7e7d2;
}

.row-card.revealed-wrong {
  background: #fff3f3;
  border-color: #efc0c0;
}

.row-card-label {
  font-size: 0.95rem;
}

.row-card-value {
  font-family: 'Baloo 2', 'Nunito', sans-serif;
  font-size: 2.1rem;
  font-weight: 800;
}

.row-card-value.wrong {
  color: var(--bad);
}

.row-card-value.correct {
  color: var(--ok);
}

.reveal-btn,
.self-check-btn {
  width: 100%;
  border-radius: 16px;
  padding: 10px 12px;
}

.reveal-btn {
  background: white;
  border: 2px dashed #bfd0ea;
  color: var(--blue);
}

.self-check {
  display: grid;
  gap: 8px;
}

.self-check-btn.correct-btn {
  background: #e9f8ef;
  color: var(--ok);
}

.self-check-btn.wrong-btn {
  background: #fff0f0;
  color: var(--bad);
}

.success {
  color: var(--ok);
}

.error {
  color: var(--bad);
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .hero-shell {
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    min-height: auto;
  }

  .hero-copy {
    max-width: none;
  }

  .hero-art {
    flex: none;
    align-self: center;
  }

  .hero-image {
    max-width: 320px;
  }
}


@media (max-width: 760px) {
  .practice-mode-box,
  .multiplier-grid,
  .status,
  .row-selector {
    grid-template-columns: 1fr 1fr;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .question-top,
  .actions,
  .settings-actions,
  .round-bar,
  .limit-box,
  .row-practice-top {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 520px) {
  .practice-mode-box,
  .multiplier-grid,
  .status,
  .row-selector {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.8rem;
  }
}
