:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display-font: Georgia, "Times New Roman", serif;
  --ink: #191735;
  --muted: #76708f;
  --paper: #fbf7f0;
  --panel: rgba(255, 252, 246, 0.82);
  --line: #e8d9ca;
  --heavy-line: #735f52;
  --side-gutter: clamp(44px, 12vw, 96px);
}

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

.icon-sprite {
  display: none;
}

svg {
  display: block;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 238, 218, 0.88), transparent 28%),
    radial-gradient(circle at 82% 6%, rgba(239, 232, 255, 0.82), transparent 30%),
    radial-gradient(circle at 50% 96%, rgba(247, 234, 255, 0.8), transparent 34%),
    linear-gradient(145deg, #fffaf4 0%, #fbf8f1 36%, #f8f4ff 74%, #fff6ee 100%);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

button {
  font: inherit;
}

.app {
  width: 100%;
  min-height: 100vh;
  padding: max(20px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.topbar {
  width: min(100% - 28px, 680px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

h1 {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(46px, 13.5vw, 88px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  color: #131334;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

h1 span {
  color: #b82978;
  background: linear-gradient(90deg, #3e2b9b 0%, #b82978 46%, #f27632 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
}

h1::after {
  content: "";
  position: absolute;
  left: 33%;
  top: 5px;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, #ff8a32, #e94f8e 55%, #7f00ff);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  filter: drop-shadow(0 7px 12px rgba(126, 60, 128, 0.18));
}

.ghost-button,
.difficulty-button {
  border: 1px solid rgba(21, 21, 21, 0.18);
  background: rgba(255, 252, 248, 0.82);
  color: var(--ink);
  border-radius: 18px;
  cursor: pointer;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.ghost-button {
  flex: 0 0 auto;
  padding: 11px 17px;
  font-weight: 700;
  min-height: 42px;
  box-shadow: 0 10px 28px rgba(98, 64, 40, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.ghost-button.subtle {
  min-width: 96px;
  color: #393554;
}

.ghost-button.danger {
  background: #d92f4a;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.72);
}

.screen {
  width: 100%;
}

.screen[hidden],
[hidden] {
  display: none !important;
}

.start-screen {
  width: min(100% - 28px, 620px);
  display: grid;
  gap: 16px;
  margin-top: 8px;
}

.daily-card {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 138px;
  padding: 22px 20px;
  overflow: hidden;
  border: 1px solid rgba(127, 83, 255, 0.28);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 252, 0.96), rgba(253, 249, 255, 0.86)),
    #fffdf8;
  box-shadow: 0 22px 52px rgba(35, 28, 47, 0.11), inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.daily-card::after {
  content: "";
  position: absolute;
  left: -34px;
  right: -22px;
  bottom: -13px;
  height: 82px;
  background:
    radial-gradient(ellipse at 10% 90%, rgba(255, 127, 0, 0.2), transparent 45%),
    radial-gradient(ellipse at 52% 88%, rgba(255, 242, 0, 0.18), transparent 42%),
    radial-gradient(ellipse at 82% 68%, rgba(127, 0, 255, 0.2), transparent 46%),
    linear-gradient(105deg, rgba(255, 127, 0, 0.18), rgba(255, 242, 0, 0.16) 38%, rgba(0, 188, 212, 0.12) 60%, rgba(127, 0, 255, 0.2));
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  opacity: 0.92;
}

.date-icon {
  position: relative;
  z-index: 1;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(250, 247, 241, 0.88);
  border: 1px solid rgba(30, 26, 54, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 10px 24px rgba(35, 28, 47, 0.08);
}

.date-icon svg {
  width: 31px;
  height: 31px;
  color: #171a48;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.eyebrow {
  position: relative;
  z-index: 1;
  color: #74718d;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.daily-card strong {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 100%;
  font-family: var(--display-font);
  font-size: clamp(25px, 6.35vw, 48px);
  line-height: 0.98;
  white-space: normal;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  min-height: 112px;
  overflow: hidden;
  border: 1px solid rgba(30, 26, 54, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 252, 0.82);
  box-shadow: 0 18px 46px rgba(35, 28, 47, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.stat {
  position: relative;
  min-height: 112px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  padding: 12px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.stat:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 22px;
  bottom: 22px;
  width: 1px;
  background: rgba(30, 26, 54, 0.13);
}

.stat-icon {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 999px;
  background: #edf8df;
}

.stat-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.streak-icon {
  color: #5c9b32;
}

.record-icon {
  color: #3f7fe8;
  background: #dfecff;
}

.solved-icon {
  color: #7f3be8;
  background: #f1e5ff;
}

.stat > span:not(.stat-icon) {
  font-family: var(--display-font);
  font-size: 32px;
  line-height: 1;
}

.stat small {
  color: #6f6884;
  font-size: 15px;
  font-weight: 650;
}

.difficulty-list {
  display: grid;
  gap: 14px;
}

.difficulty-button {
  --accent: #00a651;
  --accent-2: #7fff00;
  --accent-3: #00bcd4;
  --accent-wash: rgba(0, 166, 81, 0.11);
  --accent-shadow: rgba(0, 166, 81, 0.28);
  --art-bg: #d9f6bb;
  --name-color: #23782f;
  min-height: 116px;
  padding: 0;
  overflow: hidden;
  text-align: left;
  border-color: rgba(30, 26, 54, 0.12);
  border-radius: 18px;
  box-shadow: 0 18px 46px rgba(35, 28, 47, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.difficulty-button[data-difficulty="easy"] {
  --accent: #00a651;
  --accent-2: #7fff00;
  --accent-3: #00bcd4;
  --accent-wash: rgba(0, 166, 81, 0.11);
  --accent-shadow: rgba(0, 166, 81, 0.28);
  --art-bg: #d8f4b6;
  --name-color: #23782f;
}

.difficulty-button[data-difficulty="medium"] {
  --accent: #ff7f00;
  --accent-2: #ff4fa3;
  --accent-3: #e32636;
  --accent-wash: rgba(255, 127, 0, 0.12);
  --accent-shadow: rgba(255, 127, 0, 0.3);
  --art-bg: #ffd77d;
  --name-color: #c95b00;
}

.difficulty-button[data-difficulty="hard"] {
  --accent: #7f00ff;
  --accent-2: #0066ff;
  --accent-3: #e32636;
  --accent-wash: rgba(127, 0, 255, 0.12);
  --accent-shadow: rgba(127, 0, 255, 0.28);
  --art-bg: #5d2ecb;
  --name-color: #38208e;
}

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

.difficulty-content {
  display: grid;
  grid-template-columns: 116px 1fr 54px;
  align-items: center;
  gap: 18px;
  min-height: 116px;
  padding: 0 18px 0 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.72)),
    linear-gradient(90deg, var(--accent-wash), transparent 60%);
}

.difficulty-main {
  min-width: 0;
  display: grid;
  align-content: center;
  padding: 12px 0;
}

.difficulty-name {
  display: block;
  font-family: var(--display-font);
  color: var(--name-color);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
}

.difficulty-meta {
  display: block;
  color: #666988;
  font-size: 16px;
  margin-top: 5px;
}

.difficulty-history {
  width: 118px;
  display: grid;
  grid-template-columns: repeat(7, 10px);
  grid-auto-rows: 10px;
  gap: 7px;
  margin-top: 14px;
}

.solve-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(25, 23, 53, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.solve-dot.filled {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 3px 8px var(--accent-shadow);
}

.solve-dot.filled:nth-child(3n) {
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
}

.solve-overflow {
  min-width: 22px;
  height: 14px;
  display: grid;
  place-items: center;
  color: #4e4864;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.difficulty-art {
  position: relative;
  align-self: stretch;
  display: grid;
  place-items: center;
  min-height: 116px;
  overflow: hidden;
  background: var(--art-bg);
}

.difficulty-art::before,
.difficulty-art::after {
  content: "";
  position: absolute;
}

.difficulty-button[data-difficulty="easy"] .difficulty-art {
  background:
    radial-gradient(circle at 105% -8%, rgba(255, 255, 255, 0.42) 0 42%, transparent 43%),
    radial-gradient(circle at 65% 115%, rgba(127, 255, 0, 0.38) 0 42%, transparent 43%),
    linear-gradient(135deg, #94e766, #eefccf);
}

.difficulty-button[data-difficulty="easy"] .difficulty-art::before {
  left: -26px;
  top: -12px;
  width: 118px;
  height: 118px;
  border-radius: 0 0 118px 0;
  background: rgba(112, 211, 70, 0.42);
  transform: rotate(2deg);
}

.difficulty-button[data-difficulty="easy"] .difficulty-art::after {
  left: 0;
  bottom: -46px;
  width: 112px;
  height: 92px;
  border-radius: 100% 100% 0 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.36), rgba(127, 255, 0, 0.28));
}

.difficulty-button[data-difficulty="medium"] .difficulty-art {
  background:
    radial-gradient(circle at -8% 12%, rgba(255, 83, 47, 0.74) 0 39%, transparent 40%),
    radial-gradient(circle at 20% 106%, rgba(227, 38, 90, 0.68) 0 50%, transparent 51%),
    radial-gradient(circle at 100% 100%, rgba(255, 94, 189, 0.36) 0 52%, transparent 53%),
    radial-gradient(circle at 58% -14%, rgba(255, 191, 0, 0.58) 0 46%, transparent 47%),
    linear-gradient(135deg, #ff8d3a, #ffe097);
}

.difficulty-button[data-difficulty="hard"] .difficulty-art {
  background:
    linear-gradient(38deg, rgba(25, 13, 71, 0.88), transparent 46%),
    linear-gradient(142deg, rgba(127, 0, 255, 0.48), transparent 42%),
    linear-gradient(90deg, transparent 0 30%, rgba(255, 255, 255, 0.08) 30% 31%, transparent 31% 60%, rgba(255, 255, 255, 0.1) 60% 61%, transparent 61%),
    linear-gradient(135deg, #3b178f, #243dcc 72%, #7f00ff);
}

.difficulty-button[data-difficulty="hard"] .difficulty-art::before {
  inset: 0;
  background:
    linear-gradient(45deg, transparent 0 48%, rgba(255, 255, 255, 0.12) 49% 51%, transparent 52%),
    linear-gradient(128deg, transparent 0 40%, rgba(255, 255, 255, 0.1) 41% 42%, transparent 43%);
}

.difficulty-badge {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 24px rgba(35, 28, 47, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.difficulty-badge svg {
  width: 31px;
  height: 31px;
  color: var(--name-color);
  fill: none;
  stroke: currentColor;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.difficulty-arrow {
  position: relative;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-wash);
}

.difficulty-arrow svg {
  width: 27px;
  height: 27px;
  color: var(--name-color);
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-screen {
  display: grid;
  gap: 10px;
}

.game-meta {
  width: min(100% - 28px, 680px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.status {
  min-height: 20px;
  text-align: right;
}

.name-reel {
  --reel-width: min(calc(100vw - 28px), 680px);
  width: var(--reel-width);
  height: clamp(56px, 15vw, 78px);
  margin: 0 auto;
  overflow: hidden;
  position: relative;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  background: #e32636;
  box-shadow: 0 14px 34px rgba(66, 43, 31, 0.14), inset 0 0 0 2px rgba(255, 255, 255, 0.38);
  transform: translateZ(0);
  cursor: grab;
  touch-action: pan-y;
}

.reel-strip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform: translateZ(0);
  touch-action: pan-y;
}

.reel-strip.dragging {
  cursor: grabbing;
}

.reel-panel {
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(86px, 23vw, 112px);
  height: 100%;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.62);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 12px;
  color: #fff;
  font-family: var(--display-font);
  font-size: clamp(14px, 4.1vw, 24px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26), inset 0 -9px 16px rgba(0, 0, 0, 0.1);
  backface-visibility: hidden;
  cursor: inherit;
  touch-action: pan-y;
  will-change: transform;
}

.reel-panel.selected-colour-mark {
  opacity: 1;
  z-index: 2;
  border: 5px solid rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 24px rgba(35, 28, 47, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.34);
}

.reel-count {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(13px, 3.8vw, 20px);
  font-weight: 900;
  line-height: 1;
}

.reel-name {
  font: inherit;
  line-height: 1;
}

.candidate-hint {
  width: min(100% - 28px, 680px);
  min-height: 23px;
  margin: 1px auto -2px;
  display: grid;
  place-items: center;
  color: rgba(71, 63, 94, 0.68);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.candidate-hint.visible {
  opacity: 1;
  transform: translateY(0);
}

.play-pad {
  width: 100%;
  padding: 2px 0 18px;
}

.board-frame {
  width: min(540px, 100vw);
  margin: 0 auto;
}

.board {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  border: 3px solid var(--heavy-line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--heavy-line);
  box-shadow: 0 18px 44px rgba(98, 64, 40, 0.16), 0 0 0 12px rgba(255, 252, 246, 0.68), inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.cell {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0 solid var(--line);
  border-right-width: 1px;
  border-bottom-width: 1px;
  border-radius: 0;
  background: rgba(255, 252, 246, 0.92);
  appearance: none;
  cursor: pointer;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.cell:nth-child(9n) {
  border-right-width: 0;
}

.cell:nth-child(n+73) {
  border-bottom-width: 0;
}

.cell.box-right {
  border-right: 3px solid var(--heavy-line);
}

.cell.box-bottom {
  border-bottom: 3px solid var(--heavy-line);
}

.cell.given {
  cursor: default;
}

.cell.given::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(7px, 2vw, 12px);
  height: clamp(7px, 2vw, 12px);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(37, 24, 18, 0.42);
  transform: translate(-50%, -50%);
}

.corner-mark,
.cell::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.corner-mark {
  z-index: 0;
  background: var(--mark-color);
  filter: saturate(1.08);
}

.corner-mark.mark-conflict {
  --mark-conflict-border: clamp(3px, 0.8vw, 5px);
  z-index: 2;
  background: #cb243e;
  filter: saturate(1.08);
  animation: markerConflictBorder 1.15s ease-in-out infinite alternate;
}

.corner-mark.mark-conflict::after {
  content: "";
  position: absolute;
  inset: var(--mark-conflict-border);
  clip-path: inherit;
  pointer-events: none;
  background: var(--mark-color);
}

.corner-tl,
.board.marking-tl .cell.markable-tl::before {
  clip-path: polygon(0 0, 50% 0, 0 50%);
}

.corner-tr,
.board.marking-tr .cell.markable-tr::before {
  clip-path: polygon(100% 0, 50% 0, 100% 50%);
}

.corner-bl,
.board.marking-bl .cell.markable-bl::before {
  clip-path: polygon(0 100%, 0 50%, 50% 100%);
}

.corner-br,
.board.marking-br .cell.markable-br::before {
  clip-path: polygon(100% 100%, 50% 100%, 100% 50%);
}

.board.colour-marking .cell.markable-next[data-next-corner="tl"]::before {
  clip-path: polygon(0 0, 50% 0, 0 50%);
}

.board.colour-marking .cell.markable-next[data-next-corner="tr"]::before {
  clip-path: polygon(100% 0, 50% 0, 100% 50%);
}

.board.colour-marking .cell.markable-next[data-next-corner="bl"]::before {
  clip-path: polygon(0 100%, 0 50%, 50% 100%);
}

.board.colour-marking .cell.markable-next[data-next-corner="br"]::before {
  clip-path: polygon(100% 100%, 50% 100%, 100% 50%);
}

.board.marking-tl .cell.markable-tl::before,
.board.marking-tr .cell.markable-tr::before,
.board.marking-bl .cell.markable-bl::before,
.board.marking-br .cell.markable-br::before {
  content: "";
  z-index: 0;
  animation: cornerBlink 1.85s ease-in-out infinite;
}

.board.colour-marking .cell.markable-next::before {
  content: "";
  z-index: 0;
  animation: selectedColourCornerPulse 2.35s ease-out infinite;
}

.cell.preview-filled .corner-mark {
  display: none;
}

.cell-label {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: clamp(18px, 5vw, 36px);
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
  text-transform: uppercase;
  z-index: 1;
}

.board.label-colours .cell-label {
  display: grid;
}

.board.label-colours .cell.given::after {
  left: auto;
  right: 0;
  top: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 clamp(8px, 2.1vw, 14px) clamp(8px, 2.1vw, 14px) 0;
  border-color: transparent rgba(255, 255, 255, 0.96) transparent transparent;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 2px 4px rgba(37, 24, 18, 0.18));
  transform: none;
}

.cell.filled {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.34), inset 0 -10px 20px rgba(0, 0, 0, 0.12), inset 0 10px 18px rgba(255, 255, 255, 0.2);
}

.cell.selected {
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.96), inset 0 0 0 5px rgba(255, 139, 83, 0.52);
  z-index: 1;
}

.cell.conflict {
  --cell-conflict-border: clamp(3px, 0.8vw, 5px);
  box-shadow: inset 0 0 0 var(--cell-conflict-border) #cb243e;
  animation: cellConflictBorder 1.15s ease-in-out infinite alternate;
  z-index: 2;
}

.action-row {
  width: min(100% - 28px, 680px);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.label-toggle {
  min-height: 42px;
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(21, 21, 21, 0.18);
  border-radius: 18px;
  background: rgba(255, 252, 248, 0.82);
  color: #393554;
  box-shadow: 0 10px 28px rgba(98, 64, 40, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  user-select: none;
  -webkit-user-select: none;
}

.label-toggle input {
  width: 18px;
  height: 18px;
  accent-color: #b82978;
}

.wheel {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 210px;
  height: 210px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.92);
  transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms;
  z-index: 20;
  touch-action: none;
}

.wheel.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 0s;
}

.wheel-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.92);
  border: 1px solid rgba(198, 157, 126, 0.4);
  box-shadow: 0 10px 28px rgba(50, 35, 26, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  appearance: none;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transition: background 120ms ease, border-color 120ms ease;
}

.wheel-hub.empty-preview {
  background:
    linear-gradient(135deg, transparent 0 44%, #151515 44% 56%, transparent 56% 100%),
    #fff;
  border-color: rgba(21, 21, 21, 0.38);
}

.wheel-hub::after {
  content: "";
  width: 25px;
  height: 25px;
  background:
    linear-gradient(45deg, transparent 0 43%, rgba(92, 87, 104, 0.82) 43% 57%, transparent 57% 100%),
    linear-gradient(135deg, transparent 0 43%, rgba(92, 87, 104, 0.82) 43% 57%, transparent 57% 100%);
  opacity: 0.82;
}

.wheel-hub.has-preview::after,
.wheel-hub.empty-preview::after {
  content: none;
}

.wheel-color {
  position: absolute;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(45, 31, 24, 0.22), inset 0 -8px 14px rgba(0, 0, 0, 0.14), inset 0 8px 14px rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transform: translate(-50%, -50%);
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.wheel-color.hover {
  outline: 3px solid rgba(21, 21, 21, 0.72);
  outline-offset: 2px;
  transform: translate(-50%, -50%) scale(1.1);
}

.wheel-color.empty-option {
  background:
    linear-gradient(135deg, transparent 0 43%, #151515 43% 57%, transparent 57% 100%),
    #fff;
  border-color: rgba(21, 21, 21, 0.32);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(28, 20, 16, 0.28);
  z-index: 40;
}

.modal {
  width: min(100%, 360px);
  padding: 22px;
  border-radius: 22px;
  background: #fffaf3;
  box-shadow: 0 28px 80px rgba(28, 20, 16, 0.28);
}

.modal h2 {
  margin: 0 0 8px;
  font-family: var(--display-font);
  font-size: 32px;
}

.modal p {
  margin: 0 0 18px;
  color: var(--muted);
}

.share-modal {
  width: min(100%, 390px);
}

.share-preview {
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid rgba(21, 21, 21, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font: 700 15px/1.45 ui-monospace, "SFMono-Regular", Consolas, monospace;
  white-space: pre-wrap;
  user-select: text;
  -webkit-user-select: text;
}

.modal-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
}

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 30;
}

@keyframes cornerBlink {
  0%,
  100% {
    background: hsla(42, 86%, 95%, 0.5);
  }

  50% {
    background: hsla(28, 23%, 48%, 0.5);
  }
}

@keyframes selectedColourCornerPulse {
  0% {
    background: color-mix(in srgb, var(--pending-mark-color) 72%, transparent);
  }

  42%,
  100% {
    background: color-mix(in srgb, var(--pending-mark-color) 0%, transparent);
  }
}

@keyframes markerConflictBorder {
  from {
    background: #cb243e;
  }

  to {
    background: #fff;
  }
}

@keyframes cellConflictBorder {
  from {
    box-shadow: inset 0 0 0 var(--cell-conflict-border) #cb243e;
  }

  to {
    box-shadow: inset 0 0 0 var(--cell-conflict-border) #fff;
  }
}

@media (max-width: 370px) {
  :root {
    --side-gutter: 36px;
  }

  .topbar,
  .game-meta,
  .start-screen,
  .candidate-hint,
  .action-row {
    width: min(100% - 20px, 680px);
  }
}

@media (min-width: 760px) {
  .app {
    padding-top: 26px;
  }

  .play-pad {
    padding-bottom: 32px;
  }

  .start-screen {
    margin-top: 22px;
  }
}
