:root {
  color-scheme: light;
  --ink: #253250;
  --muted: #70809f;
  --blue: #4779df;
  --blue-dark: #315fc1;
  --purple: #725ce0;
  --line: #e2e8f5;
  --card: #ffffff;
  --page: #f5f8ff;
  --yellow: #ffca5b;
  --shadow: 0 20px 50px rgba(61, 91, 153, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(205, 222, 255, 0.55), transparent 27rem),
    radial-gradient(circle at 93% 13%, rgba(238, 229, 255, 0.75), transparent 25rem),
    var(--page);
  font-family: "Nunito", "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.page-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 28px;
}

.intro-card,
.game-card {
  border: 1px solid rgba(221, 229, 246, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.intro-card {
  position: relative;
  display: flex;
  min-height: 250px;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  overflow: hidden;
  padding: 42px 60px;
}

.intro-card::after {
  position: absolute;
  right: -78px;
  bottom: -108px;
  width: 280px;
  height: 280px;
  border: 38px solid rgba(224, 233, 255, 0.65);
  border-radius: 50%;
  content: "";
}

.intro-copy {
  position: relative;
  z-index: 1;
  max-width: 700px;
}

.eyebrow,
.section-kicker {
  color: var(--purple);
  font-size: 0.77rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
  text-transform: uppercase;
}

.sparkle {
  color: var(--yellow);
  font-size: 1.3rem;
  line-height: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 11px;
  color: #253251;
  font-size: clamp(2.05rem, 4vw, 3.4rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

h1 span {
  color: var(--blue);
}

.intro-text {
  max-width: 560px;
  margin-bottom: 21px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

.tip-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid #f5e5bd;
  border-radius: 999px;
  color: #8c6b2a;
  background: #fffaf0;
  font-size: 0.81rem;
  font-weight: 700;
}

.mascot {
  position: relative;
  z-index: 1;
  width: 190px;
  height: 150px;
  flex: 0 0 190px;
}

.mascot-face {
  position: absolute;
  top: 18px;
  left: 23px;
  display: grid;
  width: 126px;
  height: 126px;
  place-items: center;
  border: 7px solid #7798e9;
  border-radius: 42% 58% 52% 48%;
  background: #dce7ff;
  box-shadow: inset -8px -8px 0 rgba(165, 185, 245, 0.45);
  transform: rotate(-8deg);
}

.eye {
  position: absolute;
  top: 43px;
  width: 10px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink);
}

.left-eye {
  left: 35px;
}

.right-eye {
  right: 35px;
}

.smile {
  position: absolute;
  bottom: 27px;
  left: 48px;
  width: 29px;
  height: 15px;
  border-bottom: 4px solid var(--ink);
  border-radius: 0 0 30px 30px;
}

.mascot-star {
  position: absolute;
  color: var(--yellow);
  font-size: 2rem;
  font-weight: 900;
}

.star-one {
  top: 2px;
  right: 8px;
}

.star-two {
  bottom: 4px;
  left: 3px;
  color: #9e8df0;
  font-size: 1.5rem;
}

.game-card {
  margin-top: 26px;
  padding: 31px 32px 23px;
}

.game-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 3px 25px;
}

.section-kicker {
  margin-bottom: 5px;
  color: #9a8ce5;
  font-size: 0.68rem;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  font-weight: 900;
  letter-spacing: -0.025em;
}

.reset-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 7px 16px rgba(71, 121, 223, 0.24);
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.reset-button {
  min-height: 45px;
  padding: 0 17px;
}

.reset-button:hover,
.secondary-button:hover {
  background: var(--blue-dark);
  box-shadow: 0 9px 20px rgba(71, 121, 223, 0.3);
  transform: translateY(-2px);
}

.reset-button:active,
.secondary-button:active {
  transform: translateY(0);
}

.reset-button:focus-visible,
.secondary-button:focus-visible {
  outline: 3px solid #b8c9fa;
  outline-offset: 3px;
}

.reset-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.board-wrap {
  min-height: 445px;
  padding: 14px;
  border: 1px solid #e5ebf8;
  border-radius: 21px;
  background: #f9fbff;
}

.symbol-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
}

.symbol-cell {
  display: flex;
  min-width: 0;
  min-height: 72px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #e3e9f6;
  border-radius: 12px;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.symbol-cell:hover {
  z-index: 1;
  border-color: #a9bff3;
  box-shadow: 0 8px 18px rgba(78, 105, 164, 0.13);
  transform: translateY(-2px);
}

.cell-number {
  color: #6e85b6;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
}

.cell-symbol {
  display: block;
  min-height: 34px;
  margin-top: 5px;
  color: #253250;
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif;
  font-size: 1.72rem;
  font-weight: 600;
  line-height: 1;
}

.loading-state,
.error-state {
  display: flex;
  min-height: 415px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.loading-state p,
.error-state p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.loader {
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  border: 4px solid #dce6fb;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.error-icon {
  display: grid;
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 50%;
  color: #9b6a22;
  background: #fff0c9;
  font-size: 1.25rem;
  font-weight: 900;
}

.error-state h3 {
  margin-bottom: 7px;
  font-size: 1.12rem;
}

.error-state p {
  max-width: 400px;
  margin-bottom: 18px;
  line-height: 1.55;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  color: #5847b2;
  background: #eeeaff;
  font-size: 0.86em;
}

.secondary-button {
  min-height: 39px;
  padding: 0 15px;
  font-size: 0.9rem;
}

.game-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 4px 0;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #5671ad;
  font-size: 0.81rem;
  font-weight: 800;
}

.status-dot span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5fcb94;
  box-shadow: 0 0 0 4px #e4f8ed;
}

.game-footer p {
  margin: 0;
  color: #94a2ba;
  font-size: 0.78rem;
  font-weight: 700;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  padding: 22px 6px 0;
  color: #9aa8c2;
  font-size: 0.75rem;
  font-weight: 700;
}

.footer-symbols {
  color: #a99bf0;
  letter-spacing: 0.35em;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 600px);
    padding-top: 20px;
  }

  .intro-card {
    min-height: 0;
    padding: 30px 25px;
  }

  .mascot {
    display: none;
  }

  .game-card {
    padding: 24px 12px 18px;
  }

  .game-heading {
    align-items: flex-start;
    margin: 0 4px 20px;
  }

  .reset-button {
    flex: 0 0 auto;
    padding: 0 13px;
  }

  .board-wrap {
    padding: 7px;
  }

  .symbol-grid {
    gap: 5px;
  }

  .symbol-cell {
    min-height: 59px;
    border-radius: 9px;
  }

  .cell-number {
    font-size: 0.65rem;
  }

  .cell-symbol {
    min-height: 27px;
    margin-top: 3px;
    font-size: 1.27rem;
  }

  .loading-state,
  .error-state {
    min-height: 390px;
  }
}

@media (max-width: 440px) {
  .intro-card {
    padding: 25px 20px;
    border-radius: 22px;
  }

  .intro-text {
    font-size: 0.92rem;
  }

  .tip-pill {
    align-items: flex-start;
    border-radius: 14px;
    font-size: 0.75rem;
    line-height: 1.35;
  }

  .game-heading {
    gap: 10px;
  }

  .reset-button {
    min-height: 40px;
    padding: 0 10px;
    font-size: 0.78rem;
  }

  .reset-icon {
    font-size: 1.1rem;
  }

  .symbol-cell {
    min-height: 51px;
  }

  .cell-symbol {
    font-size: 1.08rem;
  }

  .game-footer {
    display: block;
  }

  .game-footer p {
    margin-top: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
