:root {
  color-scheme: light;
  --viewport-height: 100vh;
  --play-board-size: 540px;
  --ink: #20312b;
  --muted: #617069;
  --paper: #fffdf8;
  --cream: #f7f3e8;
  --line: #a9b2ab;
  --strong-line: #273d35;
  --leaf: #2f765d;
  --leaf-dark: #1f5946;
  --leaf-pale: #dcefe6;
  --sun: #f2b84b;
  --error: #a23b32;
  --error-pale: #fae5e1;
  --shadow: 0 18px 45px rgb(44 58 51 / 12%);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--cream);
  overscroll-behavior: none;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgb(242 184 75 / 17%), transparent 30rem),
    radial-gradient(circle at 95% 40%, rgb(47 118 93 / 10%), transparent 34rem),
    var(--cream);
  font-family: ui-rounded, "Avenir Next", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body,
button {
  user-select: none;
  -webkit-user-select: none;
}

button {
  color: inherit;
  font: inherit;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 5px solid var(--sun);
  outline-offset: 4px;
}

.app-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
}

.topbar,
.game-heading,
.level-strip-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.topbar {
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 15px;
}

.brand-mark {
  display: grid;
  width: 66px;
  height: 66px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 20px;
  color: #fff;
  background: var(--leaf);
  box-shadow: 0 8px 0 var(--leaf-dark);
  font-size: 2.25rem;
  font-weight: 850;
}

.eyebrow,
.level-kicker,
.celebration-kicker {
  margin: 0 0 3px;
  color: var(--leaf-dark);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.05;
}

.topbar-actions {
  display: flex;
  gap: 12px;
}

.utility-button {
  display: inline-flex;
  min-height: 62px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border: 2px solid #c9cec9;
  border-radius: 18px;
  background: rgb(255 253 248 / 86%);
  box-shadow: 0 5px 0 #d8d7d0;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
}

.utility-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #d8d7d0;
}

.utility-button[aria-pressed="true"] {
  border-color: var(--leaf);
  background: var(--leaf-pale);
}

.utility-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.fullscreen-icon {
  width: 22px;
  height: 22px;
  border: solid var(--ink);
  border-width: 3px 0 0 3px;
  box-shadow: 5px 5px 0 -2px var(--paper), 8px 8px 0 -2px var(--ink);
}

.game-card {
  display: grid;
  grid-template-columns: minmax(310px, 1fr) minmax(270px, 0.72fr);
  grid-template-areas:
    "heading heading"
    "instruction instruction"
    "board controls";
  column-gap: clamp(30px, 7vw, 90px);
  padding: clamp(22px, 4vw, 44px);
  border: 2px solid rgb(39 61 53 / 9%);
  border-radius: 34px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.game-screen {
  width: 100%;
}

.game-menu {
  padding: clamp(28px, 5vw, 56px);
  border: 2px solid rgb(39 61 53 / 9%);
  border-radius: 34px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.menu-heading {
  margin-bottom: 30px;
  text-align: center;
}

.menu-heading h2 {
  margin-bottom: 10px;
  font-size: clamp(2.4rem, 6vw, 4.1rem);
  line-height: 1;
}

.menu-heading > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.3rem;
  font-weight: 650;
}

.game-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 42px);
}

.game-choice {
  display: flex;
  min-height: 280px;
  align-items: center;
  gap: clamp(20px, 4vw, 36px);
  padding: clamp(24px, 4vw, 38px);
  border: 4px solid var(--leaf-dark);
  border-radius: 30px;
  background: #fff;
  box-shadow: 0 10px 0 var(--leaf-dark);
  text-align: left;
  cursor: pointer;
}

.game-choice:active {
  transform: translateY(6px);
  box-shadow: 0 4px 0 var(--leaf-dark);
}

.pattern-choice {
  border-color: #765b16;
  box-shadow: 0 10px 0 #765b16;
}

.game-choice-picture {
  display: grid;
  width: 155px;
  height: 155px;
  flex: 0 0 155px;
  overflow: hidden;
  border: 5px solid var(--strong-line);
  border-radius: 24px;
  background: #f4f5f1;
}

.sudoku-mini {
  grid-template-columns: repeat(2, 1fr);
}

.sudoku-mini span {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  font-size: 2.7rem;
  font-weight: 850;
}

.sudoku-mini span:nth-child(2n) {
  border-right: 0;
}

.sudoku-mini span:nth-child(n + 3) {
  border-bottom: 0;
}

.pattern-mini {
  grid-template-columns: repeat(2, 1fr);
  place-items: center;
  padding: 12px;
  background: #fff4cf;
}

.pattern-mini i {
  display: block;
  width: 38px;
  height: 38px;
  background: var(--leaf);
}

.pattern-mini .mini-circle {
  border-radius: 50%;
}

.pattern-mini b {
  font-size: 3.2rem;
}

.game-choice-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 10px;
}

.game-choice-copy strong {
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  line-height: 1;
}

.game-choice-copy > span {
  color: var(--muted);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 650;
}

.game-choice-copy small {
  color: var(--leaf-dark);
  font-size: 1rem;
  font-weight: 850;
}

.pattern-card {
  padding: clamp(24px, 4vw, 44px);
  border: 2px solid rgb(39 61 53 / 9%);
  border-radius: 34px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.pattern-card .game-heading h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
}

.pattern-sequence {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: clamp(12px, 2vw, 22px);
  margin: 8px auto 34px;
}

.pattern-tile {
  position: relative;
  display: flex;
  min-width: 0;
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px;
  border: 4px solid var(--strong-line);
  border-radius: 24px;
  background: #f3f5f0;
}

.pattern-tile.question {
  border-color: #9b7217;
  color: #765b16;
  background: #fff1bc;
  font-size: clamp(3.5rem, 8vw, 6.5rem);
  font-weight: 900;
}

.pattern-mark {
  display: block;
  width: min(40%, 52px);
  aspect-ratio: 1;
  flex: 0 1 52px;
  border: 5px solid var(--leaf-dark);
  background: var(--leaf);
}

.pattern-mark.circle {
  border-radius: 50%;
}

.pattern-mark.diamond {
  transform: rotate(45deg) scale(0.76);
}

.pattern-mark.outline {
  background: transparent;
}

.pattern-tile[data-count="3"] {
  gap: 4px;
}

.pattern-tile[data-count="3"] .pattern-mark {
  width: 30%;
}

.pattern-answers {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: clamp(20px, 4vw, 36px);
}

.pattern-answer {
  min-height: 150px;
  border: 4px solid var(--leaf-dark);
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 9px 0 var(--leaf-dark);
  cursor: pointer;
}

.pattern-answer:active {
  transform: translateY(6px);
  box-shadow: 0 3px 0 var(--leaf-dark);
}

.pattern-answer.correct {
  background: var(--leaf-pale);
  animation: cell-finish 700ms ease-out;
}

.pattern-answer.try-again {
  border-color: var(--error);
  background: var(--error-pale);
  animation: gentle-nudge 420ms ease-out;
}

.pattern-answer .pattern-tile {
  width: 120px;
  height: 120px;
  margin: auto;
  border: 0;
  background: transparent;
}

.pattern-flying-tile {
  position: fixed;
  z-index: 40;
  margin: 0;
  pointer-events: none;
  transform-origin: top left;
  transition: transform 600ms cubic-bezier(0.22, 0.75, 0.28, 1);
  box-shadow: 0 12px 28px rgb(32 49 43 / 24%);
}

.pattern-filled-answer {
  border-color: var(--leaf-dark);
  background: var(--leaf-pale);
  animation: pattern-land 450ms ease-out;
}

.game-heading {
  grid-area: heading;
}

.game-heading h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
}

.score-card {
  display: flex;
  min-width: 126px;
  min-height: 78px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid #e0c887;
  border-radius: 20px;
  background: #fff3ce;
}

.score-label {
  color: #665018;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-card strong {
  font-size: 2rem;
  line-height: 1;
}

.instruction {
  grid-area: instruction;
  margin: 16px 0 25px;
  color: var(--muted);
  font-size: clamp(1.15rem, 2.3vw, 1.45rem);
  font-weight: 650;
}

.board-wrap {
  display: flex;
  grid-area: board;
  align-items: center;
  justify-content: center;
}

.sudoku-board {
  position: relative;
  display: grid;
  width: min(100%, 540px);
  height: auto;
  aspect-ratio: 1;
  grid-template-columns: repeat(4, 25%);
  grid-template-rows: repeat(4, 25%);
  border: 6px solid var(--strong-line);
  border-radius: 18px;
  overflow: hidden;
  background: #fffdf8;
  box-shadow: 0 10px 0 rgb(32 49 43 / 14%);
}

.sudoku-board::before,
.sudoku-board::after {
  position: absolute;
  z-index: 5;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  content: "";
  pointer-events: none;
}

.sudoku-board::before {
  background:
    linear-gradient(to right, transparent 24.65%, var(--line) 24.65%, var(--line) 25.35%, transparent 25.35%, transparent 74.65%, var(--line) 74.65%, var(--line) 75.35%, transparent 75.35%),
    linear-gradient(to bottom, transparent 24.65%, var(--line) 24.65%, var(--line) 25.35%, transparent 25.35%, transparent 74.65%, var(--line) 74.65%, var(--line) 75.35%, transparent 75.35%);
}

.sudoku-board::after {
  background:
    linear-gradient(to right, transparent 49.35%, var(--strong-line) 49.35%, var(--strong-line) 50.65%, transparent 50.65%),
    linear-gradient(to bottom, transparent 49.35%, var(--strong-line) 49.35%, var(--strong-line) 50.65%, transparent 50.65%);
}

.cell {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: #fff;
  font-size: clamp(2.4rem, 7vw, 5.4rem);
  font-weight: 750;
  line-height: normal;
  text-align: center;
  text-indent: 0;
  vertical-align: middle;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.cell.clue {
  color: #2d3833;
  background:
    repeating-linear-gradient(135deg, rgb(47 118 93 / 4%) 0 8px, transparent 8px 16px),
    #f0f2ed;
  cursor: default;
}

.cell.player-value {
  color: var(--leaf-dark);
  font-weight: 850;
}

.cell.selected {
  z-index: 1;
  color: var(--leaf-dark);
  background: #fff0b7;
  box-shadow: inset 0 0 0 7px var(--sun);
}

.cell.wrong {
  color: var(--error);
  background: var(--error-pale);
  animation: gentle-nudge 420ms ease-out;
}

.cell.completed {
  animation: cell-finish 700ms ease-out both;
  animation-delay: calc(var(--cell-index) * 35ms);
}

.number-pad {
  display: grid;
  grid-area: controls;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: clamp(18px, 3vw, 28px);
  align-self: center;
}

.number-button,
.erase-button,
.hint-button,
.check-button,
.continue-button {
  min-height: 112px;
  border: 3px solid var(--leaf-dark);
  border-radius: 25px;
  background: var(--leaf);
  box-shadow: 0 9px 0 var(--leaf-dark);
  color: #fff;
  font-size: clamp(2.8rem, 7vw, 4.7rem);
  font-weight: 850;
  cursor: pointer;
}

.number-button:active,
.erase-button:active,
.hint-button:active,
.check-button:active,
.continue-button:active {
  transform: translateY(6px);
  box-shadow: 0 3px 0 var(--leaf-dark);
}

.number-button:disabled,
.erase-button:disabled,
.hint-button:disabled,
.check-button:disabled {
  cursor: default;
  opacity: 0.42;
  filter: grayscale(0.35);
}

.erase-button {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-color: #9f4d43;
  background: #fff6f3;
  box-shadow: 0 8px 0 #dec4bf;
  color: #7f3028;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.erase-button:active {
  box-shadow: 0 2px 0 #dec4bf;
}

.erase-symbol,
.hint-symbol {
  font-size: 2.4rem;
  line-height: 0.8;
}

.hint-button,
.check-button {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-color: #8a6b1f;
  background: #fff3ce;
  box-shadow: 0 8px 0 #dbc27c;
  color: #634d16;
  font-size: clamp(1.2rem, 2.6vw, 1.65rem);
}

.hint-button:active,
.check-button:active {
  box-shadow: 0 2px 0 #dbc27c;
}

.check-button {
  grid-column: 1 / -1;
  border-color: var(--leaf-dark);
  background: var(--leaf);
  box-shadow: 0 8px 0 var(--leaf-dark);
  color: #fff;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.check-button[hidden] {
  display: none;
}

.cell.hinted::after {
  position: absolute;
  top: 8px;
  right: 10px;
  content: "?";
  color: #765b16;
  font-size: 1rem;
  font-weight: 900;
}

.fox-mascot {
  position: fixed;
  z-index: 12;
  left: max(6px, env(safe-area-inset-left));
  bottom: max(5px, env(safe-area-inset-bottom));
  width: 104px;
  height: 69px;
  pointer-events: none;
  background-image: url("assets/a_3d_rendered_sprite_sheet_showcases_a_cute_fox_ch.png");
  background-repeat: no-repeat;
  background-size: 300% 300%;
  background-position: 0 0;
  filter: drop-shadow(0 4px 3px rgb(28 51 43 / 20%));
}

body.fullscreen-play .fox-mascot {
  width: 64px;
  height: 43px;
}

.level-strip {
  margin-top: 28px;
  padding: 26px 30px 30px;
  border-radius: 28px;
  background: rgb(255 253 248 / 74%);
}

.level-strip-heading {
  align-items: end;
  margin-bottom: 18px;
}

.level-strip h2 {
  margin-bottom: 0;
  font-size: 1.5rem;
}

.level-strip p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 650;
}

.level-list {
  display: grid;
  grid-template-columns: repeat(10, minmax(64px, 1fr));
  gap: 12px;
}

.level-button {
  position: relative;
  min-height: 68px;
  border: 2px solid #c9cec9;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 5px 0 #d9d9d2;
  font-size: 1.4rem;
  font-weight: 850;
  cursor: pointer;
}

.level-button.current {
  border-color: var(--leaf-dark);
  background: var(--leaf-pale);
  box-shadow: 0 5px 0 var(--leaf-dark);
}

.level-button.complete::after {
  position: absolute;
  top: -9px;
  right: -7px;
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  content: "✓";
  color: #fff;
  background: var(--leaf);
  font-size: 1rem;
}

.level-button.locked {
  color: #7b817e;
  background: #eceeea;
  cursor: default;
}

.celebration {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgb(22 37 31 / 72%);
  backdrop-filter: blur(6px);
}

.celebration[hidden] {
  display: none;
}

.celebration-card {
  position: relative;
  z-index: 2;
  width: min(560px, 100%);
  padding: clamp(32px, 7vw, 58px);
  border: 5px solid #fff;
  border-radius: 36px;
  background: var(--paper);
  box-shadow: 0 24px 80px rgb(0 0 0 / 28%);
  text-align: center;
  animation: celebration-in 600ms cubic-bezier(0.2, 0.8, 0.2, 1.1);
}

.success-check {
  display: grid;
  width: 112px;
  height: 112px;
  margin: 0 auto 24px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--leaf);
  box-shadow: 0 9px 0 var(--leaf-dark);
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
}

.celebration-card h2 {
  margin-bottom: 12px;
  font-size: clamp(2.8rem, 8vw, 4.8rem);
  line-height: 1;
}

.celebration-card p:not(.celebration-kicker) {
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 1.3rem;
  font-weight: 650;
}

.continue-button {
  width: 100%;
  min-height: 92px;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -10%;
  width: 16px;
  height: 30px;
  border-radius: 5px;
  animation: confetti-fall var(--fall-time) ease-in var(--delay) both;
}

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  min-width: min(410px, calc(100% - 40px));
  padding: 18px 26px;
  transform: translate(-50%, 150%);
  border: 3px solid var(--error);
  border-radius: 20px;
  color: #6f2923;
  background: #fff1ee;
  box-shadow: var(--shadow);
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
  transition: transform 250ms ease-out;
}

.toast.show {
  transform: translate(-50%, 0);
}

body.fullscreen-play {
  overflow: hidden;
}

body.fullscreen-play .app-shell {
  display: grid;
  width: 100%;
  height: 100vh;
  height: var(--viewport-height);
  min-height: 0;
  padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  place-items: center;
}

body.fullscreen-play .level-strip {
  display: none;
}

body.fullscreen-play .topbar {
  position: fixed;
  z-index: 30;
  top: max(12px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  margin: 0;
}

body.fullscreen-play .brand,
body.fullscreen-play #soundButton {
  display: none;
}

body.fullscreen-play .fullscreen-button {
  min-height: 50px;
  padding: 9px 14px;
  border-color: var(--strong-line);
  background: var(--paper);
  font-size: 0.95rem;
}

body.fullscreen-play .game-card {
  width: min(1050px, 100%);
  height: 100%;
  max-height: 100%;
  padding: clamp(14px, 2vw, 26px);
  overflow: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

body.fullscreen-play .game-screen {
  width: min(1050px, 100%);
  height: 100%;
}

body.fullscreen-play .pattern-card {
  width: min(1050px, 100%);
  max-height: 100%;
  padding: clamp(18px, 3vw, 34px);
  overflow: hidden;
}

body.fullscreen-play .pattern-card .game-heading {
  padding-right: 190px;
}

body.fullscreen-play .pattern-card .score-card {
  display: none;
}

body.fullscreen-play .pattern-sequence {
  width: min(900px, 100%);
  margin-bottom: clamp(18px, 4vh, 34px);
}

body.fullscreen-play .pattern-answers {
  width: min(760px, 100%);
  margin: 0 auto;
}

body.fullscreen-play .pattern-answer {
  min-height: clamp(120px, 24vh, 180px);
}

body.fullscreen-play .game-heading {
  padding-right: 190px;
}

body.fullscreen-play .score-card {
  display: none;
}

body.fullscreen-play .game-heading h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

body.fullscreen-play .level-kicker {
  font-size: 0.82rem;
}

body.fullscreen-play .instruction {
  margin: 8px 0 14px;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
}

body.fullscreen-play .sudoku-board {
  width: var(--play-board-size);
  height: var(--play-board-size);
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: auto;
  flex: 0 0 auto;
}

body.fullscreen-play .number-pad {
  width: min(100%, 390px);
  gap: clamp(12px, 2vw, 20px);
  justify-self: center;
}

body.fullscreen-play .number-button {
  min-height: 88px;
  min-height: clamp(82px, 15vh, 118px);
}

body.fullscreen-play .erase-button,
body.fullscreen-play .hint-button,
body.fullscreen-play .check-button {
  min-height: 72px;
  min-height: clamp(66px, 10vh, 86px);
}

body.fullscreen-play .game-card::-webkit-scrollbar {
  display: none;
}

@media (orientation: landscape) and (min-width: 560px) {
  body.fullscreen-play .game-card {
    grid-template-columns: minmax(300px, 1fr) minmax(260px, 0.78fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "heading heading"
      "instruction instruction"
      "board controls";
    column-gap: clamp(24px, 5vw, 64px);
  }

  body.fullscreen-play .board-wrap,
  body.fullscreen-play .number-pad {
    min-height: 0;
    align-self: center;
  }
}

@media (orientation: landscape) and (min-width: 560px) and (max-height: 700px) {
  body.fullscreen-play .game-card {
    padding: 12px 20px;
  }

  body.fullscreen-play .game-heading h2 {
    font-size: 2.15rem;
  }

  body.fullscreen-play .level-kicker {
    margin-bottom: 0;
    font-size: 0.72rem;
  }

  body.fullscreen-play .instruction {
    margin: 4px 0 8px;
    font-size: 1rem;
  }

  body.fullscreen-play .number-button {
    min-height: 72px;
    min-height: clamp(64px, 13vh, 78px);
    border-radius: 20px;
    font-size: clamp(2.4rem, 8vh, 3.2rem);
  }

  body.fullscreen-play .erase-button,
  body.fullscreen-play .hint-button,
  body.fullscreen-play .check-button {
    min-height: 58px;
    min-height: clamp(52px, 9vh, 64px);
    font-size: clamp(0.9rem, 3vh, 1.1rem);
  }
}

@media (orientation: landscape) and (min-width: 560px) and (max-height: 450px) {
  body.fullscreen-play .game-card {
    padding-block: 8px;
  }

  body.fullscreen-play .game-heading h2 {
    font-size: 1.8rem;
  }

  body.fullscreen-play .instruction {
    margin: 2px 0 5px;
    font-size: 0.9rem;
  }

  body.fullscreen-play .number-pad {
    gap: 8px;
  }

  body.fullscreen-play .number-button {
    min-height: 56px;
    font-size: 2.4rem;
  }

  body.fullscreen-play .erase-button,
  body.fullscreen-play .hint-button,
  body.fullscreen-play .check-button {
    min-height: 48px;
    font-size: 0.88rem;
  }
}

@keyframes gentle-nudge {
  0%,
  100% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-7px);
  }
  65% {
    transform: translateX(7px);
  }
}

@keyframes cell-finish {
  50% {
    transform: scale(0.9);
    background: var(--leaf-pale);
  }
}

@keyframes pattern-land {
  0% {
    transform: scale(0.86);
  }
  65% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes celebration-in {
  from {
    transform: translateY(20px) scale(0.9);
    opacity: 0;
  }
}

@keyframes confetti-fall {
  from {
    transform: translate3d(0, -15vh, 0) rotate(0);
    opacity: 1;
  }
  to {
    transform: translate3d(var(--drift), 115vh, 0) rotate(360deg);
    opacity: 0.9;
  }
}

@media (max-width: 780px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    flex-direction: column;
  }

  .utility-button {
    min-width: 150px;
  }

  .game-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "heading"
      "instruction"
      "board"
      "controls";
  }

  .game-choices {
    grid-template-columns: 1fr;
  }

  .game-choice {
    min-height: 220px;
  }

  .pattern-sequence {
    grid-template-columns: repeat(5, minmax(62px, 1fr));
    gap: 8px;
  }

  .pattern-tile {
    padding: 7px;
    border-width: 3px;
    border-radius: 16px;
  }

  .pattern-answers {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .pattern-answer {
    min-width: 0;
    min-height: 125px;
  }

  .pattern-answer .pattern-tile {
    width: 96px;
    height: 96px;
  }

  .sudoku-board {
    width: min(100%, 500px);
  }

  .number-pad {
    width: min(100%, 560px);
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    justify-self: center;
    margin-top: 26px;
  }

  .number-button,
  .erase-button,
  .hint-button,
  .check-button {
    min-width: 0;
    min-height: 82px;
    border-radius: 20px;
    font-size: clamp(2.1rem, 8vw, 3.3rem);
  }

  .erase-button {
    flex-direction: column;
    gap: 0;
    font-size: 0.86rem;
  }

  .hint-button {
    flex-direction: column;
    gap: 2px;
    font-size: 0.86rem;
  }

  .check-button {
    grid-column: 1 / -1;
  }

  .erase-symbol,
  .hint-symbol {
    font-size: 2rem;
  }

  .level-list {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (orientation: portrait) and (max-width: 780px) {
  body.fullscreen-play .game-card {
    display: grid;
    grid-template-rows: auto auto auto auto;
    height: 100%;
    overflow-y: auto;
  }

  body.fullscreen-play .game-heading {
    padding-right: 185px;
  }

  body.fullscreen-play .sudoku-board {
    width: var(--play-board-size);
    height: var(--play-board-size);
    max-width: 100%;
    max-height: none;
  }

  body.fullscreen-play .number-pad {
    margin-top: 14px;
  }
}

@media (max-width: 540px) {
  .app-shell {
    padding-inline: 12px;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    flex-direction: row;
  }

  .utility-button {
    min-width: 0;
    flex: 1;
    padding-inline: 10px;
  }

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

  .game-menu,
  .pattern-card {
    padding: 20px 12px 24px;
    border-radius: 24px;
  }

  .game-choice {
    min-height: 190px;
    gap: 16px;
    padding: 20px;
    border-width: 3px;
    border-radius: 22px;
  }

  .game-choice-picture {
    width: 110px;
    height: 110px;
    flex-basis: 110px;
  }

  .pattern-answer {
    min-height: 105px;
    border-width: 3px;
    border-radius: 18px;
  }

  .pattern-answer .pattern-tile {
    width: 82px;
    height: 82px;
  }

  .game-heading {
    padding-inline: 6px;
  }

  .score-card {
    min-width: 100px;
    min-height: 68px;
  }

  .instruction {
    padding-inline: 6px;
  }

  .sudoku-board {
    border-width: 4px;
    border-radius: 12px;
  }

  .number-pad {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .number-button,
  .erase-button,
  .hint-button,
  .check-button {
    min-height: 88px;
    border-width: 2px;
    border-radius: 16px;
    box-shadow: 0 6px 0 var(--leaf-dark);
  }

  .erase-button {
    min-height: 82px;
    flex-direction: row;
    gap: 10px;
    box-shadow: 0 6px 0 #dec4bf;
    font-size: 1.15rem;
  }

  .hint-button {
    min-height: 82px;
    flex-direction: row;
    font-size: 1.05rem;
  }

  .check-button {
    min-height: 82px;
  }

  .level-strip {
    padding-inline: 16px;
  }

  .level-strip-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
}

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