:root {
  background: #091d18;
  --jade: #cee0bb;
  --gold: #ebc785;
  --muted: #b4c2ac;
}
body {
  min-height: 100dvh;
  background: radial-gradient(ellipse at 50% 9%, #244737 0, #112a22 45%, #091d18 88%);
}
.top { border-bottom-color: #dbbb783e; }
.top button { min-height: 42px; }
.top a { letter-spacing: .16em; }
.seal { border: 1px solid #efd292; box-shadow: inset 0 0 0 3px #a4753a65; }
.hero {
  min-height: 288px;
  padding: 38px clamp(18px, 5.5vw, 68px);
  border-radius: 14px;
  background-image: linear-gradient(90deg,#102d22 0%,#102d22db 27%,#102d221a 70%),url(hero.webp);
  box-shadow: inset 0 0 0 4px #12291f9c, 0 14px 35px #08171254;
}
.hero h1 { font-size: clamp(34px, 7vw, 76px); margin: 12px 0; white-space: nowrap; }
.hero .eyebrow { color: #e6cb93; }
.hero .gold { min-height: 46px; box-shadow: 0 4px 0 #9c743f; }
.gold {
  color: #213025;
  background: linear-gradient(170deg,#fce4ad,#d8b272);
  border-color: #f2d69c;
}
.sectionhead { align-items: end; gap: 8px; }
#filters { display: flex; gap: 3px; padding: 3px; border: 1px solid #92a98054; border-radius: 9px; }
#filters button { min-height: 36px; font-size: 13px; border: 0; color: var(--muted); background: transparent; padding: 5px 11px; }
#filters button[aria-pressed=true] { color: #142a20; background: #ddc28d; }
#modes { gap: 12px; }
.mode {
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 11px;
  align-items: center;
  min-height: 110px;
  padding: 12px;
  background: linear-gradient(125deg,#335741,#1b3529 80%);
  box-shadow: inset 0 1px #c3d2a32b,0 4px 8px #05191243;
}
.mode .tile { width: 42px; height: 56px; font-size: 21px; box-shadow: 2px 5px 8px #07181088; }
.mode strong { font: 750 19px/1.3 "Songti SC","Noto Serif CJK SC",serif; margin-top: 3px; }
.mode small { font-size: 12px; }
.mode .go { color: #d7c290; align-self: end; padding-bottom: 3px; }
.tile {
  position: relative;
  border-radius: 5px;
  background: linear-gradient(155deg,#fffdf1,#e8dac0);
  border: 1px solid #d6c29b;
  border-bottom: 4px solid #589176;
  box-shadow: 0 2px 0 #183f32;
}
.tile[data-suit="0"] b { color: #273e36; font-size: .93em; }
.tile[data-suit="-1"] b { font-size: 1.08em; }
.tile[data-suit="0"] .symbol { color: #a43933; }
.tile .pips { position: relative; width: 77%; height: 77%; color: #22495d; }
.pips i {
  position: absolute; display: block;
  left: calc(var(--column) * 34% + 16%);
  top: calc(var(--row) * 34% + 16%);
  transform: translate(-50%,-50%);
}
.circles i { width: 27%; aspect-ratio: 1; border: max(1px,.12em) solid currentColor; border-radius: 50%; }
.bamboo i { width: 17%; height: 30%; background: #34805a; border-radius: 35%; box-shadow: inset 0 -.11em #18492c; }
.pips i.accent { color: #a13833; }
.bamboo i.accent { background: #ad4438; box-shadow: inset 0 -.11em #73372d; }
.pips i:only-child { width: 54%; height: auto; aspect-ratio: 1; }
.bamboo i:only-child { border-radius: 60% 10%; transform: translate(-50%,-50%) rotate(-18deg); }
#game { max-width: 1110px; }
.gamebar { min-height: 55px; }
.gamebar strong { color: #f2d391; font-size: 17px; letter-spacing: .06em; }
.table {
  min-height: 360px;
  height: min(49dvh,510px);
  isolation: isolate;
  border: 6px solid #ac8957;
  background:
    repeating-linear-gradient(37deg,#c9d69c06 0 1px,transparent 1px 5px),
    radial-gradient(ellipse,#2e704e,#21503c 68%,#153d2d 100%);
  box-shadow: inset 0 0 0 3px #e0bd7f40,inset 0 0 60px #0b2a24,0 4px 0 #442f1f,0 14px 32px #05151080;
}
.table::before { content:""; position:absolute; inset: 11px; border: 1px solid #bdc29556; border-radius: 19px; pointer-events: none; }
.tablemark { position:absolute; z-index:-1; top:50%; left:50%; transform:translate(-50%,-50%); padding:8px; border-block:1px solid currentColor; color:#bbd7ae25; letter-spacing:.24em; font:700 clamp(32px,8vw,77px)/1.1 "Songti SC",serif; pointer-events:none; }
#rivers { max-width: 670px; gap: 7px; align-self:center; }
.river { background: #163d2b77; border-color:#accc9b46; padding: 6px; }
.river .tile { width:19px; height:25px; font-size:11px; }
.river .tile.last { transform: translateY(-2px); outline:2px solid #ffe1a1; box-shadow: 0 0 9px #f7dc98a0; z-index:1; }
.opponent { box-shadow: 0 4px 12px #0b211d71; }
.rack { margin-top: 8px; padding: 2px 7px 9px; border: 1px solid #abb7904b; border-radius: 12px; background: #142e25; }
#hand { min-height: 65px; }
#hand .tile { transition: transform 110ms ease; }
#hand .tile:disabled { opacity: .82; }
.racktop button { min-height: 41px; }
.tools { display:flex; justify-content:flex-end; margin-top:7px; }
.tools button { min-height: 32px; padding:3px 10px; font-size:12px; background:transparent; color:#c7d5bc; }
#waits { display:flex; align-items:center; gap:6px; flex-wrap: wrap; margin:9px 0 0; color:#e9c98b; font-size:12px; }
#waits .tile { width:17px; height:23px; font-size:10px; border-bottom-width:2px; }
#waits small { color:#cbd8bf; margin-left:2px; white-space:nowrap; }
.duel .table { padding-inline: 13%; }
.duel #rivers { grid-template-columns: 1fr; max-width: 460px; }
.history { max-height: 50dvh; overflow: auto; }
@media(max-width:640px) {
 .hero { min-height: 225px; padding: 25px 16px; }
 .sectionhead { align-items: start; flex-direction:column; }
 #filters { align-self:stretch; }
 #filters button { flex:1; }
 #modes { gap: 7px; }
 .mode { grid-template-columns:auto minmax(0,1fr); min-height: 104px; gap:7px; padding:9px 7px; }
 .mode .tile { width: 29px; height:43px; font-size:15px; }
 .mode .go { display:none; }
 .mode strong { font-size: 15px; }
 .mode small { font-size: 11px; }
 #game { padding-inline: 7px; }
 .table { min-height: 290px; height: 43dvh; padding-inline: 39px; border-width:4px; }
 .river { padding: 4px; }
 .river .tile { width: 13px; height:18px; font-size:8px; }
 .rack { padding-inline: 2px; }
 #hand { min-height: 46px; }
 #hand .tile { width:clamp(17px,calc((100vw - 40px)/14),42px); }
}
@media(max-height:570px) and (orientation:landscape) {
 .table { min-height: 160px; height: 51dvh; }
 .river .tile { width: 13px; height: 18px; }
 .gamebar { min-height: 41px; }
 .rack { margin-top: 4px; padding-bottom: 3px; }
 #hand { min-height: 39px; }
 .racktop button { min-height: 34px; }
}
@media(prefers-reduced-motion:reduce){#hand .tile{transition:none}}
