/* ========================================================= */
/* Landing — the card table                                  */
/* ========================================================= */





.landing main { overflow-x: clip; }

section { position: relative; }
.landing h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 4.6vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: var(--stock);
}

/* ─── Hero ─────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  min-height: 100svh;
  padding-top: 64px;
}
.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.6rem;
  padding: clamp(2rem, 6vh, 5rem) clamp(1.25rem, 4vw, 4rem);
  max-width: 44rem;
  margin-left: auto;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.3rem, 4.3vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  color: var(--stock);
  text-wrap: wrap;
}
.hero-lede {
  font-size: clamp(1.02rem, 1.3vw, 1.18rem);
  line-height: 1.65;
  color: var(--on-surface-variant);
  max-width: 34rem;
}
.hero-lede kbd { color: var(--gold-hot); }
.hero-actions, .close-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.pull-note {
  min-height: 3.2em;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--on-surface-variant);
  max-width: 32rem;
}
.pull-note strong { color: var(--stock); }

/* The table: a vermilion field printed like a booster wrapper. */
.table {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(80% 70% at 50% 45%, var(--vermilion-hot), var(--vermilion) 55%, var(--vermilion-deep));
  border-radius: 28px 0 0 28px;
  margin: 1rem 0 1rem 0;
  display: grid;
  place-items: center;
  isolation: isolate;
  min-height: 560px;
  perspective: 1400px;
}
.table-print {
  position: absolute; inset: -10% -20%;
  display: flex; flex-direction: column; justify-content: center; gap: 0.2em;
  font-family: var(--font-display);
  font-size: clamp(4rem, 9vw, 9rem);
  line-height: 1;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(28, 7, 3, 0.16);
  transform: rotate(-8deg);
  z-index: -1;
  pointer-events: none;
}
.table-print span { display: block; animation: print-roll 38s linear infinite; }
.table-print span:nth-child(2) { animation-direction: reverse; animation-duration: 46s; }
@keyframes print-roll { from { transform: translateX(0); } to { transform: translateX(-33.33%); } }

/* The booster pack and the dealt cards live in pack.css (shared with /rw). */

/* ─── Play: the round in the chat ──────────────────────── */
.play {
  perspective: 1600px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: center;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(5rem, 12vh, 9rem) clamp(1.25rem, 4vw, 3rem) clamp(4rem, 8vh, 6rem);
}
.rules { list-style: none; display: grid; gap: 1.6rem; margin-top: 2.2rem; }
.rules li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; align-items: baseline; }
.rules kbd { font-size: 1.05rem; justify-self: start; color: var(--gold-hot); }
.rules p { color: var(--on-surface-variant); line-height: 1.6; max-width: 32rem; }

.chat {
  background: var(--ink-900);
  border-radius: 26px;
  box-shadow: var(--shadow-3), 0 0 0 1px var(--ink-700);
  overflow: hidden;
  max-width: 440px;
  width: 100%;
  justify-self: center;
}
.chat-head {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.95rem 1.1rem;
  background: var(--ink-800);
  border-bottom: 1px solid var(--ink-700);
}
.chat-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--vermilion);
  display: grid; place-items: center;
}
.chat-avatar::before {
  content: ''; width: 45%; height: 40%;
  background: var(--stock);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.chat-group { display: grid; line-height: 1.25; }
.chat-group strong { color: var(--stock); font-size: 0.95rem; }
.chat-group small { color: var(--on-surface-variant); font-size: 0.8rem; }
.chat-log {
  display: flex; flex-direction: column; gap: 0.55rem;
  padding: 1.1rem 1rem 1.3rem;
  min-height: 420px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='40' viewBox='0 0 44 40'%3E%3Cpath d='M22 12 L28 23 L16 23 Z' fill='none' stroke='%2393a7c4' stroke-opacity='.06' stroke-width='1.2'/%3E%3C/svg%3E");
}
.msg {
  display: grid; gap: 0.15rem;
  max-width: 82%;
  padding: 0.5rem 0.75rem 0.55rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  box-shadow: var(--shadow-1);
}
.msg b { font-size: 0.76rem; font-weight: 800; }
.msg-in { align-self: flex-end; background: #1d4a3f; border-bottom-right-radius: 4px; color: #e6f4ee; }
.msg-in b { color: var(--holo-mint); }
.msg-bot { align-self: flex-start; background: var(--ink-750); border-bottom-left-radius: 4px; color: var(--on-surface); }
.msg-bot b { color: var(--vermilion-hot); }
.msg-reply em { display: block; font-style: normal; font-size: 0.74rem; color: #bfe3d4; }
.msg-win { box-shadow: var(--shadow-1), 0 0 0 1px color-mix(in oklab, var(--gold) 55%, transparent); }
.msg-win strong { color: var(--gold-hot); }
.msg-hint { font-size: 0.76rem; color: var(--on-surface-variant); }
.msg-card {
  display: grid; grid-template-columns: 86px 1fr; gap: 0.7rem;
  margin: 0.3rem 0 0.2rem;
  background: var(--ink-850);
  border-radius: 10px;
  padding: 0.45rem;
}
.msg-card img {
  width: 86px; aspect-ratio: 5 / 7;
  object-fit: cover; object-position: 50% 18%;
  border-radius: 7px;
  /* the Delta back print until the character is dealt */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='18' viewBox='0 0 40 36'%3E%3Cpath d='M20 6 L28 22 L12 22 Z' fill='none' stroke='%23ffd0c4' stroke-opacity='.3' stroke-width='2'/%3E%3C/svg%3E"),
    radial-gradient(circle at 50% 42%, var(--vermilion-hot), var(--vermilion-deep) 75%);
}
.msg-card-text { display: grid; align-content: start; gap: 0.15rem; min-width: 0; }
.msg-card-text strong { color: var(--stock); font-size: 0.98rem; line-height: 1.2; }
.msg-card-text > span { font-size: 0.78rem; color: var(--on-surface-variant); }
.msg-rank {
  justify-self: start;
  font-family: var(--font-display);
  font-size: 0.74rem !important;
  color: var(--ink-900) !important;
  background: var(--rank-c);
  padding: 0.1em 0.55em 0.05em;
  border-radius: 999px;
}
.msg-value { font-family: var(--font-num); color: var(--gold-hot) !important; }
.chat.is-armed .msg { opacity: 0; }
.chat.is-armed .msg.is-in { opacity: 1; }

/* ─── Binder ───────────────────────────────────────────── */
.binder-section {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(4rem, 10vh, 8rem) clamp(1.25rem, 4vw, 3rem);
}
.binder-copy { display: grid; gap: 1.4rem; justify-items: start; }
.binder-copy p { color: var(--on-surface-variant); line-height: 1.65; max-width: 30rem; }
.binder-tabs { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.binder-tab {
  border: 0;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.86rem;
  padding: 0.55rem 0.9rem;
  border-radius: 10px 10px 4px 4px;
  color: var(--on-surface-variant);
  background: var(--ink-750);
  box-shadow: inset 0 -2px 0 var(--ink-900);
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-ui) var(--ease-out), color var(--dur-ui) var(--ease-out);
}
.binder-tab[aria-selected="true"] { background: var(--gold); color: var(--ink-900); box-shadow: none; }
.binder-tab:active { transform: scale(0.96); }
@media (hover: hover) and (pointer: fine) {
  .binder-tab:hover:not([aria-selected="true"]) { color: var(--stock); background: var(--ink-700); }
}

.binder {
  position: relative;
  background: linear-gradient(90deg, #0c1320, #111b2b 8%, #0f1826);
  border-radius: 22px;
  padding: clamp(1rem, 2.4vw, 1.8rem) clamp(1rem, 2.4vw, 1.8rem) clamp(1rem, 2.4vw, 1.8rem) clamp(2.4rem, 4vw, 3.4rem);
  box-shadow: var(--shadow-3), inset 0 0 0 1px var(--ink-700);
  perspective: 1600px;
}
.binder-rings {
  position: absolute; left: clamp(0.7rem, 1.4vw, 1.1rem); top: 12%; bottom: 12%;
  display: flex; flex-direction: column; justify-content: space-between;
}
.binder-rings i {
  display: block; width: 14px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(90deg, #6f7f99, #d8e0ec 45%, #7d8ca6);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
}
.binder-page {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.5rem, 1.2vw, 0.9rem);
  transform-origin: 0% 50%;
  transform-style: preserve-3d;
}
.pocket .tcg { width: 100%; }
.pocket-empty { aspect-ratio: 5 / 7; border-radius: var(--radius-card); background: var(--ink-800); }

/* ─── Modes: the hand ──────────────────────────────────── */
.modes {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(4rem, 10vh, 8rem) clamp(1.25rem, 4vw, 3rem) clamp(3rem, 6vh, 5rem);
  display: grid;
  gap: 1.2rem;
}
.modes > h2 { max-width: 18ch; }
.modes-lede { color: var(--on-surface-variant); line-height: 1.65; max-width: 38rem; }
.hand {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 2rem;
  padding-bottom: 1rem;
  perspective: 1600px;
}
/* The hand rests slightly fanned; the individual transform properties keep that pose
   while the crank animates `transform` on top of it. */
.mode {
  --tone: var(--gold);
  position: relative;
  transition: translate 420ms var(--ease-out), rotate 420ms var(--ease-out), scale 420ms var(--ease-out);
}
.mode:nth-child(odd)  { rotate: -1.6deg; translate: 0 6px; }
.mode:nth-child(even) { rotate: 1.4deg; }
@media (hover: hover) and (pointer: fine) {
  .mode:hover, .mode:focus-within { rotate: 0deg; translate: 0 -14px; scale: 1.03; z-index: 2; }
}

/* A mode card: title, art window, type line, rules box, set line (M1/6 … M6/6). */
.tcg-mode { --rank: var(--tone); width: 100%; }
.tcg-mode .tcg-frame { box-shadow: inset 0 0 0 2px var(--tone); }
.tcg-mode .tcg-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(0.84rem, 1vw, 1rem);
  letter-spacing: 0.01em;
  padding: 0.5rem 0.65rem 0.4rem;
  border-bottom: 2px solid var(--tone);
}
.tcg-mode .tcg-name > span:first-child { line-height: 1.5; margin-block: -0.2em; }
.tcg-mode .tcg-art { flex: 1 1 0; min-height: 64px; }
.tcg-mode .tcg-art img { object-position: 50% 16%; }
.tcg-mode .tcg-art.is-sprite {
  background: radial-gradient(circle at 50% 58%, color-mix(in oklab, var(--tone) 70%, var(--stock)), color-mix(in oklab, var(--tone) 55%, var(--ink-800)) 78%);
}
.tcg-mode .tcg-art.is-sprite img { object-fit: contain; object-position: 50% 60%; inset: 8% 0 2%; height: 90%; }
.tcg-mode .tcg-art.is-motion img { object-position: 50% 40%; }
.mode-type {
  padding: 0.3rem 0.65rem 0.28rem;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink-900);
  background: color-mix(in oklab, var(--tone) 78%, var(--stock));
}
/* The rules box: printed text on card stock, inside the dark frame. */
.mode-rules {
  display: grid; gap: 0.45rem;
  margin: 0.4rem 0.4rem 0;
  padding: 0.5rem 0.55rem 0.55rem;
  border-radius: 6px;
  background: var(--stock);
  color: var(--ink-850);
}
.mode-rules p { font-size: 0.72rem; line-height: 1.42; font-weight: 600; }
.mode-cmds { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.mode-rules kbd {
  font-size: 0.66rem;
  color: var(--ink-900);
  background: color-mix(in oklab, var(--tone) 26%, var(--stock));
  box-shadow: inset 0 -1px 0 color-mix(in oklab, var(--tone) 55%, var(--ink-900));
  border: 0;
  padding: 0.12em 0.4em 0.08em;
}
.tcg-mode .tcg-meta { padding-top: 0.4rem; }

/* ─── Ticker ───────────────────────────────────────────── */
.ticker-section { padding: 1rem 0 clamp(4rem, 10vh, 7rem); }
.ticker {
  display: grid; gap: 0.6rem;
  text-decoration: none;
  transform: rotate(-2.5deg);
  padding: 1.1rem 0;
  background: var(--stock);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.ticker-row {
  display: flex; gap: 0.6rem; width: max-content;
  animation: ticker-run 60s linear infinite;
}
.ticker-row-b { animation-direction: reverse; animation-duration: 75s; }
.ticker-row span {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: clamp(0.95rem, 1.4vw, 1.25rem);
  color: var(--ink-900);
  padding: 0.35rem 0.85rem;
  border-radius: 10px;
  background: color-mix(in oklab, var(--ink-900) 7%, var(--stock));
  white-space: nowrap;
}
.ticker-row span:nth-child(5n) { background: var(--vermilion); color: var(--vermilion-ink); }
.ticker-row span:nth-child(7n) { background: var(--ink-900); color: var(--gold-hot); }
@keyframes ticker-run { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (hover: hover) and (pointer: fine) {
  .ticker:hover .ticker-row { animation-play-state: paused; }
}

/* ─── Close ────────────────────────────────────────────── */
.close {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(3rem, 8vh, 6rem) clamp(1.25rem, 4vw, 3rem) clamp(5rem, 12vh, 8rem);
}
.close-card {
  width: min(100%, 360px);
  justify-self: center;
  perspective: 1200px;
}
.close-back {
  position: relative;
  aspect-ratio: 5 / 7;
  width: 100%;
  border-radius: 22px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='36' viewBox='0 0 40 36'%3E%3Cpath d='M20 6 L28 22 L12 22 Z' fill='none' stroke='%23ffd0c4' stroke-opacity='.32' stroke-width='1.5'/%3E%3C/svg%3E"),
    radial-gradient(circle at 50% 42%, var(--vermilion-hot), var(--vermilion-deep) 70%);
  box-shadow: inset 0 0 0 12px var(--stock), inset 0 0 0 15px var(--vermilion-deep), var(--shadow-3);
  animation: back-spin 14s var(--ease-in-out) infinite alternate;
}
.close-back::after {
  content: '';
  position: absolute; left: 50%; top: 50%;
  width: 34%; aspect-ratio: 1 / 0.88;
  transform: translate(-50%, -50%);
  background: var(--stock);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
@keyframes back-spin {
  from { transform: perspective(900px) rotateY(-16deg) rotateX(6deg) rotate(-4deg); }
  to   { transform: perspective(900px) rotateY(16deg) rotateX(-4deg) rotate(3deg); }
}
.close-copy { display: grid; gap: 1.4rem; justify-items: start; }
.close-copy > p { color: var(--on-surface-variant); line-height: 1.65; max-width: 32rem; }
.close-cmd { color: var(--vermilion); font-family: var(--font-num); font-weight: 700; }
.registry {
  display: flex; flex-wrap: wrap; gap: 1.4rem 2.4rem;
  margin-top: 1rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--outline-variant);
}
.registry div { display: grid; gap: 0.2rem; }
.registry dt { font-size: 0.82rem; color: var(--on-surface-variant); font-weight: 600; }
.registry dd { font-size: 1.7rem; font-weight: 700; color: var(--stock); line-height: 1.15; }


/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 1180px) {
  .hand { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 900px; }
  .mode-rules p { font-size: 0.82rem; }
}
@media (max-width: 900px) {
  /* Phones: headline, then the pack, then the actions, all inside the first screen. */
  .hero {
    grid-template-columns: 1fr;
    grid-template-areas: "title" "table" "actions" "lede" "note";
    min-height: auto;
    row-gap: 1rem;
    padding-bottom: 1.5rem;
  }
  .hero-copy { display: contents; }
  .hero .hero-title { grid-area: title; padding: 1.4rem 1.25rem 0; font-size: clamp(2rem, 9vw, 3rem); }
  .hero .table { grid-area: table; border-radius: 24px; margin: 0 0.75rem; min-height: min(420px, 50svh); }
  .hero .hero-actions { grid-area: actions; padding: 0 1.25rem; }
  .hero .hero-lede { grid-area: lede; padding: 0 1.25rem; }
  .hero .pull-note { grid-area: note; padding: 0 1.25rem; }
  .hero .hero-actions .btn-primary, .hero .hero-actions .btn-secondary { flex: 1 1 9rem; padding: 0.8rem 0.9rem; font-size: 0.92rem; white-space: nowrap; }
  .pack { width: clamp(170px, 46vw, 230px); }
  .deal .slot { width: 30vw; max-width: 170px; margin-left: calc(min(30vw, 170px) / -2); margin-top: calc(min(30vw, 170px) * -0.7); }
  .pull-note { min-height: 0; }
  .play, .binder-section, .close { grid-template-columns: 1fr; }
  .rules li { grid-template-columns: 1fr; gap: 0.4rem; }
  .chat { justify-self: stretch; max-width: none; }
  .close-card { width: min(70%, 300px); order: -1; }
  .close-copy { justify-items: stretch; }
  .close-actions { flex-direction: column; align-items: stretch; }
}
@media (max-width: 640px) {
  .hand {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin-inline: -1.25rem;
    padding: 0.6rem 1.25rem 1.4rem;
    scrollbar-width: none;
  }
  .hand::-webkit-scrollbar { display: none; }
  .mode { flex: 0 0 min(76%, 290px); scroll-snap-align: center; }
  .mode:nth-child(odd), .mode:nth-child(even) { rotate: none; translate: none; }
  .mode-rules p { font-size: 0.8rem; }
  .binder { padding-left: 2.1rem; }
  /* Nine pockets on a phone: art, name and rank only. */
  .binder-page .tcg { padding: 4px; }
  .binder-page .tcg-meta { display: none; }
  .binder-page .tcg-name { font-size: 0.6rem; padding: 0.3rem 0.35rem 0.3rem; gap: 0.2rem; }
  .binder-page .tcg-rank { font-size: 0.62rem; }
  .binder-page .tcg:not([data-rank="S"]):not([data-rank="GOD"]):not([data-rank="SSS"]) .tcg-rank { padding: 0.08em 0.35em 0.04em; }
  .binder-page .tcg-value { display: none; }
  .registry dd { font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .pack { animation: none; }
  .table-print span, .ticker-row, .close-back, .pack-shine::before { animation: none; }
  .mode, .mode:nth-child(odd), .mode:nth-child(even) { transition-duration: 120ms; }
  .chat.is-armed .msg { opacity: 1; }
}

/* The crank's hinges: the binder opens like a cover, from its rings. */
.binder-section { perspective: 1800px; }
.binder { transform-origin: 0% 50%; }
