:root{font-family:-apple-system,BlinkMacSystemFont,"Hiragino Kaku Gothic ProN","Noto Sans JP",sans-serif;color:#273e37;background:#f6f5ef;font-synthesis:none}*{box-sizing:border-box}body{margin:0}button,input{font:inherit}button{min-height:42px;border:1px solid #d8ded6;border-radius:7px;background:#fff;color:#344b43;padding:9px 13px;cursor:pointer;transition:background .15s}button:hover{background:#edf2eb}button:disabled{opacity:.38;cursor:default}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #cf9147;outline-offset:3px}[hidden]{display:none!important}header{height:94px;display:flex;align-items:center;gap:30px;border-bottom:1px solid #dfe2d8;padding:0 5vw;background:#fafaf6}.brand{display:flex;gap:12px;align-items:center;color:inherit;text-decoration:none;font-size:21px;font-weight:700;letter-spacing:.04em}.brand-icon{font-size:42px;color:#56806b}.brand small{display:block;font-size:9px;letter-spacing:.17em;margin-top:5px;color:#77867a}.header-note{margin-left:auto;color:#809084;font-size:12px}header button{background:transparent}main{max-width:1500px;margin:auto;padding:35px 4vw 24px}.intro{display:flex;justify-content:space-between;align-items:center;margin-bottom:28px}.eyebrow{font-size:11px;letter-spacing:.16em;color:#7b8e7d}h1{font-size:clamp(22px,2.5vw,32px);font-weight:600;letter-spacing:.04em;margin:10px 0}.intro p{font-size:12px;line-height:1.9;color:#7a877c}.modes{display:flex;gap:8px;margin-bottom:22px}.modes button{flex:1;border:0;background:#eaece3;color:#8b988a;display:flex;align-items:center;gap:16px;padding:17px 23px;text-align:left;font-size:12px}.modes span{font-size:14px;font-weight:600}.modes .active{background:#315b48;color:#fff}.workspace{display:grid;grid-template-columns:255px minmax(0,1fr);gap:25px}aside{background:#fcfcf8;border:1px solid #dfe4da;border-radius:10px;padding:21px}section+section{border-top:1px solid #e4e7df;margin-top:20px;padding-top:20px}.section-label{font-size:12px;letter-spacing:.06em;font-weight:700;margin-bottom:16px;display:block}.section-label span{float:right;font-weight:400;font-size:10px;color:#919a8e}label[for=title]{display:block;font-size:11px;color:#8b958a;margin-bottom:7px}#title{width:100%;padding:10px;border:1px solid #dce2d8;border-radius:5px;background:#fff;color:#354e42;font-size:13px}.muted{font-size:11px;color:#859182;line-height:1.8}.badge{display:inline-block;border:1px solid #d5ddcf;border-radius:4px;padding:4px 7px;font-size:10px;color:#77866d}#piece-list label{display:flex;align-items:center;gap:9px;font-size:12px;min-height:36px;cursor:pointer}input[type=checkbox]{accent-color:#39684f;width:17px;height:17px}.swatch{width:28px;height:28px;flex:0 0 28px;display:block;overflow:visible}.piece-area{margin-left:auto;color:#899585;font-size:11px}.totals{display:flex;gap:24px;margin-top:17px;padding-top:15px;border-top:1px dashed #d9dfd3}.totals>div{display:flex;flex-direction:column;gap:4px}.totals strong{font-size:30px;font-weight:500;line-height:1.2}.totals span{font-size:9px;color:#82917e}.area-text{font-size:11px;color:#5b775d}.actions{display:grid;gap:10px}.actions button{width:100%;font-size:12px}.primary{background:#315b48;color:#fff;border-color:#315b48}.primary:hover{background:#244a38}.primary span{float:right}.board-column{min-width:0}.board-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;gap:8px}.board-top strong{font-size:13px;font-weight:600}.live-dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:#60866a;margin-right:9px}.history{display:flex;gap:6px}.history button{font-size:12px;padding:7px 12px;min-height:36px}#board-wrap{position:relative;background:#fffef9;border:1px solid #d8dfd3;border-radius:9px;overflow:hidden;box-shadow:0 4px 20px #344a3410}#board{width:100%;display:block;touch-action:none;user-select:none;-webkit-user-select:none;aspect-ratio:5/3}#pieces polygon{cursor:grab;stroke:#fffef9;stroke-width:.025;stroke-linejoin:round}#pieces polygon.selected{stroke:#294c3c;stroke-width:.055;filter:drop-shadow(0px .05px .055px #1c342542)}#pieces polygon.invalid{stroke:#c33f34;stroke-width:.08}#pieces polygon:focus-visible{outline:none;stroke:#172f25;stroke-width:.08}#pieces polygon:active{cursor:grabbing}#answer-label{position:absolute;left:12px;top:12px;background:#fff;padding:8px;border-radius:6px;font-size:12px}#answer-label button{margin-left:10px;min-height:32px;padding:4px 8px}.board-bottom{display:flex;align-items:center;justify-content:space-between;padding:15px 0;gap:10px}.status-row{display:flex;gap:8px}.status{font-size:11px;padding:5px 8px;border-radius:5px;background:#e7eee1;color:#5d7857}.status.bad{color:#a8654d;background:#f6e9dd}.switch{display:flex;align-items:center;gap:6px;font-size:11px;color:#74856e}.board-hint{color:#8a9682;font-size:11px;margin:0 0 12px}#message{padding:14px 16px;background:#eaf0e4;border-left:3px solid #7f9c70;border-radius:3px;font-size:12px;line-height:1.8;min-height:50px}#message.error{background:#fff0e6;border-color:#c77b52;color:#935133}.file-bar{display:flex;justify-content:space-between;align-items:center;border-top:1px solid #dce2d5;margin-top:27px;padding:22px 0;gap:16px}.file-bar .section-label{margin:0 0 5px}.file-bar>div:last-child{display:flex;gap:8px;flex-wrap:wrap}.file-bar button{font-size:11px}.lesson-note{display:flex;align-items:center;gap:22px;background:#eeeee4;border-radius:8px;padding:18px 24px}.lesson-note>span{font-size:11px;white-space:nowrap;color:#7e8a6c}.lesson-note p{font-size:11px;line-height:1.9;margin:0;color:#7f8975}.lesson-note a{margin-left:auto;font-size:10px;white-space:nowrap;color:#6f8167}dialog{max-width:620px;width:90%;border:1px solid #d6dece;border-radius:12px;padding:30px;color:#344b3b;background:#fcfcf7}dialog::backdrop{background:#1c30245c}dialog h2{font-size:21px}dialog p{font-size:13px;line-height:1.9}@media(min-width:1500px){#board-wrap{max-height:650px}}@media(max-width:1000px){main{padding:25px 3vw}.workspace{grid-template-columns:210px minmax(0,1fr);gap:16px}aside{padding:15px}.intro p{display:none}.modes button{padding:15px;gap:10px}.modes span{font-size:12px}.board-bottom{align-items:flex-start;flex-wrap:wrap}.file-bar{align-items:flex-start}.header-note{display:none}header button{margin-left:auto}}@media(max-width:700px){header{height:75px;padding:0 5vw}.brand{font-size:17px}.intro{margin-bottom:18px}h1{font-size:22px}.modes{gap:4px}.modes button{flex-direction:column;gap:5px;padding:12px 5px;font-size:10px}.modes span{font-size:10px}.workspace{display:flex;flex-direction:column}.board-column{order:-1}.board-top strong{font-size:12px}aside{display:grid;grid-template-columns:1fr 1fr;gap:16px}aside section{margin:0;padding:0;border:0}aside section:last-child{grid-column:1/-1;border-top:1px solid #dfe4da;padding-top:16px;display:flex;flex-wrap:wrap}.actions button{width:auto;flex:1}#piece-list label{min-height:32px;font-size:10px}.totals{gap:16px}.totals strong{font-size:24px}.file-bar{flex-direction:column}.lesson-note{padding:15px;gap:10px;align-items:flex-start;flex-wrap:wrap}.lesson-note a{margin-left:0}.board-hint{font-size:10px}#message{font-size:11px}.status-row{gap:4px}.status{font-size:10px} }

/* Success remains in the normal flow below the board, never over the pieces. */
#message.success{display:flex;align-items:center;gap:16px;padding:18px 20px;background:#e0f5df;border:2px solid #82bc79;border-radius:8px;color:#245b30;line-height:1.5}
#message.success .success-check{display:flex;align-items:center;justify-content:center;flex:0 0 42px;width:42px;height:42px;border-radius:50%;background:#398449;color:#fff;font-size:28px;font-weight:800}
#message.success strong{display:block;font-size:clamp(24px,3vw,32px);font-weight:800;letter-spacing:.04em}
#message.success div>span{display:block;margin-top:4px;font-size:12px}
@media(max-width:1000px){#piece-list label{gap:6px}.swatch{width:24px;height:24px;flex-basis:24px}}
@media(max-width:700px){#message.success{gap:12px;padding:14px}#message.success strong{font-size:24px}#message.success div>span{font-size:11px}}
#message.success strong{display:block;font-size:clamp(24px,3vw,32px);font-weight:800;line-height:1.35;margin-bottom:4px}
#message.success div>span{display:block;font-size:12px}
.success-check{display:grid;place-items:center;width:44px;height:44px;flex:0 0 44px;border-radius:50%;background:#31854a;color:#fff;font-size:30px;font-weight:800;line-height:1}
.view-controls{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin:0 0 10px}
.view-controls button{font-size:11px;min-height:44px;padding:8px 11px}
.zoom-buttons{display:flex;align-items:center;gap:3px}
.zoom-buttons button{font-size:20px;min-width:44px;padding:4px 9px}
#zoom-level{font-size:11px;min-width:44px;text-align:center;font-variant-numeric:tabular-nums;color:#60745f}
#pan-view[aria-pressed=true]{background:#315b48;color:#fff;border-color:#315b48}
#board{cursor:grab}#board.pan-enabled polygon{cursor:grab}#board.panning,#board.panning polygon{cursor:grabbing}
@media(max-width:700px){.view-controls{gap:5px}.view-controls button{padding:7px 9px}}
.puzzle-library{margin:0 0 12px;padding:10px 12px;background:#fcfcf8;border:1px solid #dfe4da;border-radius:8px}
.puzzle-sources{display:flex;gap:6px;margin-bottom:8px}.puzzle-library button{min-height:44px;font-size:11px;padding:7px 11px}
.puzzle-sources button[aria-pressed=true],.problem-level button[aria-pressed=true]{background:#315b48;color:#fff;border-color:#315b48}
.builtin-toolbar{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;flex-wrap:wrap}
#problem-picker{position:relative;flex:1;min-width:220px}#problem-summary{cursor:pointer;min-height:44px;padding:12px 6px;font-size:12px;color:#365a42}
#problem-list{position:absolute;top:100%;left:0;z-index:5;background:#fffef9;border:1px solid #d8dfd3;border-radius:8px;padding:10px;box-shadow:0 5px 18px #29453420;width:355px;max-width:calc(100vw - 50px)}
.problem-level{display:grid;grid-template-columns:55px repeat(5,minmax(36px,1fr));gap:4px;align-items:center;margin-bottom:5px}.problem-level:last-child{margin-bottom:0}.problem-level>span{font-size:10px;color:#71826b}.problem-level button{padding:6px 3px}
.problem-navigation{display:flex;gap:5px}#custom-controls{display:flex;gap:6px;align-items:center;flex-wrap:wrap}#custom-problem-status{font-size:11px;color:#72836d;flex:1;min-width:130px;overflow-wrap:anywhere}
@media(max-width:1000px){#problem-picker{min-width:200px}.builtin-toolbar{gap:2px}#problem-list{width:325px}}
@media(max-width:700px){.puzzle-library{padding:8px}.puzzle-library button{padding:7px 9px}#problem-list{width:310px}.problem-navigation{margin-top:2px}.puzzle-sources button{flex:1}}
@media(min-width:1100px){.puzzle-library{display:flex;align-items:flex-start;gap:10px;flex-wrap:wrap}.puzzle-sources{margin-bottom:0;flex:0 0 auto}#builtin-controls{flex:1;min-width:440px}#custom-controls{flex:1;min-width:300px}}

/* Always reserves its own space outside the SVG; never floats over a piece. */
#piece-tools{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:8px 10px;margin:0 0 10px;min-height:62px;border:1px solid #d8dfd3;border-radius:8px;background:#fcfcf8}
#selected-name{display:block;flex:0 0 7.5em;width:7.5em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:#65785d}
#piece-tools button{min-height:44px;min-width:88px;padding:8px 10px;font-size:12px}
#piece-tools #flip{min-width:60px}
@media(max-width:700px){#piece-tools{gap:6px;padding:8px}#piece-tools button{font-size:11px;min-width:82px;padding:8px}#piece-tools #flip{min-width:54px}}
