:root {
  --black: #040403;
  --ink: #080706;
  --panel: rgba(12, 10, 8, 0.72);
  --panel-strong: rgba(8, 7, 6, 0.9);
  --copper: #b8794d;
  --copper-soft: rgba(184, 121, 77, 0.46);
  --copper-bright: #e8c196;
  --paper: #f0d2ad;
  --muted: rgba(229, 188, 147, 0.68);
  --green-felt: #151c18;
  --red: #7b2e25;
  --line: rgba(218, 150, 92, 0.26);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: var(--black);
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
}

body {
  overflow: hidden;
}

@media (pointer: fine) {
  body,
  a,
  button {
    cursor: url("assets/cursor-key.svg") 4 4, auto;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
}

.game-stage {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100vw;
  height: 100svh;
  min-height: 640px;
  padding:
    env(safe-area-inset-top, 0)
    env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 66% 20%, rgba(193, 128, 78, 0.18), transparent 26%),
    radial-gradient(circle at 26% 82%, rgba(129, 64, 40, 0.2), transparent 36%),
    linear-gradient(135deg, #030302, #11100d 58%, #040403);
}

.game-ambience,
.table-light {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.game-ambience {
  z-index: -3;
  opacity: 0.45;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.82), transparent 44%, rgba(0, 0, 0, 0.72)),
    url("assets/klucznik-hero-web.jpg") center / cover no-repeat;
  filter: saturate(0.62) contrast(1.1) brightness(0.5);
}

.table-light {
  z-index: -2;
  background:
    radial-gradient(ellipse at 48% 58%, rgba(225, 165, 105, 0.16), transparent 43%),
    radial-gradient(ellipse at 18% 52%, rgba(230, 190, 139, 0.11), transparent 23%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.56));
}

.game-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.024) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 58%, #000, transparent 76%);
}

.game-topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(18px, 2.8vw, 34px) clamp(20px, 3.4vw, 56px) 0;
}

.game-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.86);
}

.game-seal {
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  border: 1px solid rgba(220, 149, 91, 0.58);
  border-radius: 50%;
  color: rgba(235, 190, 141, 0.92);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 218, 164, 0.18), transparent 28%),
    linear-gradient(145deg, rgba(101, 35, 22, 0.96), rgba(23, 10, 7, 0.98));
  font-size: 0.65rem;
  font-weight: 700;
  box-shadow:
    inset 0 0 0 4px rgba(47, 14, 9, 0.54),
    inset 0 -8px 18px rgba(0, 0, 0, 0.58),
    0 0 24px rgba(0, 0, 0, 0.76);
}

.game-brand strong,
.game-brand small {
  display: block;
}

.game-brand strong {
  font-size: clamp(1.2rem, 1.8vw, 2rem);
  line-height: 1;
  font-weight: 500;
}

.game-brand small {
  margin-top: 5px;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: clamp(0.52rem, 0.62vw, 0.72rem);
  font-weight: 800;
  letter-spacing: 0.26em;
}

.return-link {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid rgba(210, 136, 82, 0.52);
  border-radius: 7px;
  background: rgba(11, 8, 6, 0.54);
  color: var(--copper-bright);
  font-family: Arial, sans-serif;
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.return-link:hover,
.return-link:focus-visible {
  outline: 0;
  transform: translateY(-1px);
  border-color: rgba(232, 193, 150, 0.88);
  box-shadow: 0 0 24px rgba(206, 116, 67, 0.22);
}

.game-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(190px, 0.58fr) minmax(520px, 1.7fr) minmax(220px, 0.72fr);
  align-items: stretch;
  gap: clamp(14px, 1.7vw, 30px);
  min-height: 0;
  padding: clamp(18px, 2vw, 30px) clamp(20px, 3.4vw, 56px) clamp(18px, 2.7vw, 42px);
}

.story-panel,
.dealer-panel,
.game-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(24, 17, 12, 0.76), rgba(5, 5, 4, 0.76)),
    radial-gradient(circle at 50% 0, rgba(219, 145, 86, 0.08), transparent 46%);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.56),
    0 18px 48px rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(10px);
}

.story-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 0;
  padding: 18px;
  overflow: hidden;
}

.lockbox {
  position: relative;
  width: min(100%, 220px);
  aspect-ratio: 1.3;
  margin: 0 auto auto;
  border: 1px solid rgba(222, 155, 92, 0.38);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 34%, rgba(241, 195, 129, 0.18), transparent 12%),
    linear-gradient(145deg, #4a2d18, #1e130c 58%, #080705);
  box-shadow:
    inset 0 8px 20px rgba(255, 211, 145, 0.1),
    inset 0 -20px 42px rgba(0, 0, 0, 0.62),
    0 22px 36px rgba(0, 0, 0, 0.4);
  transform: rotate(-8deg);
}

.lockbox::before,
.lockbox::after,
.lockbox span {
  content: "";
  position: absolute;
}

.lockbox::before {
  inset: 14px;
  border: 1px solid rgba(239, 178, 111, 0.2);
  border-radius: 6px;
}

.lockbox::after {
  left: 50%;
  bottom: -18px;
  width: 42px;
  height: 52px;
  border: 1px solid rgba(236, 180, 116, 0.36);
  border-radius: 10px 10px 14px 14px;
  transform: translateX(-50%);
  background: linear-gradient(#5d361d, #15100c);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.56);
}

.lockbox span {
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(244, 196, 129, 0.36);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(226, 163, 91, 0.42), transparent 56%);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--copper-bright);
  font-family: Arial, sans-serif;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.story-panel h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 3.2vw, 3.55rem);
  line-height: 0.93;
  font-weight: 500;
  text-transform: uppercase;
}

.story-panel p:last-child,
.dealer-line {
  margin: 0;
  color: rgba(236, 210, 184, 0.78);
  font-family: Arial, sans-serif;
  font-size: 0.92rem;
  line-height: 1.55;
}

.game-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding: clamp(12px, 1.4vw, 20px);
}

.game-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: clamp(12px, 1.3vw, 18px);
}

.tab,
.primary-action,
.secondary-action,
.ghost-action,
.motion-action {
  min-height: 46px;
  border: 1px solid rgba(201, 127, 77, 0.42);
  border-radius: 7px;
  background: rgba(13, 9, 7, 0.62);
  color: var(--copper-bright);
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition:
    transform 180ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    background 220ms ease,
    opacity 180ms ease;
}

.tab.is-active,
.primary-action {
  background:
    radial-gradient(circle at 50% 0, rgba(247, 185, 107, 0.2), transparent 48%),
    linear-gradient(180deg, rgba(131, 69, 33, 0.92), rgba(56, 25, 14, 0.92));
  border-color: rgba(236, 181, 115, 0.64);
  box-shadow:
    inset 0 1px 0 rgba(255, 229, 169, 0.12),
    0 0 22px rgba(198, 104, 54, 0.14);
}

.tab:hover,
.tab:focus-visible,
.primary-action:hover,
.primary-action:focus-visible,
.secondary-action:hover,
.secondary-action:focus-visible,
.ghost-action:hover,
.ghost-action:focus-visible,
.motion-action:hover,
.motion-action:focus-visible {
  outline: 0;
  transform: translateY(-1px);
  border-color: rgba(238, 195, 143, 0.84);
  box-shadow: 0 0 22px rgba(204, 118, 67, 0.2);
}

.tab:disabled,
.primary-action:disabled,
.secondary-action:disabled,
.ghost-action:disabled,
.motion-action:disabled {
  opacity: 0.46;
  transform: none;
  box-shadow: none;
}

.view {
  display: none;
  min-height: 0;
}

.view.is-active {
  display: block;
}

.view-game.is-active {
  display: grid;
  grid-template-rows: auto minmax(120px, 1fr) auto auto;
  gap: clamp(12px, 1.2vw, 18px);
  min-height: 0;
}

.key-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(54px, 1fr));
  gap: clamp(6px, 0.65vw, 11px);
}

.key-tile {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 0.66;
  min-height: 106px;
  border: 1px solid rgba(129, 70, 38, 0.78);
  border-radius: 9px;
  color: #2c170d;
  background:
    radial-gradient(circle at 50% 14%, rgba(255, 228, 159, 0.42), transparent 15%),
    linear-gradient(115deg, rgba(255, 211, 139, 0.96), rgba(177, 108, 55, 0.98) 45%, rgba(103, 55, 28, 0.98));
  box-shadow:
    inset 0 0 0 3px rgba(82, 42, 22, 0.34),
    inset 0 14px 24px rgba(255, 230, 170, 0.16),
    inset 0 -18px 28px rgba(45, 18, 8, 0.32),
    0 8px 18px rgba(0, 0, 0, 0.44);
  overflow: hidden;
  transition:
    transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 220ms ease,
    opacity 220ms ease,
    box-shadow 220ms ease;
}

.key-tile::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(57, 27, 13, 0.48);
  border-radius: 7px;
  pointer-events: none;
}

.key-tile::after {
  content: "";
  position: absolute;
  inset: -28px;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 236, 184, 0.28), transparent 56%);
  transform: translateX(-48%);
  transition: transform 360ms ease;
}

.key-tile:not(.is-closed):hover,
.key-tile:not(.is-closed):focus-visible {
  outline: 0;
  transform: translateY(-4px);
  filter: brightness(1.06);
  box-shadow:
    inset 0 0 0 3px rgba(82, 42, 22, 0.28),
    inset 0 16px 26px rgba(255, 230, 170, 0.2),
    inset 0 -18px 28px rgba(45, 18, 8, 0.28),
    0 14px 28px rgba(0, 0, 0, 0.5),
    0 0 26px rgba(221, 150, 89, 0.22);
}

.key-tile:not(.is-closed):hover::after,
.key-tile:not(.is-closed):focus-visible::after {
  transform: translateX(48%);
}

.key-tile.is-selected {
  transform: translateY(-6px);
  box-shadow:
    inset 0 0 0 3px rgba(82, 42, 22, 0.26),
    0 18px 36px rgba(0, 0, 0, 0.56),
    0 0 36px rgba(242, 181, 107, 0.38);
}

.key-tile.is-hint {
  animation: keyHint 1s ease-in-out 2;
}

.key-tile.is-closed {
  color: rgba(219, 172, 122, 0.34);
  pointer-events: none;
  opacity: 0.42;
  transform: translateY(13px) rotateX(62deg);
  filter: saturate(0.4) brightness(0.72);
}

.key-number {
  position: relative;
  z-index: 1;
  font-size: clamp(2.4rem, 3.4vw, 4.4rem);
  line-height: 0.9;
  text-shadow: 0 1px 0 rgba(255, 222, 166, 0.35);
}

.key-icon {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 34px;
  margin-top: 6px;
  opacity: 0.68;
}

.key-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 12px;
  height: 12px;
  border: 3px solid currentColor;
  border-radius: 50%;
  transform: translateX(-50%);
}

.key-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 14px;
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: currentColor;
  transform: translateX(-50%);
  box-shadow:
    7px 8px 0 -1px currentColor,
    10px 12px 0 -1px currentColor;
}

.felt-zone {
  position: relative;
  display: grid;
  grid-template-columns: minmax(170px, 0.72fr) minmax(240px, 1fr);
  align-items: center;
  gap: clamp(12px, 1.6vw, 22px);
  min-height: 0;
  padding: clamp(14px, 1.6vw, 24px);
  border: 1px solid rgba(172, 112, 72, 0.28);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 45%, rgba(219, 160, 98, 0.08), transparent 35%),
    linear-gradient(145deg, rgba(19, 26, 22, 0.96), rgba(5, 6, 5, 0.96));
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.68),
    inset 0 16px 44px rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.felt-zone::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background:
    radial-gradient(circle at 50% 52%, rgba(230, 180, 116, 0.12), transparent 18%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 8px);
}

.dice-tray {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 16px;
}

.die {
  position: relative;
  width: clamp(58px, 6vw, 82px);
  aspect-ratio: 1;
  border-radius: 15px;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.58), transparent 24%),
    linear-gradient(145deg, #fff1d0, #c99d69 58%, #755331);
  box-shadow:
    inset 0 -12px 20px rgba(66, 38, 18, 0.28),
    inset 0 2px 4px rgba(255, 255, 255, 0.5),
    0 12px 22px rgba(0, 0, 0, 0.5);
  transform: rotate(var(--die-tilt, -5deg));
}

.die:last-child {
  --die-tilt: 8deg;
}

.die.is-rolling {
  animation: diceRoll 680ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.die span,
.die::after {
  position: absolute;
  width: 10px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #1c1510;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2);
  opacity: 0;
}

.die::after {
  content: "";
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.die span:nth-child(1) { left: 20%; top: 20%; }
.die span:nth-child(2) { right: 20%; top: 20%; }
.die span:nth-child(3) { left: 20%; top: 50%; transform: translateY(-50%); }
.die span:nth-child(4) { right: 20%; top: 50%; transform: translateY(-50%); }
.die span:nth-child(5) { left: 20%; bottom: 20%; }
.die span:nth-child(6) { right: 20%; bottom: 20%; }

.die[data-value="1"]::after,
.die[data-value="3"]::after,
.die[data-value="5"]::after {
  opacity: 1;
}

.die[data-value="2"] span:nth-child(1),
.die[data-value="2"] span:nth-child(6),
.die[data-value="3"] span:nth-child(1),
.die[data-value="3"] span:nth-child(6),
.die[data-value="4"] span:nth-child(1),
.die[data-value="4"] span:nth-child(2),
.die[data-value="4"] span:nth-child(5),
.die[data-value="4"] span:nth-child(6),
.die[data-value="5"] span:nth-child(1),
.die[data-value="5"] span:nth-child(2),
.die[data-value="5"] span:nth-child(5),
.die[data-value="5"] span:nth-child(6),
.die[data-value="6"] span {
  opacity: 1;
}

.status-plaque {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: clamp(14px, 1.4vw, 22px);
  border: 1px solid rgba(204, 137, 83, 0.38);
  border-radius: 8px;
  background: rgba(8, 7, 6, 0.66);
  text-align: center;
}

.status-label,
.game-message {
  font-family: Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.status-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.roll-value {
  color: var(--paper);
  font-size: clamp(2.6rem, 5vw, 5rem);
  line-height: 0.9;
  font-weight: 500;
}

.game-message {
  color: var(--copper-bright);
  font-size: clamp(0.64rem, 0.82vw, 0.82rem);
  font-weight: 800;
}

.game-actions {
  display: grid;
  grid-template-columns: 1.25fr 1.1fr 0.9fr 0.9fr;
  gap: 10px;
}

.secondary-action {
  background: rgba(38, 23, 13, 0.66);
}

.ghost-action,
.motion-action {
  background: rgba(9, 8, 7, 0.54);
}

.motion-action {
  display: none;
}

.rules-view,
.scores-view {
  min-height: 100%;
  padding: clamp(18px, 2vw, 28px);
  border: 1px solid rgba(199, 129, 78, 0.25);
  border-radius: 10px;
  background: rgba(8, 7, 6, 0.56);
}

.rules-view h2,
.scores-view h2 {
  margin: 0 0 18px;
  color: var(--paper);
  font-size: clamp(2rem, 3vw, 3.4rem);
  line-height: 1;
  font-weight: 500;
  text-transform: uppercase;
}

.rules-view ol {
  margin: 0;
  padding-left: 24px;
  color: rgba(244, 222, 199, 0.82);
  font-family: Arial, sans-serif;
  font-size: clamp(1rem, 1.15vw, 1.18rem);
  line-height: 1.7;
}

.rules-view p {
  max-width: 680px;
  margin: 20px 0 0;
  color: var(--muted);
  font-family: Arial, sans-serif;
  line-height: 1.55;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.score-grid article {
  padding: 18px;
  border: 1px solid rgba(201, 127, 77, 0.28);
  border-radius: 8px;
  background: rgba(15, 11, 8, 0.7);
}

.score-grid span,
.score-grid strong {
  display: block;
}

.score-grid span {
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.score-grid strong {
  margin-top: 10px;
  color: var(--paper);
  font-size: clamp(2.4rem, 4vw, 4.4rem);
  line-height: 1;
  font-weight: 500;
}

.dealer-panel {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.dealer-portrait {
  min-height: 0;
  background:
    linear-gradient(180deg, transparent 20%, rgba(0, 0, 0, 0.74)),
    url("assets/klucznik-hero-clean.png") 67% 34% / 230% auto no-repeat;
  filter: saturate(0.82) contrast(1.12) brightness(0.78);
}

.dealer-copy {
  padding: 18px;
  background: linear-gradient(180deg, rgba(6, 5, 4, 0.42), rgba(6, 5, 4, 0.92));
}

.dealer-copy .eyebrow {
  margin-bottom: 8px;
}

.game-card.is-shaking {
  animation: badMove 300ms ease;
}

@keyframes diceRoll {
  0% { transform: translateY(0) rotate(var(--die-tilt, -5deg)); }
  30% { transform: translateY(-22px) rotate(28deg); }
  62% { transform: translateY(7px) rotate(-20deg); }
  100% { transform: translateY(0) rotate(var(--die-tilt, -5deg)); }
}

@keyframes badMove {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

@keyframes keyHint {
  0%, 100% { box-shadow: 0 8px 18px rgba(0, 0, 0, 0.44); }
  50% { box-shadow: 0 0 34px rgba(242, 181, 107, 0.55); }
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .game-stage {
    min-height: 100svh;
    height: auto;
  }

  .game-shell {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 28px;
  }

  .story-panel {
    display: none;
  }

  .dealer-panel {
    min-height: 220px;
    grid-template-columns: minmax(0, 0.9fr) minmax(220px, 1fr);
    grid-template-rows: auto;
  }

  .dealer-portrait {
    min-height: 220px;
    background-position: 64% 32%;
    background-size: 150% auto;
  }

  .dealer-copy {
    display: grid;
    align-content: center;
  }
}

@media (max-width: 760px) {
  body {
    overflow: hidden;
  }

  .game-stage {
    height: 100svh;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .game-ambience {
    opacity: 0.28;
    background-position: 62% center;
  }

  .game-topbar {
    padding:
      calc(14px + env(safe-area-inset-top, 0px))
      calc(14px + env(safe-area-inset-right, 0px))
      0
      calc(14px + env(safe-area-inset-left, 0px));
  }

  .game-brand {
    gap: 9px;
    letter-spacing: 0.08em;
  }

  .game-seal {
    width: 34px;
  }

  .game-brand strong {
    max-width: 175px;
    font-size: 1.04rem;
  }

  .game-brand small {
    font-size: 0.5rem;
    letter-spacing: 0.18em;
  }

  .return-link {
    min-height: 38px;
    padding: 0 13px;
    font-size: 0.62rem;
    letter-spacing: 0.16em;
  }

  .game-shell {
    display: block;
    min-height: 0;
    padding:
      12px
      calc(14px + env(safe-area-inset-right, 0px))
      calc(14px + env(safe-area-inset-bottom, 0px))
      calc(14px + env(safe-area-inset-left, 0px));
    overflow: hidden;
  }

  .game-card {
    height: 100%;
    max-height: calc(100svh - 86px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    padding: 10px;
    border-radius: 9px;
  }

  .game-tabs {
    gap: 6px;
    margin-bottom: 10px;
  }

  .tab {
    min-height: 38px;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
  }

  .view-game.is-active {
    grid-template-rows: minmax(0, 1fr) auto auto auto;
    gap: 10px;
  }

  .key-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: center;
    gap: 8px;
    min-height: 0;
  }

  .key-tile {
    min-height: 0;
    aspect-ratio: 0.82;
    border-radius: 8px;
  }

  .key-number {
    font-size: clamp(2rem, 12vw, 3rem);
  }

  .key-icon {
    width: 20px;
    height: 25px;
    margin-top: 2px;
  }

  .felt-zone {
    grid-template-columns: minmax(118px, 0.74fr) minmax(0, 1fr);
    gap: 9px;
    padding: 10px;
  }

  .dice-tray {
    gap: 9px;
  }

  .die {
    width: clamp(44px, 13vw, 58px);
    border-radius: 11px;
  }

  .die span,
  .die::after {
    width: 7px;
  }

  .status-plaque {
    padding: 10px 8px;
  }

  .status-label {
    font-size: 0.52rem;
  }

  .roll-value {
    font-size: clamp(2rem, 12vw, 3.1rem);
  }

  .game-message {
    font-size: 0.56rem;
    letter-spacing: 0.12em;
  }

  .game-actions {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .primary-action,
  .secondary-action,
  .ghost-action,
  .motion-action {
    min-height: 42px;
    border-radius: 8px;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
  }

  .motion-action {
    display: block;
  }

  .dealer-panel {
    display: none;
  }

  .rules-view,
  .scores-view {
    max-height: 100%;
    overflow: auto;
    padding: 16px;
  }

  .rules-view h2,
  .scores-view h2 {
    font-size: 2rem;
  }

  .rules-view ol {
    padding-left: 20px;
    font-size: 0.95rem;
  }

  .score-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px), (max-height: 720px) and (max-width: 760px) {
  .game-brand small {
    display: none;
  }

  .game-card {
    max-height: calc(100svh - 68px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  .key-grid {
    gap: 6px;
  }

  .key-number {
    font-size: clamp(1.7rem, 10vw, 2.35rem);
  }

  .key-icon {
    display: none;
  }

  .felt-zone {
    padding: 8px;
  }

  .primary-action,
  .secondary-action,
  .ghost-action,
  .motion-action {
    min-height: 38px;
  }
}

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