:root {
  --bg: #f6f8fc;
  --bg-deep: #e9eef7;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: #ffffff;
  --line: rgba(22, 46, 84, 0.12);
  --text: #14233d;
  --muted: #5f6f88;
  --blue: #1c67c9;
  --blue-deep: #123f8c;
  --orange: #f28c2f;
  --shadow: 0 22px 60px rgba(25, 54, 104, 0.14);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(242, 140, 47, 0.18), transparent 34%),
    radial-gradient(circle at bottom right, rgba(28, 103, 201, 0.18), transparent 36%),
    linear-gradient(180deg, #f9fbff 0%, var(--bg) 100%);
  position: relative;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  width: 20rem;
  height: 20rem;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.42;
  pointer-events: none;
}

.bg-glow-one {
  top: -5rem;
  left: -4rem;
  background: rgba(242, 140, 47, 0.28);
}

.bg-glow-two {
  right: -5rem;
  bottom: -4rem;
  background: rgba(28, 103, 201, 0.22);
}

.shell {
  width: min(100%, 72rem);
  margin: 0 auto;
  padding: 1.25rem;
}

.screen {
  display: none;
}

.screen-active {
  display: block;
}

.hero {
  padding: 2.25rem 0 1.25rem;
}

.eyebrow,
.section-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

.hero h1 {
  margin: 0.55rem 0 0;
  max-width: 18ch;
  font-size: clamp(2rem, 5vw, 3.9rem);
  line-height: 0.98;
}

.intro,
.helper-text {
  margin: 0.75rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.panel,
.result-card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.panel {
  padding: 1.25rem;
}

.result-card {
  padding: 1rem;
}

.stack-lg > * + * {
  margin-top: 1.4rem;
}

.stack-sm > * + * {
  margin-top: 0.8rem;
}

.choice-grid,
.count-grid,
.word-grid {
  display: grid;
  gap: 0.8rem;
}

.choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.count-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.choice-option input,
.count-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-option span,
.count-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.8rem;
  padding: 0.9rem 1rem;
  background: var(--surface-strong);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text);
  font-weight: 600;
  text-align: center;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.choice-option input:checked + span,
.count-option input:checked + span {
  border-color: rgba(28, 103, 201, 0.4);
  background: linear-gradient(180deg, rgba(28, 103, 201, 0.1), rgba(28, 103, 201, 0.04));
  box-shadow: 0 14px 28px rgba(28, 103, 201, 0.14);
  transform: translateY(-1px);
}

.button {
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  min-height: 3.4rem;
  padding: 0.9rem 1.25rem;
  color: #fff;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%);
  box-shadow: 0 16px 30px rgba(20, 63, 140, 0.26);
}

.button-secondary {
  min-height: 2.9rem;
  padding: 0.7rem 1rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
}

.topbar,
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar {
  padding: 1.25rem 0 1rem;
}

.meta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
}

.meta-pill {
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.word-grid {
  margin-top: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.word-card {
  min-height: 8rem;
  padding: 1rem;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(237, 243, 252, 0.9)),
    var(--surface-strong);
  border: 1px solid rgba(28, 103, 201, 0.12);
  box-shadow: 0 16px 30px rgba(25, 54, 104, 0.08);
}

.word-topic {
  margin: 0;
  color: var(--orange);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.word-text {
  margin: 0.65rem 0 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.05;
  font-weight: 800;
  word-break: break-word;
}

@media (max-width: 720px) {
  .shell {
    padding: 1rem;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .count-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .topbar,
  .result-head {
    flex-direction: column;
    align-items: stretch;
  }

  .meta-group {
    justify-content: flex-start;
  }

  .button-primary,
  .button-secondary {
    width: 100%;
  }
}
