@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');
:root{color-scheme:dark;--bg:#0b2027;--table:#12343b;--panel:#102a31;--line:#ffffff15;--muted:#9bb4b8;--ink:#f1f6f1;--accent:#a9e5ce;--gold:#f2c477;--fire:#ff845f;--water:#59cfed;--cell:58px;font-family:'DM Sans',sans-serif;font-size:16px}
*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 28% 4%,#1b4147 0,transparent 55%),var(--bg);color:var(--ink);min-height:100vh}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;cursor:pointer;touch-action:manipulation}button:disabled{cursor:default;opacity:.38}button:focus-visible,a:focus-visible{outline:3px solid var(--gold);outline-offset:4px}button{border:0}a{color:inherit}button{transition:background .18s,box-shadow .18s,transform .18s}button:not(:disabled):active{transform:translateY(1px)}[hidden]{display:none!important}.topbar{height:91px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 4%;gap:20px}.brand{display:block;width:196px;flex-shrink:0}.brand img{width:100%;height:auto;display:block;filter:invert(1);opacity:.96}.header-actions{display:flex;align-items:center;gap:14px}.quiet-button,.text-button{background:transparent;color:var(--muted);padding:10px 12px;font-size:.875rem}.quiet-button:hover,.text-button:hover{color:var(--ink);background:#ffffff08}.new-game-button{background:#ffffff09;color:var(--ink);border:1px solid #ffffff29;border-radius:30px;padding:11px 21px;font-size:.875rem}.new-game-button:hover{border-color:var(--accent)}.game-shell{max-width:1540px;margin:0 auto;padding:30px 4% 32px;display:grid;grid-template-columns:minmax(0,1fr) 352px;gap:32px}.table-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:24px}.eyebrow{display:block;font-size:.75rem;font-weight:700;letter-spacing:.15em;color:var(--accent);margin-bottom:9px}h1,h2,h3,p{margin:0}h1{font-family:Manrope,sans-serif;font-size:clamp(1.25rem,1.8vw,1.65rem);font-weight:500;letter-spacing:-.035em;line-height:1.35}.round-badge{white-space:nowrap;border:1px solid var(--line);border-radius:50px;padding:8px 12px;font-size:.8125rem;color:var(--muted)}.round-badge>span:first-child{font-weight:700;color:var(--ink)}.opponents{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:0 12px 18px}.opponent{display:flex;position:relative;align-items:center;gap:12px;padding:14px;border:1px solid var(--line);border-radius:12px;background:#0c252b90;transition:border-color .2s,background .2s}.opponent.last-player{border-color:var(--gold);background:#403a29;box-shadow:0 0 25px #f2c47710;transition:none}.opponent.last-player .opponent-name,#human-name.last-player{color:var(--gold)}.avatar{width:38px;height:38px;display:flex;align-items:center;justify-content:center;font-family:Manrope,sans-serif;font-size:1rem;border-radius:50%;color:var(--gold);background:#59483255;flex-shrink:0}.opponent[data-player="2"] .avatar{color:var(--water);background:#284a5f}.opponent[data-player="1"] .avatar{color:#cab8ee;background:#49395b}.opponent-name{font-size:.9375rem;font-weight:600}.opponent-caption{font-size:.75rem;color:var(--muted);margin-top:2px}.mini-hand{display:flex;gap:0;margin-left:auto;padding-left:5px}.tile-back-mini{width:13px;height:22px;border:1px solid #af8d5555;background:linear-gradient(135deg,#536a64,#2b4744);border-radius:2px;margin-left:-7px;box-shadow:1px 1px 2px #0006}.play-surface{background:linear-gradient(155deg,#1c474b,#13383e 58%,#173e40);border:1px solid #648c8245;box-shadow:0 16px 50px #0002,inset 0 0 90px #02151d40;border-radius:22px;padding:14px 17px 10px;position:relative}.board-toolbar{display:flex;align-items:center;justify-content:space-between;color:var(--muted);margin-bottom:9px}.board-label{font-size:.75rem;letter-spacing:.12em;font-weight:700}.board-label span{font-size:.75rem;letter-spacing:0;margin-left:12px;font-weight:400;color:#99b7b18c}.board-toolbar>div{display:flex;align-items:center}.icon-button{width:34px;height:34px;border-radius:50%;background:#ffffff08;color:var(--ink);font-size:1.2rem}.board-toolbar .text-button{font-size:.8125rem}.board-viewport{overflow:auto;max-height:min(60vh,610px);min-height:290px;border-radius:4px;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#51706a transparent;position:relative}.board{display:grid;gap:3px;margin:auto;width:max-content;position:relative;isolation:isolate;padding:4px}.cell{width:var(--cell);height:var(--cell);padding:0;position:relative;border:1px solid #bed1c112;border-radius:3px;background:#0f303529;display:flex;align-items:center;justify-content:center;transition:background .2s,border-color .2s;flex-shrink:0}.cell.occupied{border:0;box-shadow:0 3px 0 #5e4227,0 5px 9px #0007;z-index:1;background:#f9dfb7}.tile-image{width:100%;height:100%;object-fit:cover;display:block;border-radius:2px;pointer-events:none;user-select:none;-webkit-user-drag:none}.cell .tile-image{transition:transform .18s}.cell.last-played{outline:2px solid var(--gold);outline-offset:1px;box-shadow:0 0 16px #f2c4774d,0 3px 0 #5e4227;z-index:2}.cell.last-played::after{content:'';position:absolute;right:3px;top:3px;width:5px;height:5px;border-radius:50%;background:#81560b;box-shadow:0 0 0 2px var(--gold)}.cell.just-played{animation:tileIn .4s cubic-bezier(.16,1,.3,1)}.cell.legal{background:#a9e5ce17;border:1px dashed #a9e5ce90;cursor:pointer}.cell.legal::before{content:'+';color:var(--accent);font-size:1.35rem;font-weight:400}.cell.legal:hover,.cell.legal:focus-visible{background:#a9e5ce35;box-shadow:inset 0 0 15px #a9e5ce15}.cell.legal .placement-preview{position:absolute;inset:0;opacity:0;transition:opacity .18s}.cell.legal:hover .placement-preview,.cell.legal:focus-visible .placement-preview{opacity:.75}.cell.hole::before{content:'✦';font-size:1rem}.cell.start-cell{background:#a9e5ce12;border:1px dashed #a9e5ce88}.cell.start-cell::before{content:'+';color:var(--accent);font-size:1.4rem}.cell.bound-top{border-top-color:#c5d9bf55}.cell.bound-bottom{border-bottom-color:#c5d9bf55}.cell.bound-left{border-left-color:#c5d9bf55}.cell.bound-right{border-right-color:#c5d9bf55}.board-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px 2px 4px;font-size:.75rem;color:#b0c9c4}.legend{display:flex;gap:16px}.legend span{display:flex;gap:5px;align-items:center}.legend i{width:7px;height:7px;border-radius:50%;display:block}.fire-mark{background:var(--fire)}.water-mark{background:var(--water)}.wind-mark{background:#cfdedb}.last-key{display:flex;gap:7px;align-items:center;font-size:.75rem}.last-key i{border:1px solid var(--gold);width:10px;height:10px;display:block;border-radius:2px}.turn-strip{display:flex;align-items:center;gap:13px;margin-top:18px;min-height:57px;padding:14px 16px;border-radius:22px;background:#ffad66;color:#102a31}.turn-strip>div{min-width:0}.turn-icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;border:1px solid #a9e5ce45;color:#173a32;background:var(--accent);font-weight:700;flex-shrink:0}.turn-strip strong{font-size:.9375rem;font-weight:700;color:#102a31}.turn-strip p{font-size:.875rem;line-height:1.45;font-weight:700;color:#102a31;margin-top:3px}.turn-strip.your-turn .turn-icon{background:var(--accent);color:#173a32;box-shadow:0 0 20px #a9e5ce10}.hand-area{padding:24px 21px 20px;border:1px solid var(--line);background:#0c2429aa;border-radius:18px;align-self:start;min-width:0}.hand-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:19px}.hand-heading .eyebrow{font-size:.75rem;letter-spacing:.12em;color:var(--muted)}h2{font-family:Manrope,sans-serif;font-size:1.65rem;font-weight:600;letter-spacing:-.045em}.hand-heading h2{font-size:1.5rem}.hand-heading h2 span{font-size:.875rem;background:#ffffff0d;border:1px solid var(--line);border-radius:20px;padding:3px 8px;margin-left:6px;font-family:'DM Sans',sans-serif;vertical-align:middle;letter-spacing:0}.score-label{font-size:.75rem;color:var(--muted);white-space:nowrap}.selected-controls{min-height:44px;display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:16px}.selected-controls>div{font-size:.8125rem;color:var(--muted);line-height:1.45}.rotate-button{display:flex;align-items:center;gap:5px;border-radius:25px;background:#ffffff08;color:var(--ink);border:1px solid var(--line);padding:7px 10px;font-size:1.2rem}.rotate-button span{font-size:.8125rem}.hand{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:11px 8px}.hand-tile{aspect-ratio:1;padding:0;position:relative;background:#f9dfb7;box-shadow:0 3px 0 #816044,0 6px 8px #0005;border-radius:3px;overflow:visible;transition:transform .18s,outline .18s,opacity .18s;outline:2px solid transparent;outline-offset:2px;min-width:0}.hand-tile:hover{transform:translateY(-3px)!important}.hand-tile.selected{outline-color:var(--accent);transform:translateY(-4px);box-shadow:0 4px 0 #816044,0 0 20px #a9e5ce30}.hand-tile.unplayable{opacity:.48}.hand-tile.selected.unplayable{opacity:1}/* Availability halo is separated from the artwork by a dark gap. */
.hand-tile.can-play:not(.selected)::after{content:'';position:absolute;inset:-4px;pointer-events:none;border:1px solid #ffd58d;border-radius:6px;background:transparent;box-shadow:0 0 5px 2px #ffbd6670,0 0 10px 3px #ffad6638}
.hand-tile.dealing{animation:handDeal .4s both;animation-delay:calc(var(--tile-index)*.035s)}.hand.placeholder .hand-tile{background:#1c3c3b;border:1px solid #61827855;box-shadow:0 3px 0 #0a191b}.hand.placeholder .hand-tile::before{content:'C';color:#759888;position:absolute;inset:20%;border:1px solid #658b7877;font-family:Manrope,sans-serif;font-size:1.5rem;display:flex;align-items:center;justify-content:center;transform:rotate(45deg)}.hand-actions{margin-top:22px;display:flex;flex-direction:column;gap:10px}.primary-button{background:var(--accent);color:#12382d;border:1px solid var(--accent);border-radius:10px;padding:13px 20px;font-size:.9375rem;font-weight:700;min-height:48px}.primary-button:hover:not(:disabled){background:#c3f2de;box-shadow:0 4px 20px #a9e5ce15}.primary-button:disabled{background:#ffffff0a;border-color:var(--line);color:#aac1bc;opacity:.55}.swap-button{background:#f2c47712;color:var(--gold);border:1px solid #f2c47750;padding:12px;border-radius:10px;font-size:.875rem}.move-log{border-top:1px solid var(--line);margin-top:23px;padding-top:20px}.move-log h3{font-size:.75rem;font-weight:500;color:var(--muted);margin-bottom:15px}.move-log ol{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:11px;max-height:135px;overflow:auto;scrollbar-width:thin}.move-log li{font-size:.8125rem;color:#a6bfbb;line-height:1.4;padding-left:11px;border-left:2px solid #ffffff1a}.move-log li:first-child{color:#deeee6;border-color:var(--accent)}.game-dialog{border:1px solid #69877b5c;border-radius:24px;background:radial-gradient(ellipse at top right,#2b4b42,transparent 70%),#132e32;color:var(--ink);padding:38px;width:min(480px,calc(100vw - 32px));max-height:calc(100dvh - 40px);box-shadow:0 35px 130px #0008;overflow:auto}.game-dialog::backdrop{background:#041619b8;backdrop-filter:blur(7px)}.game-dialog h2{font-size:2.4rem;line-height:1.12;letter-spacing:-.055em;margin-bottom:16px}.game-dialog p{font-size:.9375rem;line-height:1.7;color:#adc5c2;margin-bottom:24px}.game-dialog>.primary-button{width:100%}.game-dialog>.text-button,.result-content>.text-button{display:block;margin:12px auto 0}.game-dialog .eyebrow{margin-bottom:16px}.start-dialog{text-align:center;width:min(500px,calc(100vw - 32px));padding:40px}.start-emblem{display:flex;align-items:center;justify-content:center;gap:16px;margin:0 auto 25px;padding:13px 21px;border:1px solid #f2c47740;border-radius:16px;width:max-content;max-width:100%;background:#0b202744}.start-emblem>svg{width:30px;height:36px;flex:none}.start-emblem>span{color:#e9f4ed;font-size:.94rem;line-height:1.4;text-align:center;font-weight:600;letter-spacing:.01em}.start-dialog h2{font-size:2.8rem;font-weight:500}.start-dialog p{max-width:320px;margin:0 auto 27px}.deal-summary{display:flex;justify-content:center;gap:26px;margin-bottom:29px;font-size:.8125rem;color:#9eb6b0}.deal-summary strong{display:block;font-size:1.2rem;color:var(--ink);font-weight:500;margin-bottom:4px}.large{display:flex;align-items:center;justify-content:space-between;min-height:54px;padding:14px 20px}.large span{font-size:1.5rem;font-weight:400}.start-rules{font-size:.8125rem!important}.close-button{position:absolute;right:13px;top:12px;background:transparent;color:var(--muted);font-size:1.75rem;width:40px;height:40px;border-radius:50%}.rules-dialog{width:min(580px,calc(100vw - 32px))}.rules-content h3{font-family:Manrope,sans-serif;font-size:1rem;font-weight:600;margin:22px 0 8px;color:var(--accent)}.rules-content p{margin:0 0 12px;font-size:.9375rem;line-height:1.65}.rules-content table{width:100%;border-collapse:collapse;font-size:.875rem;margin:14px 0 24px}.rules-content td,.rules-content th{border-bottom:1px solid var(--line);padding:9px 0;text-align:left}.rules-content th{font-weight:500;color:var(--muted)}.rules-content th:last-child,.rules-content td:last-child{text-align:right}.rules-dialog>.primary-button{margin-top:24px}.swap-choices{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.swap-choice{aspect-ratio:1;background:linear-gradient(140deg,#385d50,#17352f);border:1px solid #abcc9980;color:#d0ddbc;font-family:Manrope,sans-serif;font-size:1.2rem;border-radius:4px;box-shadow:0 3px 0 #061916}.swap-choice:hover{outline:2px solid var(--gold);outline-offset:2px}.result-dialog{text-align:center}.result-dialog h2{color:var(--gold);font-size:2.8rem}.result-row{display:flex;align-items:center;gap:10px;padding:13px 0;border-top:1px solid var(--line);text-align:left;font-size:.9375rem}.result-row .avatar{width:30px;height:30px;font-size:.8125rem}.result-row small{margin-left:auto;color:var(--muted);font-size:.8125rem}.result-row.winner{color:var(--gold)}#results{margin-bottom:26px}.toast{position:fixed;bottom:25px;left:50%;transform:translate(-50%,15px);opacity:0;pointer-events:none;background:#e5f5e8;color:#15382f;padding:13px 21px;border-radius:30px;font-size:.875rem;box-shadow:0 10px 50px #0005;z-index:20;transition:opacity .2s,transform .2s;width:max-content;max-width:90vw;text-align:center}.toast.visible{opacity:1;transform:translate(-50%,0)}.hand-empty{grid-column:1/-1;color:var(--accent);padding:40px 10px;text-align:center;font-size:.9375rem}.thinking::after{content:'…';display:inline-block;animation:pulse 1.2s infinite}.board-viewport:has(.board:empty){height:430px}@keyframes tileIn{from{transform:scale(1.25) translateY(-12px);opacity:0}to{transform:scale(1) translateY(0);opacity:1}}@keyframes handDeal{from{transform:translateY(15px) rotate(4deg);opacity:0}to{transform:translateY(0) rotate(0);opacity:1}}@keyframes pulse{50%{opacity:.25}}
@media(min-width:1440px){.game-shell{grid-template-columns:minmax(0,1fr) 370px;gap:40px}.hand{gap:13px 10px}.play-surface{padding:16px 28px 13px}}
@media(max-width:1100px){.game-shell{grid-template-columns:minmax(0,1fr) 300px;gap:20px;padding:25px 3%}.topbar{padding:0 3%;height:80px}.hand-area{padding:22px 16px}.table-heading h1{font-size:1.25rem}.opponent{padding:10px;gap:8px}.mini-hand{display:none}.opponents{margin-left:0;margin-right:0;gap:8px}.avatar{width:32px;height:32px;font-size:.875rem}.play-surface{padding:10px 10px 9px}.selected-controls{margin-bottom:13px}.hand{gap:10px 7px}}
@media(max-width:900px){.game-shell{grid-template-columns:minmax(0,1fr);max-width:820px;padding:22px 4% 35px;gap:18px}.topbar{padding:0 4%}.hand-area{padding:20px}.hand{grid-template-columns:repeat(8,minmax(0,1fr));gap:12px 8px}.hand-heading{margin-bottom:5px}.hand-heading .eyebrow{display:none}.hand-actions{margin-top:16px;flex-direction:row}.hand-actions>button{flex:1}.move-log{margin-top:17px;padding-top:14px}.move-log ol{max-height:78px;gap:7px}.move-log h3{margin-bottom:10px}.opponents{gap:14px;margin:0 20px 17px}.opponent{padding:13px}.mini-hand{display:flex}.table-heading{margin-bottom:20px}.board-viewport{max-height:520px}.play-surface{padding:12px 25px}.table-heading h1{font-size:1.75rem}.turn-strip{margin-top:13px}.selected-controls{min-height:42px;margin-bottom:13px}}
@media(max-width:560px){.topbar{height:72px;gap:8px;padding:0 16px}.brand{width:136px}.header-actions{gap:2px}.quiet-button{padding:8px;font-size:.75rem}.new-game-button{font-size:.75rem;padding:9px 12px}#sound-button{display:none}.game-shell{padding:20px 12px 28px;gap:14px}.table-heading{margin:0 4px 18px}.table-heading .eyebrow{font-size:.75rem;margin-bottom:6px}.table-heading h1{font-size:1.1rem;max-width:215px;letter-spacing:-.025em}.round-badge{font-size:.75rem;padding:7px 9px}.opponents{gap:7px;margin:0 1px 13px}.opponent{padding:9px 7px;gap:7px;border-radius:10px}.opponent .avatar{width:27px;height:27px;font-size:.8125rem}.opponent-name{font-size:.8125rem}.opponent-caption{font-size:.75rem}.mini-hand{display:none}.play-surface{padding:6px 7px 10px;border-radius:14px}.board-toolbar{margin:0 5px 4px}.board-toolbar .icon-button{width:30px;height:30px}.board-viewport{min-height:240px;max-height:460px}.board{gap:2px;padding:3px}.board-footer{font-size:.75rem;padding:13px 7px 2px;gap:5px}.last-key{font-size:.75rem}.legend{gap:10px}.turn-strip{padding:12px 10px;gap:10px;border-radius:14px}.turn-strip strong{font-size:.875rem}.turn-strip p{font-size:.8125rem}.turn-icon{width:34px;height:34px}.hand-area{padding:17px 14px;border-radius:14px}.hand-heading h2{font-size:1.35rem}.hand{grid-template-columns:repeat(4,minmax(0,1fr));gap:13px 10px}.selected-controls{margin:5px 0 13px}.hand-actions{margin-top:18px}.hand-tile{max-width:100%}.game-dialog{padding:30px 23px;border-radius:18px}.start-dialog{padding:30px 25px}.start-dialog h2{font-size:2.4rem}.game-dialog h2{font-size:2.2rem}.game-dialog p{font-size:.875rem}.deal-summary{gap:24px}.hand-area .eyebrow{font-size:.75rem}.toast{bottom:16px}.cell.legal::before{font-size:1rem}.cell.last-played::after{width:3px;height:3px;right:2px;top:2px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

/* Keep instructions and recurring controls legible on touch screens. */
.rules-content p,.game-dialog p{font-size:1rem}.header-actions button,.rotate-button span,.selected-controls>div{font-size:.875rem}.hand-heading .eyebrow{font-size:.75rem}.board-label{font-size:.75rem}.icon-button{min-width:36px;min-height:36px}@media(max-width:560px){.header-actions button{font-size:.8125rem}.brand{width:128px}.quiet-button{padding:8px 7px}.game-dialog p{font-size:1rem}.board-toolbar .icon-button{width:36px;height:36px}.score-label{font-size:.8125rem}}

/* Center the opening tile on an unmarked table. Only playable targets are shown
   until placed Wind sides establish two perpendicular outer boundaries. */
.board-viewport{display:flex}
.board{flex-shrink:0}
.board:not(.grid-defined) .cell:not(.occupied):not(.legal):not(.start-cell){background:transparent;border-color:transparent}
.board:not(.grid-defined) .cell.start-cell:not(.legal){background:transparent;border-color:#a9e5ce45}
.board.grid-defined{border-radius:4px}

/* Keep the count visible while the player's status changes. */
.opponent-details{min-width:0}
.player-order{display:block;color:var(--ink);font-size:.875rem;line-height:1.4;margin:3px 0;font-variant-numeric:tabular-nums}
.player-order[hidden]{display:none}
.opponent-caption{display:grid;gap:2px}
.opponent-count{font-size:.875rem;color:var(--ink);font-variant-numeric:tabular-nums}

/* Compact reference images leave room for readable tile names and explanations. */
.help-tabs{display:flex;flex-wrap:wrap;gap:8px;border-bottom:1px solid var(--line);padding-bottom:12px;margin:4px 0 20px}
.help-tabs button{padding:10px 18px;min-height:44px;border-radius:8px;background:transparent;color:var(--muted);font-size:1rem}
.help-tabs button[aria-selected="true"]{background:var(--accent);color:#12382d;font-weight:600}
.help-tabs button:hover:not([aria-selected="true"]){background:#ffffff08;color:var(--ink)}
.tile-guide-content{font-size:1.0625rem;line-height:1.55}
.tile-guide-content .tile-guide-intro,.tile-guide-content .tile-guide-footnote{font-size:1rem;line-height:1.65;margin:0 0 22px}
.tile-guide-group{margin:22px 0 28px}
.tile-guide-group h3{font-family:Manrope,sans-serif;font-size:1.125rem;font-weight:600;color:var(--accent);margin:0 0 6px}
.tile-guide-group .tile-guide-orientation{font-size:1rem;margin:0 0 5px}
.tile-guide-list{margin:0;padding-left:1.65rem}
.tile-guide-list>li{padding:14px 0 14px 4px;border-bottom:1px solid var(--line)}
.tile-guide-list>li::marker{color:var(--muted);font-size:1rem;font-variant-numeric:tabular-nums}
.tile-guide-row{display:grid;grid-template-columns:minmax(0,1fr) 64px;gap:20px;align-items:center}
.tile-guide-copy{min-width:0;overflow-wrap:break-word}
.tile-guide-copy strong{display:block;font-size:1.1875rem;font-weight:600;letter-spacing:.01em;color:var(--ink)}
.tile-guide-copy p{font-size:1.0625rem;line-height:1.5;margin:4px 0 6px;color:var(--ink)}
.tile-guide-points{display:block;color:var(--muted);font-size:.875rem}
.tile-guide-image{width:64px;height:64px}
.tile-guide-image .tile-image{border-radius:0}
@media(max-width:560px){.tile-guide-row{grid-template-columns:minmax(0,1fr) 56px;gap:12px}.tile-guide-image{width:56px;height:56px}.tile-guide-copy p{font-size:1.0625rem}.tile-guide-list{padding-left:1.5rem}.help-tabs button{padding:10px 15px}}

/* Match the existing rules paragraphs when presenting steps and short lists. */
.rules-content ul,.rules-content ol{margin:0 0 12px;padding-left:1.4rem;font-size:1rem;line-height:1.65;color:#adc5c2}
.rules-content li{margin-bottom:8px}

/* Optional shop links use the game's existing type and colors. */
.physical-game-promo{width:min(580px,calc(100% - 32px));margin:0 auto 32px;text-align:center}
.game-shell>aside.physical-game-promo{grid-column:1 / -1;justify-self:stretch;display:flex;flex-direction:column;align-items:center;width:auto;max-width:none;margin:0;padding:0 16px;text-align:center}
.game-shell>aside.physical-game-promo .physical-game-shipping{width:100%;max-width:580px}
.physical-game-link{display:inline-flex;align-items:center;justify-content:center;max-width:100%;min-height:44px;padding:11px 20px;border:1px solid #a9e5ce70;border-radius:10px;background:transparent;color:var(--accent);font:inherit;font-size:.9375rem;font-weight:600;line-height:1.4;text-decoration:none;transition:background .18s,border-color .18s}
.physical-game-link:hover{background:#a9e5ce10;border-color:var(--accent)}
.physical-game-promo .physical-game-shipping{margin:8px 0 0;font-size:.875rem;line-height:1.5;color:var(--muted)}
.result-dialog .physical-game-promo{width:auto;margin:16px 0 0}

/* Let the table shrink to the device, not to its scrollable board's intrinsic
   width. Board zoom stays inside its own viewport; page pinch zoom stays free. */
.table-area,.play-surface,.board-viewport{min-width:0;max-width:100%}
.game-dialog{max-width:calc(100% - 32px);max-height:calc(100vh - 40px);max-height:calc(100dvh - 40px)}
@media(max-width:560px){
  .board-toolbar,.board-footer{flex-wrap:wrap;row-gap:8px}
}
@media(max-width:380px){
  .topbar{height:auto;min-height:72px;flex-wrap:wrap;justify-content:center;padding-top:12px;padding-bottom:12px}
}

/* Keep dismissal within reach, including when a dialog scrolls. */
.dialog-close-bar{position:sticky;top:0;z-index:2;display:flex;justify-content:flex-end;margin:-26px -26px 8px;pointer-events:none}
.dialog-close-bar .close-button{position:static;display:grid;place-items:center;flex:none;width:44px;height:44px;padding:0;line-height:1;background:#132e32;color:var(--ink);border:1px solid #69877b5c;pointer-events:auto}
.dialog-close-bar .close-button:hover{background:#2b4b42}
@media(max-width:560px){.dialog-close-bar{margin:-18px -11px 8px}}

/* Illustrated matching examples; game rules and state are unchanged. */
.move-examples{margin:18px 0 26px;padding:16px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}
.rules-content .move-example-intro{font-size:.9375rem;margin:0 0 14px}
.move-example-switch{display:flex;gap:6px;padding:5px;background:var(--bg);border:1px solid #91b2a52d;border-radius:11px;margin:0 0 16px}
.move-example-switch button{flex:1;min-width:0;min-height:44px;border:1px solid transparent;border-radius:7px;padding:10px 6px;background:transparent;color:var(--muted);font-size:.875rem;font-weight:600}
.move-example-switch button[aria-pressed="true"]{background:var(--accent);color:#113c30;border-color:var(--accent)}
.move-example-switch button[data-move-example="incorrect"][aria-pressed="true"]{background:#f4b0a1;border-color:#f4b0a1;color:#56271f}
.move-example-diagram{display:block;width:100%;height:auto;border-radius:8px}
.move-example-caption{margin:15px 0 0}.move-example-caption>strong{display:block;color:var(--accent);font-size:1rem;margin-bottom:5px}
#move-example-incorrect .move-example-caption>strong{color:#f4b0a1}
.rules-content .move-example-caption p{font-size:.9375rem;margin:0;line-height:1.6}
.rules-content .move-example-reminder{font-size:.875rem;margin:16px 0 0;padding-top:13px;border-top:1px solid var(--line);line-height:1.6}
@media(max-width:380px){.move-example-switch button{font-size:.75rem;padding:9px 3px}}

/* Count the board from a Corner without changing its placement rules. */
.boundary-example{margin:18px 0 26px}
.boundary-diagram{display:block;width:100%;height:auto;border-radius:8px}
.boundary-example figcaption{margin-top:15px;color:var(--ink);font-size:1rem;line-height:1.6}
.boundary-example figcaption>strong{display:block;color:var(--accent);margin-bottom:5px}
.rules-content .boundary-example p{font-size:.9375rem;line-height:1.6;margin:0}
.rules-content .boundary-example .boundary-note{font-size:.8125rem;color:var(--muted);margin-top:10px}

/* Approved insert example: slim gold brackets identify the closed last tile. */
.closed-tile-example{margin:16px 0 24px}
.closed-tile-diagram{display:block;width:100%;height:auto;border-radius:8px}
.closed-tile-example figcaption{margin-top:15px;color:var(--ink);font-size:.9375rem;line-height:1.6}
.closed-tile-example figcaption>strong{display:block;color:var(--accent);font-size:1rem;margin-bottom:5px}
.rules-content .closed-tile-example p{font-size:.9375rem;line-height:1.6;margin:0}
.rules-content .closed-tile-example .closed-tile-reminder{font-size:.8125rem;margin-top:16px;padding-top:13px;border-top:1px solid var(--line);color:var(--muted)}

/* Enclosed-space examples, including already-established edges and corners. */
.gap-examples{margin:16px 0 24px}
.gap-tabs{display:flex;gap:5px;background:var(--bg);border:1px solid #91b2a52d;border-radius:10px;padding:5px;margin:0 0 16px}
.gap-tabs button{flex:1;min-width:0;min-height:44px;border:0;border-radius:6px;padding:9px 5px;font-size:.8125rem;font-weight:600;background:transparent;color:var(--muted)}
.gap-tabs button[aria-pressed="true"]{background:var(--accent);color:#113c30}
.gap-examples button:focus-visible{outline:2px solid #ffd45a;outline-offset:2px}
.rules-content .gap-summary{font-size:.875rem;color:var(--ink);min-height:42px;margin:0 0 12px}
.gap-examples figure{margin:0}
.gap-examples svg{display:block;width:100%;height:auto;border-radius:8px}
.gap-examples figcaption{font-size:.875rem;line-height:1.6;margin-top:14px}
.gap-examples figcaption>strong{display:block;font-size:.9375rem;color:var(--accent);margin-bottom:5px}
.rules-content .gap-examples figcaption p{font-size:.875rem;margin:0;line-height:1.6}
.gap-preview-toggle{display:block;width:100%;min-height:44px;margin:16px 0 0;padding:10px 14px;font-size:.875rem;font-weight:600;color:var(--accent);background:#102a31;border:1px solid #719a8a;border-radius:8px}
.gap-preview-toggle[aria-pressed="true"]{background:var(--accent);color:#113c30}
.rules-content .gap-legend{color:#ffd45a;font-size:.75rem;margin:12px 0 0}
.rules-content .gap-scope{font-size:.75rem;color:var(--muted);margin:4px 0 0}
.rules-content .gap-reminder{font-size:.8125rem;margin:12px 0 0;padding-top:13px;border-top:1px solid var(--line);color:var(--muted)}
.gap-examples [hidden]{display:none!important}
@media(max-width:430px){.gap-tabs button{font-size:.6875rem}}

.game-dialog .feedback-contact{border-top:1px solid var(--line);padding-top:18px;margin:24px 0 0;font-size:.875rem;line-height:1.7;text-align:center;color:var(--muted)}
.feedback-contact span{display:block}
.feedback-contact a{display:inline-block;color:var(--accent);font-weight:600;text-decoration:underline;text-underline-offset:3px;overflow-wrap:anywhere;user-select:text}
.feedback-contact a:hover{color:var(--ink)}
.feedback-contact a:focus-visible{outline:2px solid var(--accent);outline-offset:4px;border-radius:2px}

/* Smaller results close icon, with its full 44px touch target retained. */
.result-dialog .dialog-close-bar{margin-top:0}
.result-dialog .dialog-close-bar .close-button{position:relative;inset:auto;isolation:isolate;background:transparent;border:0;font-size:1.4rem}
.result-dialog .dialog-close-bar .close-button::before{content:'';position:absolute;inset:4px;z-index:-1;border:1px solid #69877b5c;border-radius:50%;background:#132e32}
.result-dialog .dialog-close-bar .close-button:hover::before{background:#2b4b42}
.result-dialog .dialog-close-bar .close-button:focus-visible{outline-width:2px;outline-offset:-2px}

.share-shortcut, .share-result-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
}
.share-shortcut svg, .share-result-button svg { flex: none; }
.result-actions { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 8px; }
.result-actions button { min-height: 48px; padding: 10px 8px; font-size: .9375rem; }
.share-result-button {
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}
.share-result-button:hover { background: #a9e5ce10; }
.result-dialog .physical-game-link { width: 100%; gap: 8px; border-color: var(--gold); color: var(--gold); }
#share-dialog label { display: block; font-weight: 600; }
#share-url {
  width: 100%;
  margin: 8px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
#copy-status { margin: 12px 0 0; }
#copy-status:empty { margin: 0; }
@media (max-width: 560px) {
  .share-shortcut { min-width: 44px; }
  .share-shortcut span { display: none; }
}
/* Give the close control a separate row from the scrolling scores on phones. */
@media (max-width: 560px), (max-height: 500px) and (pointer: coarse) {
  .result-dialog[open] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 6px 14px 12px;
    overflow: hidden;
  }
  .result-dialog .dialog-close-bar {
    grid-area: 1 / 2;
    position: static;
    margin: 0;
  }
  #result-kicker {
    grid-area: 1 / 1;
    align-self: center;
    margin: 0;
    text-align: left;
  }
  .result-content {
    grid-column: 1 / -1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: 2px 4px 6px;
  }
  .result-content h2 { margin: 0 0 8px; }
  #result-reason { margin: 0 0 12px; line-height: 1.45; }
  #results { margin-bottom: 14px; }
  .result-row { padding: 7px 0; }
  .result-dialog .physical-game-promo { margin-top: 10px; }
}
@media (max-width: 300px) { .result-actions { grid-template-columns: 1fr; } }

/* The aggregate count stays private; visitors can read this short notice. */
.count-privacy{font-size:.8125rem;color:var(--muted);line-height:1.6;text-align:left;margin-top:20px}
.count-privacy summary{cursor:pointer;min-height:44px;display:list-item;align-content:center;text-align:center;color:var(--muted);text-underline-offset:3px}
.count-privacy p,.start-dialog .count-privacy p{font-size:.8125rem;line-height:1.65;margin:10px 0 0;max-width:none}
.count-privacy a{color:var(--accent)}
.count-privacy-footer{max-width:620px;margin:0 auto;padding:0 20px 25px}
.count-privacy-footer .count-privacy{margin-top:0}

/* First-game guidance uses the existing surfaces, not a blocking tour. The
   glow surrounds the entire hand, including every row of the sixteen tiles. */
.hand-area.guided-hand{border-color:#a9e5cebb;background:linear-gradient(150deg,#a9e5ce14,#0c2429aa 72%);box-shadow:0 0 0 1px #a9e5ce40,0 0 26px #a9e5ce18,inset 0 0 28px #a9e5ce08}
.first-play-hint{color:var(--accent);font-size:1rem;font-weight:500;line-height:1.45;margin:0}
.selected-controls>div{min-width:0}
.rotate-button{min-height:44px;flex-shrink:0}
.rotate-button.guided-control{background:var(--accent);border-color:var(--accent);color:#12382d;padding:9px 14px;box-shadow:0 0 16px #a9e5ce20}
.rotate-button.guided-control span{font-size:1rem;font-weight:700}
.primary-button.guided-control{box-shadow:0 0 0 2px #a9e5ce35,0 0 20px #a9e5ce20}
.placement-hint{margin:8px 0 0;padding:12px 16px;border-radius:10px;background:#102f34;color:#c0f4dc;font-size:1.125rem;font-weight:600;line-height:1.4;text-align:center;text-wrap:balance;box-shadow:inset 0 0 0 1px #a9e5ce24}
.board.guided-placements .cell.legal{background:#a9e5ce29;border-color:#b8f4d5;box-shadow:0 0 8px #a9e5ce12}
.game-dialog .replay-hint{color:var(--accent);font-size:1rem;line-height:1.5;margin:0 0 14px}
@media(max-width:560px){.selected-controls{flex-wrap:wrap;gap:10px}.selected-controls>div{flex:1 1 150px}.first-play-hint{font-size:1rem}.placement-hint{padding:11px 14px;font-size:1.0625rem}}

/* Board camera only. The original header and game layout are unchanged. */
.board-viewport{scroll-behavior:auto}.board{will-change:transform}

/* Compact player rows, preserving original typography and colors. */
.opponents{grid-template-columns:minmax(0,1fr);gap:4px}
.opponent{padding:3px 7px;gap:0}
.opponent>.avatar,.opponent>.mini-hand{display:none}
.opponent-details{display:grid;grid-template-columns:1fr 1fr 1fr;align-items:center;gap:5px;width:100%}
.opponent-name{color:var(--gold)}
.opponent[data-player="1"] .opponent-name{color:#cab8ee}
.opponent[data-player="2"] .opponent-name{color:var(--water)}
.opponent.last-player .opponent-name{color:var(--gold)}
.opponent .player-order{margin:0}
.opponent-caption{display:block;margin:0}
.opponent-status{display:none}

/* Keep the goal legible across the full heading width. */
.table-heading h1.game-goal{max-width:none}

/* Compact, colorful goal using the existing CuadraFio palette and font. */
.table-heading:has(.game-goal){margin-bottom:8px}
.game-goal .goal-match{display:block;font-size:20px;line-height:1.15;font-weight:800;letter-spacing:-.035em}
.game-goal .goal-fire{color:var(--fire)}
.game-goal .goal-water{color:var(--water)}
.game-goal .goal-win{display:block;font-size:14px;line-height:1.3;font-weight:600;letter-spacing:0;color:var(--accent);margin-top:3px}
@media(max-width:560px){.game-shell:has(.game-goal){padding-top:12px}}

/* Match the optional rotation cue to its real enabled control. */
.rotation-word,#rotate-button.rotation-match{background:#123b50;color:#d1f6ff;border:1px solid #59cfed;border-radius:9px;font-weight:800;box-shadow:none}
.rotation-word{display:inline-block;padding:3px 9px;font-size:14px;line-height:1.4;vertical-align:baseline}
#rotate-button.rotation-match{padding:9px 14px;min-height:44px}
#rotate-button.rotation-match span{font-weight:800;font-size:14px}

.turn-strip p{font-weight:400}

/* Place blocked-turn actions with their explanation; preserve the game palette. */
#turn-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
#turn-actions button{min-height:44px;padding:10px 16px;font-weight:700}
#turn-actions .swap-button{background:#f1e2bd;color:#12382d;border:1px solid #12382d}
.turn-strip:has(#turn-actions:not([hidden])){align-items:flex-start}
.turn-strip:has(#turn-actions:not([hidden])) .turn-icon{margin-top:2px}

/* First-play nudge: the hand is below the orange panel only in the stacked layout. */
.first-tile-arrow{display:none;pointer-events:none;flex:0 0 52px;width:52px;height:60px;margin-inline:auto}
.first-tile-arrow svg{display:block;width:100%;height:100%;overflow:visible}
.arrow-shadow{fill:#102a3130}
.arrow-body{fill:var(--accent);stroke:#173a32;stroke-width:3;stroke-linejoin:round}
.arrow-motion{fill:none;stroke:#173a32;stroke-width:2.5;stroke-linecap:round}
.arrow-highlight{fill:none;stroke:#eff9f0;stroke-width:3;stroke-linecap:round}
@media(max-width:900px){.first-tile-arrow{display:block}}
@media(max-width:380px){.first-tile-arrow{flex-basis:40px;width:40px;height:50px}}
