:root{--ink:#1d352e;--pine:#184b3a;--muted:#596d63;--line:#d8e2da;--page:#f5f7f3;--radius:18px;color-scheme:light}
html,body{touch-action:auto}
body{background:var(--page);color:var(--ink);font-family:system-ui,-apple-system,sans-serif}
header{height:64px;background:#fff;border-bottom:1px solid var(--line);padding:0 max(22px,calc((100vw - 1080px)/2));justify-content:flex-start}
.brand{display:flex;align-items:center;gap:0;font:750 23px/1 system-ui;letter-spacing:-1.15px;color:var(--ink)}
.brand-light{font-weight:450}.brand-symbol{display:grid;place-items:center;width:36px;height:36px;background:var(--pine);color:#e9f4df;border-radius:11px;margin-right:10px}.brand-symbol svg{width:23px}
.header-studio{margin-left:auto;color:var(--muted);font-size:14px}
body:has(#studio:not([hidden])) .header-studio{display:none}
main{max-width:none}main:has(#home:not([hidden])){display:block;overflow:auto;overscroll-behavior:contain}
#home{display:block;width:min(100%,1120px);max-height:none;margin:0 auto;padding:26px 20px 44px}
.feature{border-radius:22px;background:#143c30 url(hero.webp) center 52%/cover no-repeat;isolation:isolate;position:relative;overflow:hidden}
.feature:before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,#102e29ee,#132f28a6 37%,transparent 70%)}
.feature-copy{padding:34px 42px;color:white;width:55%}.feature h1{font:500 clamp(40px,5.2vw,70px)/.98 Georgia,serif;letter-spacing:-2.4px;margin:0;color:white}.feature h1 em{font-weight:normal;color:#d8ebbc}
.feature p{font-size:16px;line-height:1.5;margin:12px 0 19px;max-width:340px;color:#eef4eb}
button{font-family:inherit}.feature button{display:inline-flex;align-items:center;gap:8px;background:#e0efce;color:#203e2e;border:0;border-radius:100px;padding:10px 17px;font-size:14px;min-height:42px}.feature button svg{width:16px}
.dashboard{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(250px,1fr);gap:22px;margin-top:24px;align-items:start}
.recent,.imports{color:var(--ink);background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:22px 24px;box-shadow:0 4px 16px #1c442c05}
.recent{display:grid;gap:12px;grid-template-columns:1fr auto;align-items:center;max-height:none}
.dashboard h2,dialog h2{font:670 22px/1.2 system-ui;letter-spacing:-.8px;color:var(--ink);margin:0}
.section-heading{display:flex;align-items:center;gap:9px}.section-heading svg{width:20px;color:#4e755f}
.sources{display:flex;background:#eef2ed;border-radius:8px;padding:3px;gap:1px}.sources button{color:var(--muted);background:none;border:0;font-size:13px;padding:7px 10px;border-radius:6px}.sources [aria-pressed=true]{background:white;color:var(--pine);box-shadow:0 1px 4px #243b2924}
#lookup,#results,#status{grid-column:1/-1}#lookup{margin:2px 0 0;gap:8px}.search-field{min-width:0;flex:1;display:flex;align-items:center;gap:8px;background:#f6f8f5;border:1px solid var(--line);border-radius:9px;padding-left:12px}.search-field svg{width:16px;color:var(--muted);flex:none}#lookup input{background:transparent;color:var(--ink);border:0;padding:10px 5px}.search-field:focus-within{outline:2px solid #498366}#lookup button,dialog #load,#analyzeFilm,#confirm{background:var(--pine);color:#fff;border-radius:9px;padding:9px 16px}
#results{overflow:visible}#results button{width:100%;min-height:47px;padding:9px 2px;color:var(--ink);border:0;border-top:1px solid #e2e8e1;gap:12px;background:transparent;text-align:left}#results button:hover{background:#f1f5ef}#results button:before{content:"♟";width:30px;height:30px;display:grid;place-items:center;background:#edf2e9;color:#4b6b55;border-radius:8px;flex:none;font-size:20px}#results strong{flex:1;font-weight:580}#results small,#status{color:var(--muted)}.imports{display:grid;gap:12px}.imports h2{margin-bottom:4px}
.imports .import-card{display:flex;align-items:center;justify-content:flex-start;gap:13px;width:100%;height:auto;min-height:72px;padding:12px;background:#f8faf6;color:var(--ink);border:1px solid var(--line);border-radius:12px;text-align:left}.import-card strong,.import-card small{display:block}.import-card strong{font-size:16px}.import-card small{font:400 13px/1.4 system-ui;color:var(--muted);letter-spacing:0;margin-top:4px}.tool-icon{width:42px;height:42px;flex:none;display:grid;place-items:center;border-radius:12px;background:#e3ecda;color:#456947}.tool-icon.plum{background:#ebe7f0;color:#695875}.tool-icon svg{width:23px}
#homeBtn,.audioctrl button,.transport .navmove,dialog button,.filebtn{background:#e9efe7;color:var(--ink);border:1px solid var(--line);border-radius:9px}.players span,.players b,#speechStatus{color:var(--ink)}#homeBtn{min-height:38px;padding:7px 13px}.boardpanel #side,.boardpanel #bestPreview,.boardpanel #voiceSettings{color:var(--ink);background:#fff}.boardpanel>.audioctrl #listen{color:#fff;background:var(--pine);border:0;border-radius:13px}.transport .navmove{font-size:22px}.boardstage{border-radius:8px;overflow:hidden}.boardrow>#history{border-radius:6px}.boardrow>.meter{border:1px solid #9ba99b;border-radius:5px;overflow:hidden}
dialog{color:var(--ink);background:#fff;border:1px solid var(--line);border-radius:18px;padding:24px;box-shadow:0 14px 70px #10251f32}dialog::backdrop{background:#13291fe0}dialog input,dialog select,dialog textarea{background:#f7f9f5;color:var(--ink);border:1px solid #b9c8ba}dialog p,dialog label{color:var(--muted)}.voice-settings button{background:#e6eee2;color:var(--ink)}
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #518661;outline-offset:2px}
@media(max-width:850px){.recent{grid-template-columns:1fr}.sources{width:fit-content}.dashboard{grid-template-columns:1.4fr 1fr;gap:14px}.recent,.imports{padding:18px}}
@media(max-width:660px){header{height:54px;padding-inline:14px}.brand{font-size:20px}.brand-symbol{width:32px;height:32px}.header-studio{font-size:12px}#home{padding:12px 12px 26px}.feature{border-radius:16px;background-position:60% center}.feature-copy{width:65%;padding:24px 16px}.feature h1{font-size:clamp(35px,8vw,47px);letter-spacing:-1.5px}.feature p{font-size:14px;margin:10px 0 14px}.feature button{font-size:13px;padding-inline:12px}.dashboard{display:flex;flex-direction:column-reverse;gap:14px;margin-top:14px}.imports,.recent{width:100%}.imports{grid-template-columns:repeat(2,minmax(0,1fr));padding:0;background:none;border:0;box-shadow:none;gap:8px}.imports h2{grid-column:1/-1;font-size:18px;margin:1px 0}.imports .import-card{min-height:62px;gap:8px;padding:9px;background:white}.tool-icon{width:30px;height:34px;border-radius:8px}.tool-icon svg{width:18px}.import-card strong{font-size:14px}.import-card small{font-size:12px}.recent{padding:15px}.dashboard h2{font-size:20px}.sources button{min-height:34px}.boardstage{border-radius:3px}dialog{padding:18px}}
@media(max-height:480px) and (orientation:landscape){header{height:36px}.recent{max-height:none}}
@media(min-width:661px){.feature{background-color:#112c23;background-size:auto 132%;background-position:right 20%}.feature:before{background:linear-gradient(90deg,#122e25 34%,#122e25bd 46%,transparent 67%)}}
#board:not(.hypothesis){background:#e8ddc4}
#board:not(.hypothesis) .sq{background:#eee4cf}
#board:not(.hypothesis) .sq.dark{background:#91aa92}
#board:not(.hypothesis) .sq.hl{background:#d9df9d;box-shadow:inset 0 0 0 2px #758c53}
#board:not(.hypothesis) .sq.dark.hl{background:#bdce83}

/* Keep the departure subtle and outline the landing square under its piece. */
#board:not(.hypothesis) .sq.hl{box-shadow:none}
#board:not(.hypothesis) .sq.last-arrival{background:#ffda63;box-shadow:inset 0 0 0 3px #8d5400}
#board.hypothesis .sq.last-arrival{background:#9ae4d2;box-shadow:inset 0 0 0 3px #136351}

.sq.piece-exposed img{filter:drop-shadow(0 1px 2px #b14d17)}
.sq.king-check{background:radial-gradient(ellipse,#fff0d6 2%,#ff9880 60%,#ae2331 100%)}
.sq .check-label{position:absolute;bottom:1%;left:50%;transform:translateX(-50%);z-index:4;background:#941d32;color:white;font:700 clamp(8px,1.3vmin,13px)/1.2 system-ui;padding:0 .32em;border-radius:.25em;pointer-events:none}
@media(prefers-reduced-motion:no-preference){
 .sq.piece-exposed img{animation:piece-shiver 1.15s ease-in-out infinite}
 .sq.king-check img{transform-origin:50% 85%;animation:king-alarm .95s ease-in-out infinite}
}
@keyframes piece-shiver{0%,38%,100%{transform:none}8%,24%{transform:translateX(-3%) rotate(-3deg)}16%,32%{transform:translateX(3%) rotate(3deg)}}
@keyframes king-alarm{0%,100%{transform:none}40%{transform:translateY(-6%) rotate(-5deg)}65%{transform:translateY(-2%) rotate(4deg)}}

.feature{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,3fr);align-items:center;background:#122e25}
.feature:before{display:none}
.feature .feature-copy{grid-area:1/1;width:auto}
.feature .team-photo{grid-area:1/2;width:100%;height:auto;display:block}
@media(max-width:660px){.feature{display:flex;flex-direction:column}.feature .feature-copy{align-self:stretch;padding:18px}.feature .team-photo{width:100%}}

@media(max-width:660px){
 .dashboard .imports,.dashboard .recent{grid-template-columns:minmax(0,1fr);min-width:0}
 .imports .import-card{min-height:64px;padding:10px 14px;gap:12px}
 #lookup{display:grid;grid-template-columns:minmax(0,1fr) auto}
 #lookup input{min-width:0;width:100%;font-size:16px}
 #lookup button{min-height:44px}
 #results{min-width:0}
 #results button{display:grid;grid-template-columns:30px minmax(0,1fr);gap:3px 10px;padding:10px 2px}
 #results button::before{grid-row:1/3}
 #results strong,#results small{grid-column:2;white-space:normal;overflow-wrap:anywhere}
}

.sources button{display:grid;place-items:center;min-width:48px;min-height:44px;padding:7px 10px}
.sources img{display:block;object-fit:contain}
.sources button[aria-pressed=true]{box-shadow:inset 0 0 0 2px var(--pine)}
#status a{color:var(--pine);font-weight:600}#status .status-action{margin-left:4px;padding:5px 10px;font-size:13px;background:var(--pine);color:#fff;border-radius:7px}
#authBtn{margin-left:12px;background:#fff;border:1px solid var(--line);color:var(--pine);font-size:14px;padding:8px 14px}#authDialog form{display:grid;gap:10px}#authDialog form button,#authSignOut{background:var(--pine);color:#fff;border-radius:9px;padding:10px 16px}#authMsg:empty{display:none}
@media(max-width:660px){#authBtn{margin-left:8px;padding:6px 10px;font-size:13px}}
