:root {
  color-scheme: light;
  font-family: "Space Grotesk", sans-serif;
  --ink: #17233b;
  --muted: #5b6784;
  --accent: #0b7a67;
  --accent-strong: #065446;
  --danger: #c74646;
  --panel: rgba(255, 252, 247, 0.78);
  --panel-border: rgba(23, 35, 59, 0.08);
  --shadow: 0 24px 60px rgba(23, 35, 59, 0.14);
  --board-shadow: 0 18px 40px rgba(23, 35, 59, 0.12);
  --cell-gap: 0.1rem;
  --board-padding: 1rem;
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 212, 170, 0.55), transparent 28%),
    radial-gradient(circle at top right, rgba(159, 229, 217, 0.48), transparent 24%),
    radial-gradient(circle at bottom left, rgba(255, 255, 255, 0.95), transparent 42%),
    linear-gradient(145deg, #fff8ed 0%, #f6fbff 48%, #eef7f3 100%);
  position: relative;
}

body.has-settings-open {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(23, 35, 59, 0.05) 1px, transparent 1px),
    linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.25) 50%, transparent 100%);
  background-size: 22px 22px, 100% 100%;
  opacity: 0.5;
}

button,
select {
  font: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
select:focus-visible,
.cell:focus-visible {
  outline: 3px solid rgba(11, 122, 103, 0.72);
  outline-offset: 3px;
}

.shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.2rem 0 3rem;
  position: relative;
  z-index: 1;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.95fr);
  gap: 1.4rem;
  align-items: stretch;
}

.hero-copy,
.hero-card,
.board-panel,
.panel-card,
.status-card,
.hint-card {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.hero-copy {
  border-radius: 28px;
  padding: 2rem;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(105deg, rgba(255, 250, 243, 0.96) 0%, rgba(255, 250, 243, 0.84) 44%, rgba(255, 250, 243, 0.38) 76%),
    url("./assets/queen-garden-hero.webp");
  background-position: left center, center center;
  background-size: cover;
}

.eyebrow {
  position: relative;
  z-index: 1;
  margin: 0 0 0.7rem;
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-title {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(2.6rem, 7vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.lede {
  position: relative;
  z-index: 1;
  width: min(58ch, 100%);
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.hero-note {
  position: relative;
  z-index: 1;
  width: fit-content;
  margin: 1.15rem 0 0;
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(23, 35, 59, 0.08);
  color: var(--accent-strong);
  font-size: 0.94rem;
  font-weight: 700;
}

.hero-seal {
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  width: clamp(72px, 10vw, 110px);
  aspect-ratio: 1 / 1;
  padding: 0.65rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow:
    0 14px 28px rgba(23, 35, 59, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(10px);
}

.hero-seal img,
.tool-icon,
.token-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.hero-card {
  border-radius: 28px;
  padding: 1.5rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(250, 255, 251, 0.72)),
    var(--panel);
}

.hero-card-label,
.field-label,
.status-heading,
.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-rules,
.tips-list {
  margin: 0.9rem 0 0;
  padding-left: 1.15rem;
  color: var(--ink);
  line-height: 1.65;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: 1.4rem;
  min-width: 0;
}

.board-panel {
  border-radius: 32px;
  padding: 1rem;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: min(780px, calc(100vh - 9.5rem));
  min-width: 0;
}

.control-group {
  display: grid;
  gap: 0.55rem;
}

.playbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.9rem;
}

.playbar-copy {
  display: grid;
  gap: 0.2rem;
}

.playbar-title,
.playbar-subtitle,
.playbar-seed,
.settings-title {
  margin: 0;
}

.playbar-title {
  font-family: "Fraunces", serif;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
}

.playbar-subtitle,
.playbar-seed {
  color: var(--muted);
  line-height: 1.45;
}

.playbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.playbar-stats {
  display: inline-flex;
  align-items: stretch;
  gap: 0.5rem;
}

.playbar-stat {
  min-width: 5.4rem;
  padding: 0.58rem 0.72rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(23, 35, 59, 0.07);
}

.playbar-stat-label,
.playbar-stat-value {
  margin: 0;
}

.playbar-stat-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.playbar-stat-value {
  margin-top: 0.28rem;
  font-size: 0.96rem;
  font-weight: 700;
}

.playbar-meta {
  display: grid;
  justify-items: end;
  gap: 0.12rem;
}

.playbar-timer {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.36rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.help-toggle {
  width: fit-content;
  max-width: 100%;
  margin-top: 0.55rem;
  padding: 0.42rem 0.68rem;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(23, 35, 59, 0.08);
  font: inherit;
  font-size: 0.76rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.help-toggle:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
}

.help-toggle:focus-visible {
  outline: 2px solid rgba(11, 122, 103, 0.5);
  outline-offset: 2px;
}

.help-toggle-text {
  display: block;
}

.settings-button,
.settings-close-button,
.settings-tab-button {
  border: 0;
  border-radius: 999px;
  font: inherit;
}

.settings-button,
.settings-close-button {
  padding: 0.55rem 0.85rem;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(23, 35, 59, 0.08);
  cursor: pointer;
}

.settings-layer {
  position: absolute;
  inset: 0;
  z-index: 7;
}

.settings-layer[hidden],
.settings-panel[hidden] {
  display: none;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(23, 35, 59, 0.18);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.settings-drawer {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: min(380px, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: 1rem;
  overflow: auto;
  border-radius: 26px;
  border: 1px solid rgba(23, 35, 59, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 252, 249, 0.9)),
    var(--panel);
  box-shadow: 0 24px 60px rgba(23, 35, 59, 0.2);
}

.settings-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.8rem;
}

.settings-title {
  margin-top: 0.25rem;
  font-size: 1.18rem;
}

.settings-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.95rem;
}

.settings-tab-button {
  padding: 0.6rem 0.5rem;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(23, 35, 59, 0.08);
  cursor: pointer;
}

.settings-tab-button.is-active {
  background: linear-gradient(180deg, #0f9079, #0a725f);
  color: #f7fffd;
  box-shadow:
    0 16px 24px rgba(11, 122, 103, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.settings-panel {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.95rem;
}

.settings-level-card,
.settings-score-card {
  gap: 1rem;
}

.settings-action-grid,
.settings-tool-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.settings-drawer .select-input,
.settings-drawer .control-button,
.settings-drawer .tool-button {
  padding: 0.72rem 0.82rem;
  min-height: 0;
}

.settings-drawer .status-card,
.settings-drawer .hint-card {
  margin-top: 0;
}

.size-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.size-chip {
  border: 0;
  border-radius: 999px;
  padding: 0.52rem 0.78rem;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(23, 35, 59, 0.08);
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.size-chip.is-active {
  background: linear-gradient(180deg, #0f9079, #0a725f);
  color: #f7fffd;
  box-shadow:
    0 12px 20px rgba(11, 122, 103, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.level-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.level-selection-label {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.level-grid,
.score-level-grid,
.score-summary-grid {
  display: grid;
  gap: 0.6rem;
}

.level-grid,
.score-level-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.level-button,
.score-level-card,
.score-random-card {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(23, 35, 59, 0.08);
}

.level-button {
  border: 0;
  min-height: 4.1rem;
  padding: 0.72rem 0.58rem;
  display: grid;
  gap: 0.28rem;
  justify-items: start;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.level-button.is-cleared {
  background:
    linear-gradient(180deg, rgba(247, 255, 253, 0.92), rgba(231, 248, 242, 0.88)),
    rgba(255, 255, 255, 0.78);
  box-shadow:
    inset 0 0 0 1px rgba(11, 122, 103, 0.16),
    0 10px 16px rgba(23, 35, 59, 0.06);
}

.level-button.is-current,
.score-level-card.is-current {
  box-shadow:
    0 0 0 3px rgba(235, 156, 31, 0.2),
    inset 0 0 0 2px rgba(235, 156, 31, 0.96);
}

.level-button-label,
.score-level-label {
  margin: 0;
  font-weight: 700;
}

.level-button-meta,
.score-level-value,
.score-random-value {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.score-random-card {
  padding: 0.9rem 1rem;
}

.score-random-value {
  margin-top: 0.34rem;
  color: var(--ink);
  font-size: 1.18rem;
  font-weight: 700;
}

.score-level-card {
  padding: 0.72rem 0.78rem;
}

.score-level-card.is-cleared {
  background:
    linear-gradient(180deg, rgba(247, 255, 253, 0.92), rgba(231, 248, 242, 0.88)),
    rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(11, 122, 103, 0.16);
}

.select-input,
.control-button,
.tool-button {
  border: 0;
  border-radius: 16px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease;
}

.select-input {
  min-width: 132px;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 0 0 1px rgba(23, 35, 59, 0.1);
  color: var(--ink);
}

.button-row,
.tool-row {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.control-button,
.tool-button {
  padding: 0.9rem 1.1rem;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(23, 35, 59, 0.09);
  cursor: pointer;
}

.control-button.primary,
.tool-button.is-active {
  background: linear-gradient(180deg, #0f9079, #0a725f);
  color: #f7fffd;
  box-shadow:
    0 16px 24px rgba(11, 122, 103, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.control-button.accent {
  background: linear-gradient(180deg, #f7c968, #eb9c1f);
  color: #3b2800;
  box-shadow:
    0 16px 24px rgba(235, 156, 31, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.26);
}

.control-button:hover,
.tool-button:hover,
.select-input:hover,
.size-chip:hover,
.level-button:hover,
.cell:hover {
  transform: translateY(-2px);
}

.control-button:disabled,
.tool-button:disabled,
.select-input:disabled,
.level-button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.status-card {
  margin-top: 1rem;
  border-radius: 22px;
  padding: 1rem 1.1rem;
  background:
    linear-gradient(135deg, rgba(255, 248, 228, 0.88), rgba(238, 250, 245, 0.78)),
    var(--panel);
}

.status-text {
  margin: 0.45rem 0 0;
  color: var(--ink);
  line-height: 1.55;
}

.hint-card {
  margin-top: 0.85rem;
  border-radius: 22px;
  padding: 1rem 1.1rem;
  background:
    linear-gradient(135deg, rgba(255, 249, 231, 0.92), rgba(255, 244, 210, 0.8)),
    var(--panel);
}

.hint-text {
  margin: 0.45rem 0 0;
  color: var(--ink);
  line-height: 1.55;
}

.board-shell {
  margin-top: 0.6rem;
  border-radius: 28px;
  padding: var(--board-padding);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.42)),
    rgba(255, 255, 255, 0.46);
  box-shadow: var(--board-shadow);
  overflow: auto;
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  align-items: safe center;
  justify-content: safe center;
}

.play-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.play-actions .control-button { padding: 0.45rem 0.7rem; }
.region-toggle { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; }
.completion-message { padding: 0.6rem; border-radius: 12px; background: #e1efce; color: #26452f; }
.region-number { display: none; position: absolute; left: 3px; top: 2px; font-size: clamp(8px, 1.3vw, 12px); color: #182e29; background: #ffffffdd; border-radius: 3px; padding: 0 2px; pointer-events: none; z-index: 3; line-height: 1.25; }
.show-region-numbers .region-number { display: block; }
.garden-scene { margin-top: 0.8rem; }
.settings-drawer:has(.garden-scene[open]) { width: min(840px, calc(100% - 2rem)); }
.garden-scene summary { cursor: pointer; font-weight: 700; }
.garden-scene p { font-size: 0.85rem; line-height: 1.5; }
.garden-scene canvas { display: block; width: 100%; height: auto; border-radius: 12px; margin: 0.7rem 0; }
.garden-scene input[type="range"] { display: block; width: 100%; margin: 0.7rem 0; }
.garden-scene label:has(#scene-detail) { display: block; margin: 0.8rem 0; }

.board {
  --size: 7;
  display: grid;
  grid-template-columns: repeat(var(--size), minmax(0, 1fr));
  gap: var(--cell-gap);
  width: min(100%, 82vh);
  min-width: var(--minimum-board-width, 175px);
  margin: 0 auto;
}

.board,
.cell {
  touch-action: pinch-zoom;
}

.board.is-scrollable,
.board.is-scrollable .cell {
  touch-action: pan-x pan-y pinch-zoom;
}

.board-message {
  max-width: 34rem;
  margin: auto;
  padding: 1rem 1.15rem;
  border-radius: 18px;
  color: var(--danger);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 0 0 1px rgba(199, 70, 70, 0.24);
  line-height: 1.55;
  text-align: center;
}

.board-message[hidden] {
  display: none;
}

.board-row {
  display: contents;
}

.board.is-unavailable {
  display: none;
}

.board.is-solved .cell.is-queen {
  animation: celebrate 650ms ease;
  box-shadow:
    0 0 0 2px rgba(255, 248, 223, 0.96),
    0 0 0 5px rgba(255, 232, 176, 0.34),
    0 16px 28px rgba(23, 35, 59, 0.18),
    inset 0 -12px 20px rgba(255, 255, 255, 0.3);
  filter: brightness(1.05) saturate(1.06);
}

.board.is-solved .cell.is-queen::after {
  inset: 10%;
  border: 2px solid rgba(255, 249, 227, 0.98);
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.82), transparent 36%),
    radial-gradient(circle at 50% 88%, rgba(255, 226, 160, 0.3), transparent 44%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.42),
    0 0 18px rgba(255, 223, 150, 0.28);
}

.board.is-solved .cell.is-queen .token-icon {
  filter:
    drop-shadow(0 10px 16px rgba(23, 35, 59, 0.22))
    brightness(1.08)
    saturate(1.05);
}

.board.is-loading::after {
  content: "Building puzzle...";
  display: grid;
  grid-column: 1 / -1;
  place-items: center;
  width: 100%;
  min-height: 360px;
  border-radius: 22px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 0 0 1px rgba(23, 35, 59, 0.08);
}

.cell {
  min-width: 0;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: var(--tone, #f4efe6);
  color: var(--ink);
  box-shadow:
    0 4px 10px rgba(23, 35, 59, 0.08),
    inset 0 -6px 10px rgba(255, 255, 255, 0.08);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  animation: rise 320ms ease both;
  animation-delay: var(--delay, 0ms);
  transition:
    transform 160ms ease,
    box-shadow 180ms ease,
    filter 180ms ease;
}

.warning-overlay {
  position: absolute;
  inset: 10%;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.warning-overlay::before,
.warning-overlay::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 122%;
  height: 4px;
  border-radius: 999px;
  background: rgba(199, 70, 70, 0.9);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28);
  transform-origin: center;
}

.warning-overlay::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.warning-overlay::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.warning-overlay.is-visible {
  opacity: 1;
}

.cell::before {
  content: "";
  position: absolute;
  inset: 0;
  border-style: solid;
  border-width:
    var(--stroke-top, 1px)
    var(--stroke-right, 1px)
    var(--stroke-bottom, 1px)
    var(--stroke-left, 1px);
  border-top-color: var(--stroke-top-color, rgba(255, 255, 255, 0.42));
  border-right-color: var(--stroke-right-color, rgba(255, 255, 255, 0.42));
  border-bottom-color: var(--stroke-bottom-color, rgba(255, 255, 255, 0.42));
  border-left-color: var(--stroke-left-color, rgba(255, 255, 255, 0.42));
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 50%);
  opacity: 1;
  pointer-events: none;
}

.cell.is-queen {
  box-shadow:
    0 12px 20px rgba(23, 35, 59, 0.15),
    inset 0 -10px 18px rgba(255, 255, 255, 0.22);
}

.cell.is-queen::after {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.7), transparent 34%),
    radial-gradient(circle at 50% 88%, rgba(255, 215, 140, 0.22), transparent 42%);
  pointer-events: none;
}

.cell.is-mark {
  color: rgba(23, 35, 59, 0.54);
}

.cell.is-conflict {
  box-shadow:
    0 0 0 3px rgba(199, 70, 70, 0.22),
    0 10px 18px rgba(199, 70, 70, 0.12),
    inset 0 0 0 2px rgba(199, 70, 70, 0.92);
}

.cell.is-hint-target {
  box-shadow:
    0 0 0 4px rgba(235, 156, 31, 0.24),
    0 12px 22px rgba(235, 156, 31, 0.16),
    inset 0 0 0 3px rgba(235, 156, 31, 0.96),
    inset 0 -10px 18px rgba(255, 255, 255, 0.18);
}

.cell.is-hint-mark {
  box-shadow:
    0 0 0 4px rgba(235, 156, 31, 0.22),
    0 12px 22px rgba(235, 156, 31, 0.14),
    inset 0 0 0 3px rgba(235, 156, 31, 0.96),
    inset 0 -10px 18px rgba(255, 255, 255, 0.18);
}

.cell.is-hint-source {
  box-shadow:
    0 0 0 3px rgba(11, 122, 103, 0.18),
    0 10px 20px rgba(11, 122, 103, 0.12),
    inset 0 0 0 3px rgba(11, 122, 103, 0.88),
    inset 0 -10px 18px rgba(255, 255, 255, 0.18);
}

.cell.is-revealed {
  cursor: default;
}

.cell[aria-disabled="true"] {
  cursor: default;
  transform: none;
}

.cell:disabled {
  transform: none;
}

.token {
  position: relative;
  z-index: 1;
  font-weight: 700;
  font-size: clamp(1rem, 2.8vw, 1.45rem);
}

.token.is-dot {
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  line-height: 1;
  color: #101a2d;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

.token-icon {
  width: 74%;
  height: 74%;
  filter: drop-shadow(0 8px 12px rgba(23, 35, 59, 0.18));
}

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.tool-icon {
  width: 1.15rem;
  height: 1.15rem;
}

.panel-card {
  border-radius: 26px;
  padding: 1.2rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.12rem;
}

.panel-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.stat-card {
  padding: 0.95rem 0.85rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 0 0 1px rgba(23, 35, 59, 0.07);
}

.stat-value {
  margin: 0.45rem 0 0;
  font-size: 1.2rem;
  font-weight: 700;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes celebrate {
  0% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.08);
  }

  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cell,
  .board.is-solved .cell.is-queen {
    animation: none;
  }

  .cell,
  .control-button,
  .tool-button,
  .select-input,
  .size-chip,
  .level-button,
  .settings-button,
  .settings-close-button,
  .settings-tab-button,
  .help-toggle {
    transition: none;
  }
}

@media (max-width: 980px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    min-height: 340px;
  }

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

@media (max-width: 820px) {
  :root {
    --cell-gap: 0.06rem;
    --board-padding: 0.65rem;
  }

  body {
    overflow: hidden;
  }

  .shell {
    width: 100%;
    height: 100svh;
    padding: 0.55rem;
    display: flex;
    flex-direction: column;
  }

  .hero {
    display: none;
  }

  .workspace {
    margin-top: 0;
    flex: 1;
    min-height: 0;
  }

  .board-panel {
    height: 100%;
    min-height: 0;
    padding: 0.78rem;
    border-radius: 24px;
  }

  .playbar-title {
    font-size: 1.05rem;
  }

  .playbar-subtitle,
  .playbar-seed,
  .settings-drawer .panel-head p,
  .settings-drawer .status-text,
  .settings-drawer .hint-text,
  .tips-list,
  .level-selection-label {
    font-size: 0.92rem;
  }

  .playbar-actions {
    flex-wrap: wrap;
    justify-content: end;
    gap: 0.45rem;
  }

  .playbar-stats {
    gap: 0.4rem;
  }

  .playbar-stat {
    min-width: 4.85rem;
    padding: 0.5rem 0.62rem;
    border-radius: 16px;
  }

  .playbar-stat-value {
    font-size: 0.9rem;
  }

  .playbar-meta {
    justify-items: end;
  }

  .settings-button,
  .settings-close-button {
    padding: 0.48rem 0.72rem;
    font-size: 0.9rem;
  }

  .board-shell {
    margin-top: 0.5rem;
  }

  .board {
    width: min(100%, calc(100svh - 12rem));
  }

  .settings-layer {
    inset: 0.35rem;
  }

  .settings-drawer {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(76vh, 620px);
    border-radius: 24px 24px 0 0;
    padding: 0.95rem;
  }

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

  .settings-action-grid,
  .settings-tool-row,
  .settings-stat-grid {
    gap: 0.55rem;
  }

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

  .level-grid,
  .score-level-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (hover: none) and (pointer: coarse) and (any-hover: none) {
  .settings-tools-card {
    display: none;
  }
}

@media (any-pointer: fine) {
  .settings-tools-card {
    display: block;
  }
}

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

  .board-panel,
  .settings-drawer {
    border-radius: 20px;
  }

  .board-panel {
    padding: 0.65rem;
  }

  .playbar {
    gap: 0.7rem;
  }

  .playbar-stats {
    gap: 0.34rem;
  }

  .playbar-stat {
    min-width: 4.25rem;
    padding: 0.46rem 0.56rem;
  }

  .playbar-stat-label {
    font-size: 0.66rem;
  }

  .playbar-stat-value {
    font-size: 0.84rem;
  }

  .playbar-meta {
    gap: 0.06rem;
  }

  .playbar-timer {
    font-size: 1.18rem;
  }

  .help-toggle {
    margin-top: 0.42rem;
    padding: 0.38rem 0.58rem;
    font-size: 0.71rem;
    line-height: 1.3;
  }

  .board-shell {
    --board-padding: 0.42rem;
    border-radius: 20px;
  }

  .board {
    width: min(100%, calc(100svh - 11.5rem));
  }

  .settings-drawer {
    padding: 0.82rem;
  }

  .settings-tab-button {
    padding: 0.52rem 0.35rem;
    font-size: 0.84rem;
  }

  .level-head {
    flex-direction: column;
    align-items: stretch;
  }

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

.guide-note {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}
