/* Tessera: mosaic / terracotta.
   Tokens
   paper  #F6EEE0  page ground (warm cream)      paper-hi #FBF6EC  lifted tiles
   sand   #EADBC0  quiet tiles                   terra    #B8472A  main accent (cream text on it)
   olive  #3E4A2B  deep tiles (cream text)       ochre    #D9A02B  highlight tiles (ink text)
   teal   #2F6B6B  contrast tiles (cream text)   ink      #2B2418  text, outlines, reel frame
   Type: TeX Gyre Pagella Bold for display, Liberation Sans for reading.
   Layout concept: a left rail on wide screens, and pages built as an irregular mosaic of rounded tiles on a 12-column grid. */

@font-face { font-family: "TesseraDisplay"; src: url("/assets/fonts/pagella-bold-latin.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "TesseraText"; src: url("/assets/fonts/liberation-sans-regular-latin.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "TesseraText"; src: url("/assets/fonts/liberation-sans-bold-latin.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --paper: #F6EEE0; --paper-hi: #FBF6EC; --sand: #EADBC0; --sand-deep: #D9C49C;
  --terra: #B8472A; --terra-ink: #9A3820; --olive: #3E4A2B; --ochre: #D9A02B; --teal: #2F6B6B;
  --ink: #2B2418; --muted: #5A5140; --on-dark: #FFF8EC;
  --display: "TesseraDisplay", "TeX Gyre Pagella", Palatino, "Palatino Linotype", Georgia, serif;
  --text: "TesseraText", "Liberation Sans", Arial, Helvetica, sans-serif;
  --gap: 10px;
  --r: 14px;
  --rail: 15.5rem;
  --focus: #2B2418;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.58 var(--text);
  overflow-wrap: break-word;
}
[hidden] { display: none !important; }
img, svg { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.12; margin: 0 0 .55rem; letter-spacing: -.005em; }
h1 { font-size: clamp(2.3rem, 6.4vw, 4rem); }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.65rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 .85rem; }
p:last-child { margin-bottom: 0; }
a { color: var(--terra-ink); text-underline-offset: .18em; text-decoration-thickness: 2px; }
a:hover { color: var(--ink); }
code { font: 700 .92em/1 var(--text); background: rgba(43,36,24,.08); padding: .15em .4em; border-radius: 6px; }
ul, ol { padding-left: 1.2rem; margin: 0 0 .85rem; }
li + li { margin-top: .3rem; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.tile-dark :focus-visible, .rail :focus-visible, .tile-olive :focus-visible, .tile-teal :focus-visible,
.tile-terra :focus-visible, .tile-ink :focus-visible, .dlg :focus-visible { --focus: var(--ink); }
.tile-olive :focus-visible, .tile-teal :focus-visible, .tile-terra :focus-visible, .tile-ink :focus-visible { outline-color: var(--on-dark); }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 50; padding: .7rem 1rem; background: var(--ink); color: var(--on-dark);
  border-radius: 10px; font-weight: 700; text-decoration: none;
}
.skip:focus { top: .6rem; outline-color: var(--ochre); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Frame: rail + stage ---------- */
.frame { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.stage { min-width: 0; padding: var(--gap) var(--gap) 2rem 0; }
.stage > main, .stage > .base { max-width: 69rem; margin-inline: auto; }
main:focus { outline: none; }

/* Rail (wide screens): brand tile, nav tile, wallet tile, notes tile */
.rail {
  position: sticky; top: 0; align-self: start; height: 100vh; padding: var(--gap);
  display: flex; flex-direction: column; gap: 8px;
}
.brand {
  display: flex; align-items: center; gap: .7rem; padding: .8rem .9rem; text-decoration: none; color: var(--ink);
  background: var(--paper-hi); border: 2px solid var(--ink); border-radius: var(--r);
}
.brand:hover { color: var(--ink); }
.brand-foot, .brand-foot:hover { color: var(--ink) !important; }
.brand .mark { flex: none; display: block; }
.brand-name { font: 700 1.65rem/1 var(--display); }
.menu-btn { display: none; }
.rail-nav {
  flex: 0 1 auto; min-height: 0; overflow-y: auto; padding: .9rem .8rem;
  background: var(--sand); border: 2px solid var(--ink); border-radius: var(--r);
}
.rail-nav ul { list-style: none; margin: 0; padding: 0; }
.rail-nav li + li { margin-top: .2rem; }
.rail-nav a {
  display: block; padding: .5rem .7rem; border-radius: 9px; color: var(--ink); text-decoration: none; font-weight: 700;
}
.rail-nav a:hover { background: rgba(43,36,24,.1); }
.rail-nav a[aria-current="page"] { background: var(--ink); color: var(--on-dark); }
.rail-sub { margin: .15rem 0 .5rem .9rem !important; padding-left: .7rem !important; border-left: 4px solid var(--terra); }
.rail-sub a { font-weight: 400; padding: .38rem .6rem; }
.rail-sub a[aria-current="page"] { font-weight: 700; }
.rail-art {
  flex: 1 1 0; min-height: 0; border: 2px solid var(--ink); border-radius: var(--r); background-color: var(--paper-hi);
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2248%22 height=%2248%22 viewBox=%220 0 48 48%22%3E%3Cg fill=%22none%22 stroke=%22%23B8472A%22 stroke-width=%223%22%3E%3Cpath d=%22M24 3 L45 24 L24 45 L3 24Z%22/%3E%3C/g%3E%3Crect x=%2219%22 y=%2219%22 width=%2210%22 height=%2210%22 rx=%222%22 transform=%22rotate(45 24 24)%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%220%22 cy=%220%22 r=%224%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%2248%22 cy=%220%22 r=%224%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%220%22 cy=%2248%22 r=%224%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%2248%22 cy=%2248%22 r=%224%22 fill=%22%23B8472A%22/%3E%3C/svg%3E"); background-size: 48px 48px; background-position: center;
}
.wallet {
  display: flex; align-items: center; gap: .65rem; width: 100%; padding: .75rem .85rem; text-align: left;
  font: 700 .98rem/1.25 var(--text); color: var(--on-dark); background: var(--terra);
  border: 2px solid var(--ink); border-radius: var(--r); cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.2);
}
.wallet:hover { background: var(--terra-ink); }
.wallet-tile {
  flex: none; width: 1.15rem; height: 1.15rem; background: var(--ochre); border: 2px solid var(--ink);
  transform: rotate(45deg); border-radius: 3px;
}
.wallet-label { min-width: 0; overflow-wrap: anywhere; }
.rail-foot {
  padding: .7rem .85rem; background: var(--olive); color: var(--on-dark); border: 2px solid var(--ink); border-radius: var(--r);
  font-size: .9rem; line-height: 1.4;
}
.rail-foot p { margin: 0; }
.rail-foot a { color: var(--on-dark); font-weight: 700; }
.rail-foot a:hover { color: var(--ochre); }
.rail-age strong { display: inline-block; margin-right: .35rem; padding: .05rem .4rem; background: var(--ochre); color: var(--ink); border-radius: 6px; }

/* ---------- Mosaic grid and tiles ---------- */
.mosaic { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); grid-auto-flow: dense; }
.mosaic + .mosaic { margin-top: var(--gap); }
.tile {
  position: relative; min-width: 0; padding: 1.35rem 1.45rem; border-radius: var(--r); border: 2px solid var(--ink);
  background: var(--paper-hi); color: var(--ink); overflow: hidden;
}
.tile > :last-child { margin-bottom: 0; }
.tile-paper { background: var(--paper-hi); }
.tile-sand { background: var(--sand); }
.tile-terra { background: var(--terra); color: var(--on-dark); }
.tile-olive { background: var(--olive); color: var(--on-dark); }
.tile-ochre { background: var(--ochre); color: var(--ink); }
.tile-teal { background: var(--teal); color: var(--on-dark); }
.tile-ink { background: var(--ink); color: var(--on-dark); }
.tile-terra a, .tile-olive a, .tile-teal a, .tile-ink a { color: var(--on-dark); }
.tile-terra a:hover, .tile-olive a:hover, .tile-teal a:hover, .tile-ink a:hover { color: var(--ochre); }
.tile-ochre a { color: var(--ink); }
.tile-ochre a:hover { color: var(--terra-ink); }
.s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; }
.s7 { grid-column: span 7; } .s8 { grid-column: span 8; } .s12 { grid-column: 1 / -1; }
.r2 { grid-row: span 2; } .r3 { grid-row: span 3; }
.lead { font-size: 1.14rem; line-height: 1.5; }

/* pattern tiles: flat Mediterranean-style motifs set as inline SVG backgrounds */
.pat-star-ochre { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2256%22 height=%2256%22 viewBox=%220 0 56 56%22%3E%3Cg fill=%22%23D9A02B%22%3E%3Cpath d=%22M28 5 L33 17 L45 11 L39 23 L51 28 L39 33 L45 45 L33 39 L28 51 L23 39 L11 45 L17 33 L5 28 L17 23 L11 11 L23 17Z%22/%3E%3Cpath transform=%22translate(0 0)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3Cpath transform=%22translate(0 56)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3Cpath transform=%22translate(56 0)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3Cpath transform=%22translate(56 56)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3C/g%3E%3C/svg%3E"); background-size: 56px 56px; }
.pat-star-olive { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2256%22 height=%2256%22 viewBox=%220 0 56 56%22%3E%3Cg fill=%22%233E4A2B%22%3E%3Cpath d=%22M28 5 L33 17 L45 11 L39 23 L51 28 L39 33 L45 45 L33 39 L28 51 L23 39 L11 45 L17 33 L5 28 L17 23 L11 11 L23 17Z%22/%3E%3Cpath transform=%22translate(0 0)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3Cpath transform=%22translate(0 56)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3Cpath transform=%22translate(56 0)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3Cpath transform=%22translate(56 56)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3C/g%3E%3C/svg%3E"); background-size: 56px 56px; }
.pat-lattice-terra { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2248%22 height=%2248%22 viewBox=%220 0 48 48%22%3E%3Cg fill=%22none%22 stroke=%22%23B8472A%22 stroke-width=%223%22%3E%3Cpath d=%22M24 3 L45 24 L24 45 L3 24Z%22/%3E%3C/g%3E%3Crect x=%2219%22 y=%2219%22 width=%2210%22 height=%2210%22 rx=%222%22 transform=%22rotate(45 24 24)%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%220%22 cy=%220%22 r=%224%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%2248%22 cy=%220%22 r=%224%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%220%22 cy=%2248%22 r=%224%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%2248%22 cy=%2248%22 r=%224%22 fill=%22%23B8472A%22/%3E%3C/svg%3E"); background-size: 48px 48px; }
.pat-lattice-teal { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2248%22 height=%2248%22 viewBox=%220 0 48 48%22%3E%3Cg fill=%22none%22 stroke=%22%232F6B6B%22 stroke-width=%223%22%3E%3Cpath d=%22M24 3 L45 24 L24 45 L3 24Z%22/%3E%3C/g%3E%3Crect x=%2219%22 y=%2219%22 width=%2210%22 height=%2210%22 rx=%222%22 transform=%22rotate(45 24 24)%22 fill=%22%232F6B6B%22/%3E%3Ccircle cx=%220%22 cy=%220%22 r=%224%22 fill=%22%232F6B6B%22/%3E%3Ccircle cx=%2248%22 cy=%220%22 r=%224%22 fill=%22%232F6B6B%22/%3E%3Ccircle cx=%220%22 cy=%2248%22 r=%224%22 fill=%22%232F6B6B%22/%3E%3Ccircle cx=%2248%22 cy=%2248%22 r=%224%22 fill=%22%232F6B6B%22/%3E%3C/svg%3E"); background-size: 48px 48px; }
.pat-quatre-ink { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2252%22 height=%2252%22 viewBox=%220 0 52 52%22%3E%3Cg fill=%22%233E4A2B%22%3E%3Ccircle cx=%2226%22 cy=%2215%22 r=%229%22/%3E%3Ccircle cx=%2226%22 cy=%2237%22 r=%229%22/%3E%3Ccircle cx=%2215%22 cy=%2226%22 r=%229%22/%3E%3Ccircle cx=%2237%22 cy=%2226%22 r=%229%22/%3E%3C/g%3E%3Crect x=%2220%22 y=%2220%22 width=%2212%22 height=%2212%22 rx=%222%22 transform=%22rotate(45 26 26)%22 fill=%22%232B2418%22/%3E%3C/svg%3E"); background-size: 52px 52px; }
.motif-tile { min-height: 7rem; }
.motif-tile .motif { position: absolute; right: -1.2rem; bottom: -1.2rem; width: 9rem; height: 9rem; opacity: .9; }

/* ---------- Buttons and chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.9rem; padding: .6rem 1.15rem;
  font: 700 1rem/1.2 var(--text); color: var(--ink); text-decoration: none; text-align: center; cursor: pointer;
  background: var(--paper-hi); border: 2px solid var(--ink); border-radius: 11px;
  box-shadow: inset 0 -4px 0 rgba(43,36,24,.16);
}
.btn:hover { background: var(--sand); color: var(--ink); }
.btn-primary { background: var(--terra); color: var(--on-dark); }
.btn-primary:hover { background: var(--terra-ink); color: var(--on-dark); }
.btn-ochre { background: var(--ochre); }
.btn-ochre:hover { background: #E6B243; }
.btn-ghost { background: transparent; color: inherit; box-shadow: none; }
.btn-ghost:hover { background: rgba(255,248,236,.16); color: inherit; }
.tile-terra .btn:not(.btn-primary):not(.btn-ghost), .tile-olive .btn:not(.btn-primary):not(.btn-ghost), .tile-teal .btn:not(.btn-primary):not(.btn-ghost) { color: var(--ink); }
.tile-terra .btn-primary, .tile-olive .btn-primary, .tile-teal .btn-primary { background: var(--ochre); color: var(--ink); }
.tile-terra .btn-primary:hover, .tile-olive .btn-primary:hover, .tile-teal .btn-primary:hover { background: #E6B243; color: var(--ink); }
.btn-xl { min-height: 4.2rem; width: 100%; font-size: 1.4rem; font-family: var(--display); border-radius: 13px; }
.btn-sm { min-height: 2.3rem; padding: .35rem .8rem; font-size: .92rem; }
.btn[aria-disabled="true"] { opacity: .6; cursor: progress; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.1rem; }

.chips { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.chips legend { padding: 0; margin-bottom: .55rem; font-weight: 700; float: left; width: 100%; }
.chip {
  flex: 1 1 0; min-width: 3.4rem; min-height: 3.2rem; font: 700 1.2rem/1 var(--display); color: var(--ink); cursor: pointer;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 10px;
}
.chip:hover { background: var(--sand); }
.chip[aria-pressed="true"] { background: var(--olive); color: var(--on-dark); box-shadow: inset 0 -4px 0 rgba(0,0,0,.28); }
.chip:disabled { cursor: not-allowed; opacity: .7; }
.tile-teal .chip, .tile-olive .chip { color: var(--ink); }
.tile-teal .chip[aria-pressed="true"], .tile-olive .chip[aria-pressed="true"] { background: var(--ochre); color: var(--ink); }

/* ---------- Home ---------- */
.hero { padding: 2.1rem 2.1rem 2.3rem; min-height: 21rem; display: flex; flex-direction: column; justify-content: flex-end; }
.hero h1 { max-width: 14ch; margin-bottom: .9rem; }
.hero .lead { max-width: 31rem; color: var(--on-dark); }
.hero::before {
  content: ""; position: absolute; right: 0; top: 0; width: 46%; height: 62%; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2256%22 height=%2256%22 viewBox=%220 0 56 56%22%3E%3Cg fill=%22%23D9A02B%22%3E%3Cpath d=%22M28 5 L33 17 L45 11 L39 23 L51 28 L39 33 L45 45 L33 39 L28 51 L23 39 L11 45 L17 33 L5 28 L17 23 L11 11 L23 17Z%22/%3E%3Cpath transform=%22translate(0 0)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3Cpath transform=%22translate(0 56)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3Cpath transform=%22translate(56 0)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3Cpath transform=%22translate(56 56)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3C/g%3E%3C/svg%3E"); background-size: 56px 56px;
  -webkit-mask-image: linear-gradient(225deg, #000 20%, transparent 78%); mask-image: linear-gradient(225deg, #000 20%, transparent 78%);
  pointer-events: none;
}
.hero > * { position: relative; }
.demo h2 { color: var(--on-dark); }
.demo-note { margin-bottom: 1rem; color: #EADBC0; }
.demo .reels { margin-bottom: 1rem; }
.demo-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .9rem; }
.readout { margin: 0; min-height: 3.1em; }
.demo .readout { color: var(--on-dark); }
.fact h2 { margin-bottom: .4rem; }
.game-tile { display: flex; flex-direction: column; }
.game-tile .btn { align-self: flex-start; margin-top: auto; }
.game-tile p { margin-bottom: 1.1rem; }
.sym-row { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1.1rem; }
.sym-slot { width: 5.2rem; height: 5.2rem; }
.sym-slot svg { width: 100%; height: 100%; display: block; }
.sym-slot:nth-child(2n) { transform: translateY(.4rem) rotate(4deg); }
.sym-slot:nth-child(3n) { transform: rotate(-3deg); }
.mini-art { width: 5rem; height: 5rem; margin-bottom: .9rem; display: block; }
.mini-cards { display: flex; margin-bottom: .9rem; height: 5.4rem; }
.mini-cards svg { height: 100%; width: auto; }
.mini-cards svg + svg { margin-left: -1.2rem; transform: rotate(8deg); }
.mini-cards svg:first-child { transform: rotate(-7deg); }

/* ---------- Page heads and text pages ---------- */
.head-tile h1 { margin-bottom: .6rem; }
.head-tile .lead { margin-bottom: 0; max-width: 40rem; }
.head-tile.tile-terra .lead, .head-tile.tile-olive .lead, .head-tile.tile-teal .lead { color: var(--on-dark); }
.updated { margin-top: .9rem; font-weight: 700; }
.sections { margin-top: var(--gap); }
.sec { grid-column: span 6; }
.sec:nth-child(4n+1) { grid-column: span 7; }
.sec:nth-child(4n+2) { grid-column: span 5; }
.sec:nth-child(4n+3) { grid-column: span 5; }
.sec:nth-child(4n) { grid-column: span 7; }
.sec.wide { grid-column: 1 / -1; }
.sec h2 { margin-bottom: .6rem; }
.sec.tile-olive li::marker, .sec.tile-teal li::marker, .sec.tile-terra li::marker { color: var(--ochre); }
.sec li::marker { color: var(--terra); }
.facts { list-style: none; padding: 0; margin: 0 0 1rem; }
.facts li { padding: .45rem 0; border-bottom: 2px dotted rgba(43,36,24,.3); }
.facts li:last-child { border-bottom: 0; }
.facts strong { display: inline-block; min-width: 5.5rem; }
.table-scroll { overflow-x: auto; margin: 0 0 1rem; }
.key-table { width: 100%; border-collapse: collapse; min-width: 30rem; }
.key-table th, .key-table td { text-align: left; padding: .6rem .7rem; vertical-align: top; border-bottom: 2px solid rgba(43,36,24,.2); }
.key-table th { font-family: var(--display); font-size: 1.05rem; }

/* ---------- Game boards ---------- */
.stat dl { margin: 0; }
.stat dt { font-weight: 700; }
.stat dd { margin: .1rem 0 0; font: 700 2.3rem/1.1 var(--display); overflow-wrap: anywhere; }
.stat { display: flex; flex-direction: column; justify-content: center; padding-block: 1rem; }
.board-tile { display: flex; flex-direction: column; justify-content: center; }
.reels-tile { padding: 1.2rem; display: grid; place-items: center; }
.control-tile { display: flex; flex-direction: column; justify-content: center; }
.result-tile { padding-block: 1rem; font-size: 1.1rem; display: flex; align-items: center; min-height: 4.6rem; }
.result-tile p { margin: 0; }
.fine { font-size: .92rem; color: var(--muted); }
.tile-olive .fine, .tile-teal .fine, .tile-terra .fine, .tile-ink .fine { color: #EADBC0; }

.reels {
  --cell: clamp(4.2rem, 17vw, 6.3rem);
  position: relative; display: flex; justify-content: center; gap: .6rem; padding: .5rem;
}
.reels-sm { --cell: clamp(3.9rem, 17vw, 6rem); }
.rl-pane { position: relative; flex: none; width: calc(var(--cell) * 1.18); height: calc(var(--cell) * 3); overflow: hidden; background: var(--paper-hi); border: 2px solid var(--ink); border-radius: 10px; }
.rl-pane::before, .rl-pane::after {
  content: ""; position: absolute; left: 0; right: 0; height: var(--cell); z-index: 2; pointer-events: none; background: rgba(246,238,224,.72);
}
.rl-pane::before { top: 0; }
.rl-pane::after { bottom: 0; }
.rl-strip { will-change: transform; }
.rl-cell { height: var(--cell); display: grid; place-items: center; padding: .38rem; }
.rl-cell svg { width: 100%; height: 100%; display: block; }
.rl-line {
  position: absolute; left: .1rem; right: .1rem; top: calc(.5rem + var(--cell)); height: var(--cell); z-index: 3; pointer-events: none;
  border-top: 3px dashed var(--ochre); border-bottom: 3px dashed var(--ochre); border-radius: 4px;
}
.reels.lit .rl-pane { box-shadow: 0 0 0 4px var(--ochre); }

/* pay tables */
.pt { width: 100%; border-collapse: collapse; margin: 0 0 .9rem; }
.pt th, .pt td { text-align: left; padding: .5rem .6rem; border-bottom: 2px solid rgba(43,36,24,.18); vertical-align: middle; }
.pt th { font-family: var(--display); font-size: 1.02rem; }
.pt .pt-right, .pt .pt-pay { text-align: right; white-space: nowrap; font-weight: 700; }
.pt-art { width: 1%; white-space: nowrap; }
.pt-set { display: inline-flex; gap: 2px; vertical-align: middle; }
.pt-set svg { width: 1.85rem; height: 1.85rem; display: block; }
.pt-blank::before { content: "any 2"; font-size: .86rem; font-weight: 700; color: var(--muted); padding: 0 .3rem; }
.pt-seg { font: 700 1.2rem/1 var(--display); }

/* wheel */
.wheel-tile { display: grid; place-items: center; padding: 2.2rem 1.2rem 1.4rem; }
.wheel-stage { position: relative; width: min(100%, 31rem); aspect-ratio: 1; margin: 0 auto; }
.wheel-svg { display: block; width: 100%; height: 100%; transform: rotate(0deg); transform-origin: 50% 50%; pointer-events: none; }
.wheel-svg.turning { transition: transform 4s cubic-bezier(.12, .68, .14, 1); }
.wheel-ptr { position: absolute; z-index: 3; left: 50%; top: -1.75rem; width: 2.6rem; margin-left: -1.3rem; pointer-events: none; display: block; }
.wheel-hub { position: absolute; z-index: 2; left: 50%; top: 50%; width: 24%; transform: translate(-50%, -50%); pointer-events: none; display: block; }

/* cards */
.table-tile { display: grid; place-items: center; padding: 1.4rem 1rem; }
.cd-table { display: flex; justify-content: center; align-items: center; gap: .9rem; }
.cd-bridge { flex: none; width: clamp(1.4rem, 7vw, 3rem); height: 0; border-top: 4px dashed var(--ochre); }
.cd-slot { width: clamp(6rem, 26vw, 10.5rem); aspect-ratio: 5 / 7; perspective: 900px; }
.cd-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .5s ease; }
.cd-slot.flipped .cd-inner { transform: rotateY(180deg); }
.cd-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.cd-face svg { width: 100%; height: 100%; display: block; }
.cd-front { transform: rotateY(180deg); }
.cd-slot.still .cd-inner { transition: none; }
.call-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.call-row .btn-deal { grid-column: 1 / -1; }
.call-row .btn { width: 100%; }

/* ---------- Footer ---------- */
.base { margin-top: var(--gap); }
.base .mosaic { gap: var(--gap); }
.foot-who p, .foot-law p, .foot-help p, .foot-age p { margin-bottom: .5rem; }
.foot-op { font: 700 1.15rem/1.3 var(--display); }
.brand-foot { margin-bottom: .9rem; display: inline-flex; }
.foot-links ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 1.2rem; }
.foot-links li { break-inside: avoid; margin: 0 0 .45rem; }
.foot-links a { color: var(--ink); font-weight: 700; }
.foot-law h2, .foot-help h2 { font-size: 1.25rem; }
.foot-age { display: flex; flex-direction: column; gap: .7rem; }
.age-seal {
  display: inline-grid; place-items: center; width: 3.6rem; height: 3.6rem; margin: 0; font: 700 1.3rem/1 var(--display);
  background: var(--ochre); color: var(--ink);
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
}
.age-seal-lg { width: 4.6rem; height: 4.6rem; font-size: 1.7rem; background: var(--terra); color: var(--on-dark); margin-bottom: .8rem; }
.foot-base { margin: 0; padding: .4rem .3rem 0; font-size: .92rem; color: var(--muted); }

/* ---------- Dialogs, notice, toast ---------- */
.dlg {
  width: min(92vw, 29rem); max-height: 92vh; padding: 0; color: var(--ink); background: var(--paper-hi);
  border: 2px solid var(--ink); border-radius: 18px; overflow: auto;
}
.dlg::backdrop { background: rgba(43,36,24,.66); }
.dlg-body { padding: 0 1.5rem 1.5rem; }
.dlg-band {
  height: 1.6rem; margin: 0 -1.5rem 1.3rem; border-bottom: 2px solid var(--ink); background-color: var(--sand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2248%22 height=%2248%22 viewBox=%220 0 48 48%22%3E%3Cg fill=%22none%22 stroke=%22%23B8472A%22 stroke-width=%223%22%3E%3Cpath d=%22M24 3 L45 24 L24 45 L3 24Z%22/%3E%3C/g%3E%3Crect x=%2219%22 y=%2219%22 width=%2210%22 height=%2210%22 rx=%222%22 transform=%22rotate(45 24 24)%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%220%22 cy=%220%22 r=%224%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%2248%22 cy=%220%22 r=%224%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%220%22 cy=%2248%22 r=%224%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%2248%22 cy=%2248%22 r=%224%22 fill=%22%23B8472A%22/%3E%3C/svg%3E"); background-size: 48px 48px; background-position: center;
}
.dlg h2 { font-size: 1.6rem; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
.age-refusal { margin-top: 1.1rem; padding: 1rem; background: var(--sand); border: 2px solid var(--ink); border-radius: 12px; }
.field { display: block; margin: 1.1rem 0 .3rem; font-weight: 700; }
.input {
  width: 100%; min-height: 3rem; padding: .55rem .8rem; font: 400 1.05rem/1.3 var(--text); color: var(--ink);
  background: #fff; border: 2px solid var(--ink); border-radius: 10px;
}
.input[aria-invalid="true"] { border-color: var(--terra-ink); box-shadow: 0 0 0 3px rgba(184,71,42,.28); }
.hint { margin: .4rem 0 0; font-size: .93rem; color: var(--muted); }
.error { margin: .4rem 0 0; min-height: 1.3em; font-weight: 700; color: var(--terra-ink); }
.profile-list { margin: 0 0 1rem; display: grid; gap: .5rem; }
.profile-list div { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .8rem; background: var(--sand); border-radius: 10px; }
.profile-list dt { font-weight: 700; }
.profile-list dd { margin: 0; font: 700 1.2rem/1.2 var(--display); text-align: right; overflow-wrap: anywhere; }

.store-note {
  position: fixed; z-index: 20; right: 12px; bottom: 12px; width: min(26rem, calc(100vw - 24px)); padding: .75rem .9rem;
  display: flex; align-items: center; gap: .8rem; font-size: .9rem; line-height: 1.4;
  background: var(--ink); color: var(--on-dark); border: 2px solid var(--ochre); border-radius: 12px;
}
.store-note p { margin: 0; }
.store-note a { color: var(--ochre); }
.store-note .btn { flex: none; }
.toast {
  position: fixed; z-index: 30; left: 50%; bottom: 5.5rem; max-width: min(30rem, calc(100vw - 24px)); padding: .7rem 1.1rem;
  background: var(--olive); color: var(--on-dark); border: 2px solid var(--ink); border-radius: 12px; font-weight: 700;
  transform: translate(-50%, 1rem); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 861px) {
  .store-note { left: var(--gap); right: auto; bottom: var(--gap); width: calc(var(--rail) - 2 * var(--gap)); flex-direction: column; align-items: flex-start; }
  body:has(.store-note:not([hidden])) .rail { padding-bottom: 13.5rem; }
}
.fill-art { margin-top: 1.2rem; min-height: 6rem; flex: 1 1 auto; border: 2px solid var(--ink); border-radius: 10px; background-color: var(--paper-hi);
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2256%22 height=%2256%22 viewBox=%220 0 56 56%22%3E%3Cg fill=%22%233E4A2B%22%3E%3Cpath d=%22M28 5 L33 17 L45 11 L39 23 L51 28 L39 33 L45 45 L33 39 L28 51 L23 39 L11 45 L17 33 L5 28 L17 23 L11 11 L23 17Z%22/%3E%3Cpath transform=%22translate(0 0)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3Cpath transform=%22translate(0 56)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3Cpath transform=%22translate(56 0)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3Cpath transform=%22translate(56 56)%22 d=%22M0 -7 L7 0 L0 7 L-7 0Z%22/%3E%3C/g%3E%3C/svg%3E"); background-size: 56px 56px; background-position: center; }
.aside-tile { display: flex; flex-direction: column; }
.tile-wash::before { content: ""; position: absolute; inset: 0; background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2248%22 height=%2248%22 viewBox=%220 0 48 48%22%3E%3Cg fill=%22none%22 stroke=%22%23B8472A%22 stroke-width=%223%22%3E%3Cpath d=%22M24 3 L45 24 L24 45 L3 24Z%22/%3E%3C/g%3E%3Crect x=%2219%22 y=%2219%22 width=%2210%22 height=%2210%22 rx=%222%22 transform=%22rotate(45 24 24)%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%220%22 cy=%220%22 r=%224%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%2248%22 cy=%220%22 r=%224%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%220%22 cy=%2248%22 r=%224%22 fill=%22%23B8472A%22/%3E%3Ccircle cx=%2248%22 cy=%2248%22 r=%224%22 fill=%22%23B8472A%22/%3E%3C/svg%3E"); background-size: 48px 48px; opacity: .11; pointer-events: none; }
.tile-wash > * { position: relative; }

/* ---------- Narrower screens ---------- */
@media (max-width: 1080px) {
  :root { --rail: 13.5rem; }
  .brand-name { font-size: 1.45rem; }
  .s3 { grid-column: span 4; }
}
@media (max-width: 860px) {
  .frame { display: block; }
  .rail {
    position: static; height: auto; padding: 8px; gap: 6px; display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand wallet menu" "nav nav nav" "foot foot foot"; align-items: stretch;
  }
  .brand { grid-area: brand; padding: .45rem .6rem; gap: .5rem; }
  .brand .mark { width: 30px; height: 30px; }
  .brand-name { font-size: 1.3rem; }
  .wallet { grid-area: wallet; padding: .45rem .65rem; font-size: .9rem; min-width: 0; }
  .menu-btn {
    grid-area: menu; display: inline-flex; align-items: center; gap: .45rem; padding: 0 .7rem; min-height: 2.9rem; cursor: pointer;
    font: 700 .95rem/1 var(--text); color: var(--ink); background: var(--sand); border: 2px solid var(--ink); border-radius: var(--r);
  }
  .menu-icon, .menu-icon::before, .menu-icon::after { display: block; width: 1.05rem; height: 3px; background: var(--ink); border-radius: 2px; }
  .menu-icon { position: relative; }
  .menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
  .menu-icon::before { top: -6px; }
  .menu-icon::after { top: 6px; }
  .rail-art { display: none; }
  .rail-nav { grid-area: nav; display: none; overflow: visible; padding: .5rem; }
  .rail-nav.open { display: block; }
  .rail-foot { grid-area: foot; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem 1rem; padding: .4rem .7rem; font-size: .88rem; }
  .stage { padding: 0 8px 1.5rem; }
  .s3, .s4, .s5, .s6, .s7, .s8 { grid-column: span 12; }
  .stat, .m6 { grid-column: span 6; }
  .sec, .sec:nth-child(n) { grid-column: 1 / -1; }
  .r2, .r3 { grid-row: auto; }
  .hero { min-height: 0; padding: 1.5rem 1.2rem 1.6rem; }
  .base { padding-bottom: 4.5rem; }
  .store-note { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .toast { bottom: 5.8rem; }
}
@media (max-width: 480px) {
  body { font-size: 1rem; }
  .tile { padding: 1.1rem 1rem; }
  .stat dd { font-size: 1.9rem; }
  .reels { gap: .4rem; padding: .4rem; }
  .btn-xl { min-height: 3.8rem; }
  .foot-links ul { columns: 2; }
  .chips { gap: .4rem; }
  .brand-name { font-size: 1.2rem; }
  .menu-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .menu-btn { padding: 0 .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; scroll-behavior: auto !important; }
  .toast { transform: translate(-50%, 0); }
}
