:root{--ink:#18344d;--muted:#6a7d8a;--accent:#226dc0;--light:#f4f1df;--dark:#7c9ab1;--paper:#f3f6fa;--border:#dbe4eb;--turn:#1764b0;--face:0deg}*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font:16px/1.45 system-ui,-apple-system,Segoe UI,sans-serif;-webkit-tap-highlight-color:transparent}body[data-theme=forest]{--accent:#267d59;--dark:#85a68b;--turn:#236e4c}body[data-theme=sunshine]{--accent:#9a6020;--dark:#ccab72;--turn:#8c5720}button,input,select{font:inherit}button,a{touch-action:manipulation}button{min-height:46px;padding:10px 15px;border:1px solid var(--border);background:white;color:var(--ink);border-radius:13px;font-weight:650;cursor:pointer}button:disabled{opacity:.35;cursor:default}button:focus-visible,a:focus-visible{outline:3px solid #efb635;outline-offset:2px}input,select{min-height:46px;width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:12px;background:white;color:var(--ink)}input:focus,select:focus{outline:2px solid var(--accent);outline-offset:2px}input[type=checkbox]{width:22px;height:22px;min-height:22px;accent-color:var(--accent)}main{max-width:730px;margin:auto;padding:20px 18px 26px}.app-header{display:flex;align-items:center;gap:12px}.brand-mark{background:#132b47;color:white;border-radius:17px;width:54px;height:54px;display:grid;place-items:center;font-size:43px}.app-header small,.eyebrow{font-size:11px;letter-spacing:2px;font-weight:750;color:#647b8d}h1{font-size:30px;letter-spacing:-1px;margin:0}.round{margin-left:auto;border-radius:50%;padding:0;width:46px}.welcome p{color:var(--muted);font-size:14px;margin:18px 0}.online-entry{display:block;background:#e7eff8;border:1px solid #cdddeb;color:var(--accent);padding:14px 16px;text-decoration:none;border-radius:14px;font-weight:750;margin:16px 0;font-size:15px}.online-entry span{display:block;font-size:12px;font-weight:500;margin-top:3px}.arena{width:100%;max-width:680px;margin:0 auto;background:#fff;padding:10px;border-radius:22px;box-shadow:0 16px 48px #1b3a5014;border:1px solid #dce5eb}.seat{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px;border-radius:13px;transition:background .25s,color .25s;min-height:66px}.seat.active{background:var(--turn);color:#fff;box-shadow:0 3px 12px #1358a126}.seat-person{display:flex;gap:10px;align-items:center;min-width:0}.seat-piece{width:30px;height:30px;border-radius:10px;background:#dce5eb;display:grid;place-items:center;flex-shrink:0}.seat-piece img{width:29px;height:29px}.seat-name{display:block;font-size:17px;overflow-wrap:anywhere;line-height:1.2}.seat-status{display:block;font-size:12px;opacity:.8;margin-top:3px}.seat-actions{display:flex;gap:7px;flex-shrink:0}.seat-actions button{width:42px;min-height:42px;padding:0;border:0;background:#e9eef4;color:#284a64;font-size:23px;border-radius:11px}.seat.active .seat-actions button{background:#ffffff22;color:white}.board-wrap{position:relative;margin:9px 0}#board{display:grid;grid-template-columns:repeat(8,1fr);aspect-ratio:1;width:100%;border:2px solid #3c5971;border-radius:7px;overflow:hidden}.square{position:relative;display:grid;place-items:center;min-width:0;min-height:0;aspect-ratio:1;padding:0;border:0;border-radius:0;background:var(--light);isolation:isolate}.square.dark{background:var(--dark)}.piece{width:86%;height:86%;pointer-events:none;z-index:1;transform:rotate(var(--face));transition:transform .42s cubic-bezier(.2,.65,.3,1);filter:drop-shadow(0 2px 1px #142d3526)}.square.selected{background:#f2d77b}.square.legal:after{content:'';position:absolute;inset:3px;border:4px solid #078b41;border-radius:5px;pointer-events:none;z-index:3}.square.capture:after{border-color:#eb7814}.square.last:before{content:'';position:absolute;inset:2px;border:2px solid #287dac88;background:#58b8dc26;border-radius:4px}.square.check{background:#f19b8a}.coord{position:absolute;left:3px;top:1px;font-size:10px;color:#223f54;z-index:2;pointer-events:none;transform:rotate(var(--face));transition:transform .42s}.quick-controls{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:15px}.quick-controls label{display:flex;gap:6px;align-items:center;font-size:13px}.quick-controls button{font-size:13px;padding:8px 11px}.primary{background:var(--accent);border-color:var(--accent);color:white}.table-note{text-align:center;color:var(--muted);font-size:12px;margin:14px 0 0}.tabletop{background:#122a42}.tabletop main{padding:8px max(8px,env(safe-area-inset-right)) 8px max(8px,env(safe-area-inset-left));max-width:none;height:100vh;height:100svh;display:flex;align-items:center;justify-content:center}.tabletop .app-header,.tabletop .welcome,.tabletop .quick-controls,.tabletop .table-note{display:none}.tabletop .arena{width:min(calc(100vw - 16px),calc(100svh - 170px),740px);padding:8px;border-radius:20px;background:#edf2f7;box-shadow:0 14px 60px #0003}.tabletop .top-seat{transform:rotate(180deg)}.tabletop .seat{min-height:58px;padding:7px 10px}.tabletop .seat-name{font-size:16px}.tabletop .board-wrap{margin:7px 0}.tabletop .seat-status{font-size:12px}.tabletop .seat-actions button{min-height:42px}.top-seat{margin-bottom:0}dialog{width:min(490px,94vw);max-height:90vh;max-height:90svh;border:0;padding:28px;border-radius:24px;color:var(--ink);box-shadow:0 25px 100px #071d5266;background:#fbfcff;overflow:auto}dialog::backdrop{background:#102841a8;backdrop-filter:blur(4px)}dialog.from-top{transform:rotate(180deg)}dialog h2{font-size:27px;letter-spacing:-.6px;margin:4px 25px 18px 0;line-height:1.2}dialog p{font-size:14px;color:var(--muted);line-height:1.65}.close{position:absolute;right:12px;top:12px;border:0;min-height:38px;width:38px;padding:0;font-size:25px;background:transparent}.settings-grid,.name-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.settings-grid label:first-child{grid-column:1/-1}dialog label{display:block;font-size:13px;font-weight:650}dialog label>input,dialog label>select{margin-top:6px}.name-grid{margin:16px 0}.preference{padding:12px 0;border-top:1px solid var(--border);border-bottom:1px solid var(--border)}.preference label{display:flex;align-items:center;gap:11px;min-height:47px;font-size:14px}.preference input{margin:0;flex-shrink:0}.preference small{display:block;font-size:11px;font-weight:400;color:var(--muted);margin-top:2px}.theme-label{margin:14px 0}.dialog-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}.dialog-actions button{flex:1;font-size:14px}.text-button{border:0;background:transparent;color:var(--accent);padding-left:0;font-size:14px}.fine{font-size:11px!important}details{margin-top:8px;font-size:14px}summary{cursor:pointer;min-height:36px;padding:7px 0}#promotionChoices{display:flex;gap:7px}#promotionChoices button{flex:1;padding:7px}#promotionChoices img{width:100%}.result-star{display:block;font-size:65px;color:#e8a91d;margin-bottom:10px}#resultDialog{text-align:center}#resultDialog h2{margin-right:0}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.flying-piece{position:fixed;z-index:50;pointer-events:none;filter:drop-shadow(0 4px 3px #0002)}.confetti{position:absolute;width:7px;height:12px;top:0;border-radius:2px;animation:celebrate 1.2s ease-out forwards;pointer-events:none}@keyframes celebrate{0%{transform:translateY(0) rotate(0);opacity:1}100%{transform:translateY(260px) rotate(400deg);opacity:0}}.no-motion .piece,.no-motion .coord{transition:none}.compat-message{margin:15px;padding:20px;background:#fff0c9;border-radius:12px}[hidden]{display:none!important}@media(max-width:360px){.seat-name{font-size:14px!important}.seat-status{font-size:10px!important}.seat-actions{gap:4px}.seat-actions button{width:37px;min-height:37px!important}.seat{padding:6px!important;gap:6px}.seat-person{gap:6px}.seat-piece{width:25px}.seat-piece img{width:25px}dialog{padding:22px}.square.legal:after{border-width:3px;inset:2px}.coord{font-size:8px}.quick-controls{flex-wrap:wrap}}@media(orientation:landscape) and (max-height:500px){.tabletop .arena{width:min(calc(100svh - 140px),740px)}.tabletop .seat{min-height:47px;padding:3px 8px}.tabletop .seat-piece{display:none}.tabletop .seat-status{font-size:10px}.tabletop .seat-name{font-size:13px}.tabletop .seat-actions button{width:35px;min-height:35px}.tabletop .board-wrap{margin:4px 0}}@media(prefers-reduced-motion:reduce){.piece,.coord,.seat{transition:none!important}.confetti{animation:none!important}}

/* A complete play surface at every size. Settings scroll independently. */
html,body{height:100%;overflow:hidden;overscroll-behavior:none}body{background:radial-gradient(ellipse at top,#e4eef7,var(--paper) 70%)}main{height:var(--screen-height,100svh);max-width:100%;padding:12px max(12px,env(safe-area-inset-right)) 12px max(12px,env(safe-area-inset-left));display:flex;flex-direction:column;align-items:center;gap:10px;overflow:hidden}.app-header{width:min(100%,758px);min-height:44px;flex-shrink:0}.brand-mark{width:44px;height:44px;font-size:35px;border-radius:14px}h1{font-size:24px}.app-header small{font-size:9px}.welcome{width:min(100%,758px);display:flex;align-items:center;justify-content:space-between;gap:10px;flex-shrink:0}.welcome p{font-size:12px;margin:0;max-width:290px}.offline-badge{display:block;color:#23724b;font-weight:750}.welcome .online-entry{margin:0;padding:9px 12px;font-size:12px;min-height:42px;display:flex;align-items:center}.arena{margin:auto 0;flex-shrink:0;max-width:758px;padding:8px;box-shadow:0 10px 35px #17375018}.seat{min-height:58px;padding:7px 10px}.board-wrap{margin:7px 0}.seat-name{font-size:16px}.quick-controls{width:min(100%,758px);margin:0;flex-shrink:0}.quick-controls button{min-height:44px}.quick-controls label{min-height:44px}.table-note{display:none}.tabletop main{height:var(--screen-height,100svh);flex-direction:column;gap:0;padding-top:8px;padding-bottom:8px}.tabletop .arena{max-width:758px;margin:auto 0}.seat-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:44vw}.seat-person>div{min-width:0}.seat-status{line-height:1.3;max-width:40ch}dialog{overscroll-behavior:contain;max-height:calc(var(--screen-height,100svh) - 24px);scrollbar-width:thin;-webkit-overflow-scrolling:touch}#promotionChoices{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}#promotionChoices button{display:flex;flex-direction:column;align-items:center;gap:4px;padding:8px 3px;font-size:12px;min-width:0}#promotionChoices img{width:100%;max-width:85px;aspect-ratio:1}#promotionChoices span{display:block}#promotion p{font-size:14px}.square{touch-action:manipulation}
@media(max-width:400px){main{padding:8px;gap:6px}.welcome p{font-size:10px}.welcome .online-entry{font-size:11px;padding:7px 9px}.quick-controls{gap:5px;flex-wrap:nowrap}.quick-controls button{font-size:11px;padding:6px 8px}.quick-controls label{font-size:11px}.app-header{min-height:40px}.brand-mark{height:40px;width:40px}h1{font-size:22px}}
@media(min-aspect-ratio:6/5) and (max-height:700px){body:not(.tabletop) main{display:grid;grid-template-columns:200px minmax(0,1fr);grid-template-rows:auto 1fr auto;gap:12px 16px;padding:10px 16px}body:not(.tabletop) .app-header{grid-column:1;grid-row:1}body:not(.tabletop) .welcome{grid-column:1;grid-row:2;flex-direction:column;align-self:start;align-items:stretch;gap:16px}body:not(.tabletop) .arena{grid-column:2;grid-row:1/4;justify-self:center;margin:0}body:not(.tabletop) .quick-controls{grid-column:1;grid-row:3;flex-wrap:wrap;justify-content:start}body:not(.tabletop) .quick-controls label{width:100%}.seat-status{font-size:10px}.seat-name{font-size:13px}.seat{min-height:47px;padding:3px 8px}.seat-piece{display:none}.board-wrap{margin:4px 0}.seat-actions button{width:38px;min-height:38px}.seat-person{min-width:0}.seat-name{max-width:20vw}}

#startScreen{display:none}.choosing-game{background:radial-gradient(ellipse at top left,#dceaf7,#f5f7fb 65%)}.choosing-game main{display:none!important}.choosing-game #startScreen{display:block;position:fixed;inset:0;overflow-y:auto;padding:clamp(20px,5vw,64px);max-height:100%;overscroll-behavior:contain}.start-brand{display:flex;gap:12px;align-items:center;font-size:25px;font-weight:800;max-width:970px;margin:0 auto 32px}.start-brand small{display:block;font-size:9px;letter-spacing:2px;color:var(--muted);margin-top:2px}#startScreen>h1,#startScreen>.start-intro,#startScreen>.start-footnote{max-width:970px;margin-left:auto;margin-right:auto}#startScreen>h1{font-size:clamp(25px,4vw,38px);line-height:1.15}.start-intro{color:var(--muted);margin-top:10px;margin-bottom:25px}.mode-cards{max-width:970px;margin:auto;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.mode-card{display:flex;flex-direction:column;padding:24px;border-radius:22px;background:#fff;border:1px solid #d8e3ed;box-shadow:0 8px 25px #23395109;gap:10px}.mode-card h2{font-size:20px;margin:0}.mode-card p{font-size:14px;color:var(--muted);margin:0 0 8px;line-height:1.55}.mode-icon{font-size:34px;color:var(--accent);height:48px}.mode-card label{font-size:12px;font-weight:700}.mode-card button,.start-online{margin-top:auto;min-height:48px;font-size:14px}.mode-card select{margin-bottom:8px}.start-online{display:flex;align-items:center;justify-content:center;text-decoration:none;color:var(--accent);background:#e8f0f9;border:1px solid #cfdfee;border-radius:13px;font-weight:700;padding:10px}.start-footnote{font-size:12px;color:var(--muted);margin-top:24px}.resume-game{display:flex;justify-content:space-between;align-items:center;gap:10px;width:100%;max-width:970px;margin:0 auto 20px;padding:16px 20px;background:#e4f2ea;border-color:#b6d8c5;color:#246044;text-align:left}.resume-game small{font-weight:400}.recommended{outline:2px solid var(--accent)}
@media(max-width:700px){.mode-cards{grid-template-columns:1fr}.mode-card{padding:18px;gap:7px}.mode-icon{display:none}.mode-card p{margin-bottom:3px}.start-brand{margin-bottom:22px}.resume-game{align-items:start;flex-direction:column}.choosing-game #startScreen{padding:22px 16px}.start-intro{font-size:14px}.mode-card h2{font-size:19px}}

.start-links{max-width:970px;margin:22px auto;display:flex;gap:14px;align-items:center;flex-wrap:wrap}.start-links a{color:var(--accent);font-weight:750}.start-links span{font-size:12px;color:var(--muted)}.seat-actions{gap:4px}.seat-actions button{width:36px}.seat-name{max-width:36vw}.app-header .round{margin-left:0}.app-header .round:first-of-type{margin-left:auto}

.seat{flex-wrap:wrap;row-gap:3px}.seat-details{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:23px}.taken{display:flex;align-items:center;gap:4px;font-size:10px;opacity:.9;min-width:0}.taken>span{display:inline-flex;align-items:center;gap:1px}.taken img{width:19px;height:19px}.taken small{font-size:10px}.think-time{font-variant-numeric:tabular-nums;font-weight:750;font-size:14px;white-space:nowrap;background:#dbe5ef;padding:1px 7px;border-radius:7px;color:#244762}.seat.active .think-time{background:#ffffff2b;color:white}.think-time.ticking:before{content:"● ";font-size:9px}@media(max-width:360px){.taken img{width:16px;height:16px}.taken{gap:2px;font-size:9px}.think-time{font-size:12px}}

.taken{white-space:nowrap;overflow:hidden}.seat-details .taken{flex:1}.think-time{flex-shrink:0}
@media(orientation:landscape) and (max-height:500px){.tabletop .seat{padding:3px 4px;gap:2px;min-height:0}.tabletop .seat-person{max-width:calc(100% - 100px)}.tabletop .seat-name{font-size:11px!important;max-width:100%}.tabletop .seat-status{display:none}.tabletop .seat-actions button{width:30px;min-height:30px!important}.tabletop .seat-details{min-height:19px}.tabletop .think-time{font-size:11px}.tabletop .taken{font-size:8px}.tabletop .taken img{width:15px;height:15px}}

.square.tutor-square{box-shadow:inset 0 0 0 4px #c28b16!important}.tip-button{font-size:12px!important;font-weight:800;padding:4px!important;min-width:32px}#tipReasons p{line-height:1.5}#tipReply{padding:12px;border-radius:12px;background:#e9f0f7}#tipDialog{max-height:88dvh;overflow:auto}
