:root {
  --cupcake-blue: #a4d2e7;
  --cupcake-blue-deep: #7eb8d4;
  --cupcake-red: #b33c3c;
  --cupcake-ink: #120b0a;
  --cupcake-center: #3d2621;
  --cupcake-edge: #0f0908;

  --bg: var(--cupcake-edge);
  --ink: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --action: var(--cupcake-blue);
  --action-ink: var(--cupcake-ink);
  --ok: #53c47a;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --font: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  --page-bg1: var(--cupcake-center);
  --btn-radius: 14px;
  --chip-radius: 10px;
  --pad-zoom: 1;
  --pad-base: 780px;
  --chrome-h: 210px;
  --nav-tracking: 0.12em;
  --tile-red: #ed292e;
  --tile-blue: #1e7af2;
  --tile-green: #29bd3d;
  --tile-yellow: #fccc1a;

  --wood: #945e2e;
  --wood-ink: #fff7e0;
  --wood-muted: rgba(255, 247, 224, 0.82);
  --wood-texture: url("../img/wood-background.jpg");
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
}

body,
body.dark {
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, var(--page-bg1) 0%, transparent 68%),
    radial-gradient(ellipse 90% 70% at 50% 100%, #1c1210 0%, transparent 55%),
    var(--cupcake-edge);
  color: var(--ink);
}

body.light {
  --bg: #f4ebe6;
  --ink: #1a100e;
  --muted: rgba(26, 16, 14, 0.62);
  --action: #6aa8c4;
  --action-ink: #ffffff;
  --shadow: 0 14px 36px rgba(40, 20, 16, 0.16);
  --page-bg1: #e8d5cb;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, var(--page-bg1) 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
}

.wood-plaque {
  background-color: var(--wood);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 42%, rgba(0, 0, 0, 0.28) 100%),
    var(--wood-texture);
  background-size: cover;
  background-position: center;
  box-shadow:
    0 5px 12px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(237, 209, 148, 0.62),
    inset 0 -1px 0 rgba(0, 0, 0, 0.42);
}

.wood-ink {
  color: var(--wood-ink);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.88), 0 1px 2px rgba(0, 0, 0, 0.55);
}

.app {
  max-width: min(1280px, 100%);
  width: 100%;
  margin: 0 auto;
  padding: 10px 16px 14px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 10px;
  padding: 6px 2px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.light .topbar {
  border-bottom-color: rgba(26, 16, 14, 0.1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
}

.brand img {
  height: 52px;
  width: auto;
  display: block;
  border-radius: 50%;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 36rem;
  line-height: 1.35;
  font-weight: 500;
}

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

[hidden] {
  display: none !important;
}

.chip, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--chip-radius);
  padding: 9px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  text-align: center;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.chip:hover:not(:disabled),
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.chip {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.18);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: var(--nav-tracking);
}

body.light .chip {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(26, 16, 14, 0.14);
}

.chip.active {
  background: var(--cupcake-blue);
  color: var(--cupcake-ink);
  border-color: transparent;
}

body.light .chip.active {
  background: var(--action);
  color: #fff;
}

.btn {
  background: var(--cupcake-blue);
  color: var(--cupcake-ink);
  border-radius: var(--btn-radius);
}

body.light .btn {
  background: var(--action);
  color: var(--action-ink);
}

.btn.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

body.light .btn.secondary {
  border-color: rgba(26, 16, 14, 0.28);
}

.btn:disabled,
.chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.wood-btn {
  background-color: var(--wood);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 42%, rgba(0, 0, 0, 0.28) 100%),
    var(--wood-texture);
  background-size: cover;
  background-position: center;
  color: var(--wood-ink);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.88), 0 1px 2px rgba(0, 0, 0, 0.55);
  border: 0;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(237, 209, 148, 0.62),
    inset 0 -1px 0 rgba(0, 0, 0, 0.42);
}

.wood-btn:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.wood-btn:active:not(:disabled) {
  transform: translateY(2px) scale(0.97);
}

.stage {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 8px 0;
}

.device {
  --board-max: min(calc(100vh - var(--chrome-h)), calc(var(--pad-base) * var(--pad-zoom) * 0.62));
  --ink: var(--wood-ink);
  --muted: var(--wood-muted);
  position: relative;
  width: fit-content;
  max-width: 96vw;
  border-radius: 22px;
  padding: 14px;
  color: var(--wood-ink);
  overflow: visible;
}

.device-main {
  display: grid;
  grid-template-columns: var(--board-max) minmax(190px, calc(var(--board-max) * 0.42));
  gap: 12px;
  align-items: stretch;
}

@media (max-width: 760px) {
  .brand p { font-size: 0.85rem; }
  .device {
    width: min(94vw, calc(var(--pad-base) * var(--pad-zoom)));
  }
  .device-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

.board-wrap {
  position: relative;
  z-index: 1;
  aspect-ratio: 1 / 1;
  width: var(--board-max);
  max-width: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(0, 0, 0, 0.28),
    inset 0 -1px 0 rgba(237, 209, 148, 0.28);
}

.motif-overlay {
  position: absolute;
  z-index: 8;
  display: flex;
  flex-direction: column;
  padding: 3px 6px 6px;
  border-radius: 14px;
  opacity: 0.86;
  isolation: isolate;
  cursor: grab;
  touch-action: none;
  user-select: none;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(237, 209, 148, 0.7),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45);
}

.motif-size-controls {
  position: absolute;
  z-index: 9;
  width: 160px;
  height: 48px;
  padding: 0 4px;
  border-radius: 12px;
  color: var(--wood-ink);
  font-size: 12px;
  font-weight: 800;
}

.motif-size-background {
  position: absolute;
  inset: 12px 0;
  border-radius: 6px;
  border-width: 1px;
  pointer-events: none;
}

.motif-size-controls label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  padding: 0 4px;
  border-radius: 4px;
  background: #fff7e0;
  color: #3c2414;
  text-shadow: none;
  white-space: nowrap;
  pointer-events: none;
}

.motif-size-controls input {
  position: relative;
  display: block;
  width: 100%;
  height: 48px;
  margin: 0;
  accent-color: var(--wood-ink);
  cursor: pointer;
  touch-action: none;
}

.motif-overlay-label {
  flex: 0 0 auto;
  margin: 0;
  padding: 1px 4px 3px;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wood-ink);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.88);
  pointer-events: none;
  line-height: 1.1;
}

.motif-overlay:active {
  cursor: grabbing;
}

.motif-overlay-board {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 9px;
  overflow: hidden;
  background-color: var(--wood);
  background-image:
    linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, transparent 40%, rgba(0, 0, 0, 0.24) 100%),
    var(--wood-texture);
  background-size: cover;
  background-position: 40% center;
  box-shadow:
    inset 0 1px 0 rgba(0, 0, 0, 0.28),
    inset 0 -1px 0 rgba(237, 209, 148, 0.22);
}

.motif-overlay .chip-token {
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.36),
    inset 0 -2px 3px rgba(0, 0, 0, 0.2);
}

.board {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--wood);
  background-image:
    linear-gradient(180deg, rgba(0, 0, 0, 0.18) 0%, transparent 40%, rgba(0, 0, 0, 0.22) 100%),
    var(--wood-texture);
  background-size: cover;
  background-position: 40% center;
  border-radius: 16px;
  user-select: none;
  touch-action: none;
}

.chip-token {
  position: absolute;
  border-radius: 50%;
  background: var(--tile-red);
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.38),
    inset 0 -4px 7px rgba(0, 0, 0, 0.22),
    0 2px 4px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.chip-token.red { background: var(--tile-red); }
.chip-token.blue { background: var(--tile-blue); }
.chip-token.green { background: var(--tile-green); }
.chip-token.yellow { background: var(--tile-yellow); }
.chip-token.hidden { visibility: hidden; }

.axis {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(145deg, #dbdee3 0%, #858992 55%, #c5c8cd 100%);
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  z-index: 3;
}

.axis::after {
  content: "";
  position: absolute;
  inset: 33%;
  border-radius: 50%;
  background: radial-gradient(circle, #4a4c52 0%, #1e1f22 80%);
}

.axis:hover {
  filter: brightness(1.08);
}

.spinner {
  position: absolute;
  pointer-events: none;
  z-index: 2;
  background: transparent;
}

.spinner .chip-token {
  position: absolute;
}

.side {
  position: relative;
  z-index: 1;
  min-width: 0;
  overflow: hidden;
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--wood-ink);
}

.side .logo-sm {
  height: 96px;
  width: auto;
  align-self: center;
  border-radius: 50%;
}

.level-line {
  margin: 0;
  font-size: 0.74rem;
  color: var(--wood-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.88);
}

.puzzle-title {
  margin: 3px 0 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--wood-ink);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.88), 0 1px 2px rgba(0, 0, 0, 0.55);
}

.moves {
  margin: 4px 0 0;
  font-weight: 800;
  color: var(--cupcake-blue);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.82rem;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.continue-peek .btn {
  width: 100%;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  min-width: 0;
}

.actions .btn,
.continue-peek .btn,
.dialog .btn {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  white-space: nowrap;
}

.actions-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.actions-row .btn {
  flex: none;
  width: 100%;
}

.status {
  min-height: 1.1em;
  color: var(--muted);
  font-size: 0.82rem;
  margin: 8px 0 0;
  text-align: center;
}

.footer {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

body.light .footer {
  border-top-color: rgba(26, 16, 14, 0.1);
}

.footer .version,
.footer .copyright {
  flex: 1 0 100%;
  margin: 2px 0 0;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.footer .copyright {
  text-transform: none;
  font-weight: 600;
}

#getAppHint {
  color: var(--cupcake-blue);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 8px;
}

body.light #getAppHint {
  color: var(--action);
}

.store-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.store-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  background: var(--cupcake-blue);
  color: var(--cupcake-ink);
  padding: 9px 14px;
  border-radius: var(--btn-radius);
  font-weight: 800;
  font-size: 0.85rem;
}

.store-row a:hover {
  filter: brightness(1.05);
}

.store-row a.play,
.store-row a.mac,
.store-row a.windows {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

body.light .store-row a.play,
body.light .store-row a.mac,
body.light .store-row a.windows {
  border-color: rgba(26, 16, 14, 0.22);
  color: var(--ink);
}

.publisher {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.publisher img {
  height: 54px;
  width: auto;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 4, 4, 0.42);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 40;
}

.overlay[hidden] { display: none; }

.dialog {
  --ink: var(--wood-ink);
  --muted: var(--wood-muted);
  color: var(--wood-ink);
  border-radius: 22px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.dialog.feature-dialog {
  max-width: 460px;
  padding: 0 0 18px;
  overflow: hidden;
}

.dialog-hero {
  padding: 22px 22px 14px;
}

.dialog-logo {
  height: 64px;
  width: auto;
  display: block;
  margin: 0 auto 10px;
  border-radius: 50%;
}

.dialog h2 {
  margin: 0 0 6px;
  font-size: 1.55rem;
  color: var(--wood-ink);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.88), 0 1px 2px rgba(0, 0, 0, 0.55);
}

.dialog-prompt {
  margin: 0 0 12px;
  color: var(--wood-muted);
  font-size: 0.92rem;
  font-weight: 600;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.dialog-score {
  margin: 0;
  color: #73d48f;
  font-weight: 800;
  font-size: 1.15rem;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.dialog-lead {
  margin: 14px 22px 8px;
  color: var(--wood-muted);
  font-size: 0.92rem;
  font-weight: 600;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.feature-list {
  list-style: none;
  margin: 0 18px 16px;
  padding: 0;
  display: grid;
  gap: 8px;
  text-align: left;
}

.feature-list li {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--wood-ink);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.feature-list .feat-icon {
  color: var(--cupcake-blue);
  font-weight: 800;
}

.dialog-stores {
  justify-content: center;
  padding: 0 18px;
}

.dialog-stores a {
  flex: 1 1 140px;
  text-align: center;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  margin: 4px 0 0;
}

.feature-dialog .dialog-actions {
  margin: 12px 18px 0;
}

.dialog-actions .btn {
  flex: 1;
  white-space: normal;
}

.dialog .peek-board {
  margin: 12px 18px 0;
  width: calc(100% - 36px);
}

.picker-dialog {
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
}

.picker-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  overflow-y: auto;
  max-height: min(60vh, 520px);
  padding-right: 4px;
}

.picker-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 14px;
  background-color: var(--wood);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, transparent 42%, rgba(0, 0, 0, 0.26) 100%),
    var(--wood-texture);
  background-size: cover;
  background-position: 60% center;
  color: var(--wood-ink);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.88);
  font: inherit;
  cursor: pointer;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(237, 209, 148, 0.55);
}

.picker-item span {
  color: var(--wood-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.picker-item.current {
  box-shadow:
    0 0 0 2px rgba(164, 210, 231, 0.85),
    0 4px 8px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(237, 209, 148, 0.55);
}

.picker-item.locked {
  opacity: 0.48;
  cursor: not-allowed;
}

.help-dialog {
  max-width: 400px;
}

.help-figure {
  margin: 0 0 14px;
}

.help-board {
  width: 168px;
  height: 168px;
}

.help-chip.red { fill: var(--tile-red); }
.help-chip.blue { fill: var(--tile-blue); }
.help-chip.green { fill: var(--tile-green); }
.help-chip.yellow { fill: var(--tile-yellow); }
.help-axis { fill: #c5c8cd; stroke: #3a3c40; }
.help-pin { fill: #1e1f22; }

.help-rules {
  text-align: left;
  margin: 0 0 12px;
  padding-left: 1.2rem;
  color: var(--wood-ink);
  font-weight: 600;
  line-height: 1.45;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.help-note {
  color: var(--wood-muted);
  font-weight: 600;
  margin: 0 0 16px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.help-dialog .btn {
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .spinner { transition: none !important; }
}

/* Real-game hints: transparent and non-blocking; only dismiss is interactive. */
#guidedIntro { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
#guidedIntro[hidden] { display: none; }
#guideText { position: absolute; margin: 0; color: #70ff53; font-size: 28px; font-weight: 800; line-height: 1.15; text-align: center; text-shadow: 2px 3px 4px #000, 0 0 3px #000; }
#guideArrow { position: absolute; fill: #70ff53; stroke: #173610; stroke-width: 3; filter: drop-shadow(2px 3px 3px #000); animation: guide-point .65s ease-in-out infinite alternate; }
#guideArrow.points-up { rotate: 180deg; }
#hideHints { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); pointer-events: auto; min-height: 48px; max-width: calc(100% - 24px); padding: 12px 24px; border-radius: 16px; font-size: 18px; font-weight: 800; box-shadow: 0 7px 0 #573316, 0 12px 18px rgba(0,0,0,.48), inset 0 2px 0 rgba(255,239,192,.65), inset 0 -2px 0 rgba(0,0,0,.35); }
#hideHints:hover { transform: translate(-50%, -2px); }
#hideHints:active { transform: translate(-50%, 3px) scale(.97); box-shadow: 0 3px 0 #573316, 0 6px 10px rgba(0,0,0,.4); }
#hideHints:focus-visible { outline: 3px solid #70ff53; outline-offset: 5px; }
@keyframes guide-point { from { translate: 0 -10px; } to { translate: 0 10px; } }
@media (prefers-reduced-motion: reduce) { #guideArrow { animation: none; } }

@media (max-width: 760px) { .board-wrap { width: 100%; min-width: 0; } }

.help-dialog { max-height: calc(100dvh - 40px); overflow-y: auto; }

.store-row a[hidden], .dialog-stores a[hidden] { display: none; }

/* Mobile play surface: keep the board and all four actions within reach. */
@media (max-width: 1024px) {
  .app { padding: 4px max(8px, env(safe-area-inset-right)) 12px max(8px, env(safe-area-inset-left)); }
  .topbar { flex-wrap: nowrap; gap: 6px; margin-bottom: 4px; padding: 2px 0 4px; }
  .brand { flex: 1; min-width: 0; }
  .brand img { height: 36px; }
  .brand p, .side .logo-sm { display: none; }
  .tools { flex-wrap: nowrap; gap: 4px; }
  .tools .chip { min-height: 44px; padding: 6px 10px; font-size: 14px; }
  .stage { padding: 0; }
  .device { --board-max: min(calc(100vw - 32px), max(240px, calc(100dvh - 260px))); width: 100%; max-width: 100%; padding: 6px; }
  .device-main { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .board-wrap { width: var(--board-max); justify-self: center; }
  .side { padding: 8px; gap: 4px; }
  .level-meta { display: flex; align-items: baseline; gap: 8px; }
  .level-line { font-size: 11px; }
  .puzzle-title { font-size: 15px; margin: 0; }
  .moves { margin: 0; font-size: 12px; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; }
  .actions .btn { min-height: 44px; font-size: 14px; padding: 8px 6px; }
  .status { margin: 8px 0; font-size: 12px; }
  .footer { margin-top: 8px; padding-top: 8px; }
  .overlay { padding: 8px; }
  .dialog, .dialog.feature-dialog { max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }
  #guideText { font-size: 22px; }
  #hideHints { top: 10px; bottom: auto; left: 10px; transform: none; min-height: 44px; padding: 8px 12px; font-size: 14px; }
  #hideHints:hover { transform: translateY(-2px); }
  #hideHints:active { transform: translateY(3px); }
}
@media (max-width: 1024px) and (orientation: landscape) {
  .device { --board-max: min(calc(100dvh - 82px), calc(100vw - 260px)); width: fit-content; }
  .device-main { grid-template-columns: var(--board-max) 210px; }
  .side { justify-content: center; }
  .level-meta { display: block; }
  .actions { grid-template-columns: 1fr; margin-top: 4px; gap: 4px; }
  .actions .btn { padding: 4px 6px; }
  #guideText { font-size: 20px; }
}
