:root {
  color-scheme: light;
  --bg: #eef3f7;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #d1985e;
  --panel: #ffffff;
  --accent: #126a63;
  --accent-strong: #0d514b;
  --warm: #b45367;
  --number-bg: #f0a45d;
  --number-ink: #44342e;
  --card: #fbfcf7;
  --card-edge: #c98c50;
  --shadow: 0 18px 50px rgb(31 41 51 / 13%);
  --card-size: clamp(64px, 11vw, 112px);
  --hex-card-width: clamp(72px, 9.5vw, 112px);
  --hex-card-height: calc(var(--hex-card-width) * 1.1547);
  --board-gap: 0px;
  --art-bleed-scale: 1.055;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgb(18 106 99 / 8%), transparent 38%),
    linear-gradient(315deg, rgb(180 83 103 / 10%), transparent 34%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0;
}

.intro {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(680px, 100%);
  margin: min(9vh, 76px) auto 0;
  text-align: center;
}

.language-switch {
  position: fixed;
  z-index: 20;
  top: 18px;
  right: 18px;
  display: flex;
  padding: 3px;
  border: 1px solid rgb(18 106 99 / 22%);
  border-radius: 10px;
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 8px 24px rgb(31 41 51 / 12%);
  backdrop-filter: blur(10px);
}

.language-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  filter: saturate(0.72);
  transition: background-color 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.language-button:hover { filter: saturate(1); }
.language-button.is-active {
  background: #fff;
  box-shadow: 0 3px 10px rgb(31 41 51 / 18%);
  filter: saturate(1);
}
.language-button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid rgb(18 106 99 / 30%);
  outline-offset: 1px;
}

.app-shell.is-game-active .intro,
.app-shell.is-game-active .site-information { display: none; }
.app-shell:not(.is-game-active) .toolbar,
.app-shell:not(.is-game-active) .workspace { display: none; }

.intro-icon {
  width: 82px;
  height: 82px;
  border-radius: 20%;
  box-shadow: 0 14px 28px rgb(31 41 51 / 16%);
}

.intro-kicker {
  margin: 20px 0 8px;
  color: var(--warm);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.intro h1 { font-size: clamp(2.8rem, 8vw, 5rem); }
.intro-copy { max-width: 610px; margin-top: 22px; font-size: 1rem; line-height: 1.58; }
.intro-copy p { margin: 0 0 11px; }
.intro-copy p:last-child { margin-bottom: 0; }

.deck-button {
  display: grid;
  justify-items: center;
  gap: 53px;
  margin-top: 0;
  padding: 40px 28px 28px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.deck-button:hover .intro-deck,
.deck-button:focus-visible .intro-deck {
  transform: translateY(-8px) rotate(-2deg);
  filter: drop-shadow(0 18px 17px rgb(77 18 18 / 30%));
}

.deck-button:focus-visible { outline: 3px solid rgb(18 106 99 / 30%); outline-offset: 3px; }

.intro-deck,
.intro-deck::before,
.intro-deck::after,
.intro-deck span {
  display: block;
  width: clamp(112px, 19vw, 148px);
  aspect-ratio: 1;
  border: 1px solid #7e211e;
  border-radius: 5px;
  background: url("assets/card-back/red-ornament.webp") center / cover;
}

.intro-deck {
  position: relative;
  isolation: isolate;
  box-shadow: 0 14px 15px rgb(75 24 18 / 25%);
  transition: transform 240ms ease, filter 240ms ease;
  animation: deck-breathe 2.7s ease-in-out infinite;
}

.deck-button:disabled {
  cursor: wait;
}

.deck-button:disabled .intro-deck {
  transform: none;
  filter: grayscale(0.25);
  animation: none;
}

.intro-deck .deck-spinner {
  position: absolute;
  z-index: 2;
  display: none;
  width: 34px;
  height: 34px;
  inset: 50% auto auto 50%;
  border: 4px solid rgb(255 255 255 / 55%);
  border-top-color: #fff;
  border-radius: 50%;
  background: none;
  transform: translate(-50%, -50%);
  animation: deck-spinner 800ms linear infinite;
}

.deck-button.is-loading .deck-spinner { display: block; }

.intro-deck::before,
.intro-deck::after { content: ""; position: absolute; z-index: -1; inset: 0; }
.intro-deck::before { transform: translate(6px, 7px) rotate(2deg); }
.intro-deck::after { transform: translate(-6px, 13px) rotate(-3deg); }
.intro-deck span { display: none; }
.deck-prompt { font-size: 1.02rem; }

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 4rem;
  line-height: 0.92;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 0.86em;
  height: 0.86em;
  border-radius: 18%;
  flex: 0 0 auto;
}

h2 {
  font-size: 1.2rem;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-switch {
  /* Temporary: keep the 37-card mode available in code, but hide its selector. */
  display: none;
  align-items: center;
  gap: 0;
  margin: 0;
  border: 1px solid rgb(18 106 99 / 22%);
  border-radius: 8px;
  background: rgb(255 255 255 / 76%);
  padding: 3px;
  box-shadow: 0 8px 20px rgb(31 41 51 / 8%);
}

.mode-switch legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.mode-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 92px;
  border-radius: 6px;
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 850;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease;
}

.mode-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.mode-option span {
  position: relative;
  z-index: 1;
}

.mode-option:has(input:checked) {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 14px rgb(18 106 99 / 20%);
}

.mode-option:has(input:focus-visible) {
  outline: 3px solid rgb(18 106 99 / 26%);
  outline-offset: 2px;
}

.mode-option:has(input:disabled) {
  cursor: wait;
  opacity: 0.72;
}

.start-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 132px;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 26px rgb(18 106 99 / 24%);
  transition:
    background-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.start-button:hover {
  background: var(--accent-strong);
  box-shadow: 0 14px 30px rgb(18 106 99 / 28%);
  transform: translateY(-1px);
}

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

.start-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
  box-shadow: 0 8px 18px rgb(18 106 99 / 18%);
}

.start-button:focus-visible {
  outline: 3px solid rgb(18 106 99 / 30%);
  outline-offset: 3px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  gap: 18px;
  align-items: start;
}

.board-panel,
.matches-panel {
  border: 1px solid rgb(146 125 93 / 28%);
  border-radius: 8px;
  background: rgb(255 253 250 / 82%);
  box-shadow: var(--shadow);
}

.board-panel {
  overflow-x: auto;
  padding: clamp(10px, 2vw, 20px);
}

.board {
  min-width: 100%;
  perspective: 900px;
}

.square-board {
  display: grid;
  grid-template-columns: repeat(6, var(--card-size));
  grid-auto-rows: var(--card-size);
  gap: var(--board-gap);
  width: max-content;
  justify-content: center;
}

.card {
  position: relative;
  isolation: isolate;
  justify-self: center;
  align-self: center;
  width: var(--card-size);
  aspect-ratio: 1;
  border: 1px solid var(--card-edge);
  border-radius: 5px;
  background:
    radial-gradient(circle at 50% 50%, rgb(18 106 99 / 12%), transparent 28%),
    conic-gradient(
      from 45deg,
      rgb(18 106 99 / 17%) 0deg 90deg,
      rgb(180 83 103 / 12%) 90deg 180deg,
      rgb(18 106 99 / 10%) 180deg 270deg,
      rgb(240 164 93 / 20%) 270deg 360deg
    ),
    var(--card);
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 70%),
    0 5px 12px rgb(31 41 51 / 12%);
  transform-origin: center;
  will-change: transform, opacity, filter;
}

.board.is-shuffling .card {
  animation: shuffle-card 520ms cubic-bezier(0.32, 0.72, 0.18, 1) both;
}

.board.is-shuffling .hex-card {
  animation: shuffle-card 520ms cubic-bezier(0.32, 0.72, 0.18, 1) both;
}

.board.is-shuffling .card:nth-child(3n + 1) {
  animation-delay: 24ms;
}

.board.is-shuffling .card:nth-child(3n + 2) {
  animation-delay: 48ms;
}

.card.is-dealing {
  animation: deal-card 620ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--deal-delay);
}

.hex-card.is-dealing {
  animation: deal-card 620ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--deal-delay);
}

.card::before,
.card::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 142%;
  height: 1px;
  background: var(--line);
  box-shadow: 0 0 0 0.5px rgb(255 248 220 / 28%);
  transform-origin: center;
}

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

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

.card-inner,
.card-front,
.card-back { position: absolute; inset: 0; }

.card-inner,
.card-front,
.card-back { border-radius: inherit; }

.card-inner { transform-style: preserve-3d; }

.card-front,
.card-back { overflow: hidden; backface-visibility: hidden; }

.card-front {
  background:
    radial-gradient(circle at 50% 50%, rgb(18 106 99 / 12%), transparent 28%),
    conic-gradient(from 45deg, rgb(18 106 99 / 17%) 0deg 90deg, rgb(180 83 103 / 12%) 90deg 180deg, rgb(18 106 99 / 10%) 180deg 270deg, rgb(240 164 93 / 20%) 270deg 360deg),
    var(--card);
}

.card-back {
  background: url("assets/card-back/red-ornament.webp") center / cover;
  transform: rotateY(180deg);
}

.card::before,
.card::after { display: none; }

.card-front::before,
.card-front::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 142%;
  height: 1px;
  background: var(--line);
  box-shadow: 0 0 0 0.5px rgb(255 248 220 / 28%);
  transform-origin: center;
}

.card-front::before { transform: translate(-50%, -50%) rotate(45deg); }
.card-front::after { transform: translate(-50%, -50%) rotate(-45deg); }

.card.is-dealing .card-inner {
  animation: flip-card 620ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--deal-delay);
}

.card-art-slot,
.card-art-position,
.card-art-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.card-art-slot {
  z-index: 1;
  overflow: hidden;
  transition: opacity 180ms ease;
}

.card-art-slot.is-revealing-source {
  opacity: 0;
}

.card-art-slot.is-matched-art {
  cursor: pointer;
  pointer-events: auto;
}

.card-art-slot.is-matched-art:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.card-art-position {
  transform-origin: center;
}

.card-art-image {
  object-fit: cover;
  transform-origin: center;
}

.card-art-slot.top {
  clip-path: polygon(-2% -2%, 102% -2%, 50% 52%);
}

.card-art-slot.right {
  clip-path: polygon(102% -2%, 102% 102%, 48% 50%);
}

.card-art-slot.bottom {
  clip-path: polygon(-2% 102%, 102% 102%, 50% 48%);
}

.card-art-slot.left {
  clip-path: polygon(-2% -2%, -2% 102%, 52% 50%);
}

.card-number-hub {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  /* Deliberately fixed: numbers remain legible even when the card shrinks. */
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  overflow: hidden;
  background: rgb(233 237 238 / 30%);
  box-shadow:
    0 1px 3px rgb(25 20 18 / 22%),
    inset 0 1px 0 rgb(255 255 255 / 20%);
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.card-number-hub::before,
.card-number-hub::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 142%;
  height: 1px;
  background: var(--line);
  transform-origin: center;
  pointer-events: none;
}

.card-number-hub::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.card-number-hub::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.card-hub-sector {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: transparent;
  pointer-events: none;
}

.card-hub-sector.top {
  clip-path: polygon(0 0, 100% 0, 50% 50%);
}

.card-hub-sector.right {
  clip-path: polygon(100% 0, 100% 100%, 50% 50%);
}

.card-hub-sector.bottom {
  clip-path: polygon(0 100%, 100% 100%, 50% 50%);
}

.card-hub-sector.left {
  clip-path: polygon(0 0, 0 100%, 50% 50%);
}

.card-hub-sector.is-matched-sector {
  background: rgb(244 228 63 / 82%);
  cursor: pointer;
  pointer-events: auto;
}

.card-hub-sector.is-matched-sector:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.card-hub-value {
  position: absolute;
  z-index: 4;
  display: block;
  min-width: 1.25em;
  color: #24211f;
  font-size: 0.46rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 0 rgb(255 255 255 / 70%);
  pointer-events: none;
}

.card-hub-value.top {
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.card-hub-value.left {
  top: 50%;
  left: 22%;
  transform: translate(-50%, -50%);
}

.card-hub-value.right {
  top: 50%;
  left: 78%;
  transform: translate(-50%, -50%);
}

.card-hub-value.bottom {
  top: 80%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.hex-board {
  display: flex;
  width: max-content;
  min-width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--hex-card-height) * 0.12) 0;
}

.hex-row {
  display: flex;
  height: var(--hex-card-height);
  justify-content: center;
}

.hex-row + .hex-row {
  margin-top: calc(var(--hex-card-height) * -0.25);
}

.hex-card {
  position: relative;
  isolation: isolate;
  flex: 0 0 var(--hex-card-width);
  width: var(--hex-card-width);
  height: var(--hex-card-height);
  border: 0;
  background: var(--card-edge);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  overflow: hidden;
  filter: drop-shadow(0 5px 10px rgb(31 41 51 / 12%));
  transform-origin: center;
  will-change: transform, opacity, filter;
}

.hex-card::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 1px;
  background:
    radial-gradient(circle at 50% 50%, rgb(18 106 99 / 10%), transparent 32%),
    conic-gradient(
      from 30deg,
      rgb(18 106 99 / 15%) 0deg 60deg,
      rgb(240 164 93 / 20%) 60deg 120deg,
      rgb(180 83 103 / 12%) 120deg 180deg,
      rgb(18 106 99 / 11%) 180deg 240deg,
      rgb(240 164 93 / 16%) 240deg 300deg,
      rgb(18 106 99 / 12%) 300deg 360deg
    ),
    var(--card);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.hex-sector {
  position: absolute;
  z-index: 1;
  inset: 1px;
  background: transparent;
}

.hex-sector.top-right {
  clip-path: polygon(50% 50%, 50% 0, 100% 25%);
}

.hex-sector.right {
  clip-path: polygon(50% 50%, 100% 25%, 100% 75%);
}

.hex-sector.bottom-right {
  clip-path: polygon(50% 50%, 100% 75%, 50% 100%);
}

.hex-sector.bottom-left {
  clip-path: polygon(50% 50%, 50% 100%, 0 75%);
}

.hex-sector.left {
  clip-path: polygon(50% 50%, 0 75%, 0 25%);
}

.hex-sector.top-left {
  clip-path: polygon(50% 50%, 0 25%, 50% 0);
}

.hex-sector.is-matched-sector {
  background: rgb(244 228 63 / 82%);
}

.hex-value {
  position: absolute;
  z-index: 4;
  min-width: 3.6em;
  color: #24211f;
  font-size: clamp(0.48rem, calc(var(--hex-card-width) * 0.09), 0.68rem);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 0 rgb(255 255 255 / 76%);
  transform: translate(-50%, -50%);
}

.hex-value.top-right {
  top: 27%;
  left: 66%;
}

.hex-value.right {
  top: 50%;
  left: 78%;
}

.hex-value.bottom-right {
  top: 73%;
  left: 66%;
}

.hex-value.bottom-left {
  top: 73%;
  left: 34%;
}

.hex-value.left {
  top: 50%;
  left: 22%;
}

.hex-value.top-left {
  top: 27%;
  left: 34%;
}

.hex-lines {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.story-reveal-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  overflow: hidden;
  background: rgb(17 24 39 / 44%);
  backdrop-filter: blur(4px);
  cursor: pointer;
  animation: story-reveal-overlay-in 220ms ease both;
}

.story-reveal-overlay.is-closing {
  pointer-events: none;
  animation: story-reveal-overlay-out 220ms ease both;
}

.story-reveal-piece {
  position: fixed;
  z-index: 1003;
  overflow: hidden;
  border-radius: 9px;
  transform-origin: center;
  pointer-events: none;
  will-change: transform, opacity, filter;
}

.story-reveal-piece.is-settled {
  opacity: 0;
}

.story-reveal-card-image,
.story-reveal-card-turn,
.story-reveal-card-position,
.story-reveal-join-mask,
.story-reveal-piece-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.story-reveal-card-turn,
.story-reveal-card-position {
  transform-origin: center;
}

.story-reveal-card-image {
  object-fit: cover;
  transform-origin: center;
}

.story-reveal-join-mask {
  overflow: hidden;
  opacity: 0;
}

.story-reveal-join-mask.to-top {
  clip-path: polygon(50% -2%, 102% 50%, -2% 50%);
}

.story-reveal-join-mask.to-right {
  clip-path: polygon(50% -2%, 102% 50%, 50% 102%);
}

.story-reveal-join-mask.to-bottom {
  clip-path: polygon(-2% 50%, 102% 50%, 50% 102%);
}

.story-reveal-join-mask.to-left {
  clip-path: polygon(50% -2%, 50% 102%, -2% 50%);
}

.story-reveal-piece-image {
  object-fit: cover;
  transform: scale(var(--art-bleed-scale));
  transform-origin: center;
}

.story-reveal-join-mask.from-top.to-bottom .story-reveal-piece-image {
  transform: translateY(50%) scale(var(--art-bleed-scale));
}

.story-reveal-join-mask.from-bottom.to-top .story-reveal-piece-image {
  transform: translateY(-50%) scale(var(--art-bleed-scale));
}

.story-reveal-join-mask.from-right.to-left .story-reveal-piece-image {
  transform: translateX(-50%) scale(var(--art-bleed-scale));
}

.story-reveal-join-mask.from-left.to-right .story-reveal-piece-image {
  transform: translateX(50%) scale(var(--art-bleed-scale));
}

.story-reveal-composite {
  position: fixed;
  z-index: 1004;
  display: grid;
  margin: 0;
  place-items: center;
  pointer-events: none;
  overflow: hidden;
  clip-path: url("#roundedDiamondClip");
  opacity: 0;
  transform: rotate(var(--reveal-start-rotation, 0deg)) scale(0.82);
}

.story-reveal-composite.is-settled {
  opacity: 1;
  transform: none;
}

.story-reveal-composite img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(var(--art-bleed-scale));
  transform-origin: center;
  filter:
    drop-shadow(0 20px 34px rgb(16 22 31 / 34%))
    drop-shadow(0 4px 10px rgb(16 22 31 / 18%));
}

.story-reveal-badge {
  position: absolute;
  z-index: 1;
  display: grid;
  width: 34px;
  height: 34px;
  margin: 0;
  border: 1px solid rgb(108 76 33 / 72%);
  border-radius: 50%;
  place-items: center;
  color: var(--ink);
  background: rgb(255 239 92 / 92%);
  box-shadow: 0 2px 7px rgb(24 18 14 / 22%);
  font-size: 0.65rem;
  font-weight: 900;
}

.story-reveal-card-number { top: 17px; }
.story-reveal-variant { bottom: 17px; }

.story-reveal-meaning {
  position: fixed;
  z-index: 1005;
  max-width: calc(100vw - 36px);
  padding: 14px 16px;
  border: 1px solid rgb(18 106 99 / 22%);
  border-radius: 8px;
  background: rgb(255 253 250 / 94%);
  box-shadow: var(--shadow);
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  animation:
    story-reveal-meaning-in var(--meaning-duration, 420ms) ease
    var(--meaning-delay, 1160ms) both;
}

.story-reveal-title {
  margin-bottom: 7px;
  color: var(--accent-strong);
  font-weight: 900;
}

.story-reveal-text {
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.45;
}

.story-reveal-proverb,
.meaning-picked-proverb {
  font-style: italic;
}

.story-reveal-prediction {
  margin-top: 6px;
}

@keyframes story-reveal-overlay-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes story-reveal-overlay-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes story-reveal-meaning-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

@keyframes shuffle-card {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    filter: blur(0);
  }

  38% {
    opacity: 0.95;
    transform:
      translate3d(
        calc(var(--card-size) * 0.18),
        calc(var(--card-size) * -0.12),
        0
      )
      rotate(7deg)
      scale(0.96);
    filter: blur(0.2px);
  }

  100% {
    opacity: 0;
    transform:
      translate3d(
        calc(var(--card-size) * 0.55),
        calc(var(--card-size) * 0.18),
        -90px
      )
      rotate(-12deg)
      scale(0.58);
    filter: blur(1.2px);
  }
}

@keyframes deal-card {
  0% {
    opacity: 0;
    transform:
      translate3d(
        var(--deal-x),
        var(--deal-y),
        -80px
      )
      rotate(var(--deal-rotate))
      scale(0.62);
    filter: blur(1.4px);
  }

  66% {
    opacity: 1;
    filter: blur(0);
  }

  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    filter: blur(0);
  }
}

.matches-panel {
  padding: 18px;
}

.matches-header {
  padding-bottom: 13px;
  border-bottom: 1px solid rgb(146 125 93 / 22%);
}

.matches-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.match-item,
.empty-state {
  border: 1px solid rgb(18 106 99 / 16%);
  border-radius: 8px;
  background: var(--panel);
  padding: 11px 12px;
}

.match-item {
  display: grid;
  gap: 8px;
}

.match-title-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.match-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.match-number {
  color: var(--accent-strong);
  font-weight: 900;
}

.meaning-picked {
  display: grid;
  gap: 5px;
  margin: 2px 0 0;
  border-top: 1px solid rgb(18 106 99 / 12%);
  padding-top: 9px;
}

.meaning-picked-label {
  color: var(--warm);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.meaning-picked-text {
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.42;
}

.meaning-picked-proverb {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.42;
}

.empty-state {
  color: var(--muted);
  line-height: 1.45;
}

.restart-button {
  width: 100%;
  margin-top: 16px;
  min-height: 46px;
  border: 1px solid rgb(18 106 99 / 28%);
  border-radius: 8px;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.board-actions {
  display: flex;
  justify-content: center;
  padding-top: 20px;
}

.board-actions .restart-button {
  width: auto;
  min-width: 210px;
  margin-top: 0;
}

.restart-button:hover { background: rgb(18 106 99 / 8%); }
.restart-button:disabled { cursor: wait; opacity: 0.6; }

@keyframes flip-card {
  from { transform: rotateY(180deg); }
  to { transform: rotateY(360deg); }
}

@keyframes deck-breathe {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-4px) rotate(1deg); }
}

@keyframes deck-spinner {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (max-width: 880px) {
  :root {
    --card-size: clamp(58px, 14vw, 82px);
  }

  h1 {
    font-size: 2.8rem;
  }

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

  .matches-panel {
    padding: 14px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100vw - 16px, 1180px);
    padding: 14px 0;
  }

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

  .toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-switch,
  .mode-option,
  .start-button {
    width: 100%;
  }

  h1 {
    font-size: 2.1rem;
  }

  .start-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .board.is-shuffling .card,
  .board.is-shuffling .hex-card,
  .hex-card.is-dealing,
  .card.is-dealing,
  .story-reveal-overlay,
  .story-reveal-composite,
  .story-reveal-meaning {
    animation: none;
  }

  .card.is-dealing .card-inner,
  .intro-deck { animation: none; }

  .story-reveal-overlay.is-closing {
    opacity: 0;
  }

  .story-reveal-overlay.is-reduced-motion .story-reveal-piece {
    display: none;
  }

  .story-reveal-composite,
  .story-reveal-meaning {
    opacity: 1;
    transform: none;
  }

  .card-art-slot {
    transition: none;
  }

  .start-button {
    transition: none;
  }
}

.cookie-banner {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(10 27 35 / 56%);
}

.cookie-banner[hidden] { display: none; }

.cookie-dialog {
  width: min(780px, 100%);
  max-height: min(800px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 18px;
  background: #fffdf8;
  color: #17323a;
  box-shadow: 0 26px 70px rgb(3 20 26 / 35%);
}

.cookie-notice { padding: 42px 46px; }
.cookie-dialog__eyebrow { margin: 0 0 8px; color: #b67732; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.cookie-notice h2, .cookie-options h2 { margin: 0 0 16px; color: #17323a; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 2.65rem); line-height: 1.08; }
.cookie-notice > p:not(.cookie-dialog__eyebrow), .cookie-options__intro { max-width: 640px; margin: 0; font-size: 1.12rem; line-height: 1.62; }
.cookie-dialog__hint { color: #607076; font-size: 0.94rem !important; }
.cookie-dialog__actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 30px; }
.cookie-dialog__legal { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px !important; font-size: 0.9rem !important; }
.cookie-dialog__legal a { color: #126a63; text-underline-offset: 3px; }

.cookie-button {
  min-height: 52px;
  padding: 12px 18px;
  border: 1px solid #126a63;
  border-radius: 9px;
  background: #126a63;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 750;
  transition: background 150ms ease, transform 150ms ease;
}

.cookie-button:hover { background: #0d554f; transform: translateY(-1px); }
.cookie-button--secondary { background: transparent; color: #126a63; }
.cookie-button--secondary:hover { background: #e8f2f0; }

.cookie-options { padding: 34px 42px 28px; }
.cookie-options__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 24px; border-bottom: 1px solid #dce7e5; }
.cookie-options__header h2 { font-size: 2rem; }
.cookie-close { width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; color: #65777b; cursor: pointer; font-size: 2rem; line-height: 1; }
.cookie-close:hover { background: #edf4f2; color: #126a63; }
.cookie-options__intro { margin: 22px 0; }

.cookie-category { display: block; margin-top: 12px; padding: 20px; border: 1px solid #dce7e5; border-radius: 12px; background: #f7fbfa; }
.cookie-category h3 { margin: 0; color: #17323a; font-size: 1.08rem; }
.cookie-category p { margin: 8px 0 0; color: #607076; line-height: 1.5; }
.cookie-category__title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cookie-category__title span { color: #126a63; font-size: 0.88rem; font-weight: 750; }
.cookie-category--toggle { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; cursor: pointer; }
.cookie-category--toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.cookie-switch { position: relative; flex: 0 0 auto; width: 48px; height: 28px; margin-top: 3px; border-radius: 999px; background: #cbd4d3; transition: background 150ms ease; }
.cookie-switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 25%); transition: transform 150ms ease; }
.cookie-category--toggle input:checked + .cookie-switch { background: #126a63; }
.cookie-category--toggle input:checked + .cookie-switch::after { transform: translateX(20px); }
.cookie-category--toggle input:focus-visible + .cookie-switch { outline: 3px solid #b67732; outline-offset: 3px; }
.cookie-options__actions { position: sticky; bottom: -28px; margin: 28px -42px -28px; padding: 18px 42px; background: #fffdf8; border-top: 1px solid #dce7e5; }

@media (max-width: 560px) {
  .cookie-banner { padding: 12px; }
  .cookie-notice { padding: 30px 24px; }
  .cookie-options { padding: 26px 20px 20px; }
  .cookie-dialog__actions { grid-template-columns: 1fr; }
  .cookie-options__actions { bottom: -20px; margin: 22px -20px -20px; padding: 14px 20px; }
}

.site-information {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: min(920px, 100%);
  margin: 72px auto 24px;
}

.information-card {
  padding: 28px;
  border: 1px solid rgb(18 106 99 / 14%);
  border-radius: 16px;
  background: rgb(255 255 255 / 76%);
  box-shadow: 0 12px 34px rgb(31 41 51 / 7%);
}

.information-card h2 {
  margin-bottom: 14px;
  color: var(--accent-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.16;
}

.information-card p,
.information-card li {
  color: #4b5964;
  line-height: 1.65;
}

.information-card p { margin: 0; }
.information-card ol { margin: 0; padding-left: 1.25rem; }
.information-card li + li { margin-top: 8px; }
.information-card--faq { grid-column: 1 / -1; }
.information-kicker {
  margin-bottom: 8px !important;
  color: var(--warm) !important;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.information-card details {
  padding: 14px 0;
  border-top: 1px solid rgb(18 106 99 / 14%);
}

.information-card details:last-child { padding-bottom: 0; }
.information-card summary { color: var(--accent-strong); font-weight: 780; cursor: pointer; }
.information-card details p { margin-top: 10px; }

.site-footer {
  width: min(920px, calc(100vw - 28px));
  margin: 8px auto 0;
  padding: 26px 0 34px;
  border-top: 1px solid rgb(18 106 99 / 16%);
  color: var(--muted);
  text-align: center;
}

.site-footer p { margin: 0; }
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin-top: 12px;
}

.site-footer a,
.site-footer button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer__disclaimer {
  max-width: 660px;
  margin: 14px auto 0 !important;
  font-size: 0.86rem;
  line-height: 1.5;
}

.legal-shell {
  width: min(820px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 34px 0 60px;
}

.legal-header {
  margin-bottom: 20px;
  padding: 30px;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.legal-header a {
  display: inline-block;
  max-width: 100%;
  color: var(--accent-strong);
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.legal-header h1 {
  margin: 24px 0 10px;
  color: var(--accent-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 7vw, 4.2rem);
  line-height: 1;
  hyphens: auto;
  overflow-wrap: anywhere;
}

.legal-header p { margin: 0; color: var(--muted); line-height: 1.6; }

.legal-content {
  padding: 30px;
  border: 1px solid rgb(18 106 99 / 12%);
  border-radius: 16px;
  background: rgb(255 255 255 / 82%);
}

.legal-content + .legal-content { margin-top: 20px; }
.legal-content h2 { margin: 28px 0 10px; color: var(--accent-strong); font-size: 1.35rem; }
.legal-content h2:first-child { margin-top: 0; }
.legal-content p,
.legal-content li { line-height: 1.68; }
.legal-content a { color: var(--accent-strong); }
.legal-language-label { color: var(--warm); font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }

.cookie-storage-list {
  display: grid;
  gap: 14px;
  margin: 24px 0 30px;
  padding: 0;
  list-style: none;
}

.cookie-storage-item {
  padding: 20px;
  border: 1px solid rgb(18 106 99 / 16%);
  border-radius: 12px;
  background: rgb(18 106 99 / 4%);
}

.cookie-storage-name {
  margin: 0 0 16px;
  color: var(--accent-strong);
  font-size: 1.08rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.cookie-storage-name code { font-size: 0.96em; }

.cookie-storage-item dl {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(220px, 2fr) minmax(140px, 1fr);
  gap: 16px;
  margin: 0;
}

.cookie-storage-item dl div { min-width: 0; }
.cookie-storage-item dt {
  margin-bottom: 5px;
  color: var(--warm);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cookie-storage-item dd {
  margin: 0;
  color: #394854;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.error-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px;
  text-align: center;
}

.error-card {
  width: min(620px, 100%);
  padding: 48px 30px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.error-card strong { color: var(--warm); font-size: 5rem; line-height: 1; }
.error-card h1 { margin: 16px 0; color: var(--accent-strong); font-size: clamp(2rem, 7vw, 3.6rem); line-height: 1; }
.error-card p { color: var(--muted); line-height: 1.6; }
.error-card a { display: inline-block; margin-top: 12px; padding: 13px 20px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 800; text-decoration: none; }

@media (max-width: 700px) {
  .site-information { grid-template-columns: 1fr; }
  .information-card--faq { grid-column: auto; }
  .legal-shell {
    width: min(820px, calc(100vw - 20px));
    padding: 10px 0 36px;
  }
  .legal-header,
  .legal-content { padding: 20px; }
  .legal-header h1 {
    margin-top: 20px;
    font-size: clamp(2rem, 10vw, 3rem);
    line-height: 1.02;
  }
  .legal-header p { font-size: 0.94rem; }
  .legal-content h2 {
    font-size: 1.22rem;
    overflow-wrap: anywhere;
  }
  .cookie-storage-item { padding: 17px; }
  .cookie-storage-item dl {
    grid-template-columns: 1fr;
    gap: 13px;
  }
}
