/* CrossField Shogi — a quiet indigo room, warm wooden board, vermilion match action. */
:root{--ink:#101b2a;--panel:#1a2a3d;--raised:#26374d;--gold:#dabd83;--gold-edge:#9e824f;--text:#f4ecdc;--muted:#b5c2d3;--line:#52647b;--serif:"Yu Mincho","Noto Serif JP","Hiragino Mincho ProN",serif;font-family:system-ui,-apple-system,"Noto Sans JP",sans-serif;color:var(--text);background:var(--ink);font-synthesis:weight}
*{box-sizing:border-box}body{margin:0;min-height:100vh;background:radial-gradient(ellipse at 50% 0,#283b50,var(--ink) 72%)}
main{max-width:620px;margin:auto;padding:max(18px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(26px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
[hidden]{display:none!important}p{line-height:1.7}h1,h2{font-family:var(--serif)}h1{font-size:25px}h2{font-size:19px}a{color:inherit}button{font:inherit;color:var(--text);background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:12px;min-height:44px;min-width:0;cursor:pointer;touch-action:manipulation}button:disabled{opacity:.45;cursor:default}button:focus-visible,a:focus-visible{outline:3px solid #f0cd85;outline-offset:3px}button[aria-pressed=true]{background:var(--raised);border:2px solid var(--gold)}small{display:block;font-size:10px;font-weight:400}button:active:not(:disabled){filter:brightness(1.08)}
header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-bottom:13px;border-bottom:1px solid #dabd8345}#brand{font-family:var(--serif);font-size:25px;font-weight:750;letter-spacing:.13em;text-decoration:none}#brand span{font-family:system-ui,sans-serif;font-size:9px;font-weight:400;letter-spacing:.1em;color:var(--gold);display:block;margin-top:4px}.header-tools{display:flex;align-items:center;justify-content:flex-end;gap:8px;min-width:0}#engine-status{max-width:145px;font-size:10px;text-align:right;line-height:1.6;color:var(--muted)}#sound-toggle{min-height:44px;min-width:44px;padding:7px 9px;font-size:10px;border-radius:20px;background:transparent;color:var(--muted)}#sound-toggle[aria-pressed=true]{color:var(--gold);border-color:var(--gold)}
.note{font-size:11px;color:var(--muted)}.eyebrow{color:var(--gold);letter-spacing:.14em;font-size:11px}#error,#storage-error{padding:13px;background:#f4ded3;color:#702b1d;border-radius:6px;overflow-wrap:anywhere}#retry{width:100%;margin-bottom:12px}.primary{color:#172435;background:var(--gold);border-color:#efd6a3;border-bottom:3px solid var(--gold-edge);font-weight:750;min-height:54px;box-shadow:0 4px 12px #0003}
/* Home: one illustrated stage, real saved-play destinations. */
#home-menu{position:relative;isolation:isolate;min-height:530px;padding:24px 18px 18px;margin-top:16px;overflow:hidden;border:1px solid #ae945e;border-radius:8px;background:#17243b;box-shadow:0 10px 24px #0003}.home-menu-actions{display:grid;gap:12px;padding-top:214px}.home-menu-actions>button{width:100%;position:relative}.home-menu-actions>button span{display:block}.home-menu-actions>button b{display:none}#new-match{min-height:88px;text-align:center;color:#fff0d8;background:linear-gradient(#a74536,#7d2b24);border:1px solid #e3b478;border-bottom:4px solid #541d1a;box-shadow:0 5px 18px #0006,inset 0 1px #e4a779;padding:14px 18px}#new-match span{font-family:var(--serif);font-size:28px;letter-spacing:.1em;font-weight:750}#new-match small{color:#f3d9bf;font-size:10px;margin-top:5px;letter-spacing:.05em}#resume{min-height:54px;background:#ead4a1;color:#25334a;border:1px solid #f1deb6;border-left:4px solid #aa7832;font-size:14px;font-weight:650;text-align:center;box-shadow:0 4px 12px #0003}.home-menu-actions:has(#resume:not([hidden])) #resume{order:0}.home-menu-actions:has(#resume:not([hidden])) #new-match{order:1}.home-menu-actions:has(#resume:not([hidden])) .menu-secondary{order:2}.menu-secondary{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;margin-top:6px}#open-history,.menu-help{min-height:70px;padding:12px 6px;text-align:center;background:#17283ce8;border:1px solid #b39660;border-radius:6px;color:#efdbb3;display:flex;flex-direction:column;justify-content:center;text-decoration:none;box-shadow:0 3px 10px #0003}#open-history span,.menu-help span{font-family:var(--serif);font-size:17px;font-weight:650;line-height:1.4}#open-history small,.menu-help small{font-size:10px;color:#c7d2e1;line-height:1.4;margin-top:6px}.home-save-note{text-align:center;font-size:10px;margin:18px 0 0;color:#c1ccdb}
/* Preparation and records. */
.home-subheading{display:flex;align-items:center;gap:15px;margin:22px 0}.home-subheading button{min-width:58px;background:transparent}.home-subheading h1{font-size:23px;margin:0}.match-setup{background:#18283c;border:1px solid #576980;border-radius:8px;padding:22px 16px;box-shadow:0 5px 16px #0002}fieldset{padding:0;border:0;margin:0 0 24px}legend{font-size:12px;letter-spacing:.06em;color:#d1dce9;margin-bottom:10px}.choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}.choices button{position:relative;padding:10px 5px;font-size:14px;font-weight:650;min-height:94px;background:#22354a;border-color:#687c94}.choices button small{color:#c0cbda;margin-top:5px}.choices button[aria-pressed=true]{background:#324457;border-color:#e1c38d;box-shadow:inset 0 -3px #dfbf7d}.choices button[aria-pressed=true]:after{content:"✓";position:absolute;right:6px;top:3px;font-size:11px;color:#f0d299}.level-emblem{display:flex;justify-content:center;align-items:flex-end;gap:3px;height:20px;margin:0 0 7px}.level-emblem i{display:block;width:13px;height:18px;background:#97a9c0;clip-path:polygon(50% 0,83% 19%,100% 100%,0 100%,17% 19%)}button[aria-pressed=true] .level-emblem i{background:var(--gold)}.sides{grid-template-columns:repeat(2,minmax(0,1fr))}.sides button{min-height:48px}#start{width:100%;font-size:16px;letter-spacing:.04em}.match-setup .note{margin:16px 0 0}.history{background:#17283b;border:1px solid #435c77;border-radius:7px;padding:15px 12px}.history button{display:block;width:100%;min-height:56px;text-align:left;background:#22364c;border-color:#62788f;font-size:12px;line-height:1.6;margin-bottom:8px;overflow-wrap:anywhere}.history button:last-child{margin-bottom:0}.history .note{margin:0}
/* Play: the board takes priority over its surrounding information. */
body[data-view=game] main,body[data-view=replay] main{padding:max(8px,env(safe-area-inset-top)) max(6px,env(safe-area-inset-right)) max(14px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left))}body[data-view=game] header,body[data-view=replay] header{padding:0 0 8px}body[data-view=game] #brand,body[data-view=replay] #brand{font-size:20px}body[data-view=game] #brand span,body[data-view=replay] #brand span{font-size:8px;margin-top:1px}.game-heading{display:flex;align-items:center;justify-content:space-between;gap:6px;margin-top:7px}.game-heading button{min-height:44px;padding:7px 9px;font-size:12px;background:#1c2d42}.opponent-heading{flex:1;min-width:0;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:4px}.game-heading h1{font-family:system-ui,sans-serif;font-size:15px;font-weight:750;margin:0}.level-badge{color:#ead6b2;border:1px solid #a58d5c;border-radius:12px;padding:2px 6px;font-size:9px;line-height:1.5}.level-badge:empty{display:none}#move-count{font-size:12px;color:#e5d1a7;white-space:nowrap;font-variant-numeric:tabular-nums}#undo{color:#eed6a7;border-color:#af945d}body[data-view=replay] #undo{display:none}#turn{font-size:13px;font-weight:650;min-height:30px;padding:4px 8px;text-align:center;color:#f6eedf;background:#22364b;border:1px solid #55748c;border-radius:5px;line-height:1.6;margin:5px 0 3px}.board-wrap{width:100%;max-width:510px;min-width:0;margin:auto}.player-band{display:inline-block;margin:3px 0 0;padding:3px 9px;border-radius:3px;background:#894b3e;color:#fff3e9;font-size:11px;font-weight:750;line-height:1.4}#player-label{background:#2c5d80;margin:0 0 3px}.hand .label{display:none}.hand .note{font-size:12px;color:#4b381c}.hand button{min-height:44px;min-width:44px;padding:5px 7px;border:1px solid #987341;background:#fff1d1;color:#201507;font-size:23px;font-weight:850;border-radius:3px;box-shadow:0 1px 1px #6a452533}.hand button small{display:inline;font-size:12px;font-weight:650;margin-left:3px}.hand button.selected{outline:3px solid #17486b;outline-offset:-3px;background:#e3edf2}.board-files,.board-ranks{display:none}.board-grid{display:grid;grid-template-columns:minmax(0,1fr)}

#board button{display:flex;align-items:center;justify-content:center;height:100%;min-height:0;min-width:0;border:0;border-right:1px solid #906b36;border-bottom:1px solid #906b36;border-radius:0;background:transparent;padding:0;line-height:1;font-size:clamp(15px,4.6vw,23px);font-weight:850;color:#201307;opacity:1;position:relative;touch-action:manipulation;overflow:visible}#board button:nth-child(9n){border-right:0}#board button:nth-child(n+73){border-bottom:0}#board .single-character{font-size:1.35em;padding-top:5%}#board .opponent .piece{transform:rotate(180deg)}#board .promoted .piece{color:#a21e14;text-shadow:0 .3px #a21e14}
#board:after{content:"";position:absolute;inset:0;z-index:2;pointer-events:none;background-image:radial-gradient(circle at 33.333333% 33.333333%,#24180c 0 2.4px,transparent 2.8px),radial-gradient(circle at 66.666667% 33.333333%,#24180c 0 2.4px,transparent 2.8px),radial-gradient(circle at 33.333333% 66.666667%,#24180c 0 2.4px,transparent 2.8px),radial-gradient(circle at 66.666667% 66.666667%,#24180c 0 2.4px,transparent 2.8px)}

.actions{display:flex;justify-content:center;gap:8px;margin:8px 0}.actions button{min-height:44px;font-size:12px}#resign{flex:none;min-width:110px;padding:9px 20px;color:#dfd5ca}#last-move{text-align:center;font-size:10px;color:#c2cddd;overflow-wrap:anywhere;margin:3px 0}#replay-actions{display:grid;grid-template-columns:minmax(0,.7fr) minmax(0,1fr) auto minmax(0,1fr) minmax(0,.7fr);align-items:center;gap:5px}#replay-actions button{padding:9px 3px}#replay-first,#replay-last{color:var(--gold)}#replay-count{text-align:center;font-size:11px;white-space:nowrap;min-width:32px}
/* Results, promotion, information pages. */
.result-panel{margin:20px 0;padding:22px 18px;background:#1c2e42;border:1px solid var(--gold);border-radius:8px;text-align:center;box-shadow:0 8px 24px #0003}.result-panel .eyebrow{margin:0 0 8px}#result-title{font-size:25px;line-height:1.5;margin:8px 0}#result-detail{font-size:13px;color:var(--muted);line-height:1.7;overflow-wrap:anywhere}.result-actions{display:grid;grid-template-columns:minmax(0,1fr);gap:9px;margin-top:16px}.result-actions button{width:100%}#result-replay{color:var(--gold);border-color:var(--gold)}dialog.promotion{position:fixed;z-index:3;left:50%;top:45%;transform:translate(-50%,-50%);margin:0;width:min(90vw,340px);padding:20px;background:#1c2e42;color:var(--text);border:2px solid var(--gold);border-radius:8px;text-align:center;box-shadow:0 16px 60px #0008}dialog.promotion:not([open]){display:none}dialog.promotion::backdrop{background:#050c1bcc}dialog.promotion p{font-family:var(--serif);font-size:20px}dialog.promotion button{margin:4px}#promote{background:var(--gold);color:#172435;border-color:var(--gold)}.info-nav{display:flex;flex-wrap:wrap;gap:12px 20px;border-top:1px solid #dabd8345;margin-top:24px;padding-top:14px;font-size:12px}.info-nav a{color:var(--muted);padding:8px 0;text-underline-offset:3px}.info-page h1{margin-top:28px}.info-page h2{color:var(--gold);margin-top:28px}.info-page p{font-size:15px;color:var(--muted);overflow-wrap:anywhere}body[data-view=game] .info-nav,body[data-view=replay] .info-nav{margin-top:9px;padding-top:6px;font-size:12px}
@keyframes shogi-arrival{0%{background-color:#f9efbb;box-shadow:inset 0 0 0 4px #b88724}100%{box-shadow:inset 0 0 0 3px #99691e}}@media(prefers-reduced-motion:no-preference){#board .moving{animation:shogi-arrival 180ms ease-out}button{transition:background-color .15s,border-color .15s}}
@media(max-width:360px){main{padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}.header-tools{gap:5px}#engine-status{max-width:125px;font-size:9px}#home-menu{min-height:500px;padding:20px 13px 16px}.home-menu-actions{padding-top:195px;gap:10px}#new-match{min-height:82px}.menu-secondary{gap:8px}#open-history small,.menu-help small{font-size:9px}.match-setup{padding:18px 12px}.choices{gap:5px}.choices button{font-size:13px;min-height:90px}.home-subheading h1{font-size:20px}.game-heading{gap:4px}.game-heading h1{font-size:13px}.game-heading button{padding:7px 6px;font-size:11px}.level-badge{font-size:8px;padding:2px 4px}#board button{font-size:15px}#turn{font-size:12px}#replay-actions{gap:3px}#replay-actions button{font-size:10px}}/* Frame the actual king on the left, rather than enlarging a landscape into a portrait. */






body[data-view=game] #opponent-level{display:none}
body[data-view=game] #brand span,body[data-view=replay] #brand span{color:#a3b2c3}
body[data-view=game] #engine-status,body[data-view=replay] #engine-status{color:#b9c8d8}
@media(max-width:360px){}
/* Title, personal play menu, and a native preparation dialog. */
#home-menu{min-height:475px}.mypage-heading{margin:24px 0 20px}.mypage-heading .eyebrow{font-size:10px;margin:0 0 7px;letter-spacing:.18em}.mypage-heading h1{font-size:29px;margin:0 0 8px}.mypage-heading>p:last-child{font-size:12px;color:var(--muted);margin:0}.mypage-play{display:flex;align-items:center;gap:17px;padding:16px;background:#1c2d41;border:1px solid #a68d5b;border-bottom:0;border-radius:7px 7px 0 0}.mypage-piece{display:flex;align-items:center;justify-content:center;font-family:var(--serif);font-size:31px;color:#35220b;clip-path:polygon(50% 0,85% 20%,100% 100%,0 100%,15% 20%);width:48px;height:58px;flex:none;background:linear-gradient(100deg,#e9c484,#f4dca7);padding-top:5px}.mypage-play h2{font-size:22px;margin:0 0 5px;color:#eed6a6}.mypage-play p{font-size:11px;margin:0;color:var(--muted)}#home-mypage #new-match{min-height:66px}#home-mypage #new-match span{font-size:21px}
dialog#home-setup{color:var(--text);background:#162538;border:1px solid var(--gold);border-radius:9px;width:min(94vw,490px);max-height:90dvh;overflow-y:auto;margin:auto;padding:15px;box-shadow:0 16px 60px #0009}dialog#home-setup:not([open]){display:none}dialog#home-setup::backdrop{background:#070e1bc9}dialog#home-setup .home-subheading{margin:0 0 18px;gap:12px}dialog#home-setup .home-subheading h1{font-size:23px}dialog#home-setup .match-setup{padding:18px 13px}dialog#home-setup fieldset{margin-bottom:20px}dialog#home-setup .choices button{min-height:88px}dialog#home-setup .sides button{min-height:46px}dialog#home-setup #start{font-size:15px}
@media(max-width:360px){#home-menu{min-height:440px}.mypage-heading h1{font-size:26px}.mypage-play{padding:14px;gap:13px}dialog#home-setup{padding:12px}dialog#home-setup .match-setup{padding:15px 10px}dialog#home-setup .home-subheading h1{font-size:21px}dialog#home-setup .choices button{font-size:12px}}
/* A full-screen game title; the transition note does not claim loading progress. */
body[data-home-panel=menu]{background:#0b1625}
body[data-home-panel=menu] main{width:100%;max-width:none;margin:0;padding:0}
body[data-home-panel=menu] header,body[data-home-panel=menu] .info-nav,body[data-home-panel=menu] #error,body[data-home-panel=menu] #retry,body[data-home-panel=menu] #storage-error{display:none}
.setup-readiness{margin:0 0 16px;padding:12px;border:1px solid #576980;border-radius:6px;background:#22354a;font-size:12px;line-height:1.6}.setup-readiness p{margin:0}.setup-readiness #setup-error{margin-top:8px;color:#ffd2bf;overflow-wrap:anywhere}.setup-readiness #setup-retry{width:100%;margin-top:10px}
body[data-home-panel=menu] #home-menu{position:relative;width:100%;height:100svh;min-height:100svh;margin:0;padding:0;border:0;border-radius:0;box-shadow:none;overflow:hidden;background:#0b1625;isolation:isolate}
.title-keyart{display:block;width:100%;height:100%;object-fit:cover;object-position:center 58%;position:absolute;inset:0;z-index:-2}
body[data-home-panel=menu] #home-menu:after{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(#07132170 0,transparent 35%,transparent 72%,#071321b8);pointer-events:none}
.title-logo{position:absolute;top:max(8svh,env(safe-area-inset-top));left:0;right:0;padding:0 20px;text-align:center;color:#f4e0b7}
.title-logo h1{font-family:var(--serif);font-weight:850;font-size:clamp(58px,18vw,96px);line-height:1.2;letter-spacing:.18em;padding-left:.18em;margin:0;text-shadow:0 3px 1px #715124,0 8px 24px #0008}

.title-transition{position:absolute;bottom:max(24px,env(safe-area-inset-bottom));left:0;right:0;text-align:center;padding:0 16px;font-size:11px;letter-spacing:.06em;color:#e4e8ee;line-height:1.7;margin:0;text-shadow:0 1px 8px #000}
@media(min-aspect-ratio:3 / 4){body[data-home-panel=menu] #home-menu{max-width:min(100vw,calc(100svh * 9 / 16));margin:auto}.title-keyart{object-fit:cover}.title-logo h1{font-size:clamp(52px,10svh,86px)}}
@media(prefers-reduced-motion:no-preference){.title-logo{animation:title-reveal 420ms ease-out both}@keyframes title-reveal{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}}
/* Bright adventure title: lettering is fully visible from the first frame. */

body[data-home-panel=menu] #home-menu:after{background:linear-gradient(#15396535 0,transparent 32%,transparent 76%,#092546b0)}
@keyframes title-reveal{from{transform:translateY(4px)}to{transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){.title-logo{animation:none}}
/* An original game wordmark with rounded weight and warm carved edges. */
.title-logo{top:max(7svh,env(safe-area-inset-top));color:#fff1c0;opacity:1}
.title-logo h1{font-family:"Hiragino Maru Gothic ProN","Yu Gothic","Noto Sans JP",sans-serif;font-weight:950;font-size:clamp(62px,19vw,100px);line-height:1.16;letter-spacing:.08em;padding-left:.08em;color:#fff1c0;-webkit-text-stroke:1px #684820;paint-order:stroke fill;text-shadow:0 2px 0 #e4b35f,0 4px 0 #b48137,0 6px 0 #715022,0 9px 0 #3a371f,0 13px 18px #18430380}
.title-wordmark{display:block;font-family:Georgia,serif;font-size:12px;font-weight:750;letter-spacing:.36em;padding-left:.36em;color:#fff3ce;margin-top:12px;text-shadow:0 2px 4px #204663}

@media(min-aspect-ratio:3 / 4){.title-logo h1{font-size:clamp(58px,10svh,88px)}}
/* Compact match room. States decorate existing controls without invented metrics. */
body[data-view=game] header,body[data-view=replay] header{padding-bottom:5px;border-bottom-color:#dabd8330}body[data-view=game] #brand span,body[data-view=replay] #brand span{display:none}body[data-view=game] #brand,body[data-view=replay] #brand{font-size:19px;letter-spacing:.08em}body[data-view=game] #engine-status,body[data-view=replay] #engine-status{font-size:10px;max-width:143px;color:#b8cadc}body[data-view=game] #sound-toggle,body[data-view=replay] #sound-toggle{border-radius:5px;min-height:44px;background:#1b2e41;color:#dce7f2}
.game-heading{padding:4px 0 2px;margin-top:4px}.game-heading button{background:#1c3044;border-color:#59718b}.game-heading h1{color:#edf3fa;font-size:14px}.level-badge{background:#112336}#turn{background:#192e42;border-color:#435f78;min-height:29px;font-size:12px;line-height:1.5;margin:4px 0;padding:4px 8px}
.player-band{background:#803c32;border:1px solid #ac7661;border-left:4px solid #d79674;border-radius:3px;line-height:1.4;letter-spacing:.04em;color:#fff1e8;padding:3px 8px;min-height:23px}#player-label{background:#224e70;border:1px solid #6a91b0;border-left:4px solid #96c1df;color:#f0f8ff}
body[data-turn=player] #player-label{border-color:#b5d5eb;box-shadow:0 0 0 1px #88b6d555}body[data-turn=ai] #opponent-label{border-color:#ebbf9d;box-shadow:0 0 0 1px #d1967755}body[data-turn=ended] .player-band{box-shadow:none}
.hand{display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-height:31px;padding:3px 6px;background:#ddc295;border:1px solid #977343;border-radius:2px;margin:3px 0;color:#251b0d;border-color:#987546;background-color:#d6b781;background-image:repeating-linear-gradient(91deg,transparent 0 11px,#8363280c 11px 12px);border-top:2px solid #f1d49b;border-bottom:2px solid #8d6837;border-radius:2px;box-shadow:inset 0 1px #fff0c233;min-height:32px}.hand .note{color:#443119;font-size:11px}.hand button{background:#f2d49c;border-color:#a57b40;box-shadow:0 2px #93662f44;color:#241609;font-size:22px;font-family:var(--serif);font-weight:900}.hand button.selected{background:#e9eef0;border-color:#225479;outline-color:#225479}.hand button small{font-family:system-ui,sans-serif;color:#563918}
#board{display:grid;position:relative;grid-template-columns:repeat(9,minmax(0,1fr));grid-template-rows:repeat(9,minmax(0,1fr));aspect-ratio:590 / 640;border:2px solid #7c572b;background-color:#dfba78;background-image:repeating-linear-gradient(90deg,#e8c68a22 0 1px,transparent 1px 7px),repeating-linear-gradient(91deg,transparent 0 17px,#91622210 17px 18px);box-shadow:0 2px 0 #4d321b,0 5px 13px #0004;border-color:#725022;box-shadow:0 2px 0 #523315,0 5px 14px #0005;background-color:#dfba78}#board button{border-right-color:#916a35;border-bottom-color:#916a35}#board .piece{position:relative;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:0;width:83%;height:92%;padding:10% 0 2%;clip-path:polygon(50% 0,84% 17%,100% 100%,0 100%,16% 17%);background:linear-gradient(100deg,#efcf90,#f7dcaa 50%,#e6bb73);box-shadow:inset 0 -3px #855529;filter:drop-shadow(0 1px 1px #5d3d1e99);color:#201307;font-family:var(--serif);font-weight:900;text-shadow:0 .3px #201307;letter-spacing:0;background:linear-gradient(95deg,#eec887,#f6dca7 45%,#e7bc77);box-shadow:inset 0 1px #ffe4b8,inset 0 -3px #8a582b;filter:drop-shadow(0 1px 1px #603b1988);text-shadow:0 .35px #201307}#board .piece-line{display:block;line-height:.94;font-size:inherit;letter-spacing:0;font-weight:900}#board .last{box-shadow:inset 0 0 0 3px #99691e;box-shadow:inset 0 0 0 3px #ae751b}#board .last-from:before{content:"";position:absolute;inset:4px;border:2px dashed #674616;pointer-events:none;z-index:1;border-color:#7d5419;inset:4px}#board .target{background-color:#bbd4ba;background-color:#b4d4ba}#board .target:after{content:"";position:absolute;width:12px;height:12px;left:50%;top:50%;transform:translate(-50%,-50%);right:auto;bottom:auto;background:#f8fff8;border:2px solid #145137;border-radius:50%;z-index:2;pointer-events:none;}#board .selected{background-color:#ead99b;background-image:linear-gradient(#17486b,#17486b),linear-gradient(#17486b,#17486b),linear-gradient(#17486b,#17486b),linear-gradient(#17486b,#17486b),linear-gradient(#17486b,#17486b),linear-gradient(#17486b,#17486b),linear-gradient(#17486b,#17486b),linear-gradient(#17486b,#17486b);background-size:9px 3px,3px 9px,9px 3px,3px 9px,9px 3px,3px 9px,9px 3px,3px 9px;background-position:left 2px top 2px,left 2px top 2px,right 2px top 2px,right 2px top 2px,left 2px bottom 2px,left 2px bottom 2px,right 2px bottom 2px,right 2px bottom 2px;background-repeat:no-repeat;background-color:#ecdea6}
#game-actions{margin-top:7px}#game-actions #resign{border-color:#805c52;background:#2a2d39;color:#ecd2c5;min-height:44px}.info-nav a:focus-visible{outline-offset:1px}
#home-mypage .mypage-play{padding:15px 16px;background:#21374b;border-color:#b79d69}.mypage-play h2{letter-spacing:.07em}.mypage-play p{color:#c3cfdd}#home-mypage .home-menu-actions{padding:16px;gap:11px;border:1px solid #a68d5b;border-top:0;border-radius:0 0 7px 7px;background:#1c2d41;padding:13px;background:#182c40;box-shadow:0 7px 18px #0003}#home-mypage #new-match small{font-size:10px;color:#f3d9bf}#home-mypage #resume{box-shadow:none}
.title-logo p{font-family:var(--serif);font-size:clamp(12px,3.7vw,18px);letter-spacing:.15em;line-height:1.6;color:#f1e7d4;margin:14px 0 0;text-shadow:0 2px 10px #0009;color:#fff9e8;font-weight:750;letter-spacing:.13em;text-shadow:0 2px 2px #172c4b,0 3px 8px #172c4b,1px 0 #172c4b,-1px 0 #172c4b;margin-top:12px;font-size:clamp(12px,3.6vw,17px);color:#fff9e8;letter-spacing:.12em;font-weight:800;text-shadow:0 2px 2px #173b61,0 3px 8px #173b61,1px 0 #173b61,-1px 0 #173b61}
dialog#confirm-action{color:var(--text);background:#182d42;border:1px solid var(--gold);border-radius:8px;width:min(90vw,380px);margin:auto;padding:24px 20px;box-shadow:0 15px 55px #0008}dialog#confirm-action:not([open]){display:none}dialog#confirm-action::backdrop{background:#050e1bcb}#confirm-title{font-family:var(--serif);font-size:23px;margin:0 0 13px}#confirm-message{font-size:14px;color:#ced8e6;line-height:1.75;overflow-wrap:anywhere;margin:0 0 21px}.confirm-actions{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}.confirm-actions button{min-height:46px}.confirm-actions .primary{min-height:46px;box-shadow:none;padding:10px}
@media(max-width:360px){.game-heading h1{font-size:12px}.game-heading button{padding:7px 6px}#turn{font-size:12px}.player-band{font-size:10px}.hand button{font-size:21px}dialog#confirm-action{padding:20px 15px}#confirm-title{font-size:21px}}
/* Opponent identity card: an original wooden king emblem, no invented profile. */
.opponent-heading{position:relative;min-height:50px;padding:7px 8px 7px 30px;background:#172d43;border:1px solid #b09661;border-radius:5px;box-shadow:inset 0 1px #dcc38b22;gap:3px;}
.opponent-heading:before{content:"王";position:absolute;left:6px;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;width:20px;height:28px;padding-top:3px;clip-path:polygon(50% 0,85% 18%,100% 100%,0 100%,15% 18%);background:#e4c791;color:#35200c;font-family:var(--serif);font-size:14px;font-weight:850;line-height:1;pointer-events:none;}
.game-heading h1{font-size:14px;line-height:1.35;color:#f4e9d3;}
@media(max-width:360px){.opponent-heading{padding:6px 5px;min-height:48px;}.opponent-heading:before{display:none;}.game-heading h1{font-size:12px;}}
/* Personal lobby: the same shogi world, centred on real play and saved games. */
#home-mypage{padding-top:14px;}
#home-mypage .mypage-heading{position:relative;isolation:isolate;overflow:hidden;min-height:178px;margin:0 0 18px;padding:31px 20px;border:1px solid #b99a60;border-radius:7px;background:#1a3046;box-shadow:0 7px 20px #0003;}
#home-mypage .lobby-art{position:absolute;inset:0;z-index:-2;background-image:url('assets/shogi-title-keyart-v4.png');background-size:cover;background-position:center 47%;opacity:.78;}
#home-mypage .mypage-heading:after{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,#10263deb 0,#10263dbb 41%,#10263d15 85%);pointer-events:none;}
#home-mypage .mypage-heading .eyebrow{font-size:10px;color:#e4c48a;letter-spacing:.19em;margin:0 0 11px;}
#home-mypage .mypage-heading h1{font-size:30px;color:#fff0cd;line-height:1.25;margin:0 0 11px;letter-spacing:.06em;text-shadow:0 2px 8px #0006;}
#home-mypage .mypage-heading>p:last-child{font-size:12px;line-height:1.6;color:#e2eaf3;margin:0;}
#home-mypage .mypage-play{padding:15px 17px;background:#20374c;border-color:#b89a63;gap:16px;}
#home-mypage .mypage-piece{width:37px;height:46px;font-size:26px;background:linear-gradient(100deg,#ddb677,#f3d7a1);}
#home-mypage .mypage-play h2{font-size:20px;margin:0 0 5px;color:#f1dfba;}
#home-mypage .mypage-play p{font-size:11px;color:#bdcbdc;}
#home-mypage .home-menu-actions{padding:16px;gap:12px;background:#152b40;border-color:#b89a63;}
#home-mypage #new-match{min-height:76px;border-color:#dfb779;background:linear-gradient(#ae4838,#812e25);box-shadow:0 3px 8px #0004;}
#home-mypage #new-match span{font-size:24px;letter-spacing:.09em;}
#home-mypage #new-match small{font-size:11px;color:#f2d4bc;margin-top:6px;}
#home-mypage #resume{min-height:56px;color:#24344a;background:#eed9ad;border-color:#f8e5ba;border-left:4px solid #b1853f;font-size:14px;box-shadow:0 3px 9px #0003;}
#home-mypage .menu-secondary{gap:10px;margin-top:3px;}
#home-mypage #open-history,#home-mypage .menu-help{min-height:78px;border-color:#7690a3;background:#20394d;box-shadow:none;}
#home-mypage #open-history span,#home-mypage .menu-help span{font-size:18px;color:#f2e3c4;}
#home-mypage #open-history small,#home-mypage .menu-help small{font-size:12px;line-height:1.6;color:#c7d5e3;overflow-wrap:anywhere;}
#home-mypage .home-save-note{font-size:12px;line-height:1.6;color:#b7c7d8;margin:17px 0 0;}

@media(max-width:360px){#home-mypage .mypage-heading{min-height:162px;padding:26px 16px;margin-bottom:15px;}#home-mypage .mypage-heading h1{font-size:26px;}#home-mypage .home-menu-actions{padding:13px;}#home-mypage .mypage-play{padding:13px;gap:12px;}#home-mypage #new-match span{font-size:22px;}#home-mypage #open-history span,#home-mypage .menu-help span{font-size:17px;}}

/* Keep saved-game details readable and separate the wooden piece face from the board. */
#last-move{font-size:12px;line-height:1.6;margin:0 0 6px}
#mypage-title:focus,#setup-title:focus{outline:none}
body[data-view=replay][data-board-ready=false] .board-wrap,body[data-view=game][data-board-ready=false] .board-wrap{visibility:hidden}
#resume small{display:block;margin-top:5px;font-size:12px;font-weight:500;line-height:1.6;color:#394666;overflow-wrap:anywhere}
#board .piece{isolation:isolate;background:#96632e;color:#160d04;box-shadow:none;text-shadow:0 .35px #160d04}
/* A separate inset face leaves a thin wooden side below the readable glyphs.
   Opponent pieces reverse the lighting as well as their orientation. */
#board .piece:before{content:"";position:absolute;inset:0 1px 3px;z-index:-1;pointer-events:none;clip-path:polygon(50% 0,84% 17%,100% 100%,0 100%,16% 17%);background:linear-gradient(115deg,#fff0cc,#f5d8a2 48%,#ebc991);box-shadow:inset 0 1px #fff8df,inset 0 -1px #b48040;}
#board .opponent .piece{background:#96632e;}
#board .opponent .piece:before{inset:3px 1px 0;background:linear-gradient(295deg,#fff0cc,#f5d8a2 48%,#ebc991);box-shadow:inset 0 -1px #fff8df,inset 0 1px #b48040;}
/* Capture targets use a centred frame around the piece, leaving its glyph readable. */
#board .target:has(.piece):after{width:88%;height:94%;border-radius:3px;background:transparent;border:2px solid #145137;pointer-events:none;}
/* Give opponent details one shared centre column without shrinking the controls. */
#levels{grid-template-columns:repeat(2,minmax(0,1fr));}
#levels button{min-height:108px;overflow-wrap:anywhere;}
#levels button small{font-size:12px;line-height:1.6;margin-top:5px;}
#strongest-budget{font-size:12px;line-height:1.6;margin:10px 0 0;}
@media(max-width:420px){
  .game-heading{display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:auto auto;column-gap:6px;row-gap:2px;align-items:center;}
  .game-heading #home-button{grid-column:1;grid-row:1 / 3;min-height:44px;}
  .game-heading #undo{grid-column:3;grid-row:1 / 3;min-height:44px;}
  .game-heading .opponent-heading{grid-column:2;grid-row:1;min-height:44px;padding:4px 6px;gap:3px;}
  .game-heading .opponent-heading:before{display:none;}
  .game-heading h1{font-size:14px;line-height:1.35;overflow-wrap:anywhere;}
  .game-heading .level-badge{font-size:10px;line-height:1.5;padding:1px 4px;}
  .game-heading #move-count{grid-column:2;grid-row:2;text-align:center;font-size:12px;line-height:1.4;}
  body[data-view=replay] .game-heading{grid-template-columns:auto minmax(0,1fr);}
}
#brand{white-space:nowrap;}
.title-logo h1{font-size:clamp(42px,12vw,72px);}
@media(max-width:420px){#brand{font-size:20px;}}
/* Keep every match action above the board, with opponent details on their own row. */
.game-heading{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:auto auto;gap:6px;align-items:center;}
.game-heading #home-button{grid-column:1;grid-row:1;min-height:44px;}
.game-heading #undo{grid-column:2;grid-row:1;min-height:44px;}
.game-heading #game-actions{grid-column:3;grid-row:1;display:flex;margin:0;}
.game-heading #game-actions #resign{width:100%;min-width:44px;min-height:44px;padding:7px 6px;}
.game-heading .opponent-heading{grid-column:1 / 3;grid-row:2;min-height:44px;}
.game-heading #move-count{grid-column:3;grid-row:2;text-align:center;}
body[data-view=replay] .game-heading{grid-template-columns:repeat(3,minmax(0,1fr));}
.info-nav a{display:inline-flex;align-items:center;min-height:44px;box-sizing:border-box;}
dialog.promotion{padding-top:54px;}
dialog.promotion .promotion-close{position:absolute;top:5px;right:5px;width:44px;min-width:44px;height:44px;min-height:44px;margin:0;padding:0;font-size:25px;line-height:1;}
/* Equal choice widths do not depend on the Japanese label length. */
dialog.promotion #promote,dialog.promotion #no-promote{width:calc(50% - 12px);min-height:44px;}
.history-date{display:block;margin-bottom:5px;}
.opponent-details{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:2px 6px;min-width:0;}
#replay-date{font-size:12px;line-height:1.4;color:#ead6b2;overflow-wrap:anywhere;}
body[data-view=replay] .opponent-details .level-badge{font-size:12px;padding:0;border:0;}
body[data-view=game] .opponent-details{display:none;}
.history-details{display:flex;flex-wrap:wrap;gap:4px 12px;}
.history-detail{display:inline-block;max-width:100%;word-break:keep-all;overflow-wrap:anywhere;}

/* A quiet shogi room: one illustrated welcome, one vermilion invitation to play. */
body[data-home-panel=mypage]{background:linear-gradient(180deg,#172b3c,#101d29 68%);}
body[data-home-panel=mypage] header{border-bottom-color:#a38e6533;padding-bottom:12px;}
#home-mypage{padding-top:18px;}
#home-mypage .mypage-heading{min-height:144px;margin-bottom:20px;padding:24px 20px;border:0;border-radius:3px;background:#172b3c;box-shadow:none;}
#home-mypage .lobby-art{background-position:center 43%;opacity:.66;}
#home-mypage .mypage-heading:after{background:linear-gradient(90deg,#122638f0,#122638a8 48%,#12263808);}
#home-mypage .mypage-heading .eyebrow{font-size:10px;letter-spacing:.22em;margin-bottom:9px;color:#eed3a0;}
#home-mypage .mypage-heading h1{font-size:27px;letter-spacing:.09em;margin-bottom:8px;}
#home-mypage .mypage-heading>p:last-child{font-size:13px;color:#e5e9ed;}
#home-mypage .mypage-play{display:none;}
#home-mypage .home-menu-actions{padding:0;gap:14px;border:0;border-radius:0;background:transparent;box-shadow:none;}
#home-mypage #new-match{min-height:88px;border:1px solid #d39c67;border-bottom:3px solid #602c25;border-radius:4px;background:linear-gradient(110deg,#a74332,#873124);box-shadow:0 5px 14px #0002;}
#home-mypage #new-match span{font-size:27px;letter-spacing:.12em;}
#home-mypage #new-match small{font-size:12px;line-height:1.6;color:#f8e1c8;margin-top:5px;}
#home-mypage #resume{min-height:68px;border:1px solid #c5a66e;border-left:4px solid #b48a48;border-radius:4px;background:#e8d6b0;color:#263a48;box-shadow:none;padding:11px 12px;}
#home-mypage #resume>span{font-family:var(--serif);font-size:18px;letter-spacing:.04em;}
#home-mypage .menu-secondary{margin-top:3px;gap:0;border-top:1px solid #a38e6550;border-bottom:1px solid #a38e6550;}
#home-mypage #open-history,#home-mypage .menu-help{min-height:84px;border:0;border-radius:0;background:transparent;box-shadow:none;padding:13px 6px;}
#home-mypage .menu-help{border-left:1px solid #a38e6540;}
#home-mypage #open-history span,#home-mypage .menu-help span{font-size:19px;letter-spacing:.08em;color:#e9d6b4;}
#home-mypage #open-history small,#home-mypage .menu-help small{font-size:12px;color:#bfcbd4;margin-top:6px;}
#home-mypage .home-save-note{margin-top:16px;color:#b5c3cf;}

body[data-home-panel=mypage] .info-nav{margin-top:17px;padding-top:9px;}

/* The wooden board remains the focus; the turn is its clearest instruction. */
body[data-view=game],body[data-view=replay]{background:#142331;}
.game-heading button{border-color:#526777;border-radius:3px;background:#1b3040;}
.game-heading #game-actions #resign{border-color:#705b54;background:#302f34;color:#e9d4ca;}
.game-heading .opponent-heading{border:0;border-radius:0;background:transparent;box-shadow:none;}
.game-heading h1{font-family:var(--serif);font-size:15px;font-weight:700;letter-spacing:.03em;color:#eee2cd;}
.game-heading .level-badge{border:0;border-radius:0;background:transparent;color:#b7c7d3;}
#turn{background:#e4d7b8;border:0;border-left:3px solid #a98b55;border-radius:2px;color:#213747;font-size:13px;line-height:1.6;min-height:30px;}
#last-move{color:#c0cbd4;margin:2px 0 7px;}
.player-band{background:#763e33;border-radius:2px;font-size:11px;letter-spacing:.03em;}
#player-label{background:#284d66;}
@media(max-width:360px){
  #home-mypage .mypage-heading{min-height:132px;padding:21px 16px;margin-bottom:17px;}
  #home-mypage .mypage-heading h1{font-size:25px;}
  #home-mypage #new-match span{font-size:25px;}
  #home-mypage #open-history span,#home-mypage .menu-help span{font-size:18px;}
  .game-heading h1{font-size:14px;}
}
/* Resume the real saved game first; DOM order and visual order stay identical. */
#home-mypage .home-menu-actions>*{order:0!important;}
#home-mypage[data-has-active=true] #resume{min-height:104px;padding:18px 14px;border-left:4px solid #b68b49;background:linear-gradient(110deg,#eee0bf,#dcc599);}
#home-mypage[data-has-active=true] #resume>span{font-size:25px;line-height:1.4;letter-spacing:.07em;}
#home-mypage[data-has-active=true] #resume small{margin-top:9px;color:#344b59;font-size:12px;line-height:1.6;}
#home-mypage[data-has-active=true] #new-match{min-height:60px;padding:10px 12px;border:1px solid #657781;background:#203340;box-shadow:none;}
#home-mypage[data-has-active=true] #new-match span{font-size:18px;letter-spacing:.05em;}
#home-mypage[data-has-active=true] #new-match small{color:#c3d0d8;margin-top:3px;}
@media(max-width:360px){#home-mypage[data-has-active=true] #resume>span{font-size:22px;}}
.result-panel{padding:22px 16px;border-radius:4px;}
#result-detail{font-size:14px;line-height:1.7;margin:10px 0 14px;color:#e4eaf0;}
.result-match-info{font-size:12px;line-height:1.7;margin:0;padding:11px 4px;border-top:1px solid #a38e6550;color:#c3d0db;overflow-wrap:anywhere;}
.result-actions{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}
.result-actions #rematch-button{grid-column:1 / -1;min-height:60px;font-family:var(--serif);font-size:21px;}
.result-actions #result-replay,.result-actions #result-home{min-height:52px;font-size:12px;padding:10px 6px;}
.setup-summary{margin:0 0 10px;padding:12px 8px;border-top:1px solid #a38e6560;text-align:center;color:#f0dfbd;font-size:14px;font-weight:650;line-height:1.6;overflow-wrap:anywhere;}
dialog#home-setup .setup-readiness{margin-bottom:8px;background:transparent;border-color:#526777;font-size:12px;}
dialog#home-setup #setup-readiness[data-compact="true"]{padding:0;border:0;background:transparent;font-size:12px;}
#turn{min-height:30px;display:flex;align-items:center;justify-content:center;padding:4px 8px;}
#turn[data-state=player]{background:#e4d7b8;color:#213747;border-left-color:#a98b55;}
#turn[data-state=thinking],#turn[data-state=ai]{background:#29465b;color:#ecf2f5;border-left-color:#8cacc0;}
#turn[data-state=ended]{background:#343c44;color:#e9e3d5;border-left-color:#a8a391;}
#turn[data-state=replay]{background:#2d3c4d;color:#d9e5ef;border-left-color:#93abc2;}
#turn[data-state=loading],#turn[data-state=updating],#turn[data-state=unavailable]{background:#333f49;color:#e0e7ed;border-left-color:#8fa0ae;}
#replay-actions{margin:5px 0;gap:5px;grid-template-columns:minmax(44px,.8fr) minmax(44px,1fr) auto minmax(44px,1fr) minmax(44px,.8fr);}
#replay-actions button{min-width:44px;min-height:44px;font-size:12px;padding:7px 3px;}
#replay-actions #previous,#replay-actions #next{background:#e4d7b8;border-color:#b69b67;color:#213747;font-weight:650;}
#replay-actions #replay-first,#replay-actions #replay-last{background:transparent;color:#c3d0db;border-color:#526777;}
#replay-count{display:flex;align-items:center;justify-content:center;min-height:44px;font-size:12px;}
dialog#home-setup .home-subheading{justify-content:space-between;gap:12px;margin-bottom:14px;}
dialog#home-setup #setup-back{flex:none;width:44px;min-width:44px;height:44px;min-height:44px;padding:0;border:0;background:transparent;font-size:25px;line-height:1;}
.result-actions #rematch-button{padding:4px 12px;}
.result-actions #rematch-button>span{display:block;font-size:21px;line-height:1.25;}
.result-actions #rematch-button>small{font-family:system-ui,sans-serif;font-size:12px;font-weight:400;line-height:1.5;margin-top:2px;color:#344b59;}
@media(max-height:700px){
  dialog#home-setup #levels .level-emblem{display:none;}
  dialog#home-setup #levels button{min-height:54px;padding:4px 5px;font-size:13px;line-height:1.4;}
  dialog#home-setup #levels button small{font-size:12px;line-height:1.6;margin-top:2px;}
  dialog#home-setup{padding:10px;}
  dialog#home-setup .home-subheading{margin-bottom:8px;}
  dialog#home-setup .match-setup{padding:12px 10px;}
  dialog#home-setup fieldset{margin-bottom:12px;}
  dialog#home-setup legend{margin-bottom:6px;}
  dialog#home-setup .setup-readiness{padding:8px;margin-bottom:4px;}
  dialog#home-setup .setup-summary{padding:8px 4px;margin-bottom:6px;}
  dialog#home-setup .match-setup>.note{margin-top:10px;margin-bottom:0;}
}
dialog#home-setup .sides button{min-height:46px;padding:3px 5px;}
dialog#home-setup .sides button>span{display:block;font-size:13px;line-height:1.25;}
dialog#home-setup .sides button>small{font-size:12px;line-height:1.4;margin-top:1px;}
@media(max-height:600px){
  dialog#home-setup{padding:8px;}
  dialog#home-setup .home-subheading{margin-bottom:2px;}
  dialog#home-setup .match-setup{padding-top:4px;padding-bottom:4px;}
  dialog#home-setup fieldset{margin-bottom:4px;min-width:0;}
  dialog#home-setup legend{margin-bottom:2px;}
  dialog#home-setup #levels .level-emblem{display:none;}
  dialog#home-setup #levels button{min-height:54px;padding:4px 5px;font-size:13px;line-height:1.4;}
  dialog#home-setup #levels button small{font-size:12px;line-height:1.6;margin-top:2px;}
  dialog#home-setup #strongest-budget{margin-top:4px;}
  dialog#home-setup .setup-summary{padding:4px;font-size:12px;margin-bottom:4px;}
  dialog#home-setup #start{min-height:54px;}
  dialog#home-setup .match-setup>.note{margin-top:6px;}
}
/* Title-only composition: a spacious desktop identity with original key art. */
body[data-home-panel=menu] #home-menu{max-width:none;width:100%;background:#102536;}
body[data-home-panel=menu] #home-menu:after{background:linear-gradient(180deg,#06152678,transparent 46%,#081d358c);}
.title-logo{top:max(8svh,env(safe-area-inset-top));padding:0 20px;color:#fff0c9;animation:none;}
.title-edition{display:block;font:600 11px/1.5 system-ui;letter-spacing:.24em;color:#e8d6b4;margin-bottom:14px;}
.title-logo h1{font-family:var(--serif);font-size:clamp(45px,14vw,78px);font-weight:800;letter-spacing:.1em;padding-left:.1em;line-height:1.3;-webkit-text-stroke:0;text-shadow:0 2px 12px #081a30b3;color:#fff0c9;}
.title-wordmark{font:500 11px/1.6 system-ui;letter-spacing:.3em;margin-top:12px;color:#f4e3c6;text-shadow:0 1px 7px #091d32;}
.title-logo p{font-family:var(--serif);font-size:clamp(14px,3.9vw,18px);font-weight:500;letter-spacing:.14em;margin-top:20px;color:#fff6df;text-shadow:0 1px 8px #091d32;}
.title-transition{font-size:12px;color:#e0e8ec;letter-spacing:.06em;}
.title-logo h1{color:#ffe4a6;text-shadow:0 1px 0 #b58a45,0 3px 0 #55391d,0 7px 20px #071321;}
.title-edition{letter-spacing:.3em;}
.title-rule{display:block;width:56px;height:1px;margin:22px auto 0;background:#d4b67a;box-shadow:0 1px 6px #071321;}
@media(max-width:899px) and (max-height:600px){.title-logo{top:max(5svh,env(safe-area-inset-top));}.title-edition{margin-bottom:8px;}.title-wordmark{margin-top:8px;}.title-logo p{margin-top:12px;}.title-rule{margin-top:12px;}}
@media(min-width:900px) and (min-aspect-ratio:1 / 1){
 body[data-home-panel=menu] #home-menu{max-width:none;margin:0;}
 .title-keyart{inset:0 0 0 auto;width:54%;height:100%;object-fit:cover;object-position:center 62%;}
 body[data-home-panel=menu] #home-menu:after{background:linear-gradient(90deg,#102536 0%,#102536 40%,#102536e6 46%,#10253600 64%),linear-gradient(0deg,#091d3570,transparent 25%);}
 .title-logo{left:0;right:auto;top:50%;width:48%;box-sizing:border-box;transform:translateY(-50%);text-align:left;padding-left:clamp(48px,7vw,144px);padding-right:24px;}
 .title-edition{font-size:12px;letter-spacing:.28em;margin-bottom:24px;}
 .title-logo h1{font-size:clamp(64px,6.3vw,110px);letter-spacing:.07em;padding-left:0;white-space:nowrap;line-height:1.25;}
 .title-wordmark{font-size:13px;margin-top:22px;padding-left:0;letter-spacing:.34em;}
 .title-logo p{font-size:20px;margin-top:36px;}
 .title-rule{width:80px;margin:28px 0 0;}
 .title-transition{left:clamp(48px,7vw,144px);right:auto;bottom:40px;padding:0;text-align:left;}
}

@media(min-width:1024px){
  body[data-view=game] #error,body[data-view=replay] #error,body[data-view=game] #retry,body[data-view=replay] #retry{width:100%;max-width:min(620px,max(360px,calc((100dvh - 330px) * .921875)));align-self:center;box-sizing:border-box;}
  body[data-view=game] #error,body[data-view=replay] #error{font-size:16px;line-height:1.6;margin:8px 0;}
  body[data-view=game] #retry,body[data-view=replay] #retry{min-height:44px;margin:0 0 8px;}

  body[data-view=game] main,body[data-view=replay] main{max-width:900px;min-height:100dvh;display:flex;flex-direction:column;justify-content:center;}
  body[data-view=game] main>*,body[data-view=replay] main>*{flex-shrink:0;}
  body[data-view=game] main>header,body[data-view=replay] main>header,body[data-view=game] main>.info-nav,body[data-view=replay] main>.info-nav{width:100%;max-width:900px;align-self:center;}
  body[data-view=game] #game,body[data-view=replay] #game{display:grid;grid-template-columns:minmax(0,1fr);width:100%;max-width:min(620px,max(360px,calc((100dvh - 330px) * .921875)));align-self:center;row-gap:4px;align-items:start;}
  #game>.game-heading{grid-column:1;grid-row:1;margin-top:4px;display:flex;flex-wrap:wrap;gap:6px;}
  #game>.game-heading #home-button,#game>.game-heading #undo,#game>.game-heading #game-actions{flex:0 0 auto;}
  #game>.game-heading .opponent-heading{flex:1 1 120px;min-width:0;}
  #game>.game-heading #move-count{flex:0 0 auto;}
  #game>#replay-actions{grid-column:1;grid-row:2;}
  #game>#turn{grid-column:1;grid-row:3;}
  #game>#last-move{grid-column:1;grid-row:4;}
  #game>.game-heading,#game>#replay-actions,#game>#turn,#game>#last-move{width:100%;}
  #game>.board-wrap{grid-column:1;grid-row:5;width:100%;max-width:none;margin:0 auto;}
  #game>#result-panel{grid-column:1;grid-row:6;width:100%;}
  dialog#home-setup{width:min(90vw,620px);}
  dialog#home-setup #levels{grid-template-columns:repeat(3,minmax(0,1fr));}
}


/* Short PC: reserve space for feedback and the full-size board, not a second brand bar. */
@media(min-width:1024px) and (max-height:700px){
 body[data-view=game] main,body[data-view=replay] main{justify-content:flex-start;padding-top:4px;padding-bottom:6px;}
 body[data-view=game] main>header,body[data-view=replay] main>header{display:none;}
 body[data-view=game] #game,body[data-view=replay] #game{row-gap:2px;}
 #game>.game-heading{margin-top:0;padding:0;}
 #game>#turn{margin:0;min-height:28px;padding:3px 8px;}
 #game>#last-move{margin:0;font-size:12px;line-height:1.5;}
 #game .player-band{min-height:18px;padding:1px 8px;margin:0;font-size:11px;line-height:1.4;}
 #game .hand{gap:4px;padding:1px 4px;margin:1px 0;}
 #game .hand:not(:has(button)){min-height:20px;}
 #game .hand:has(button){min-height:48px;flex-wrap:wrap;}
 #game .hand button{min-width:44px;min-height:44px;}
 body[data-view=game] .info-nav,body[data-view=replay] .info-nav{margin-top:4px;padding-top:2px;}
}
/* Compact game chrome; unchanged board and natural overflow. */
body[data-view=game] main,body[data-view=replay] main{justify-content:flex-start;padding-top:4px;padding-bottom:8px;}
body[data-view=game] main>header,body[data-view=replay] main>header{display:none;}
body[data-view=game] #game,body[data-view=replay] #game{row-gap:2px;}
#game>.game-heading{margin-top:0;padding:0;}
#game>#turn{margin:2px 0;min-height:30px;padding:3px 8px;}
#game>#last-move{margin:0 0 3px;font-size:12px;line-height:1.6;min-height:1.6em;}
#game .player-band{min-height:18px;padding:1px 8px;margin:0;font-size:11px;line-height:1.4;}
#game .hand{gap:4px;padding:1px 4px;margin:1px 0;}
#game .hand:not(:has(button)){min-height:20px;}
#game .hand:has(button){min-height:48px;flex-wrap:wrap;}
#game .hand button{min-width:44px;min-height:44px;}
body[data-view=game] .info-nav,body[data-view=replay] .info-nav{margin-top:4px;padding-top:2px;}
@media(width < 1024px){
 #game>.game-heading .opponent-heading{min-height:22px;padding:0;}
 #game>.game-heading #move-count{min-height:22px;padding:0;}
}
/* State changes use reserved slots: no text, capture or recovery reflows the board. */
#game>.game-heading #move-count{width:56px;flex:0 0 56px;}
#game>.game-heading .opponent-heading{overflow:auto;}
html:has(body[data-view=game]),html:has(body[data-view=replay]){overflow-y:scroll;}
#game>#turn{height:30px;min-height:30px;max-height:30px;line-height:22px;padding:4px 8px;overflow:auto;overflow-wrap:anywhere;}
#game>#last-move{height:20px;min-height:20px;max-height:20px;line-height:20px;overflow:auto;overflow-wrap:anywhere;}
#game .hand,#game .hand:not(:has(button)),#game .hand:has(button){height:52px;min-height:52px;max-height:52px;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;}
#game .hand::-webkit-scrollbar{display:none;}
#game .hand button{flex:0 0 auto;height:44px;white-space:nowrap;}
body[data-view=game] #game-notices,body[data-view=replay] #game-notices{position:fixed;z-index:20;inset:auto max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));max-width:620px;margin:auto;max-height:35dvh;overflow:auto;background:#142331;box-shadow:0 4px 20px #0008;border-radius:6px;}
body[data-view=game] #game-notices:has(#error[hidden]):has(#retry[hidden]):has(#storage-error[hidden]),body[data-view=replay] #game-notices:has(#error[hidden]):has(#retry[hidden]):has(#storage-error[hidden]){display:none;}
body[data-view=game] #game-notices #error,body[data-view=replay] #game-notices #error,body[data-view=game] #game-notices #storage-error,body[data-view=replay] #game-notices #storage-error{width:100%;max-width:none;margin:0;font-size:14px;line-height:1.5;}
body[data-view=game] #game-notices #retry,body[data-view=replay] #game-notices #retry{width:100%;max-width:none;min-height:44px;margin:0;}
#dismiss-storage-error{width:100%;min-height:44px;margin:0;background:#f4ded3;color:#702b1d;}

/* Upper settings entry collects informational links outside the playing surface. */
#open-settings,#game-settings{min-width:44px;min-height:44px;white-space:nowrap;}
#game>.game-heading{grid-template-columns:repeat(4,minmax(0,1fr));}
#game>.game-heading #home-button{grid-column:1;grid-row:1;}
#game>.game-heading #game-settings{grid-column:2;grid-row:1;}
#game>.game-heading #undo{grid-column:3;grid-row:1;}
#game>.game-heading #game-actions{grid-column:4;grid-row:1;}
#game>.game-heading .opponent-heading{grid-column:1 / 4;grid-row:2;}
#game>.game-heading #move-count{grid-column:4;grid-row:2;}
body[data-view=replay] #game>.game-heading{grid-template-columns:repeat(4,minmax(0,1fr));}
#settings{width:min(90vw,420px);max-height:85dvh;overflow:auto;padding:20px;border:1px solid #b29a68;border-radius:8px;background:#172b3d;color:#f5ead6;}
#settings::backdrop{background:#07121cc9;}
.settings-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:16px;}
.settings-heading h2{margin:0;font-size:22px;}
#settings-close{min-width:44px;min-height:44px;font-size:24px;}
.settings-sound{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:8px 0 16px;}
#settings #sound-toggle{font-size:14px;min-width:88px;color:#f0dfbd;}
.settings-links{display:grid;border-top:1px solid #496072;}
.settings-links a{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:52px;padding:10px 4px;color:#f0dfbd;text-decoration:none;font-size:15px;border-bottom:1px solid #496072;}
#settings-done{width:100%;min-height:44px;margin-top:20px;}
@media(min-width:1024px){#game>.game-heading #game-settings{flex:0 0 auto;}}
@media(min-width:1024px){
 #game>.game-heading{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:44px 22px;gap:4px 6px;}
 #game>.game-heading .opponent-heading{min-height:22px;height:22px;max-height:22px;padding:0;overflow:auto;}
 #game>.game-heading #move-count{min-height:22px;height:22px;max-height:22px;padding:0;justify-self:center;}
 #game>.game-heading button{height:44px;min-height:44px;white-space:nowrap;}
 #game>.game-heading #game-actions{height:44px;min-height:44px;}
}

/* Match controls keep settings at the right; navigation is inside settings. */
#game>.game-heading,body[data-view=replay] #game>.game-heading{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:44px 22px;gap:4px 6px;}
#game>.game-heading #undo{grid-column:1;grid-row:1;}
#game>.game-heading #game-actions{grid-column:2;grid-row:1;}
#game>.game-heading #game-settings{grid-column:3;grid-row:1;}
#game>.game-heading .opponent-heading{grid-column:1 / 3;grid-row:2;min-height:22px;height:22px;max-height:22px;padding:0;overflow:auto;}
#game>.game-heading #move-count{grid-column:3;grid-row:2;justify-self:center;}
#settings #home-button{width:100%;min-height:44px;margin-top:20px;}
@media(min-width:1024px){#settings{width:min(80vw,520px);padding:28px;}}

/* A Blender-rendered surface shares the existing glyph and cell geometry. */
.piece-display{margin:0 0 16px;padding:12px 0;border:0;border-top:1px solid #496072;}
.piece-display legend{padding:0 8px 0 0;font-size:15px;}
.piece-display-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
.piece-display-choices button{min-height:44px;white-space:nowrap;padding:8px 4px;font-size:14px;}
.piece-display-choices button[aria-pressed=true]{background:#eed4a0;color:#201307;border-color:#eed4a0;}
.piece-display .note{margin:8px 0 0;font-size:12px;}
body[data-piece-renderer=blender] #board .piece,
body[data-piece-renderer=blender] #board .opponent .piece{clip-path:none;background:transparent url('assets/blender-piece.png') center / 138% 111% no-repeat;box-shadow:none;filter:none;}
body[data-piece-renderer=blender] #board .piece:before{content:none;}


/* Image feedback reserves its space through loading, failure and retry. */
.piece-load-feedback{display:grid;grid-template-columns:minmax(0,1fr);align-items:center;height:48px;min-height:48px;max-height:48px;}
#piece-display-status{margin:0;font-size:12px;line-height:18px;max-height:36px;overflow:auto;}


/* Slightly larger two-line phone glyphs keep their vertical footprint. */
@media(max-width:767px){
  #board .piece:not(.single-character)>.piece-line{font-size:clamp(16px,4.9vw,23px);line-height:.88;}
}

/* The decorative king fits the reserved match heading without an inner scrollbar. */
body[data-view=game] #game>.game-heading .opponent-heading:before,body[data-view=replay] #game>.game-heading .opponent-heading:before{height:22px;padding-top:0;line-height:20px;}

/* Keep the settings title and close action reachable in a short, scrolled dialog. */
#settings .settings-heading{position:sticky;top:0;z-index:2;background:#172b3d;}

/* Small replay headings retain title and opponent; the history list carries dates. */
@media(max-width:1023px){
 body[data-view=replay] #game>.game-heading .opponent-heading{flex-wrap:nowrap;}
 body[data-view=replay] #game>.game-heading .opponent-details{flex-wrap:nowrap;}
 body[data-view=replay] #game>.game-heading #replay-date{display:none;}
}


/* Mypage: all actions share one centered column on phone and PC. */
#home-mypage{width:100%;max-width:560px;margin-inline:auto;}
#home-mypage .mypage-heading{min-height:152px;padding:28px 22px;margin-bottom:24px;border-bottom:1px solid #bca37355;border-radius:4px;text-align:center;}
#home-mypage .mypage-heading .eyebrow{font-size:12px;letter-spacing:.12em;margin-bottom:12px;}
#home-mypage .mypage-heading h1{font-size:30px;line-height:1.35;letter-spacing:.07em;}
#home-mypage .mypage-heading>p:last-child{font-size:14px;line-height:1.65;}
#home-mypage .mypage-heading:after{background:linear-gradient(180deg,#122638d9,#1226389e);}
#home-mypage .home-menu-actions{gap:14px;width:100%;margin-inline:auto;}
#home-mypage #new-match{min-height:96px;padding:20px 24px;text-align:center;}
#home-mypage #new-match small{font-size:13px;}
#home-mypage .menu-secondary{margin-top:8px;grid-template-columns:minmax(0,1fr);}
#home-mypage #open-history{min-height:76px;padding:16px 18px;text-align:center;align-items:center;}
#home-mypage #open-history span{font-size:20px;}
#home-mypage #open-history small{font-size:13px;}
#home-mypage .home-save-note{font-size:12px;line-height:1.7;margin-top:20px;text-align:center;}
#home-mypage[data-has-active=true] #resume{min-height:112px;padding:20px 24px;text-align:center;}
#home-mypage[data-has-active=true] #new-match{padding:14px 18px;min-height:76px;}
@media(min-width:1024px){
 body[data-view=home][data-home-panel=mypage] main{max-width:720px;padding:32px 40px;}
 #home-mypage{display:block;padding-top:28px;}
 #home-mypage[hidden]{display:none;}
 #home-mypage .mypage-heading{min-height:180px;margin:0 0 24px;padding:32px;border:1px solid #bca37355;}
 #home-mypage .lobby-art{background-position:center 43%;opacity:.6;}
 #home-mypage .mypage-heading h1{font-size:34px;margin-bottom:12px;}
 #home-mypage .mypage-heading>p:last-child{font-size:16px;}
 #home-mypage .home-menu-actions{gap:16px;}
 #home-mypage #new-match{min-height:112px;padding:24px;}
 #home-mypage #new-match span{font-size:30px;}
 #home-mypage #new-match small{font-size:14px;margin-top:8px;}
 #home-mypage[data-has-active=true] #resume{min-height:124px;padding:24px;}
 #home-mypage[data-has-active=true] #resume>span{font-size:28px;}
 #home-mypage[data-has-active=true] #resume small{font-size:14px;}
 #home-mypage[data-has-active=true] #new-match{min-height:80px;}
 #home-mypage[data-has-active=true] #new-match span{font-size:22px;}
 #home-mypage .home-save-note{margin-top:20px;}
}
