*{box-sizing:border-box}body{margin:0;background:#f7f5ed;color:#253f43;font-family:'Yu Gothic',Meiryo,sans-serif}button,select,input{font:inherit}button{cursor:pointer;border:1px solid #a9c3b9;border-radius:14px;padding:11px 16px;background:#fff;color:#253f43;font-weight:bold}button:hover{background:#e9f4eb}button:focus-visible,select:focus-visible,input:focus-visible{outline:3px solid #227b76;outline-offset:3px}button:disabled{cursor:default;opacity:.55}header{max-width:1120px;margin:auto;padding:22px 28px;display:flex;gap:14px;align-items:center}.brand{font-weight:800}.edition,.eyebrow{font-size:12px;letter-spacing:.12em;color:#4b7c6b}.edition{border:1px solid #bbcebf;padding:5px 12px;border-radius:20px}main{max-width:1100px;margin:auto;padding:0 24px}.intro{display:flex;justify-content:space-between;align-items:center;padding:12px 10px 24px}h1{font-size:clamp(30px,5vw,49px);margin:6px 0;color:#244f42;letter-spacing:.08em}h1 span{display:inline-block;color:#bc6b26;margin-left:14px}.intro p{margin:10px 0}.intro-star{font-size:94px;color:#e7b653;transform:rotate(12deg);padding:0 38px}.toolbar{display:flex;align-items:center;gap:16px;flex-wrap:wrap;background:#fff;border:1px solid #dce4d9;padding:15px;border-radius:18px;margin-bottom:25px}.toolbar label{font-size:13px;display:flex;gap:6px;align-items:center}select,input{padding:9px 5px;border:1px solid #b7cbc2;border-radius:8px;background:white;color:inherit}input{width:72px}.layout{display:grid;grid-template-columns:minmax(0,700px) minmax(220px,1fr);gap:28px}.play{min-width:0}.player-row{display:flex;justify-content:space-between;padding:9px 12px;font-size:14px;font-weight:bold}.player-row time{font-size:20px;font-variant-numeric:tabular-nums}.mine{color:#247763}.board-wrap{background:#b98b57;padding:9px;border-radius:16px;box-shadow:0 7px 0 #92704c;margin:14px 0 20px}#board{display:grid;grid-template-columns:repeat(var(--width,5),minmax(0,1fr));background:#a68760;border:1px solid #a68760;gap:1px}#board button{position:relative;aspect-ratio:1.25;border:0;border-radius:0;background:#f3dfb4;padding:3px;display:flex;align-items:center;justify-content:center;min-width:0;isolation:auto}#board button:nth-child(even){background:#efdaa9}#board button.target{background:#badbc3;box-shadow:inset 0 0 0 3px #599e7e}#board button.selected{background:#fae690;box-shadow:inset 0 0 0 3px #b9851a}.coord{position:absolute;left:2px;top:1px;font-size:8px;color:#75603e;pointer-events:none}.piece{position:relative;width:68%;height:88%;max-width:72px;display:flex;align-items:center;justify-content:center;pointer-events:none}.piece.token{background:var(--color);clip-path:polygon(50% 0,87% 20%,100% 100%,0 100%,13% 20%);border-bottom:4px solid #0002}.piece .glyph{font-size:clamp(15px,3vw,30px);font-weight:bold;color:#403120}.piece.enemy.token{transform:rotate(180deg)}.piece.promoted .glyph{color:#b82837}.piece img{max-width:100%;max-height:100%;object-fit:contain}.piece.character{width:86%;max-width:90px;height:95%;z-index:3;animation:wobble .18s ease-in-out infinite alternate}.piece.character .mascot{height:80%;width:80%;position:relative;display:flex;align-items:flex-end;justify-content:center;border-radius:42% 42% 30% 30%;background:var(--color);border:2px solid #fff;box-shadow:0 4px 0 #0002}.mascot:before{content:'•  •';position:absolute;top:1%;font-size:clamp(12px,2vw,22px);white-space:pre;line-height:1}.mascot .glyph{font-size:clamp(13px,2vw,23px)}.piece.character.enemy .mascot{border-color:#b8675b}.speech{position:absolute;bottom:83%;left:50%;transform:translateX(-50%);border:1px solid #60866c;border-radius:10px;background:white;color:#254e3c;font-size:clamp(9px,1.1vw,13px);padding:5px 7px;white-space:nowrap;z-index:8;pointer-events:none;box-shadow:0 3px 4px #0001}.speech:after{content:'';position:absolute;bottom:-5px;left:45%;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid white}.speech.defend{background:#fff0eb;color:#8b4534;border-color:#bc8c7c}.edge-left .speech{left:0;transform:none}.edge-right .speech{left:auto;right:0;transform:none}.hand{display:flex;gap:6px;min-height:44px;flex-wrap:wrap;padding:4px}.hand button{padding:5px 8px;display:flex;align-items:center;gap:4px}.hand .piece{width:24px;height:29px}.hand .glyph{font-size:15px}.hand button.selected{background:#fae690}.message,.tips{background:white;border:1px solid #dce4d9;border-radius:18px;padding:21px;margin-bottom:16px}.message{border-top:5px solid #70a787;min-height:130px}#status{font-size:18px;font-weight:bold;line-height:1.7;margin-bottom:0}.tips h2{font-size:18px;margin-top:0}.tips p{font-size:13px;line-height:1.9}.tips b{background:#fff3c8;padding:3px 6px}.tips small{font-size:12px;line-height:1.8}aside>button{display:block;width:100%;margin-bottom:10px}.design-note,footer{font-size:12px;color:#75897e}footer{text-align:center;padding:30px}.flight{position:fixed;z-index:100;pointer-events:none;display:flex;align-items:center;justify-content:center}.flight .piece{animation:none!important}dialog{border:1px solid #b4c9b9;border-radius:22px;max-width:min(90vw,500px);padding:28px;color:#253f43}dialog::backdrop{background:#143a355e}dialog p{line-height:1.9}dialog button{margin:4px}dialog h2{font-size:22px}@keyframes wobble{from{transform:rotate(-5deg) translateX(-1px)}to{transform:rotate(5deg) translateX(1px)}}@media(max-width:750px){main{padding:0 12px}.layout{grid-template-columns:1fr}.intro-star{font-size:65px;padding:0 8px}.toolbar{gap:9px}.toolbar button{font-size:12px;padding:9px}aside{display:grid;grid-template-columns:1fr 1fr;gap:10px}.message,.tips{grid-column:1/-1;margin:0}.tips{display:none}#status{font-size:16px}h1 span{margin-left:7px}.speech{font-size:10px;padding:4px}header{padding:16px}.design-note{grid-column:1/-1}}@media(prefers-reduced-motion:reduce){.piece.character{animation:none}}
/* V002: supplied fantasy scenery and the sixteen original transparent PNGs. */
body{background:#eaf5ff url('./fantasy-background.png') center top / cover fixed no-repeat}
header{background:#ffffffdb;border-radius:0 0 20px 20px}.intro{margin-top:14px;background:#ffffffde;border-radius:22px;padding:18px 22px;margin-bottom:18px}.toolbar{background:#fffffff2}
.board-wrap{background:#bbdded url('./fantasy-background.png') center / cover;border:3px solid #fff;box-shadow:0 6px 0 #719eac}
#board{background:#729db28c;border-color:#729db2}#board button{background:#fff9e0dc}#board button:nth-child(even){background:#edf8ffe3}#board button.target{background:#b4ebc6ef}#board button.selected{background:#ffe89af2}
.player-row,.hand{background:#ffffffec;border-radius:12px}.player-row{margin:5px 0}.message,.tips{background:#fffffff2}.design-note{background:#fffffff0;border-radius:8px;padding:9px}.piece.token.has-art{width:79%;height:95%;max-width:80px;background:linear-gradient(135deg,#f7fcff,var(--color));border-bottom:3px solid #688bab;overflow:hidden}
.piece.token.has-art img{height:85%;width:85%;object-fit:contain;margin-top:9%;filter:drop-shadow(0 1px 1px #0002)}
.piece.enemy.token.has-art{transform:none;clip-path:polygon(0 0,100% 0,87% 80%,50% 100%,13% 80%);border-bottom:0;border-top:3px solid #b97f76}.piece.enemy.token.has-art img{margin-top:0;margin-bottom:10%}
.piece.character.has-art{width:100%;height:110%;max-width:100px;overflow:visible}.piece.character.has-art img{width:100%;height:100%;filter:drop-shadow(0 3px 2px #0003)}
.piece-badge{position:absolute;bottom:2px;right:0;min-width:1.4em;padding:1px 3px;background:#fffdf0;color:#263c54;border:1px solid #6f9abc;border-radius:6px;font-size:clamp(10px,1.3vw,16px);line-height:1.1;z-index:4;box-shadow:0 1px 2px #0002}.enemy .piece-badge{bottom:auto;top:2px;color:#8b3631;border-color:#bd8b82}.promoted .piece-badge{color:#b21736;background:#fff0b5;font-weight:900}.hand .piece.token.has-art{width:34px;height:38px}.hand .piece-badge{font-size:10px}.flight .piece.has-art{max-width:none}footer{background:#ffffffc9;border-radius:18px 18px 0 0;margin-top:20px}

/* V003: use supplied piece silhouettes without cropping or recolouring. */
.piece.token.has-art,.piece.enemy.token.has-art{background:none;border:0;clip-path:none;overflow:visible;transform:none;width:90%;height:96%;max-width:90px}
.piece.token.has-art img,.piece.enemy.token.has-art img{width:100%;height:100%;margin:0;filter:none}
.speech.warning-1{background:#ffe16a;border-color:#a17700;color:#483300}.speech.warning-1:after{border-top-color:#ffe16a}
.speech.warning-2{background:#db373e;border-color:#9d1220;color:white}.speech.warning-2:after{border-top-color:#db373e}
.two-bubbles .speech:not(.warning-1):not(.warning-2){bottom:115%}
#board button:disabled{opacity:1}.piece-badge{font-size:12px}.hand .piece.token.has-art{width:34px;height:38px}

/* V004: opponent tokens face the human player, including hands and slides. */
.piece.enemy.token.has-art{transform:rotate(180deg)}

/* V005: lettering centred on the artwork's lower gold plaque. */
.piece.token.has-art,.piece.enemy.token.has-art{aspect-ratio:1;width:auto;max-width:95%}
.piece-letter{position:absolute;left:20%;width:60%;top:68%;height:24%;display:flex;align-items:center;justify-content:center;color:#382007;font-family:'Yu Mincho','Hiragino Mincho ProN',serif;font-weight:900;font-size:clamp(11.2px,2.64vw,25.6px);line-height:1;pointer-events:none;text-shadow:0 1px 0 #fff0b0}
.piece.promoted .piece-letter{color:#b31d24}.hand .piece-letter{font-size:11.2px}

/* V009: capture recommendation. */
.speech.capture-hint,.tips b.capture-hint{background:#142d59;color:#fff;border-color:#142d59}
.speech.capture-hint:after{border-top-color:#142d59}

/* V011: explicit row sizing prevents Safari image intrinsic size from opening gaps. */
#board{aspect-ratio:calc(var(--width) * 1.25 / 9);grid-template-rows:repeat(9,minmax(0,1fr));align-items:stretch;gap:1px}
#board button{appearance:none;-webkit-appearance:none;aspect-ratio:auto;width:100%;height:100%;min-height:0;min-width:0;margin:0;box-sizing:border-box}
.speech.warning-2{background:#f00000;border-color:#bb0000;color:#fff}.speech.warning-2:after{border-top-color:#f00000}
.check-alert{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);z-index:200;background:#d90000;color:white;font-size:clamp(22px,5vw,38px);font-weight:900;padding:22px 30px;border:4px solid white;border-radius:20px;box-shadow:0 8px 30px #0005;text-align:center;pointer-events:none;max-width:90vw}.check-alert[hidden]{display:none}
@media(max-width:750px){.speech{font-size:clamp(8px,2.3vw,11px);padding:3px 5px}}

/* V013: persistent result card in the centre of the board. */
.board-wrap{position:relative}
.result-overlay{position:absolute;inset:9px;z-index:50;display:flex;align-items:center;justify-content:center;background:#183b5959;border-radius:10px;padding:12px}
.result-overlay[hidden]{display:none}
.result-card{width:min(92%,520px);padding:clamp(18px,4vw,36px);text-align:center;background:#fff9e7;border:5px solid #e8b647;border-radius:24px;box-shadow:0 10px 35px #142c5966;color:#183b59}
.result-card h2{font-size:clamp(27px,5vw,56px);line-height:1.3;margin:10px 0 18px;font-weight:900;word-break:keep-all;overflow-wrap:break-word}
.result-card p{line-height:1.8}.result-card .result-symbol{font-size:42px;line-height:1;color:#ba800e;margin:0}
.result-card button{margin-top:10px;background:#183b59;color:white;border-color:#183b59;font-size:18px;padding:13px 22px}
.result-overlay[data-outcome="loss"] .result-card{background:#f0f6ff;border-color:#83add6}.result-overlay[data-outcome="loss"] .result-symbol{color:#527fab}

/* V014: public demo navigation. */
header{flex-wrap:wrap}.back-to-experiences{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:9px 14px;border:1px solid #769e8c;border-radius:12px;background:#fff;color:#244f42;text-decoration:none;font-size:14px;font-weight:700}.back-to-experiences:hover{background:#e9f4eb}.back-to-experiences:focus-visible{outline:3px solid #227b76;outline-offset:3px}header .back-to-experiences{margin-left:auto}footer p{margin:12px 0 0}

/* V015: nine equal rows and square cells at every board width. */
#board{aspect-ratio:calc(var(--width) / 9);gap:0;border:0;outline:1px solid #729db2;grid-template-rows:repeat(9,minmax(0,1fr))}
#board button{aspect-ratio:1;border:0;border-right:1px solid #729db2;border-bottom:1px solid #729db2;box-sizing:border-box}
/* SVG lettering uses the piece's own square coordinate system, never viewport units. */
.piece .piece-letter,.hand .piece-letter{position:absolute;inset:0;top:0;left:0;width:100%;height:100%;display:block;font-size:inherit;line-height:normal;text-shadow:none;overflow:hidden}
.piece-letter text{fill:currentColor;font-family:'Yu Mincho','Hiragino Mincho ProN',serif;font-weight:900}
