:root{--ink:#344b40;--muted:#778478;--green:#32664d;--mint:#dfebc9;--paper:#fffdf6;--line:#dfe4d8;--orange:#d97743;--red:#b64142;font-family:'Yu Gothic','Meiryo',sans-serif;color:var(--ink);background:#f7f8f0;font-synthesis:none}*{box-sizing:border-box}body{margin:0}button,a,input{-webkit-tap-highlight-color:transparent}button{font:inherit;cursor:pointer}button:disabled{cursor:not-allowed}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #d88635;outline-offset:5px}button{transition:background .15s,transform .15s}button:hover:not(:disabled){filter:brightness(.97)}a{color:inherit;text-decoration:none}[hidden]{display:none!important}.site-header{height:90px;max-width:1320px;margin:auto;display:flex;align-items:center;justify-content:space-between;padding:0 36px;border-bottom:1px solid var(--line)}.brand{font-size:19px;font-weight:900;display:flex;align-items:center;gap:9px}.brand small{font-size:9px;letter-spacing:1.4px;margin-left:5px}.brand-icon{background:var(--green);color:#fff6d6;border-radius:12px;padding:7px 12px}.site-header nav{display:flex;gap:6px}nav button{border:0;background:transparent;color:#758071;font-size:12px;padding:10px 13px;border-radius:20px}nav button[aria-current=page]{background:#e5ebdc;color:var(--green);font-weight:bold}.prototype{font-size:10px;letter-spacing:1.5px;color:var(--muted)}main{max-width:1248px;margin:auto;padding:32px 28px 0}.screen{min-height:640px}.title-screen{display:grid;grid-template-columns:42% 58%;gap:0;padding-top:8px}.hero-copy{padding:27px 0 0 13px}.eyebrow{font-size:11px;letter-spacing:2.2px;font-weight:800;color:#71856b}h1{font-size:76px;letter-spacing:-5px;line-height:1.14;margin:25px 0 25px;font-weight:900}h1>span{color:#ce8247}h1 i{display:block;font-size:13px;font-style:normal;letter-spacing:6px;padding-left:4px;margin-top:15px;color:#7c896d}.lead{font-size:27px;font-weight:bold;line-height:1.7;margin:0 0 16px}.description{font-size:13px;line-height:2;color:#768170;margin-bottom:25px}.primary{display:flex;align-items:center;justify-content:space-between;gap:30px;border:0;background:var(--green);color:white;padding:17px 25px;border-radius:12px;font-size:15px;font-weight:bold;box-shadow:0 4px 0 #214e38}.primary span{font-size:11px;letter-spacing:1px}.hero-copy>.primary{width:300px}.settings-button{background:none;border:0;color:#71816b;padding:19px 6px;font-size:13px}.settings-button span{font-size:10px;letter-spacing:1.2px;margin-left:18px}.keyboard-note{font-size:10px;color:#849080;display:flex;align-items:center;gap:5px;margin-top:7px}kbd{background:#fffef9;border:1px solid #d7ddd0;border-bottom:3px solid #d7ddd0;padding:4px 7px;border-radius:4px}.garden{background:#e4edce;position:relative;overflow:hidden}.hero-art{border-radius:48% 48% 24px 24px;min-height:550px;margin-left:8px;background:linear-gradient(#edf2dd 0 37%,#dfe9c8 37% 100%)}.sun{position:absolute;width:65px;height:65px;right:95px;top:58px;border-radius:50%;background:#f7d996}.cloud{position:absolute;width:80px;height:22px;border-radius:50px;background:#fffdf3;top:130px;left:65px}.cloud:before{content:'';position:absolute;width:37px;height:37px;border-radius:50%;background:inherit;top:-18px;left:18px}.c2{left:auto;right:37px;top:165px;transform:scale(.7)}.fence{position:absolute;left:0;right:0;top:205px;height:52px;background:repeating-linear-gradient(90deg,transparent 0 28px,#f9f7e6 28px 41px,transparent 41px 65px);border-bottom:9px solid #f9f7e6;transform:rotate(-3deg)}.hero-ground{position:absolute;width:640px;height:280px;background:#d1dfb5;border-radius:50%;left:-20px;bottom:-90px}.hero-circle{position:absolute;width:380px;height:165px;background:#f2edcf;border-radius:50%;left:100px;top:325px;transform:rotate(-8deg)}.hero-dog{position:absolute;width:270px;left:175px;top:192px;transform:rotate(-4deg)}.hero-food{position:absolute;width:170px;left:225px;top:379px}.hero-cat{position:absolute;width:118px;left:25px;top:311px;transform:rotate(10deg)}.hero-rabbit{position:absolute;width:105px;right:19px;top:295px;transform:rotate(-9deg)}.speech{position:absolute;top:167px;left:150px;background:var(--paper);padding:13px 21px;border-radius:24px;font-size:13px;font-weight:bold;transform:rotate(-6deg)}.speech:after{content:'';position:absolute;bottom:-9px;right:35px;border-top:12px solid var(--paper);border-right:13px solid transparent}.hero-badge{position:absolute;bottom:26px;left:31px;display:flex;align-items:center;gap:14px;background:#fffdf0e8;padding:14px 20px;border:1px solid white;border-radius:15px;transform:rotate(-3deg);font-size:13px;font-weight:bold}.hero-badge>span{font-size:30px;color:#7f9866}.hero-badge small{display:block;font-size:10px;font-weight:400;margin-top:4px;color:#778268}.flower{position:absolute;color:#fff8df;font-size:31px}.f1{top:265px;left:110px}.f2{bottom:55px;right:62px;color:#f6dda3}.f3{top:395px;right:25px;font-size:23px}.title-bottom{grid-column:1/-1;display:flex;justify-content:space-between;margin-top:35px;padding:23px 10px;border-top:1px solid var(--line);font-size:11px;color:#87907c}.title-bottom b{color:var(--ink);margin:0 10px;font-size:13px}footer{max-width:1192px;margin:20px auto 0;border-top:1px solid var(--line);padding:22px 0;display:flex;justify-content:space-between;color:#85907e;font-size:9px;letter-spacing:1px}footer b{padding:0 10px;color:#c6cfb9}.section-heading{text-align:center;padding:20px 0 28px}.section-heading h2{font-size:30px;margin:13px 0 10px}.section-heading p{font-size:12px;color:var(--muted)}.mode-layout{display:grid;grid-template-columns:1.5fr 1fr;gap:45px;max-width:990px;margin:0 auto 35px}.mode-form{padding-top:10px}fieldset{border:0;padding:0;margin:0 0 30px}legend{font-size:11px;color:#839476;font-weight:bold;margin-bottom:15px}legend span{font-size:15px;color:var(--ink);margin-left:14px}.choices{display:flex;gap:12px}.choice{flex:1;text-align:left;border:1px solid #dce1d4;border-radius:12px;background:#fffdf7;padding:17px 18px;color:var(--ink);font-size:15px;font-weight:bold}.choice small{display:block;color:#7b8874;font-size:10px;font-weight:normal;margin-top:8px}.choice.selected{border:2px solid #528063;background:#eaf0df;padding:16px 17px}.choice:disabled{background:#edf0e7;color:#92998c;opacity:.75}.muted{font-size:10px;line-height:1.9;color:var(--muted)}.ready-card{background:#e8edda;border:1px solid #dce3cf;border-radius:22px;padding:25px 32px;text-align:center}.ready-card>img{display:block;width:155px;margin:3px auto 0}.ready-card h3{font-size:18px;margin:8px 0}.ready-card p{font-size:11px;margin:12px}.ready-card strong{font:700 28px monospace;margin-right:8px}.ready-summary{border-top:1px solid #d0dbc2;padding:15px;font-size:11px}.ready-card .primary{width:100%}.ready-card>small{display:block;font-size:9px;color:#7d8871;margin-top:15px}.game-top{display:flex;align-items:center;justify-content:space-between;padding:0 12px 24px;gap:20px}.difficulty-pill{display:block;font-size:10px;margin-top:10px;background:#e8edde;padding:5px 12px;border-radius:20px;width:fit-content}.stat small{display:block;font-size:10px;color:#7c8875;margin-bottom:6px;letter-spacing:1px}.stat strong{font:700 30px 'Consolas',monospace}.time-track{width:130px;height:4px;background:#dfe6d4;margin-top:6px;border-radius:3px}.time-track i{display:block;width:77%;height:100%;background:#809864}.quiet{border:1px solid #d6ddce;background:#fffdf7;border-radius:9px;color:#5f745d;padding:11px 16px;font-size:11px}.arena{height:505px;border:1px solid #d0dec0;border-radius:24px;background:radial-gradient(ellipse at 50% 48%,#edf0d9 0 22%,#e1ebcb 54%,#dce7c4 100%)}.arena-path{position:absolute;width:880px;height:240px;top:110px;left:130px;border:38px solid #e9e8c8;border-radius:50%;transform:rotate(-20deg);opacity:.7}.safe-circle{position:absolute;width:320px;height:260px;left:50%;top:52%;transform:translate(-50%,-50%);border:2px dashed #bacb9c;border-radius:50%;background:#f0edcd66}.arena-caption{position:absolute;top:27px;left:50%;transform:translateX(-50%);font-size:10px;letter-spacing:2px;color:#839575}.enemy{position:absolute;display:flex;flex-direction:column;align-items:center;width:180px;z-index:3}.enemy>img{width:93px;height:90px;object-fit:contain;margin-top:5px}.enemy.fast>img{width:78px;height:82px}.enemy.big>img{width:122px;height:116px}.word-label{background:#f8f9f3;border:1px solid #aeb9a6;box-shadow:0 3px 0 #a4b39730;border-radius:9px;padding:7px 16px 9px;min-width:116px;text-align:center;color:#4e574e;position:relative}.word-label:after{content:'';position:absolute;bottom:-6px;left:calc(50% - 5px);width:9px;height:9px;background:inherit;border-right:1px solid #aeb9a6;border-bottom:1px solid #aeb9a6;transform:rotate(45deg)}.word-label small{display:block;font-size:10px;margin-bottom:3px;color:#76806e}.word-label code{font:700 21px 'Consolas','Courier New',monospace;letter-spacing:1.5px;white-space:nowrap}.type-tag{font-size:9px;color:#6a7b5e;background:#edf2e0;padding:3px 8px;border-radius:20px;margin-top:-1px}.e1{left:7%;top:35px}.e2{right:9%;top:32px}.e3{right:4%;bottom:38px}.e4{left:20%;bottom:41px}.e5{left:2%;bottom:24px}.target .word-label{border:2px solid #347b5b;background:#fffef1;box-shadow:0 0 0 5px #61956624}.target .word-label:after{border-color:#347b5b}.target-tag{font-size:9px;color:#2b674b;font-weight:bold;margin-bottom:7px;white-space:nowrap}.target>img{filter:drop-shadow(0 3px 0 #839e6330)}.typed{color:#4d8866;background:#e1edcf}.next-letter{color:#284e39;border-bottom:3px solid #32664d}.danger-tag{background:#fff2d9;color:#95622d;border:1px solid #ddb36d;border-radius:15px;font-size:9px;font-weight:bold;padding:3px 9px}.target-line{position:absolute;left:34%;top:60%;width:14%;border-top:2px dashed #92ad78;transform:rotate(-30deg);z-index:1}.guard-center{position:absolute;left:50%;top:49%;transform:translate(-50%,-50%);display:flex;align-items:center;flex-direction:column;width:186px;z-index:2}.center-dog{width:153px}.center-food{width:108px;margin-top:-27px}.health-card{margin-top:3px;background:#fffdf0;padding:10px 13px 11px;border-radius:10px;width:186px;box-shadow:0 4px 12px #657f4612}.health-card>div:first-child{display:flex;justify-content:space-between;font-size:9px;gap:9px}.health-card b{font-weight:700}.hp-track{height:9px;border-radius:6px;background:#e2e5d8;margin-top:7px;overflow:hidden}.hp-track i{display:block;width:80%;height:100%;border-radius:6px;background:#6e9d68}.combo{position:absolute;right:29px;top:209px;color:#799160;font-size:10px;font-weight:bold}.combo strong{font:700 28px monospace}.combo span{display:block;font-size:9px;text-align:right;margin-top:5px}.af1{left:36%;top:40px}.af2{right:23%;bottom:34px;color:#eec681}.af3{left:13%;top:244px;font-size:22px}.grass{position:absolute;color:#9cb482;font-size:35px}.g1{left:30%;top:50px}.g2{right:22%;top:200px}.g3{left:47%;bottom:17px}.game-bottom{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:18px 0 0;font-size:11px}.game-bottom small{display:block;font-size:10px;color:#7e8a73;margin:7px 0 0 15px}.typed-sample{color:#518569}.live-dot{display:inline-block;width:6px;height:6px;background:#779a66;border-radius:50%;margin-right:8px}.mock-note{text-align:center;font-size:9px;color:#89927f;margin-top:19px}#pause-overlay{position:absolute;inset:0;background:#f7f8efeF;z-index:22;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:25px;font-size:25px;font-weight:bold}
#ready-overlay{position:absolute;inset:0;z-index:18;display:flex;align-items:center;justify-content:center;pointer-events:none;background:#f7f8ef55}
#ready-overlay[hidden]{display:none!important}
#finish-overlay{position:absolute;inset:0;z-index:24;display:flex;align-items:center;justify-content:center;background:#344b40b8;overflow:hidden}
#finish-overlay[hidden]{display:none!important}
#finish-overlay strong{display:block;padding:.28em .7em .34em;border:2px solid #fffdf6;border-radius:18px;background:#fffdf6e8;color:var(--green);font-size:clamp(42px,8vw,76px);font-weight:900;line-height:1;letter-spacing:.12em;text-indent:.12em;box-shadow:0 12px 32px #1f352b52;animation:finish-pop .4s ease-out both}
@keyframes finish-pop{from{opacity:0;transform:scale(.72)}to{opacity:1;transform:scale(1)}}
#ready-text{font-size:48px;font-weight:900;letter-spacing:.18em;color:#32664d;text-shadow:0 2px 0 #fffdf6}.word-label.miss{background:#fff0eb;border-color:var(--red);color:var(--red);animation:shake .18s 2}.word-label.miss:before{content:'ミス · もう一度';position:absolute;left:0;right:0;top:-24px;background:#fff0eb;color:var(--red);font:700 10px sans-serif;padding:4px;border-radius:6px}@keyframes shake{50%{transform:translateX(4px)}}.result-layout{display:grid;grid-template-columns:1.35fr 1fr;gap:24px;max-width:1000px;margin:auto}.score-card{border:1px solid #dce3d1;border-radius:22px;background:#fffdf6;padding:18px 30px 25px;text-align:center}.score-illustration{height:111px;position:relative;width:180px;margin:auto}.score-illustration img:first-child{width:108px;position:absolute;left:15px;top:0}.score-illustration img:last-child{width:75px;position:absolute;right:7px;bottom:4px}.total-score{display:block;font:700 62px 'Consolas',monospace;letter-spacing:-2px;margin:5px 0 7px}.score-caption{font-size:11px;color:#849173}.result-metrics{display:grid;grid-template-columns:repeat(3,1fr);gap:22px 10px;border-top:1px solid #e3e7da;margin-top:25px;padding-top:22px}.result-metrics small{display:block;font-size:9px;color:#839076;margin-bottom:7px}.result-metrics b{font:700 25px monospace}.result-metrics b span{font-size:12px;margin-left:3px}.analysis-card{border-radius:22px;background:#eaf0df;padding:28px}.analysis-card h3{font-size:19px;margin:15px 0 8px}.analysis-card>p{font-size:11px;color:#7b886f}.bigrams{list-style:none;margin:18px 0;padding:0}.bigrams li{display:flex;align-items:center;gap:15px;padding:9px 0;border-bottom:1px solid #d6e0c9}.bigrams code{font:700 18px monospace;background:#fffdf4;padding:3px 8px;border-radius:6px}.bigrams span{font-size:10px;color:#7c886e;flex:1}.bigrams b{font-size:10px;color:#9daa8e}.analysis-progress{display:flex;flex-wrap:wrap;gap:9px;justify-content:space-between;font-size:10px;margin-top:21px}.analysis-progress>div{width:100%;height:6px;border-radius:9px;background:#d3dec5}.analysis-progress i{display:block;height:100%;width:65.2%;background:#809d65;border-radius:9px}.analysis-progress small{font-size:9px;line-height:1.9;color:#78856b}.analysis-card .muted{font-size:9px}.result-actions{display:flex;justify-content:center;gap:15px;margin:25px 0}.result-actions .primary{min-width:240px}dialog{border:1px solid #d4dec7;border-radius:20px;background:var(--paper);color:var(--ink);padding:35px;max-width:90vw}dialog::backdrop{background:#263e3655}dialog h2{font-size:24px}dialog label{display:block;font-size:13px;margin:25px 0}dialog p{font-size:11px;line-height:2;color:var(--muted)}dialog .primary{margin-top:22px;width:100%}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important}}@media(min-width:1450px){main{padding-top:45px}.title-screen{padding-top:15px}}@media(max-width:1000px){.brand small,.prototype{display:none}.hero-art{transform:none}.hero-dog{left:23%;width:235px}.hero-food{left:34%}.hero-cat{left:0;width:100px}.hero-rabbit{right:0;width:85px}.hero-circle{left:10%;width:85%}.speech{left:20%}.hero-copy{padding-left:0}h1{font-size:59px}.hero-copy>.primary{width:90%}.mode-layout{gap:20px}.e4{left:18%}.e3{right:1%}.e5{left:0}.e1{left:3%}.enemy{width:150px}.game-bottom{flex-wrap:wrap}}@media(max-width:720px){.site-header{height:auto;min-height:90px;padding:16px 20px;flex-wrap:wrap;gap:15px}.brand{font-size:17px}.site-header nav{width:100%;justify-content:space-between}nav button{padding:7px 11px}main{padding:18px 18px 0}.title-screen{grid-template-columns:1fr}.hero-copy{padding:10px 6px}.hero-art{height:460px;min-height:460px;margin:22px 0 0;max-width:580px}.hero-dog{top:135px;left:25%;width:230px}.hero-food{top:298px;left:36%;width:135px}.speech{top:103px}.hero-cat{top:260px}.hero-rabbit{top:226px}.hero-circle{top:265px}.fence{top:155px}.hero-badge{bottom:15px;font-size:11px}.sun{top:24px;right:60px;width:45px;height:45px}.c1{top:78px}.c2{top:110px}.title-bottom{flex-direction:column;gap:17px;margin-top:23px}.hero-copy>.primary{width:100%;max-width:360px}.lead{font-size:23px}.description{font-size:12px}.section-heading h2{font-size:23px}.mode-layout,.result-layout{grid-template-columns:1fr}.choice{padding:14px 10px;font-size:13px}.choice.selected{padding:13px 9px}.choice small{font-size:9px}.ready-card{max-width:450px;width:100%;margin:auto}.game-top{gap:10px;padding:0 0 18px;flex-wrap:wrap}.stat strong{font-size:24px}.game-top>.quiet{padding:8px}.time-track{width:85px}.arena{height:720px}.arena-path{width:700px;left:-200px;top:250px}.safe-circle{width:250px;height:235px;top:49%}.guard-center{top:49%}.e1{left:0;top:50px}.e2{right:0;top:70px}.e3{right:0;bottom:20px}.e4{left:0;bottom:208px}.e5{left:0;bottom:20px}.target-line{left:22%;top:56%;width:25%}.enemy{width:145px}.enemy>img{height:75px}.word-label{min-width:105px;padding:6px 10px}.word-label code{font-size:18px;letter-spacing:.5px}.combo{top:205px;right:16px}.target-tag{font-size:8px}.guard-center{width:165px;left:58%}.center-dog{width:126px}.center-food{width:94px}.health-card{width:162px;padding:9px}.health-card>div:first-child{font-size:8px}.game-bottom>div:last-child{display:flex;gap:8px;width:100%;justify-content:space-between;margin-top:8px}.game-bottom{font-size:10px}.mock-note{line-height:1.8}.result-actions{flex-wrap:wrap}.result-actions .primary{min-width:220px}footer{margin:20px 18px 0;gap:12px;flex-direction:column;font-size:8px}.total-score{font-size:56px}}@media(max-width:360px){.word-label code{font-size:16px}.enemy{width:128px}.guard-center{left:61%}.choices{gap:6px}}
/* 狭い画面ではコンボを上端の専用スペースに移動。敵の種別と重ねない。 */
@media(max-width:720px){.combo{top:12px;right:15px;font-size:9px}.combo strong{font-size:22px}.combo span{font-size:8px}.arena-caption{left:17px;top:24px;transform:none;font-size:8px;letter-spacing:1px}}

/* Phase 1: dynamic enemies, HP, pause extra, result fail */
.wpm-stat strong{font-size:24px}
.analysis-panel{max-width:1000px;margin:0 auto 28px}
.analysis-meta{font-size:12px;color:#7b886f;line-height:1.8}
.analysis-columns{display:grid;grid-template-columns:1fr 1fr;gap:24px;margin:18px 0}
.analysis-table-wrap{overflow:auto;border:1px solid #dce3d1;border-radius:14px;background:#fffdf6}
.analysis-table{width:100%;border-collapse:collapse;font-size:12px}
.analysis-table th,.analysis-table td{padding:8px 10px;text-align:left;border-bottom:1px solid #e3e7da}
.analysis-table code{font:700 14px Consolas,monospace}
#analysis-open-result{margin-top:8px}
#ime-hint{display:block;margin-top:6px;font-size:10px;color:#7e8a73}
#time-bar{width:100%}
#hp-bar{width:100%}
.arena{outline:none;height:720px;max-width:960px;width:100%;margin-left:auto;margin-right:auto;overflow:hidden;position:relative}
.safe-circle{width:240px;height:214px}
.word-label .word-main{display:block;font-size:15px;font-weight:800;line-height:1.2;letter-spacing:.02em;color:#3d4a40;white-space:nowrap}
.word-label.word-en .word-main{white-space:pre}
.word-label.word-en .typed,
.word-label.word-en .next-letter{white-space:pre}
.word-label .word-roma{display:block;font:700 9px Consolas,'Courier New',monospace;letter-spacing:.5px;color:#7a8678;margin-top:1px;background:transparent;white-space:nowrap}
.word-label{white-space:nowrap}
.word-label .word-roma .typed,.word-label .word-roma .next-letter{font-size:inherit}
.word-label.word-en .word-main,.word-label .word-main .typed,.word-label .word-main .next-letter{font-family:Consolas,'Courier New',monospace}
.foe-layer,.float-layer,.label-layer{position:absolute;inset:0;z-index:3;pointer-events:none}
.label-layer{z-index:12;isolation:isolate}
.float-layer{z-index:8}
.arena .enemy{width:0;height:0;display:block;left:0;top:0;align-items:stretch}
.arena .enemy-art{position:absolute;left:0;top:0;transform:translate(-50%,-40%);margin:0;width:76px;height:74px;object-fit:contain}
.arena .enemy.fast .enemy-art{width:64px;height:68px}
.arena .enemy.big .enemy-art{width:100px;height:96px}
.arena .word-label{position:absolute;left:0;top:0;z-index:10;pointer-events:none;padding:4px 8px 5px;min-width:56px}
.arena .word-label.slot-below:after{top:-5px;bottom:auto;transform:rotate(225deg)}
.arena .word-label.slot-left:after{left:auto;right:-5px;top:calc(50% - 5px);bottom:auto;transform:rotate(-45deg)}
.arena .word-label.slot-right:after{left:-5px;top:calc(50% - 5px);bottom:auto;transform:rotate(135deg)}
.arena .type-tag,.arena .danger-tag{position:absolute;left:0;white-space:nowrap;transform:translate(-50%,44px)}
.arena .danger-tag{transform:translate(-50%,62px);z-index:4}
.arena .word-label.target{border:2px solid #347b5b;background:#fffef1;box-shadow:0 0 0 4px #61956624,0 0 14px #347b5b33;z-index:20}
.arena .word-label.target:after{border-color:#347b5b}
.arena .center-dog{width:126px}
.arena .center-food{width:92px;max-height:118px;margin-top:-14px}
.arena .guard-center{width:168px}
.arena .health-card{width:168px}
.arena .enemy.arrived .enemy-art{animation:eat-pulse .7s ease-in-out infinite}
.arena .enemy.retreating{opacity:0;transition:opacity .4s ease,filter .4s ease;filter:blur(1px)}
.arena .word-label.retreating{opacity:0;transition:opacity .4s ease}
@keyframes eat-pulse{50%{filter:sepia(.35) hue-rotate(-18deg) saturate(1.8) brightness(1.05)}}
.center-food.is-hurting,.health-card.is-hurting{filter:sepia(.25) hue-rotate(-18deg) saturate(1.4)}
.health-card.is-low .hp-track i,#health-card.is-low #hp-bar{background:#c56a4a}
.health-card.is-low b{color:#95622d}
.damage-float{position:absolute;transform:translate(-50%,-50%);color:#b64142;font:700 13px Consolas,monospace;text-shadow:0 1px 0 #fffdf6;pointer-events:none;z-index:8}
.bark-bubble{position:absolute;top:-8px;right:-18px;background:#fffdf6;border-radius:16px;padding:6px 10px;font-size:11px;font-weight:700;box-shadow:0 2px 0 #d7decc;z-index:4}
.bark-bubble:after{content:'';position:absolute;left:18px;bottom:-7px;border-top:8px solid #fffdf6;border-right:8px solid transparent}
.arena .center-dog,.arena .center-food{object-fit:contain;height:auto;max-height:none;overflow:visible}
.arena .guard-center{width:210px;overflow:visible}
.arena .center-food{transition:filter .2s ease}
.hero-dog,.hero-food,.hero-cat,.hero-rabbit,.ready-card img,.score-illustration img{object-fit:contain}
.center-dog.is-barking{transform:translateX(-2px) rotate(-3deg)}
.combo{z-index:17;pointer-events:none;right:22px;top:24px}
#pause-overlay .quiet{min-width:180px}
#pause-overlay .primary{min-width:220px}
.arena .word-label.miss{animation:miss-tint .2s ease}
@keyframes miss-tint{50%{background:#ffd8d0}}
.result.is-fail #result-heading,.score-card.is-fail .total-score{color:#95622d}
.score-card.is-fail{background:#fff8f2}
.typed:empty,.next-letter:empty{background:transparent;border:0;padding:0}
.result-mode-line{margin:16px 0 0;font-size:11px}
.result-dev-line,.result-focus-line{margin:2px 0 0;font-size:10px;color:#8a9480}
@media(max-width:720px){
  .wpm-stat{order:5}
  .arena .enemy{width:0}
  .guard-center{left:50%}
  .arena{height:680px;max-width:100%}
  .word-label .word-main{font-size:14px}
  .word-label .word-roma{font-size:9px}
  .analysis-columns{grid-template-columns:1fr}
}

/* Phase 5-A: artwork only; field geometry stays unchanged. */
.arena.garden{background:#e2ebcd url("assets/visuals/background-field.svg") center/100% 100% no-repeat}
.arena .arena-path,.arena>.flower,.arena>.grass{display:none}
#settings-dialog input[type=range]{display:block;width:100%;margin-top:10px;accent-color:#528063}
#settings-dialog output{float:right;font-size:12px;color:#657c71}
.choices[data-group="playMode"]{flex-wrap:wrap}
.choices[data-group="playMode"] .choice{min-width:30%;flex:1 1 30%}
.challenge-hud{min-width:118px;text-align:right}
.challenge-hud small{display:block;margin-bottom:4px}
.challenge-hud strong{font-size:22px}
.challenge-hud span{display:block;font-size:10px;color:#7c8875;margin-top:4px}
.challenge-hud.is-warn strong,.challenge-hud.is-warn span{color:#c2782a}
.challenge-hud.is-fail strong,.challenge-hud.is-fail span{color:#b64142}
html,body{height:auto;min-height:100%;overflow-x:clip;overflow-y:visible;max-width:100%}
body{min-height:100dvh;display:flex;flex-direction:column}
main{flex:1;min-height:0;padding-top:16px;max-width:1248px;overflow-x:hidden}
.site-header{height:52px}
.site-header .settings-button{padding:8px 14px;font-size:13px}
footer{padding:8px 0;margin-top:0}
.screen{min-height:0}
.prototype{display:none}
.title-bottom,.hero-badge{display:none}
.mode-hero{text-align:left;margin:0 0 14px;max-width:990px;margin-left:auto;margin-right:auto}
.mode-hero h1{font-size:28px;letter-spacing:-1px;line-height:1.2;margin:0}
.mode-hero .lead{font-size:14px;font-weight:600;margin:6px 0 0;color:#6f7d68}
#mode.screen{height:calc(100dvh - 52px - 36px);overflow:auto}
.section-heading.compact{padding:0 0 10px}
.section-heading.compact h2{font-size:22px;margin:0}
.mode-layout{gap:24px;margin-bottom:12px}
fieldset{margin:0 0 12px}
legend{margin-bottom:8px}
.choice{padding:10px 12px}
.choice.selected{padding:9px 11px}
.choice small{margin-top:4px}
.choice.extra-toggle.selected{border:2px solid #528063;background:#eaf0df}
.kbd-hint{font-size:10px;color:#7d8871;margin:4px 0 0}
.ready-card{padding:16px 18px}
.ready-card>img{width:108px}
.ready-card h3{font-size:16px}
.ready-summary{white-space:pre-line;line-height:1.7;text-align:left}
.rule-badges{display:flex;gap:6px;margin-top:6px;flex-wrap:wrap}
.rule-badge{font-size:10px;font-weight:800;background:#eaf0df;border:1px solid #52806355;color:#32664d;padding:2px 8px;border-radius:999px}
.unlock-notices{list-style:none;margin:12px 0 0;padding:10px 12px;background:#eaf0df;border-radius:12px;text-align:left;font-size:13px;font-weight:700;color:#32664d}
.unlock-notices li{margin:4px 0}
#game.screen{height:calc(100dvh - 52px - 36px);display:flex;flex-direction:column;align-items:center;overflow-x:hidden;max-width:100%}
.game-top,.game-bottom{width:min(1020px,calc(100vw - 32px));max-width:100%;min-width:0}
.game-top{padding:0 8px 8px;gap:12px;flex-wrap:wrap}
.stat strong{font-size:22px}
.arena{
  flex:0 0 auto;
  width:min(1020px, calc(100vw - 32px), calc((100svh - 148px) * 1.5));
  height:min(680px, calc(100svh - 148px), calc((100vw - 32px) * 0.68));
  max-width:100%;
  min-height:360px;
  overflow:hidden;
  contain:layout;
}
.game-bottom{margin:6px 0 0;font-size:10px;min-width:0}
.game-bottom small{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.combo,.type-tag,.danger-tag,.arena-caption{display:none!important}
.label-layer{overflow:hidden;contain:layout}
.arena .word-label{width:max-content;max-width:calc(100% - 16px);box-sizing:border-box}
.arena .word-label.fit-long .word-main{font-size:calc(15px * var(--label-scale, 1))}
.arena .word-label.fit-long .word-roma{font-size:calc(9px * var(--label-scale, 1))}
.arena .word-label.fit-long code{font-size:calc(21px * var(--label-scale, 1))}
@media(max-width:720px){
  #mode.screen,#game.screen{height:auto}
  .arena{min-height:280px;width:calc(100vw - 24px);height:auto;aspect-ratio:3/2}
}

/* Phase 5-E: header / no inner scrollbar / pause / HUD / meaning / score float */
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.site-header{width:100%;max-width:none;margin:0;height:52px;padding:0 20px;justify-content:space-between;box-sizing:border-box}
.brand{gap:10px;font-size:16px}
.brand-icon{width:36px;height:36px;padding:0;border-radius:9px;background:transparent;display:inline-flex;align-items:center;justify-content:center;overflow:hidden}
.brand-icon img{display:block;width:36px;height:36px;object-fit:cover}
.brand-text{font-weight:800;letter-spacing:.02em}
.brand .brand-text{margin:0;font-size:inherit;line-height:inherit}
.brand-text b{font-weight:900}
.settings-button{background:#fffdf7;border:1px solid #d0d9c6;border-radius:9px;color:#3f5340;padding:8px 14px;font-size:13px;font-weight:800}
.settings-button:hover:not(:disabled){background:#eaf0df}
main{padding-top:8px}
#mode.screen,#game.screen{height:auto;min-height:0;overflow:visible}
#game.screen{overflow:visible}
.mode-hero{margin:0 0 10px}
.mode-hero .lead{font-size:15px;color:#4d5c4c}
.choices .choice{min-height:68px;display:flex;flex-direction:column;justify-content:center}
.choice small{min-height:1.2em}
.kbd-hint{display:none}
.ready-card .primary{justify-content:center;min-height:56px;font-size:18px;padding:16px 18px}
.ready-card>small{font-size:12px;color:#4d5c4c;margin-top:10px;font-weight:700}
.ready-card h3{font-size:17px;margin:10px 0 6px}
.ready-card p strong{font-size:0}
.pause-title{margin:0 0 8px;font-size:24px}
.pause-actions{display:flex;flex-direction:column;align-items:center;gap:12px;width:min(280px,80%)}
.pause-choice{width:100%;min-height:56px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;border:1px solid #d0d9c6;background:#fffdf7;border-radius:12px;color:#344b40;font-size:16px;font-weight:800;padding:10px 12px}
.pause-choice span{display:block;font-size:11px;font-weight:700;color:#5f6d5c;letter-spacing:.08em}
#pause-overlay .primary,#pause-overlay .quiet{min-width:0}
.word-label .word-meaning{display:block;font-size:10px;font-weight:600;color:#8a9486;margin-top:2px;line-height:1.2;max-width:168px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.word-label.word-en{padding:6px 12px 7px}
.word-label.word-en .word-main{font-size:15px}
.score-float{position:absolute;transform:translate(-50%,-70%);color:#32664d;font:700 12px Consolas,monospace;text-shadow:0 1px 0 #fffdf6;pointer-events:none;z-index:9}
.result-metrics small{font-size:11px;color:#5a6a58;font-weight:700}
.result-metrics b{color:#2f4036;font-size:26px}
.result-mode-line{font-size:13px;color:#4d5c4c;font-weight:600}
.result-challenge-line{font-size:15px;color:#344b40;font-weight:800;margin:8px 0 0}
.result-dev-line{display:none}
.total-score{color:#2f4036}
.score-caption{color:#5a6a58;font-size:13px}
#result-heading{color:#2f4036}
#result-lead{color:#4d5c4c;font-size:14px}
#result-eyebrow{color:#3f5340;font-weight:800}
.result-title-wrap{margin:4px 0 2px}
.result-title-label{display:block;font-size:10px;font-weight:700;color:#7a8778;letter-spacing:.12em}
.result-title{display:block;margin-top:1px;font-size:15px;font-weight:800;color:#3f5340;line-height:1.25}
.analysis-card>p,.analysis-card .muted,.bigrams span{color:#5a6a58}

/* Phase 5-F: content-width header, buttons, duration, labels, focus */
:root{--content-max:1100px}
button:focus,a:focus,input:focus,button:focus-visible,a:focus-visible,input:focus-visible{
  outline:none;
  box-shadow:none
}
button:focus-visible,a:focus-visible,input:focus-visible{
  outline:2px solid #9bbf9c;
  outline-offset:2px
}
.site-header{
  width:100%;
  max-width:none;
  margin:0;
  padding:0;
  height:52px;
  display:flex;
  justify-content:center;
  box-sizing:border-box
}
.header-inner{
  height:52px;
  display:flex;
  align-items:center;
  justify-content:space-between
}
.header-inner,
main{
  width:min(100% - 32px,var(--content-max));
  max-width:var(--content-max);
  margin-left:auto;
  margin-right:auto
}
.mode-hero,.mode-layout,.result-layout,.game-top,.game-bottom,.analysis-panel,.result-actions{
  width:100%;
  max-width:none;
  margin-left:auto;
  margin-right:auto
}
.mode-layout{
  display:grid;
  grid-template-columns:minmax(0,1fr) 280px;
  gap:28px;
  align-items:stretch;
  width:100%
}
.mode-form{min-width:0;max-width:none}
.ready-card{width:280px;max-width:100%;box-sizing:border-box}
.choices{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(0,1fr));
  gap:10px
}
.choices .choice,
.choice{
  flex:none;
  width:100%;
  min-width:0;
  box-sizing:border-box;
  border-width:2px;
  padding:10px 12px
}
.choice.selected{padding:10px 12px;border-width:2px}
.choices[data-group="questionMode"]{grid-template-columns:repeat(3,minmax(0,1fr))}
.choices[data-group="questionMode"] .choice{
  min-height:72px;
  align-items:flex-start
}
.choices[data-group="questionMode"] .choice small{
  font-size:9px;
  line-height:1.25;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  min-height:1.25em
}
.choices[data-group="difficulty"],
.choices[data-group="language"]{grid-template-columns:repeat(3,minmax(0,1fr))}
.choices[data-group="language"]{grid-template-columns:repeat(2,minmax(0,1fr))}
.choices[data-group="durationSec"]{grid-template-columns:repeat(5,minmax(0,1fr))}
fieldset:has([data-group="paceLevel"]){
  display:block
}
fieldset:has([data-group="paceLevel"]) legend{
  align-self:auto
}
.choices[data-group="paceLevel"]{
  display:grid;
  grid-template-columns:repeat(10,minmax(0,1fr));
  gap:6px;
  width:100%;
  max-width:none;
  margin-inline:0;
  justify-content:stretch
}
.choices[data-group="paceLevel"] .choice{
  position:relative;
  min-height:44px;
  padding:8px 0 10px;
  font-size:14px;
  font-weight:800;
  letter-spacing:0;
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:center;
  text-align:center;
  line-height:1
}
.choices[data-group="paceLevel"] .choice.is-locked{
  opacity:.5;
  cursor:not-allowed
}
.choices[data-group="paceLevel"] .choice .pace-lock{
  position:absolute;
  right:4px;
  bottom:4px;
  display:block;
  width:8px;
  height:6px;
  margin:0;
  border:1.5px solid currentColor;
  border-radius:1px
}
.choices[data-group="paceLevel"] .choice .pace-lock:before{
  content:"";
  position:absolute;
  left:1px;
  top:-5px;
  width:3px;
  height:4px;
  border:1.5px solid currentColor;
  border-bottom:0;
  border-radius:4px 4px 0 0
}
.choices[data-group="durationSec"] .choice{
  min-height:44px;
  padding:8px 4px;
  text-align:center;
  justify-content:center;
  font-size:14px
}
.choices[data-group="extraRules"]{grid-template-columns:repeat(2,minmax(0,1fr))}
.choices[data-group="extraRules"] .choice{
  min-height:88px;
  height:88px
}
.choices[data-group="extraRules"] .choice small{
  font-size:10px;
  white-space:nowrap
}
#duration-fieldset.is-disabled .choice,
#duration-fieldset.is-disabled{
  opacity:.48;
  pointer-events:none
}
#duration-fieldset.is-disabled .choice.selected{background:#eaf0df}
.btn{
  font:inherit;
  cursor:pointer;
  border-radius:12px;
  font-weight:800;
  box-sizing:border-box
}
.btn-primary,.primary{
  background:var(--green);
  color:#fff;
  border:2px solid var(--green);
  box-shadow:0 4px 0 #214e38
}
.btn-secondary,.quiet,.settings-button{
  background:#fffdf7;
  color:#32664d;
  border:2px solid #528063;
  box-shadow:none
}
.btn-danger{
  background:#fff7f4;
  color:#7a3030;
  border:2px solid #c37a6a;
  box-shadow:none
}
.pause-choice{
  width:100%;
  min-height:56px
}
.pause-choice.btn-primary{color:#fff}
.result-actions{
  display:flex;
  gap:12px;
  justify-content:center;
  flex-wrap:wrap;
  width:100%;
  margin:18px auto 0
}
.result-actions .btn{min-width:168px;width:168px;min-height:54px;height:auto;padding:9px 16px;box-sizing:border-box}
.result-choice{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  text-align:center;
  font-weight:800;
  line-height:1.25
}
.result-choice span{
  display:block;
  font-size:12px;
  font-weight:800;
  letter-spacing:.04em;
  color:#5a6a58;
  line-height:1.2
}
.result-choice.btn-primary span{color:#e8f4e6}
.ready-card .btn-primary,.ready-card .primary{width:100%;justify-content:center}
.arena .word-label{
  border:2px solid #aeb9a6;
  padding:8px 18px 10px;
  box-sizing:border-box
}
.arena .word-label.target{
  border:2px solid #347b5b;
  padding:8px 18px 10px
}
.arena .word-label .word-main{font-size:var(--label-size,17px)}
.arena .word-label.word-en .word-main,
.arena .word-label code{font-size:var(--label-size,17px)}
.arena .word-label .word-roma{font-size:11px}
.arena .word-label.fit-long .word-main{font-size:var(--label-size,16px)}
.arena .word-label.fit-long .word-roma{font-size:11px}
.arena .word-label.fit-long code{font-size:var(--label-size,16px)}
@media(max-width:820px){
  .mode-layout{grid-template-columns:1fr;gap:16px}
  .ready-card{width:100%;min-height:0}
  .choices[data-group="durationSec"]{grid-template-columns:repeat(3,minmax(0,1fr))}
  .choices[data-group="paceLevel"]{grid-template-columns:repeat(5,minmax(0,1fr));width:100%;justify-content:stretch}
  .choices[data-group="questionMode"] .choice small{font-size:8.5px}
}

/* Phase 5-G: pause key contrast / ready-card height */
.mode-form fieldset{margin:0 0 16px}
.mode-form fieldset:last-child{margin-bottom:0}
.ready-card{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  text-align:center;
  height:100%;
  min-height:100%;
  padding:22px 20px 24px;
  box-sizing:border-box
}
.ready-card>img{width:96px;margin:2px auto 0}
.ready-card h3{margin:8px 0 4px;font-size:16px}
.ready-summary{flex:1 1 auto;margin:4px 0 0;text-align:left;font-size:13px;line-height:1.55}
.ready-best{
  margin-top:auto;
  margin-bottom:0;
  padding:6px 9px;
  border:1px solid #dce3d1;
  border-radius:12px;
  background:#f3f6ec;
  text-align:left
}
.ready-best-label{font-size:10px;font-weight:800;letter-spacing:.04em;color:#7a8778}
.ready-best-kicker{font-size:10px;font-weight:800;letter-spacing:.12em;color:#7a8778;margin-top:2px}
.ready-best-main{font-size:18px;font-weight:800;color:#2f4036;margin-top:0;line-height:1.15;font-variant-numeric:tabular-nums}
.ready-best-title{font-size:11px;font-weight:800;color:#3f5340;margin-top:2px;line-height:1.2}
.ready-best-sub{font-size:11px;font-weight:700;color:#5a6a58;margin-top:2px}
.ready-best-extra{font-size:10px;font-weight:700;color:#5a6a58;margin-top:2px}
.ready-best-metrics{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:1px 10px;
  margin:4px 0 0;
  padding:0;
  list-style:none
}
.ready-best-metrics li{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  gap:8px;
  font-size:11px;
  font-weight:700;
  color:#5a6a58;
  line-height:1.35
}
.ready-best-metrics li b{
  font-size:12px;
  font-weight:800;
  color:#2f4036;
  font-variant-numeric:tabular-nums
}
.ready-card .btn-primary,.ready-card .primary{margin-top:8px}
.ready-analysis{
  width:100%;
  justify-content:center;
  margin-top:8px;
  min-height:40px;
  padding:8px 12px;
  font-size:13px;
  font-weight:800;
  color:#3f5340;
  background:#fffdf7;
  border:1px solid #d0d9c6
}
.ready-analysis span{
  font-size:11px;
  font-weight:700;
  opacity:.65;
  margin-left:6px
}
.ready-card>small{margin-top:8px;font-size:13px;font-weight:800;color:#3f5340}
.result-best-note{margin:6px 0 0;font-size:13px;font-weight:800;color:#32664d;line-height:1.45}
.result-best-note small{display:block;margin-top:2px;font-size:11px;font-weight:700;color:#5a6a58}
.pause-choice span{color:#5a6a58;font-size:12px;letter-spacing:.04em}
.pause-choice.btn-primary span{color:#e8f4e6;font-weight:800}
.analysis-unlock-hint{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  gap:8px;
  margin:10px 0 0;
  font-size:12px;
  color:#6a7768
}

/* Phase C-2: compact PC viewports, howto, analysis, WPM note */
html,body{overflow-x:hidden}
.header-left{display:flex;flex-direction:row;align-items:center;gap:12px;min-width:0}
.contents-back{font-size:12px;font-weight:700;color:#6f7d68;white-space:nowrap;line-height:1.2;flex-shrink:0;letter-spacing:.01em}
.contents-back:hover{color:var(--green);text-decoration:underline}
.brand-text{white-space:nowrap}
.header-actions{display:flex;align-items:center;gap:8px;flex-wrap:nowrap;justify-content:flex-end;flex-shrink:0}
.howto-button,.settings-button,.data-save-button{background:#fffdf7;border:1px solid #d0d9c6;border-radius:9px;color:#3f5340;padding:8px 14px;font-size:13px;font-weight:800;white-space:nowrap;flex-shrink:0}
body.is-game:not(.is-paused) .data-save-button{display:none}
body.is-game:not(.is-paused) .contents-back{display:none}
@media (max-width: 1366px){
  .contents-back{font-size:11px}
  .howto-button,.settings-button,.data-save-button,
  .site-header .settings-button{padding:6px 11px;font-size:12px}
}
.howto-list{margin:12px 0 18px;padding-left:1.2em;font-size:14px;line-height:1.7;text-align:left;color:#3f5340}
.howto-list li{margin:6px 0}
.start-error{margin:8px 0 0;font-size:12px;font-weight:800;color:#b64142;line-height:1.4}
.metric-note{display:block;font-size:9px;font-weight:700;letter-spacing:.04em;color:#7a8778;margin-top:2px}
.challenge-hud span{display:block;font-size:9px;font-weight:700;color:#7c8875;margin-top:3px;line-height:1.3}
.analysis-details{margin:18px 0 0;border:1px solid #dce3d1;border-radius:14px;background:#fffdf6;padding:10px 14px}
.analysis-details summary{cursor:pointer;font-weight:800;color:#3f5340}
.analysis-improving{margin-top:16px}
body{overflow-x:hidden}

@media (max-height: 768px){
  .site-header,.header-inner{height:44px}
  .site-header{height:44px}
  main{padding-top:0;padding-bottom:0}
  body:not(.is-game):not(.is-result){
    height:100svh;
    max-height:100svh;
    overflow:hidden;
  }
  body:not(.is-game):not(.is-result) main{
    overflow:auto;
    min-height:0;
  }
  #game.screen{height:calc(100svh - 44px);overflow:visible}
  .game-top{padding:0 6px 4px;gap:8px}
  .stat strong{font-size:18px}
  .arena{
    min-height:340px;
    width:min(1020px, calc(100vw - 24px), calc((100svh - 118px) * 1.5));
    height:min(560px, calc(100svh - 118px), calc((100vw - 24px) * 0.68));
  }
  .game-bottom{margin:2px 0 0}
  .screen{min-height:0}
  #result.screen{
    min-height:0;
    padding-bottom:8px;
    overflow-x:hidden
  }
  .section-heading.compact{padding:6px 0 8px}
  .section-heading h2{font-size:22px;margin:4px 0 6px}
  .section-heading p{font-size:12px;margin:0}
  .result-layout{gap:12px;align-items:start}
  .score-card{padding:10px 16px 12px}
  .score-illustration{height:72px;width:128px}
  .score-illustration img:first-child{width:70px}
  .score-illustration img:last-child{width:48px;right:4px;bottom:2px}
  .total-score{font-size:42px;margin:2px 0 2px;letter-spacing:-1px}
  .score-caption{margin:0}
  .result-titles{margin:2px 0}
  .result-title{font-size:13px}
  .result-metrics{margin-top:8px;padding-top:8px;gap:8px 8px}
  .result-metrics b{font-size:18px}
  .result-metrics small{margin-bottom:3px}
  .analysis-card{padding:12px 14px}
  .analysis-card h3{font-size:16px;margin:6px 0 4px}
  .bigrams li{padding:3px 0}
  .result-actions{margin:8px auto 6px;gap:8px}
  .result-actions .btn{min-height:48px;height:auto;padding:8px 12px;min-width:148px;width:148px}
  .analysis-details{margin:12px 0 0;max-height:none}
  #analysis.screen{overflow:auto;max-height:calc(100dvh - 44px)}
  .mode-hero .lead{font-size:20px;margin-bottom:8px}
}

@media (max-height: 800px){
  .mode-layout{align-items:start}
  .ready-card{height:auto;min-height:0;padding:14px 16px 12px}
  .ready-card>img{width:72px;margin-top:0}
  .ready-card h3{margin:4px 0 2px;font-size:15px}
  .ready-summary{flex:0 1 auto;font-size:12px;line-height:1.4}
  .ready-analysis{min-height:36px;padding:6px 10px;font-size:12px;margin-top:6px}
  .ready-card .btn-primary,.ready-card .primary{margin-top:6px;min-height:48px;padding:10px 14px;font-size:16px}
  .ready-card>small{margin-top:4px;font-size:11px}
  .ready-best{padding:5px 8px}
  .ready-best-main{font-size:16px}
  .ready-best-metrics li{font-size:10px}
  .ready-best-metrics li b{font-size:11px}
}

@media (max-height: 720px){
  .site-header,.header-inner,.site-header{height:40px}
  main{padding-top:0}
  #game.screen{height:calc(100svh - 40px);overflow:visible}
  .arena{
    min-height:320px;
    height:min(520px, calc(100svh - 108px), calc((100vw - 24px) * 0.68));
    width:min(1020px, calc(100vw - 24px), calc((100svh - 108px) * 1.5));
  }
  .score-illustration{height:58px;width:110px}
  .score-illustration img:first-child{width:56px}
  .score-illustration img:last-child{width:40px}
  .total-score{font-size:36px}
  .result-actions{margin:6px auto 4px}
  .result-actions .btn{min-height:46px;height:auto;padding:7px 12px}
  .analysis-card p{font-size:11px}
  .bigrams{margin:8px 0}
  .mode-layout{align-items:start}
  .ready-card{
    height:auto;
    min-height:0;
    max-height:calc(100svh - 52px);
    padding:10px 12px 12px
  }
  .ready-card>img{width:56px}
  .ready-summary{flex:0 1 auto;font-size:11px;line-height:1.35}
  .ready-analysis{min-height:34px;padding:5px 10px;font-size:12px;margin-top:4px}
  .ready-card .btn-primary,.ready-card .primary{margin-top:6px;min-height:44px;padding:8px 12px}
  .ready-card>small{display:none}
  .ready-best{padding:4px 7px}
  .ready-best-kicker{font-size:9px;margin-top:0}
  .ready-best-main{font-size:15px}
  .ready-best-metrics{margin-top:2px}
}

/* Phase C-2A: real CSS viewport fit (game/result) + footer hide during play */
html,body{
  overflow-x:clip;
  overflow-y:visible;
}
main{
  overflow-x:clip;
  overflow-y:visible;
}
body.is-game,
body.is-result{
  min-height:100svh;
}
body.is-game footer,
body.is-result footer{
  display:none;
}
body.is-game main,
body.is-result main{
  padding-top:4px;
  padding-bottom:0;
  overflow-x:clip;
  overflow-y:visible;
  flex:1 1 auto;
  min-height:0;
  display:flex;
  flex-direction:column;
}
body.is-game #game.screen{
  height:auto;
  flex:1 1 auto;
  min-height:0;
  overflow:visible;
  display:flex;
  flex-direction:column;
  align-items:center;
}
body.is-game .game-top{
  padding:0 8px 6px;
  gap:8px;
  flex:0 0 auto;
}
body.is-game .game-bottom{
  margin:2px 0 4px;
  flex:0 0 auto;
}
body.is-game .arena{
  flex:0 0 auto;
  min-height:0;
  width:min(1020px, calc(100vw - 32px), calc((100svh - 132px) * 1.5));
  height:min(680px, calc(100svh - 132px), calc((100vw - 32px) * 0.68));
  max-height:calc(100svh - 132px);
}
body.is-result #result.screen{
  flex:1 1 auto;
  min-height:0;
  overflow:visible;
  padding-bottom:4px;
}
body.is-result .section-heading.compact{
  padding:0 0 8px;
}
body.is-result .result-layout{
  gap:16px;
}
body.is-result .score-card{
  padding:14px 24px 16px;
}
body.is-result .analysis-card{
  padding:14px 16px;
}
body.is-result .result-actions{
  margin:10px auto 6px;
}

@media (max-height: 900px){
  .site-header,.header-inner{height:48px}
  .site-header{height:48px}
  main{padding-top:0;padding-bottom:0}
  body.is-game main,
  body.is-result main{padding-top:0;padding-bottom:0}
  body.is-game .game-top{padding:0 6px 4px;gap:6px}
  body.is-game .stat strong{font-size:20px}
  body.is-game .arena{
    min-height:0;
    width:min(1020px, calc(100vw - 24px), calc((100svh - 118px) * 1.5));
    height:min(600px, calc(100svh - 118px), calc((100vw - 24px) * 0.68));
    max-height:calc(100svh - 118px);
  }
  body.is-game .game-bottom{margin:2px 0 2px}
  body.is-result #result.screen{padding-bottom:2px}
  body.is-result .section-heading.compact{padding:4px 0 6px}
  body.is-result .section-heading.compact h2,
  body.is-result .section-heading h2{font-size:22px;margin:2px 0 4px}
  body.is-result .section-heading p{font-size:12px;margin:0}
  body.is-result .result-layout{gap:10px}
  body.is-result .score-card{padding:10px 16px 12px}
  body.is-result .score-illustration{height:80px;width:140px}
  body.is-result .score-illustration img:first-child{width:78px}
  body.is-result .score-illustration img:last-child{width:54px}
  body.is-result .total-score{font-size:48px;margin:2px 0}
  body.is-result .result-metrics{margin-top:6px;padding-top:6px;gap:6px 8px}
  body.is-result .result-actions{margin:8px auto 4px;gap:8px}
  body.is-result .result-actions .btn{min-height:48px;height:auto;padding:8px 12px;min-width:148px;width:148px}
  body.is-result .analysis-card{padding:10px 12px}
}

@media (max-height: 768px){
  body.is-game .site-header,
  body.is-result .site-header,
  body.is-game .header-inner,
  body.is-result .header-inner,
  .site-header,.header-inner{height:44px}
  body.is-game main,
  body.is-result main{padding-top:0;padding-bottom:0}
  body.is-game #game.screen{overflow:visible;height:auto}
  body.is-game .game-top{padding:0 6px 2px;gap:4px}
  body.is-game .game-bottom{margin:0}
  body.is-game .arena{
    min-height:0;
    width:min(1020px, calc(100vw - 24px), calc((100svh - 108px) * 1.5));
    height:min(560px, calc(100svh - 108px), calc((100vw - 24px) * 0.68));
    max-height:calc(100svh - 108px);
  }
}

@media (max-height: 720px){
  body.is-game .site-header,
  body.is-result .site-header,
  body.is-game .header-inner,
  body.is-result .header-inner,
  .site-header,.header-inner{height:40px}
  body.is-game .game-top{padding:0 6px 2px;gap:4px}
  body.is-game .stat strong{font-size:16px}
  body.is-game .game-bottom{margin:0}
  body.is-game .arena{
    min-height:0;
    height:min(520px, calc(100svh - 108px), calc((100vw - 24px) * 0.68));
    width:min(1020px, calc(100vw - 24px), calc((100svh - 108px) * 1.5));
    max-height:calc(100svh - 108px);
  }
  body.is-result .score-illustration{height:58px;width:110px}
  body.is-result .total-score{font-size:36px}
}

#settings-dialog{
  max-width:min(420px, 92vw);
  max-height:min(90vh, 640px);
  overflow:auto;
  padding:22px 24px 20px;
}
#settings-dialog h2{font-size:20px;margin:0 0 8px}
#settings-dialog label{margin:12px 0}
.romaji-display-box{
  border:1px solid #dce3d1;
  border-radius:12px;
  padding:10px 12px 8px;
  margin:14px 0 8px;
}
.romaji-display-box legend{
  font-size:13px;
  font-weight:700;
  color:#32664d;
  padding:0 6px;
}
.romaji-display-bar{display:flex;gap:8px;flex-wrap:wrap}
.romaji-display-bar .quiet{padding:8px 12px}
.romaji-display-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px 10px;
  margin-top:10px;
}
.romaji-row{display:flex;flex-direction:column;gap:4px}
.romaji-row span{font-size:11px;color:#657c71}
.romaji-row .romaji-opts{display:flex;gap:4px}
.romaji-opt{
  flex:1;
  border:1px solid #d6ddce;
  background:#fffdf7;
  border-radius:8px;
  padding:5px 6px;
  font-size:12px;
  font-family:Consolas,"Courier New",monospace;
}
.romaji-opt[aria-pressed="true"]{
  border-color:#528063;
  background:#eaf0df;
  font-weight:700;
}
#romaji-display-details .muted{margin:4px 0 0}

#data-save-dialog{
  max-width:min(420px, 92vw);
  padding:22px 24px 20px;
  border:1px solid #dce3d1;
  border-radius:16px;
  background:#fffdf6;
  color:#344b40;
}
#data-save-dialog h2{font-size:20px;margin:0 0 10px}
#data-save-dialog p{margin:0 0 10px;font-size:14px;line-height:1.7;color:#3f5340}
#data-save-dialog a{color:#32664d;font-weight:700;text-decoration:underline}
.data-save-list{margin:0 0 12px;padding-left:1.2em;font-size:14px;line-height:1.7;color:#3f5340}
.data-save-list li{margin:4px 0}
#data-save-dialog .primary{margin-top:8px}

@media (max-width: 900px){
  .site-header,
  .header-inner{
    height:auto;
    min-height:52px;
    padding:8px 0;
    flex-wrap:wrap;
    row-gap:8px;
    align-items:center
  }
  .header-left{
    flex-direction:column;
    align-items:flex-start;
    gap:4px;
    width:100%
  }
  .header-actions{
    width:100%;
    justify-content:flex-start;
    flex-wrap:wrap;
    gap:6px
  }
  .howto-button,.settings-button,.data-save-button,
  .site-header .settings-button{padding:6px 10px;font-size:12px}
  body.is-game:not(.is-paused) .site-header,
  body.is-game:not(.is-paused) .header-inner{
    height:44px;
    min-height:44px;
    padding:0;
    flex-wrap:nowrap
  }
  body.is-game:not(.is-paused) .header-left{
    flex-direction:row;
    width:auto
  }
  body.is-game:not(.is-paused) .header-actions{
    width:auto;
    flex-wrap:nowrap;
    justify-content:flex-end
  }
}

@media (max-width: 640px){
  .howto-button,.settings-button,.data-save-button,
  .site-header .settings-button{padding:6px 10px;font-size:12px}
  .header-actions{gap:6px}
}

/* Phase W-G3: common legal footer (settings/title visible; play/result stay hidden) */
footer.site-footer,
footer{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  max-width:none;
  width:100%;
  margin:0 auto;
  padding:8px 16px 10px;
  border-top:1px solid var(--line);
  color:#85907e;
  font-size:11px;
  letter-spacing:.02em;
  box-sizing:border-box;
  flex-shrink:0;
  background:#f7f8f0;
}
.site-legal-nav{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
  row-gap:2px;
  max-width:100%;
  margin:0;
}
.site-legal-nav a{
  color:#6f7d68;
  text-decoration:none;
  font-size:11px;
  font-weight:600;
  line-height:1.45;
  white-space:nowrap;
}
.site-legal-nav a:hover{
  color:var(--green);
  text-decoration:underline;
}
.site-legal-nav a + a::before{
  content:"｜";
  margin:0 .5em;
  color:#c6cfb9;
  font-weight:400;
  pointer-events:none;
}
.footer-meta,
.footer-copy{
  margin:0;
  font-size:10px;
  color:#85907e;
  text-align:center;
}
.footer-meta{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:4px 14px;
}
.footer-meta a{
  color:#6f7d68;
  text-decoration:none;
}
.footer-meta a:hover{
  color:var(--green);
  text-decoration:underline;
}
.footer-copy{
  letter-spacing:.04em;
}
.footer-copy a{
  color:inherit;
  text-decoration:none;
}
.footer-copy a:hover{
  text-decoration:underline;
}
@media (max-height: 768px){
  footer.site-footer,
  footer{
    padding:4px 12px 6px;
    gap:2px;
  }
  .site-legal-nav a{font-size:10px}
  .footer-meta,
  .footer-copy{font-size:9px}
}
body.is-game footer,
body.is-result footer{
  display:none;
}

/* Mode screen: grow the page instead of painting extra rules over the footer. */
body:not(.is-game):not(.is-result){
  height:auto;
  min-height:100dvh;
  overflow-x:hidden;
  overflow-y:auto;
}
body:not(.is-game):not(.is-result) main{
  flex:1 0 auto;
  min-height:auto;
  overflow:visible;
}
#mode.screen{
  height:auto;
  overflow:visible;
}
@media (max-height: 768px){
  .mode-hero{margin:0 0 6px}
  .mode-form fieldset{margin:0 0 10px}
  .choices[data-group="extraRules"] .choice{
    min-height:64px;
    height:auto;
    padding:8px 12px
  }
}

.mobile-pc-note{display:none}
@media (max-width:640px){
  .site-header,
  .header-inner,
  body.is-game:not(.is-paused) .site-header,
  body.is-game:not(.is-paused) .header-inner{
    height:auto;
    min-height:0;
    flex-wrap:wrap;
    align-items:flex-start
  }
  .site-header{
    padding:0;
    flex-shrink:0
  }
  .header-inner{
    width:calc(100% - 24px);
    padding:10px 0 12px;
    row-gap:9px
  }
  .header-left,
  body.is-game:not(.is-paused) .header-left{
    width:100%;
    min-width:0;
    flex-direction:column;
    align-items:flex-start;
    gap:6px
  }
  .contents-back{
    display:inline-flex;
    align-items:center;
    min-height:32px;
    max-width:100%;
    white-space:normal
  }
  .brand{
    width:100%;
    min-width:0;
    gap:8px;
    font-size:16px;
    line-height:1.25
  }
  .brand-icon,
  .brand-icon img{
    width:32px;
    height:32px;
    flex:0 0 32px
  }
  .brand-text{
    min-width:0;
    white-space:normal;
    overflow-wrap:anywhere
  }
  .header-actions,
  body.is-game:not(.is-paused) .header-actions{
    display:grid;
    grid-template-columns:minmax(0,.85fr) minmax(0,1.7fr) minmax(0,.7fr);
    width:100%;
    min-width:0;
    gap:6px
  }
  .howto-button,
  .settings-button,
  .data-save-button,
  .site-header .settings-button{
    width:100%;
    min-width:0;
    min-height:42px;
    padding:6px 7px;
    line-height:1.25;
    white-space:normal
  }
  .mode-hero{
    width:100%;
    min-width:0;
    margin:0 0 12px;
    padding:0
  }
  .mode-hero .lead{
    max-width:100%;
    margin:4px 0 8px;
    font-size:18px;
    line-height:1.45;
    overflow-wrap:anywhere
  }
}

.typing-touch-device .mobile-pc-note{
    display:block;
    max-width:100%;
    margin:0;
    padding:9px 11px;
    border:1px solid #d6dfcc;
    border-radius:10px;
    background:#eef3e5;
    color:#52634f;
    font-size:12px;
    font-weight:700;
    line-height:1.55;
    overflow-wrap:anywhere
  }
.typing-touch-device #start-game:disabled{opacity:.65;cursor:not-allowed}
.typing-touch-device #start-shortcut{display:none}

.game-info{
  margin:28px auto 0;
  padding:26px 28px;
  border:1px solid #dce3d1;
  border-radius:18px;
  background:#fffdf6;
  color:#3f5340
}
.game-info-intro{max-width:820px}
.game-info h2{margin:0 0 10px;font-size:24px;line-height:1.35}
.game-info h3{margin:0 0 8px;font-size:16px;line-height:1.4;color:#32664d}
.game-info p,
.game-info ol{margin:0;font-size:14px;line-height:1.8}
.game-info-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
  margin-top:20px
}
.game-info-grid>section{
  min-width:0;
  padding:17px 18px;
  border-radius:13px;
  background:#eef3e5
}
.game-info ol{padding-left:1.3em}
.game-info li+li{margin-top:4px}
@media (max-width:720px){
  .game-info{
    margin-top:22px;
    padding:20px 16px
  }
  .game-info h2{font-size:21px}
  .game-info-grid{
    grid-template-columns:1fr;
    gap:10px;
    margin-top:16px
  }
  .game-info-grid>section{padding:15px}
}
