/* The farm is the screen; controls sit beside it, like a small game console. */
html{height:100%;overflow:hidden}
body{height:100vh;height:100dvh;overflow:hidden;display:grid;grid-template-rows:70px minmax(0,1fr)}
.header{width:100%;max-width:none;height:auto;padding:0 22px;gap:12px}
.header .day{display:flex;gap:10px;font-size:15px;flex-shrink:0}
.day .sun{font-size:30px;line-height:1}
.day small{font-size:14px}
.header nav{gap:18px}
.header .quiet{font-size:14px;padding:9px 0}
.header #sound{display:block}
.layout,.layout.choosing{display:grid;grid-template-columns:clamp(320px,28vw,400px) minmax(0,1fr);grid-template-rows:minmax(0,1fr);gap:18px;width:100%;max-width:none;min-height:0;margin:0;padding:14px 18px 18px;align-items:stretch}
.sidebar,.layout.choosing #choice-panel,.shift-panel{display:flex;flex-direction:column;justify-content:center;min-width:0;min-height:0;width:auto;gap:0}
.panel-title{font:24px Georgia,serif;margin:0 0 14px;color:var(--ink)}
.role-cards{gap:8px;grid-template-columns:repeat(2,minmax(0,1fr))}
.role-card{min-height:125px;padding:10px 8px;border-radius:10px;transition:border-color .2s,background .2s}
.role-card:hover{transform:none}
.role-card canvas{width:64px;height:51px;margin:0 0 4px -3px}
.role-card strong{font-size:17px;line-height:1.35;margin:0;min-height:46px;display:flex;align-items:center}
.role-card .game-count{font-size:11px;letter-spacing:0;margin-top:5px;white-space:nowrap}
.role-card .choice-dot{width:11px;height:11px;top:10px;right:8px}
.role-card[aria-pressed=true] .choice-dot{border-width:3px}
.role-card .stamp{right:7px;bottom:8px;font-size:9px}
.primary{min-height:46px;padding:10px 13px;font-size:17px;box-shadow:none!important}
.primary:active{transform:none}
.layout.choosing #choice-panel>.start-button{margin-top:12px;grid-column:auto}
.farm-panel{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;width:100%;height:100%;margin:0;padding:0}
.canvas-frame{flex:none;border-width:3px;border-radius:10px;max-width:100%;max-height:100%}
#farm{width:100%;height:100%;aspect-ratio:auto}
.profession-heading{padding-bottom:12px;gap:7px}
.profession-heading canvas{width:53px;height:42px;margin:0}
.profession-heading .eyebrow{font-size:12px;margin-bottom:4px}
.profession-heading h2{font-size:26px}
.shift-progress{padding-top:12px}
.shift-progress>span{font-size:12px;letter-spacing:1px}
.progress-track{margin-top:7px;height:4px}
.tasks{margin:18px 0 4px}
.tasks li{font-size:16px;line-height:1.4;gap:8px;padding-bottom:14px}
.tasks li .task-check{width:19px;height:19px;flex-basis:19px}
.tasks li .task-duration{font-size:12px}
.progress-extra{font-size:13px;margin:10px 0 14px}
.mentor,.layout.arcade-mode .mentor{padding:10px;border-radius:8px}
.mentor p{font-size:14px;line-height:1.6;margin:5px 0 0}
.mentor strong{font-size:15px}
.toast{bottom:15px;font-size:14px}
.cancel-profession{font-size:14px}
:root{--surface:#f8f5e9;--selected:#e3edcf;--frame:#e2e2c9;--soft:#e8e9d3;--accent:#ce9053}
:root[data-theme=dark]{--paper:#152a2c;--ink:#d7e2d3;--muted:#9daea0;--green:#62855e;--line:#38504a;--gold:#ddba71;--cream:#203a38;--surface:#1e3434;--selected:#304b3e;--frame:#314b43;--soft:#2c443e;--accent:#c6945b}
body,.header,.role-card,.primary,.canvas-frame,.npc-name,dialog{transition:background-color 1.8s,color 1.8s,border-color 1.8s}
.sky-clock{position:relative;display:block;width:32px;height:34px;overflow:hidden;flex:0 0 32px}
.day .sky-clock .sun,.day .sky-clock .moon{position:absolute;inset:0;display:grid;place-items:center;font-size:31px;line-height:1;transition:transform 1.8s,opacity 1.8s}
.sky-clock .moon{color:#d4dfd1;opacity:0;transform:translateY(30px) rotate(-70deg)}
[data-theme=dark] .sky-clock .sun{opacity:0;transform:translateY(30px) rotate(80deg)}
[data-theme=dark] .sky-clock .moon{opacity:1;transform:translateY(0) rotate(0)}
.header .quiet{color:var(--muted)}
.header .quiet:hover{color:var(--ink)}
.theme-toggle{display:flex;align-items:center;gap:5px;white-space:nowrap}
.theme-symbol{font-size:18px;line-height:1;color:var(--gold)}
.help-button{color:var(--muted);border-color:var(--line)}
.role-card{background:var(--surface);border-color:var(--line)}
.role-card .game-count{color:var(--muted)}
.role-card .choice-dot{border-color:var(--muted)}
.layout.arcade-mode .role-card[aria-pressed=true]{background:var(--selected);border-color:#819765;box-shadow:inset 0 0 0 1px #819765}
.role-card[aria-pressed=true] .choice-dot{border-color:var(--selected);background:#819765;outline-color:#819765}
.layout.arcade-mode .start-button{background:var(--accent);border-color:var(--accent);color:#fff6df}
.canvas-frame{border-color:var(--frame);outline-color:var(--line)}
.layout.arcade-mode .mentor{background:var(--soft);border-color:var(--line)}
.mentor strong,.tasks li.active{color:var(--ink)}
.mentor p,.progress-extra,.tasks li,.shift-progress>span{color:var(--muted)}
.progress-track{background:var(--soft)}
[data-theme=dark] .npc-name{color:#e0e8cc;background:#203630ef;border-color:#58705a}
[data-theme=dark] .farm-npc[aria-pressed=true] .npc-name,[data-theme=dark] .farm-npc:hover .npc-name,[data-theme=dark] .farm-npc:focus-visible .npc-name{background:#354b35;color:#f4e8bb}
[data-theme=dark] .farm-npc[aria-pressed=true] .npc-name strong:before{color:#e0c489}
[data-theme=dark] .toast{background:#253c35f5;border-color:#617452;color:#e0e4c4}
[data-theme=dark] .tasks li.active .task-check{background:#3b5740;color:#e4e9cb}
[data-theme=dark] dialog{background:var(--surface);color:var(--ink);border-color:var(--line)}
[data-theme=dark] dialog p,[data-theme=dark] #help-dialog ul{color:var(--muted)}
[data-theme=dark] .text-button{color:#b5c39f}
[data-theme=dark] .arcade-head,[data-theme=dark] .arcade-foot{background:#203836;color:var(--muted)}
[data-theme=dark] .arcade-head p,[data-theme=dark] .arcade-foot .arcade-feedback{color:#b5c39f}
[data-theme=dark] .arcade-close,[data-theme=dark] .arcade-pause{background:#2b443d;border-color:#536c56;color:#d2dec5}
[data-theme=dark] .arcade-overlay{background:#152b3280}
[data-theme=dark] .arcade-overlay>div{background:#213936f5;border-color:#536c56;color:var(--ink)}
[data-theme=dark] .arcade-overlay h3{color:#dce4c9}
[data-theme=dark] .arcade-overlay p,[data-theme=dark] .arcade-overlay small,[data-theme=dark] .arcade-overlay p.arcade-lesson{color:#acbaa2}
[data-theme=dark] .arcade-retry,[data-theme=dark] .arcade-record,[data-theme=dark] .skill-tags span,[data-theme=dark] .result-seal{background:#2c463c;border-color:#4d6851;color:#cfdfb4}
[data-theme=dark] .arcade-record strong,[data-theme=dark] .arcade-summary-score{color:#c2d39e}
[data-theme=dark] .result-dialog .impact{color:#b8c7aa}
@media(max-height:660px){
 body{grid-template-rows:52px minmax(0,1fr)}
 .layout,.layout.choosing{padding:10px 14px 12px;gap:12px;grid-template-columns:clamp(320px,28vw,400px) minmax(0,1fr)}
 .panel-title{font-size:21px;margin-bottom:9px}
 .role-card{min-height:105px;padding:7px}
 .role-card canvas{width:50px;height:40px;margin-bottom:1px}
 .role-card strong{font-size:16px;min-height:42px}
 .mentor{display:none}
 .tasks{margin-top:12px}
 .tasks li{padding-bottom:10px;font-size:14px}
 .progress-extra{font-size:12px;margin-bottom:0}
}
@media(max-width:650px) and (orientation:portrait){
 body{grid-template-rows:62px minmax(0,1fr)}
 .header{padding:0 12px}
 .header nav{gap:12px}
 .header .quiet{font-size:12px}
 .header #sound{font-size:0;width:19px;overflow:hidden}
 .header #sound:before{content:'♫';font-size:17px}
 .header .day{font-size:13px;gap:7px}
 .day small{font-size:12px}
 .day .sun{font-size:26px}
 .layout,.layout.choosing{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;grid-template-areas:'map' 'controls';padding:8px 8px max(12px,env(safe-area-inset-bottom));gap:12px}
 .farm-panel{grid-area:map}
 .sidebar,.layout.choosing #choice-panel{grid-area:controls;padding:0 4px}
 .panel-title{font-size:20px;margin-bottom:8px}
 .role-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
 .role-card{display:grid;grid-template-columns:38px minmax(0,1fr);align-content:center;column-gap:5px;min-height:78px;padding:8px 6px}
 .role-card canvas{grid-column:1;grid-row:1/3;width:38px;height:30px;margin:0;align-self:center}
 .role-card strong{grid-column:2;font-size:14px;min-height:0;line-height:1.25;padding-right:5px}
 .role-card .game-count{grid-column:2;font-size:10px;letter-spacing:0;white-space:normal;margin-top:4px}
 .role-card .choice-dot{top:7px;right:6px;width:9px;height:9px}
 .role-card[aria-pressed=true] .choice-dot{border-width:2px}
 .role-card .stamp{bottom:21px;right:5px;font-size:8px}
 .layout.choosing #choice-panel>.start-button{margin-top:9px}
 .profession-heading{border:0;padding:0;grid-area:auto}
 .profession-heading canvas{height:35px;width:44px}
 .profession-heading h2{font-size:22px}
 .shift-panel{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 14px}
 .shift-panel .shift-progress{padding:0;align-self:center;grid-column:2;grid-row:1;width:100px}
 .shift-panel .tasks{grid-column:1/-1;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin:2px 0 0}
 .shift-panel .tasks li{font-size:12px;padding:0;gap:4px}
 .shift-panel .tasks li .task-check{width:15px;height:15px;flex-basis:15px;font-size:7px}
 .shift-panel>.primary{grid-column:1/-1;grid-row:auto}
 .shift-panel .mentor,.shift-panel .progress-extra{display:none}
 .npc-name{font-size:8px;padding:1px 3px}
}
@media(max-height:460px) and (orientation:landscape){
 body{grid-template-rows:44px minmax(0,1fr)}
 .header{padding:0 12px}
 .header .day{font-size:13px}
 .day small{font-size:12px;margin-top:0}
 .day .sun{font-size:25px}
 .layout,.layout.choosing{grid-template-columns:230px minmax(0,1fr);padding:7px 12px 9px;gap:12px}
 .panel-title{font-size:18px;margin-bottom:6px}
 .role-cards{gap:5px}
 .role-card{min-height:64px;padding:5px 6px}
 .role-card canvas{width:28px;height:22px;float:left;margin:0 4px 0 0}
 .role-card strong{font-size:13px;min-height:22px}
 .role-card .game-count{font-size:10px;margin-top:2px}
 .primary{min-height:34px;padding:5px 10px;font-size:15px}
 .layout.choosing #choice-panel>.start-button{margin-top:8px}
 .profession-heading{padding-bottom:6px}
 .profession-heading h2{font-size:18px}
 .tasks{margin:9px 0 0}
 .tasks li{font-size:13px;padding-bottom:7px}
 .shift-progress{padding-top:6px}
 .progress-extra{display:none}
}
@media(max-width:360px){
 .header{padding:0 8px;gap:6px}
 .header nav{gap:7px}
 .header .day{gap:3px;font-size:12px}
 .header .quiet{font-size:12px}
 .day small{font-size:11px;max-width:110px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .sky-clock{width:24px;flex-basis:24px}
 .day .sky-clock .sun,.day .sky-clock .moon{font-size:24px}
 .header #sound{width:16px}
 .help-button{width:26px;height:26px}
}

.cancel-profession{align-self:center;grid-column:1/-1;padding:7px 4px;margin-top:4px;text-decoration:underline;text-underline-offset:3px}

/* Colors change beneath the mask; the clock keeps its own sky animation. */
.theme-wave-running body,.theme-wave-running body *{transition-property:transform,opacity!important}
.theme-wave-snapshot{contain:layout paint;user-select:none}
