/* ============================================================
   Classic Solitaire — the fog table
   Royal-blue felt, gold-rimmed chrome, emerald gems.
   ============================================================ */

@font-face {
  font-family: "Baloo 2";
  src: url("vendor/fonts/baloo-2-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Fraunces";
  src: url("vendor/fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;

  --font-ui: "Baloo 2", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --font-card: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino,
    Georgia, serif;

  --gap: clamp(6px, 1.2vw, 20px);
  --pad-x: clamp(10px, 2.4vw, 36px);
  --pad-y: clamp(8px, 1.4vw, 16px);

  --card-w: clamp(
    46px,
    min(
      calc((100vw - 2 * var(--pad-x) - 6 * var(--gap)) / 7),
      calc((100dvh - 224px) / 6.6)
    ),
    126px
  );
  --card-h: calc(var(--card-w) * 1.4);
  --card-radius: clamp(5px, calc(var(--card-w) * 0.07), 9px);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);

  --ink-0: #f6f9ff;
  --ink-1: #ccdcff;
  --ink-2: #93a9de;

  --gold: #e8b64c;
  --gold-hi: #ffe49a;
  --gold-deep: #8f5c0c;
  --emerald: #3ce9ba;
  --emerald-deep: #0c8368;

  --royal: #2f62e0;
  --royal-hi: #6b98ff;
  --royal-deep: #0c1f66;
  --navy: #0a1650;
  --navy-deep: #050c30;

  --accent: #ffd45a;
  --accent-soft: rgba(255, 212, 90, 0.28);
  --ok: #6ff0c8;
  --bad: #ff8090;

  --scrim: rgba(3, 7, 28, 0.7);
  --focus: #ffe08a;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 18px -8px rgba(0, 0, 0, 0.55);
  --shadow-lift: 0 26px 52px -12px rgba(0, 0, 0, 0.7);

  --chrome-shadow: 0 22px 44px -22px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  --panel-shadow: 0 44px 100px -34px rgba(0, 0, 0, 0.9),
    inset 0 0 0 2px rgba(88, 140, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  font-family: var(--font-ui);
  color: var(--ink-0);
  background:
    radial-gradient(120% 80% at 50% 32%, rgba(72, 126, 255, 0.34), transparent 62%),
    radial-gradient(110% 90% at 50% 48%, transparent 34%, rgba(4, 10, 40, 0.62) 100%),
    url("assets/fog/felt.png") center / cover no-repeat fixed,
    #12337f;
  -webkit-tap-highlight-color: transparent;
}

body[data-screen="game"] {
  overflow: hidden;
}

body[data-screen="preloader"],
body[data-screen="home"] {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.86' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

.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;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.screen,
.app {
  position: relative;
  z-index: 1;
}

:where(button, [role="button"], a):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* ------------------------------------------------------------
   Logo art
   ------------------------------------------------------------ */

.logo {
  position: relative;
  display: block;
  width: min(80vw, 46vh, 540px);
}

.logo img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 22px 32px rgba(0, 0, 0, 0.55));
  user-select: none;
}

.logo--preloader {
  width: min(76vw, 42vh, 460px);
}

.logo--menu.is-intro img {
  animation: logo-glow 1s ease-out 0.18s both;
}

@keyframes logo-glow {
  0% {
    filter: drop-shadow(0 22px 32px rgba(0, 0, 0, 0.55))
      drop-shadow(0 0 0 rgba(255, 214, 90, 0));
  }
  35% {
    filter: drop-shadow(0 22px 32px rgba(0, 0, 0, 0.55))
      drop-shadow(0 0 28px rgba(255, 214, 90, 0.6));
  }
  100% {
    filter: drop-shadow(0 22px 32px rgba(0, 0, 0, 0.55))
      drop-shadow(0 0 0 rgba(255, 214, 90, 0));
  }
}

/* ------------------------------------------------------------
   Shared version stamp
   ------------------------------------------------------------ */

.version {
  margin: 0;
  font-size: clamp(0.54rem, 0.7vw, 0.65rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(222, 233, 255, 0.48);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.preloader .version,
.home .version {
  position: absolute;
  left: clamp(12px, 2vw, 22px);
  bottom: 10px;
  z-index: 4;
}

.version--game {
  position: absolute;
  left: clamp(10px, 1.6vw, 18px);
  bottom: 6px;
  z-index: 6;
}

.version--trigger {
  padding: 6px 0;
  border: 0;
  background: none;
  font-family: inherit;
  cursor: pointer;
}

.version--trigger:hover,
.version--trigger:focus-visible {
  color: var(--gold-hi);
}

.version--trigger:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 3px;
  border-radius: 3px;
}

.release-notes {
  position: fixed;
  inset: auto auto 42px clamp(12px, 2vw, 22px);
  width: min(280px, calc(100vw - 24px));
  margin: 0;
  padding: 16px 20px;
  border: 1px solid rgba(112, 155, 255, 0.4);
  border-left: 4px solid var(--gold-hi);
  border-radius: 4px 16px 16px 4px;
  background: rgba(7, 17, 55, 0.97);
  color: var(--ink-0);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease,
    display 180ms allow-discrete, overlay 180ms allow-discrete;
}

.release-notes:popover-open {
  opacity: 1;
  transform: translateY(0);
}

@starting-style {
  .release-notes:popover-open {
    opacity: 0;
    transform: translateY(8px);
  }
}

.release-notes h2 {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 8px;
  color: var(--gold-hi);
  font-size: 0.9rem;
  font-weight: 700;
}

.release-notes h2 span {
  color: var(--ink-1);
  font-size: 0.8rem;
}

.release-notes ul {
  margin: 0;
  padding-left: 16px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.release-notes li::marker {
  color: var(--gold-hi);
}

/* ------------------------------------------------------------
   Preloader
   ------------------------------------------------------------ */

.preloader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: clamp(16px, 3vw, 32px);
  overflow: hidden;
}

.preloader__content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 3.4vh, 38px);
  width: min(620px, 100%);
  text-align: center;
}

.loader {
  width: min(62vw, 520px);
  padding: 0;
}

.loader__track {
  display: block;
  position: relative;
  height: clamp(34px, 4.4vh, 54px);
  overflow: hidden;
  border-radius: 999px;
  border: 2px solid var(--gold);
  background: linear-gradient(180deg, #0c1a56, #040b2c 60%);
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.7), inset 0 0 0 2px rgba(74, 121, 255, 0.25),
    0 0 0 1px rgba(255, 226, 150, 0.22), 0 12px 28px -12px rgba(0, 0, 0, 0.8),
    0 0 26px rgba(72, 126, 255, 0.28);
}

.loader__track::after {
  content: "";
  position: absolute;
  inset: 3px 8% auto;
  height: 32%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent);
  pointer-events: none;
}

.loader__fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transform: scaleX(0.035);
  transform-origin: 0 50%;
  background: linear-gradient(180deg, #5f91ff 0%, #2a5be0 45%, #12308f 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 0 18px rgba(76, 134, 255, 0.65);
  transition: transform 1.05s var(--ease-soft);
}

.preloader__status {
  margin: 0;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  font-weight: 500;
  letter-spacing: 0.06em;
  color: rgba(232, 240, 255, 0.85);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* ------------------------------------------------------------
   Home
   ------------------------------------------------------------ */

.home {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: clamp(20px, 4vh, 48px) clamp(16px, 4vw, 48px) clamp(38px, 6vh, 64px);
  overflow: hidden;
}

.home__cards {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.home-card {
  --home-card-w: clamp(48px, 9vw, 108px);
  position: absolute;
  width: var(--home-card-w);
  height: calc(var(--home-card-w) * 1.4);
  border-radius: calc(var(--home-card-w) * 0.07);
  transform: rotate(var(--tilt, 0deg));
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.45));
  will-change: transform;
}

.home-card .card__face {
  box-shadow: 0 0 0 0.5px rgba(11, 22, 52, 0.24), 0 10px 20px rgba(0, 0, 0, 0.35);
}

.home-card .card__face--back {
  transform: none;
}

.home-card--tl {
  top: clamp(10px, 2.5vh, 28px);
  left: clamp(10px, 2.5vw, 32px);
}

.home-card--tr {
  top: clamp(10px, 2.5vh, 28px);
  right: clamp(10px, 2.5vw, 32px);
}

.home-card--bl {
  bottom: clamp(44px, 7vh, 72px);
  left: clamp(10px, 2.5vw, 32px);
}

.home-card--br {
  bottom: clamp(44px, 7vh, 72px);
  right: clamp(10px, 2.5vw, 32px);
}

.menu {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 2.4vh, 28px);
  width: min(100%, 720px);
  text-align: center;
}

.menu__primary {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.4vh, 14px);
  width: 100%;
}

.art-btn {
  display: block;
  width: clamp(96px, 12vw, 152px);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.45));
  transition: transform 160ms var(--ease-soft), filter 160ms var(--ease-soft);
}

.art-btn img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.art-btn:hover {
  transform: translateY(-2px) scale(1.025);
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.5)) brightness(1.07);
}

.art-btn:active {
  transform: translateY(0) scale(0.985);
}

.art-btn--start {
  width: min(78vw, 440px);
}

.menu__continue {
  padding: 0.15em 0.2em;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: clamp(0.72rem, 1vw, 0.86rem);
  font-weight: 600;
  color: var(--gold-hi);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.menu__continue:hover {
  color: #fff3c8;
}

.menu__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.2vw, 16px);
  flex-wrap: wrap;
}

/* ------------------------------------------------------------
   Game shell
   ------------------------------------------------------------ */

.app {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.1vh, 14px);
  height: 100dvh;
  padding: var(--pad-y) var(--pad-x) clamp(8px, 1.4vh, 14px);
}

.hud {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 1.4vw, 18px);
  padding: clamp(6px, 0.85vw, 10px) clamp(10px, 1.5vw, 20px);
  border-radius: 999px;
  border: 2px solid var(--gold);
  background: linear-gradient(180deg, rgba(30, 55, 146, 0.96) 0%, rgba(11, 25, 82, 0.96) 48%, rgba(6, 15, 52, 0.97) 100%);
  box-shadow: var(--chrome-shadow), inset 0 0 0 1px rgba(84, 134, 255, 0.4),
    0 0 30px rgba(44, 94, 224, 0.28);
  backdrop-filter: blur(6px);
}

.hud__side {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.6vw, 8px);
  flex: 1 1 0;
}

.hud__round {
  display: grid;
  place-items: center;
  width: clamp(32px, 3.2vw, 44px);
  height: clamp(32px, 3.2vw, 44px);
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: #eef4ff;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.hud__round svg {
  width: 62%;
  height: 62%;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

.hud__round:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 224, 148, 0.35);
}

.hud__round:active {
  transform: scale(0.94);
}

.hud__stats {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: clamp(12px, 3.4vw, 56px);
  margin: 0;
  min-width: 0;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 0.45em;
  white-space: nowrap;
}

.stat__icon {
  width: clamp(13px, 1.15vw, 16px);
  height: clamp(13px, 1.15vw, 16px);
  flex: 0 0 auto;
  align-self: center;
  color: #c5d4f8;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.stat dt {
  margin: 0;
  font-size: clamp(0.68rem, 0.9vw, 0.84rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #c5d4f8;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.stat dt::after {
  content: ":";
  margin-left: 0.1em;
}

.stat dd {
  margin: 0;
  font-size: clamp(1.1rem, 1.65vw, 1.48rem);
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  font-variant-numeric: tabular-nums;
}

.hud__side--right {
  justify-content: flex-end;
}

/* ------------------------------------------------------------
   Table
   ------------------------------------------------------------ */

.table {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-start;
  gap: clamp(10px, 1.8vh, 22px);
  padding-top: clamp(6px, 1.2vh, 16px);
  min-height: 0;
}

.table__top,
.table__tableau {
  display: grid;
  grid-template-columns: repeat(7, var(--card-w));
  gap: var(--gap);
  justify-content: center;
}

.table__top {
  align-items: start;
}

.pile {
  position: relative;
  flex: 0 0 auto;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
}

.pile--stock {
  cursor: pointer;
}

.pile--stock .card__face,
.pile--foundation .card__face {
  box-shadow: none;
}

.pile--stock .card:last-child .card__face,
.pile--foundation .card:last-child .card__face {
  box-shadow: var(--shadow-card);
}

/* Recycling marks every stock card as lifting at once; their stacked lift
   shadows would read as one black blob under the pile. */
.pile--stock .card.is-lifting .card__face {
  box-shadow: none;
}

.pile--stock::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.pile--stock.is-empty {
  background: rgba(4, 12, 48, 0.34);
  border: 2px dashed rgba(180, 205, 255, 0.28);
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.4);
}

.pile--stock.is-empty::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d6e4ff' stroke-opacity='.4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8'/%3E%3Cpath d='M21 3v5h-5'/%3E%3C/svg%3E")
    center / 50% auto no-repeat;
}

.pile--stock.is-locked {
  cursor: not-allowed;
}

.pile--stock.is-locked::after {
  opacity: 0.3;
  filter: grayscale(1);
}

.stock__passes {
  position: absolute;
  right: calc(var(--card-w) * -0.1);
  bottom: calc(var(--card-w) * -0.1);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.24em;
  padding: 0.18em 0.44em;
  border-radius: 999px;
  border: 1px solid rgba(255, 224, 148, 0.5);
  background: rgba(3, 9, 34, 0.88);
  color: #ffe08a;
  font-size: clamp(0.56rem, 0.8vw, 0.7rem);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.stock__passes[hidden] {
  display: none;
}

.stock__passes svg {
  width: 1.05em;
  height: 1.05em;
}

.stock__passes.is-spent {
  border-color: rgba(255, 138, 150, 0.6);
  color: #ff9aa7;
}

.pile--waste {
  overflow: visible;
}

.foundation {
  background: rgba(4, 12, 48, 0.26);
  border: 2px solid rgba(217, 165, 63, 0.26);
  box-shadow: inset 0 4px 14px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.07);
}

.table__tableau {
  flex: 1;
  align-items: start;
  min-height: 0;
}

.column {
  position: relative;
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  min-height: var(--card-h);
  border-radius: var(--card-radius);
}

.column.is-empty {
  height: var(--card-h);
  background: rgba(4, 12, 48, 0.18);
  border: 2px dashed rgba(190, 212, 255, 0.16);
  box-shadow: inset 0 4px 14px rgba(0, 0, 0, 0.22);
}

.table__hint {
  margin: 0;
  padding-bottom: 2px;
  text-align: center;
  font-size: clamp(0.6rem, 0.9vw, 0.76rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(214, 228, 255, 0.52);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* ------------------------------------------------------------
   Cards
   ------------------------------------------------------------ */

.card {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  perspective: 900px;
  will-change: transform;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.card.is-up {
  cursor: grab;
}

.card.is-up:not(.is-pickable) {
  cursor: default;
}

.card.is-down {
  cursor: default;
}

.column .card {
  top: calc(var(--stack, 0) * var(--card-h) * var(--fan-scale, 1));
}

.pile--waste .card {
  left: calc(var(--fan, 0) * var(--card-w) * 0.17);
}

.card.is-lifting {
  z-index: 40;
}

.card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transform-style: preserve-3d;
  transition: translate 200ms var(--ease-soft);
}

.card.is-down .card__inner {
  transform: rotateY(180deg);
}

.card__face {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--shadow-card);
}

.card__face--front {
  display: block;
  border: 0;
  background: #fefefe url("assets/fog/cards.png") no-repeat;
  background-size: 1300% 400%;
  box-shadow: 0 0 0 0.5px rgba(11, 22, 52, 0.24), var(--shadow-card);
}

.card__face--back {
  transform: rotateY(180deg);
  background: #fbfaf6 url("assets/fog/card-back.png") center / 100% 100% no-repeat;
}

.column .card:not(:last-child) .card__face,
.pile--waste .card:not(:last-child) .card__face {
  box-shadow: none;
}

/* Card feedback */

@media (hover: hover) and (pointer: fine) {
  .card.is-pickable:hover .card__face--front {
    box-shadow: 0 0 0 calc(var(--card-w) * 0.04) #000, var(--shadow-card);
  }
}

.card.is-selected .card__inner {
  translate: 0 calc(var(--card-w) * -0.06);
}

.card.is-selected .card__face--front {
  box-shadow: 0 0 0 2px var(--accent), 0 0 26px -2px var(--accent-soft),
    var(--shadow-card);
}

.card.is-hint .card__face--front {
  box-shadow: 0 0 0 2px var(--accent), 0 0 30px var(--accent-soft), var(--shadow-card);
}

.card.is-lifting .card__face--front,
.card.is-lifting .card__face--back {
  box-shadow: var(--shadow-lift);
}

.card.is-celebrating {
  filter: drop-shadow(0 26px 40px rgba(0, 0, 0, 0.45));
}

/* Drop targets */

.is-move-ok {
  outline: 2px dashed rgba(255, 220, 120, 0.55);
  outline-offset: 2px;
}

.foundation.is-move-ok,
.column.is-move-ok {
  box-shadow: inset 0 0 18px rgba(255, 212, 90, 0.16), 0 0 12px rgba(255, 212, 90, 0.16);
}

.is-drop-ok {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: inset 0 0 22px rgba(255, 212, 90, 0.26), 0 0 18px rgba(255, 212, 90, 0.35) !important;
}

.is-drop-bad {
  outline: 2px solid var(--bad);
  outline-offset: 2px;
  box-shadow: 0 0 16px rgba(255, 96, 116, 0.4) !important;
}

.is-hint-target {
  animation: target-pulse 900ms ease-in-out 2;
}

.hint-ghost {
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.45));
}

.hint-ghost .card__face--front {
  box-shadow: 0 0 0 2px var(--accent), 0 0 30px var(--accent-soft), var(--shadow-card);
}

.pile--stock.is-hint-target {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

@keyframes target-pulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 0 rgba(255, 212, 90, 0), 0 0 0 0 rgba(255, 212, 90, 0);
  }
  50% {
    box-shadow: inset 0 0 28px rgba(255, 212, 90, 0.3), 0 0 22px rgba(255, 212, 90, 0.4);
  }
}

/* Drag layer */

.drag-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

.drag-layer .card {
  position: fixed;
  pointer-events: none;
}

body.is-dragging {
  cursor: grabbing;
}

body.is-dragging .card.is-up {
  cursor: grabbing;
}

.card.is-dragging .card__face {
  box-shadow: var(--shadow-lift);
}

.card.is-source {
  visibility: hidden;
}

/* ------------------------------------------------------------
   Dock + finish
   ------------------------------------------------------------ */

.dock-row {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: clamp(2px, 0.6vh, 8px) var(--pad-x) clamp(8px, 1.4vh, 14px);
  pointer-events: none;
}

.dock-row > * {
  pointer-events: auto;
}

.dock {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 2px;
  padding: 6px clamp(8px, 1.2vw, 16px);
  border-radius: clamp(16px, 1.8vw, 24px);
  border: 1px solid rgba(255, 234, 180, 0.14);
  background: linear-gradient(180deg, rgba(27, 31, 64, 0.95), rgba(8, 10, 30, 0.97));
  box-shadow: 0 20px 44px -18px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 0 0 1px rgba(60, 80, 140, 0.25);
}

.dock__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: clamp(62px, 7.4vw, 96px);
  padding: 5px 6px 4px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #f3f7ff;
  font-family: inherit;
  font-size: clamp(0.66rem, 0.9vw, 0.8rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 140ms ease, transform 120ms ease, opacity 140ms ease;
}

.dock__item svg {
  width: clamp(24px, 2.8vw, 32px);
  height: clamp(24px, 2.8vw, 32px);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

#new-game svg {
  color: #cfe0ff;
}

#game-settings svg {
  color: #9dc4ff;
}

#hint svg {
  color: #ffd75e;
}

#undo svg {
  color: #ffb066;
}

.dock__item:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.07);
}

.dock__item:active:not(:disabled) {
  transform: translateY(1px);
}

.dock__item:disabled {
  opacity: 0.35;
  cursor: default;
}

.finish-btn {
  position: absolute;
  right: max(4px, 1.2vw);
  top: 50%;
  transform: translateY(-50%);
  padding: 0.55em 1.5em;
  border-radius: 999px;
  border: 2px solid #ffe9a3;
  background: linear-gradient(180deg, #ffe9a3 0%, #f2c14e 45%, #cb8c18 100%);
  color: #2a1a00;
  font-family: inherit;
  font-size: clamp(0.78rem, 1vw, 0.92rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 0 22px rgba(255, 208, 90, 0.4);
  animation: finish-glow 2.4s ease-in-out infinite;
  transition: opacity 200ms ease, transform 160ms ease;
}

.finish-btn:hover {
  transform: translateY(-50%) scale(1.04);
}

.finish-btn:active {
  transform: translateY(-50%) scale(0.97);
}

.finish-btn:disabled {
  opacity: 0;
  pointer-events: none;
  animation: none;
}

@keyframes finish-glow {
  0%,
  100% {
    box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.7),
      0 0 16px rgba(255, 208, 90, 0.3);
  }
  50% {
    box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.7),
      0 0 30px rgba(255, 208, 90, 0.55);
  }
}

/* ------------------------------------------------------------
   Modals
   ------------------------------------------------------------ */

.win {
  position: fixed;
  inset: 0;
  z-index: 200;
  container-type: inline-size;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 28px);
  overflow-y: auto;
  background:
    radial-gradient(80% 60% at 50% 38%, rgba(44, 94, 224, 0.28), transparent 70%),
    var(--scrim);
  backdrop-filter: blur(7px);
}

.win__panel {
  --panel-radius: clamp(18px, 2vw, 26px);
  --panel-gutter: clamp(10px, 1.5vw, 12px);
  --panel-frame: clamp(5px, 0.75vw, 7px);
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(92dvh, 820px);
  padding: var(--panel-gutter);
  overflow: hidden;
  border-radius: var(--panel-radius);
  border: 2px solid var(--gold);
  background: linear-gradient(180deg, #12225f 0%, #0a1542 55%, #060e30 100%);
  box-shadow: var(--panel-shadow), 0 0 44px rgba(44, 94, 224, 0.25);
  color: var(--ink-0);
  animation: none;
}

.win__panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(94, 146, 255, 0.18), transparent 65%),
    url("assets/fog/felt.png") center / cover no-repeat;
  opacity: 0.22;
  mix-blend-mode: overlay;
}

/* Inner frame: the panel art sits whole inside it instead of bleeding off
   the dialog edges as a cropped slice. */
.win__panel::after {
  content: "";
  position: absolute;
  inset: var(--panel-frame);
  z-index: 1;
  pointer-events: none;
  border-radius: calc(var(--panel-radius) - var(--panel-frame));
  border: 1px solid rgba(110, 158, 255, 0.5);
  box-shadow:
    inset 0 0 0 1px rgba(3, 9, 32, 0.55),
    inset 0 0 26px rgba(44, 94, 224, 0.26),
    0 0 16px rgba(44, 94, 224, 0.16);
}

.panel__head {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  line-height: 0;
}

.panel__head img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 86%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 86%, transparent 100%);
}

.panel__title {
  position: absolute;
  left: 50%;
  top: 53%;
  width: 58%;
  margin: 0;
  transform: translate(-50%, -50%);
  font-family: var(--font-ui);
  font-size: clamp(1.05rem, 2.3vw, 1.55rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  color: #ffe08a;
  text-shadow: 0 2px 0 #6b4304, 0 3px 8px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.panel__title--small {
  font-size: clamp(0.95rem, 2vw, 1.3rem);
}

.panel__body {
  position: relative;
  z-index: 2;
  min-height: 0;
  padding: clamp(12px, 2.2vw, 21px) clamp(16px, 2.6vw, 26px) clamp(14px, 2.2vw, 21px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.win__body {
  position: relative;
  z-index: 2;
  padding: clamp(6px, 1.4vw, 12px) clamp(18px, 2.8vw, 30px) clamp(18px, 2.6vw, 26px);
  overflow-y: auto;
}

.panel__sub {
  margin: 0 0 clamp(12px, 2vw, 18px);
  font-size: clamp(0.82rem, 1.2vw, 0.95rem);
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  color: var(--ink-1);
}

.panel__note {
  margin: clamp(12px, 2vw, 16px) 0 0;
  font-size: clamp(0.68rem, 0.95vw, 0.78rem);
  text-align: center;
  color: var(--ink-2);
}

.modal__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: clamp(12px, 1.8vw, 16px);
}

.btn {
  padding: 0.58em 1.5em;
  border-radius: 999px;
  border: 2px solid transparent;
  font-family: inherit;
  font-size: clamp(0.82rem, 1.1vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease, background 140ms ease,
    border-color 140ms ease;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn--primary {
  border-color: #ffe9a3;
  background: linear-gradient(180deg, #ffe9a3 0%, #f2c14e 48%, #c98a16 100%);
  color: #2a1a00;
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.btn--primary:hover {
  filter: brightness(1.06);
}

.btn--ghost {
  border-color: rgba(176, 202, 255, 0.4);
  background: rgba(12, 30, 90, 0.45);
  color: #dfe8ff;
}

.btn--ghost:hover {
  background: rgba(40, 72, 160, 0.5);
  border-color: rgba(206, 224, 255, 0.6);
}

.btn--ghost.is-armed {
  border-color: rgba(255, 128, 144, 0.8);
  background: rgba(120, 20, 40, 0.55);
  color: #ffd5da;
}

/* Statistics */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1.4vw, 12px);
  margin: 0;
}

.stats-tile {
  padding: clamp(8px, 1.3vw, 12px) clamp(10px, 1.6vw, 16px);
  border-radius: 12px;
  border: 1px solid rgba(148, 180, 255, 0.22);
  background: linear-gradient(180deg, rgba(52, 92, 190, 0.34), rgba(10, 25, 80, 0.52));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 6px 14px -10px rgba(0, 0, 0, 0.8);
}

.stats-tile dt {
  margin: 0;
  font-size: clamp(0.58rem, 0.85vw, 0.7rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.stats-tile dd {
  margin: 2px 0 0;
  font-size: clamp(1.1rem, 1.8vw, 1.45rem);
  font-weight: 700;
  line-height: 1.1;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Frame and button offsets use the artwork's 769 × 889 source dimensions. */
.art-panel {
  --art-w: min(560px, 100cqw);
  --art-u: calc(var(--art-w) / 769);
  width: var(--art-w);
  max-height: min(820px, calc(100dvh - 2 * clamp(14px, 3vw, 28px)));
  padding: 0;
  overflow: visible;
  border-radius: 0;
  border-style: solid;
  border-color: transparent;
  border-width: calc(var(--art-u) * 210) calc(var(--art-u) * 22)
    calc(var(--art-u) * 165);
  border-image: url("assets/fog/statistics-panel.png") 210 22 165 22 fill stretch;
  background: none;
  box-shadow: none;
  filter: drop-shadow(0 34px 60px rgba(0, 0, 0, 0.62))
    drop-shadow(0 0 30px rgba(44, 94, 224, 0.22));
}

.art-panel::before,
.art-panel::after {
  content: none;
}

.art-panel .panel__head {
  height: 0;
}

.art-panel .panel__title {
  top: calc(var(--art-u) * -58);
  width: 52%;
  font-size: clamp(1.02rem, 2.2vw, 1.5rem);
}

@media (max-height: 480px) and (min-width: 481px) {
  .art-panel {
    --art-w: min(400px, 100cqw);
  }
}

.art-panel .panel__body {
  padding: clamp(10px, 1.8vw, 16px) clamp(14px, 2.4vw, 22px) 8px;
}

.art-panel .modal__actions {
  justify-content: center;
  margin-top: clamp(10px, 1.6vw, 14px);
}

.art-panel .stats-grid {
  gap: clamp(7px, 1.3vw, 11px);
}

/* Transparent hit target exactly over the artwork's baked "Back" button. */
.art-panel__back {
  position: absolute;
  left: 50%;
  bottom: calc(var(--art-u) * -80);
  width: calc(var(--art-u) * 390);
  height: calc(var(--art-u) * 108);
  padding: 0;
  transform: translate(-50%, 50%);
  border: 0;
  border-radius: calc(var(--art-u) * 54);
  background: transparent;
  color: transparent;
  font-size: 0;
  cursor: pointer;
  transition: background 140ms ease;
}

.art-panel__back:hover {
  background: rgba(150, 200, 255, 0.14);
}

.art-panel__back:focus-visible {
  outline: 2px solid #ffe08a;
  outline-offset: 3px;
}

/* New game dialog */

.deal-modal .art-panel {
  border-image-source: url("assets/fog/deal-panel.png");
}

.art-panel__deal {
  z-index: 3;
  color: #fff;
  font-family: var(--font-ui);
  font-size: calc(var(--art-u) * 54);
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 2px 3px #030a2d;
}

/* Settings */

#settings .choice {
  padding-block: 8px;
}

.settings-note {
  min-height: 0;
  margin-bottom: 12px;
}

.choice-list {
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-list__legend {
  padding: 0;
  margin-bottom: 6px;
  font-size: clamp(0.62rem, 0.9vw, 0.74rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px clamp(12px, 1.8vw, 16px);
  margin-bottom: 6px;
  border-radius: 14px;
  border: 1px solid rgba(150, 180, 255, 0.2);
  background: rgba(45, 80, 175, 0.24);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.choice:hover {
  border-color: rgba(190, 214, 255, 0.4);
  background: rgba(58, 98, 205, 0.3);
}

.choice:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.choice__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.choice__title {
  font-size: clamp(0.9rem, 1.2vw, 1rem);
  font-weight: 700;
  color: #f4f8ff;
}

.choice__desc {
  font-size: clamp(0.7rem, 1vw, 0.8rem);
  line-height: 1.35;
  color: var(--ink-2);
}

.choice__check {
  position: relative;
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 2px solid rgba(190, 212, 255, 0.5);
  background: rgba(4, 12, 44, 0.6);
  transition: background 140ms ease, border-color 140ms ease;
}

.choice input:checked ~ .choice__check {
  border-color: #ffe9a3;
  background: linear-gradient(180deg, #ffe9a3, #e0a92e);
}

.choice input:checked ~ .choice__check::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2a1a00;
}

.settings-sound {
  margin-top: 10px;
}

.switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px clamp(12px, 1.8vw, 16px);
  border-radius: 14px;
  border: 1px solid rgba(150, 180, 255, 0.2);
  background: rgba(45, 80, 175, 0.24);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.switch:hover {
  border-color: rgba(190, 214, 255, 0.4);
  background: rgba(58, 98, 205, 0.3);
}

.switch:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.switch__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.switch__track {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(190, 212, 255, 0.45);
  background: rgba(4, 12, 44, 0.7);
  transition: background 160ms ease, border-color 160ms ease;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cfdcff;
  transition: transform 160ms var(--ease-soft), background 160ms ease;
}

.switch input:checked ~ .switch__track {
  border-color: #ffe9a3;
  background: linear-gradient(180deg, #ffe9a3, #e0a92e);
}

.switch input:checked ~ .switch__track::after {
  transform: translateX(20px);
  background: #2a1a00;
}

/* Rules */

.rules-panel .panel__body {
  padding-top: clamp(8px, 1.4vw, 14px);
}

.rules {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.6vw, 14px);
}

.rules section {
  padding: clamp(10px, 1.4vw, 13px) clamp(12px, 1.6vw, 15px);
  border-radius: 12px;
  border: 1px solid rgba(150, 180, 255, 0.18);
  background: rgba(38, 68, 158, 0.22);
}

.rules h3 {
  margin: 0 0 4px;
  font-size: clamp(0.82rem, 1.15vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.rules p,
.rules ul {
  margin: 0;
  font-size: clamp(0.74rem, 1vw, 0.85rem);
  line-height: 1.45;
  color: var(--ink-1);
}

.rules ul {
  padding-left: 1.2em;
}

.rules strong {
  color: #ffffff;
}

.panel__body::-webkit-scrollbar,
.win__body::-webkit-scrollbar {
  width: 8px;
}

.panel__body::-webkit-scrollbar-thumb,
.win__body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(160, 190, 255, 0.3);
}

/* Win panel */

.win__seal {
  display: grid;
  place-items: center;
  width: clamp(62px, 8vw, 84px);
  height: clamp(62px, 8vw, 84px);
  margin: -2px auto clamp(8px, 1.4vw, 12px);
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: radial-gradient(circle at 35% 28%, #3b6ae0, #0a1a56 70%);
  box-shadow: 0 12px 26px -10px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 26px rgba(255, 208, 90, 0.25);
  color: var(--gold-hi);
}

.win__seal svg {
  width: 46%;
  height: 46%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.win__sub {
  margin: 0 0 clamp(12px, 2vw, 18px);
  text-align: center;
  font-size: clamp(0.86rem, 1.2vw, 0.98rem);
  color: var(--ink-1);
}

.win__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.2vw, 12px);
  margin: 0 0 clamp(8px, 1.4vw, 12px);
}

.win__stats > div {
  padding: clamp(8px, 1.2vw, 12px) 6px;
  border-radius: 12px;
  border: 1px solid rgba(150, 180, 255, 0.2);
  background: rgba(38, 68, 158, 0.26);
  text-align: center;
}

.win__stats dt {
  font-size: clamp(0.56rem, 0.8vw, 0.68rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.win__stats dd {
  margin: 2px 0 0;
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.win__body .modal__actions {
  justify-content: center;
}

/* ------------------------------------------------------------
   Toast
   ------------------------------------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: clamp(90px, 13vh, 128px);
  z-index: 300;
  max-width: min(88vw, 420px);
  padding: 0.55em 1.1em;
  border-radius: 999px;
  border: 1px solid rgba(255, 222, 145, 0.45);
  background: rgba(5, 12, 40, 0.94);
  color: #f1f6ff;
  font-size: clamp(0.74rem, 1vw, 0.86rem);
  font-weight: 600;
  text-align: center;
  box-shadow: 0 16px 34px -14px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ------------------------------------------------------------
   Small screens
   ------------------------------------------------------------ */

@media (max-width: 1024px) {
  .hud__stats {
    gap: clamp(10px, 2.4vw, 28px);
  }
}

@media (max-width: 760px) {
  .stat--moves {
    display: none;
  }

  .hud {
    gap: 6px;
    padding: 5px 8px;
  }

  .hud__round {
    width: 34px;
    height: 34px;
  }

  .stat dt {
    font-size: 0.66rem;
  }

  .dock {
    padding: 5px 6px;
    border-radius: 18px;
  }

  .dock__item {
    width: clamp(56px, 15vw, 74px);
    padding: 4px 4px 3px;
  }

  .dock__item span {
    font-size: 0.64rem;
  }

  .finish-btn {
    top: auto;
    bottom: calc(100% + 8px);
    right: 8px;
    transform: none;
  }

  .finish-btn:hover,
  .finish-btn:active {
    transform: none;
  }

  .menu__actions {
    width: min(100%, 360px);
  }

  .menu__actions .art-btn {
    width: calc(50% - 6px);
    max-width: 168px;
  }

  .menu {
    gap: clamp(10px, 1.8vh, 18px);
  }

  .table__hint {
    font-size: 0.6rem;
  }

  .version--game {
    display: none;
  }
}

@media (max-width: 420px) {
  .hud__stats {
    gap: 8px;
  }

  .stat {
    gap: 0.3em;
  }

  .stat dt {
    font-size: 0.62rem;
  }

  .stat dd {
    font-size: 1.04rem;
  }

  .dock__item {
    width: clamp(52px, 14.5vw, 66px);
  }

  .dock__item svg {
    width: 22px;
    height: 22px;
  }

  .dock__item span {
    font-size: 0.6rem;
  }

  .loader {
    width: min(74vw, 380px);
  }

  .panel__body,
  .win__body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .modal__actions {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-height: 700px) {
  .logo--menu {
    width: min(74vw, 40vh, 400px);
  }

  .menu {
    gap: 10px;
  }

  .art-btn--start {
    width: min(66vw, 340px);
  }

  .menu__actions .art-btn {
    width: clamp(84px, 10vw, 128px);
  }

  .loader__track {
    height: 36px;
  }

  .hud {
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .dock__item {
    padding-top: 2px;
    padding-bottom: 2px;
  }
}

/* ------------------------------------------------------------
   Reduced motion
   ------------------------------------------------------------ */

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