/* A proper front door: big choices, small punchlines, room for the board. */
.main-header{box-sizing:border-box;height:90px;margin:0 24px;display:flex;align-items:center;justify-content:space-between;gap:32px;border-bottom:1px solid #bbc3b2}
.main-header .site-title{order:2;flex:none;margin:0;font:inherit}
.main-header .brand{order:2;flex:none;gap:10px;font-size:28px;letter-spacing:-.8px;line-height:1.1}
.main-header .brand-logo{width:48px;height:48px}
.main-header .brand-copy{display:block;text-align:right}
.main-header .brand-tagline{display:block;margin-top:4px;font-size:13px;font-style:italic;font-weight:400;letter-spacing:0;line-height:18px;color:#000}
.primary-nav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;max-width:850px;flex:1;align-items:stretch}
.primary-nav .menu-item{display:flex;flex-direction:column;justify-content:center;gap:5px;min-width:0;min-height:68px;padding:8px 16px;border:1px solid transparent;border-radius:10px;color:#000;text-decoration:none;text-align:left;line-height:1.1;transition:background .15s,border-color .15s,transform .15s}
.menu-title{font-size:28px;font-weight:750;letter-spacing:-.8px;white-space:nowrap}
.menu-subtitle{font-size:14px;font-weight:450;line-height:1.25;max-width:22ch}
.primary-nav .menu-item[aria-current]{background:#dce997;border-color:#a4b568}
.primary-nav .menu-item:hover{background:#e5eacb;border-color:#b1bc92;transform:translateY(-1px)}
.primary-nav .menu-item:focus-visible{outline:3px solid #617a35;outline-offset:2px}
.play-page{--header-height:90px;--play-height:calc(100svh - var(--header-height));--board-size:min(calc(100svh - var(--header-height) - 140px),calc(100vw - 446px))}
.play-page .sidebar-title .description{min-height:0;margin:0 0 12px}
.play-page .workspace{padding-top:12px}
.about-page .about-main{padding-top:30px}
#matches-dialog{box-sizing:border-box;width:min(1040px,calc(100vw - 32px));max-width:none;max-height:calc(100svh - 32px);padding:28px;border:1px solid #8e9c79;border-radius:16px;background:var(--paper);color:#000;overflow:auto}
.matches-heading{display:flex;align-items:center;justify-content:space-between;gap:20px}
.matches-heading .eyebrow{font-size:12px;letter-spacing:2px}
.matches-heading h2{font:700 36px/1.1 'DM Sans',sans-serif;letter-spacing:-1.3px;margin:8px 0 0}
#close-matches{flex:none;border:1px solid #a9b59a;border-radius:7px;background:#edf0e4;color:#000;font:600 14px 'DM Sans',sans-serif;min-height:40px;padding:8px 14px;cursor:pointer}
#matches-intro{font-size:16px;line-height:1.5;margin:14px 0 24px;max-width:650px}
.matches-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.match-card{display:grid;grid-template-columns:104px minmax(0,1fr);align-items:start;gap:16px;padding:16px;border:1px solid #bfc8b3;border-radius:10px;background:#f9faf3;color:#000;text-align:left;font:inherit;cursor:pointer;transition:background .15s,border-color .15s}
.match-card:hover{background:#e8efce;border-color:#6c8253}
.match-card:focus-visible{outline:3px solid #617a35;outline-offset:2px}
.match-preview{display:grid;grid-template-columns:repeat(8,1fr);aspect-ratio:1;width:104px;border:3px solid #4b5848;border-radius:2px;overflow:hidden}
.match-square{display:grid;place-items:center;aspect-ratio:1;background:var(--light);min-width:0}
.match-square.dark{background:var(--dark)}
.match-square .piece{width:100%;height:100%;cursor:inherit;filter:none}
.match-copy{display:block;min-width:0}
.match-kind{display:block;font-size:11px;font-weight:650;line-height:1.3;text-transform:uppercase;letter-spacing:.06em;margin-bottom:7px}
.match-copy strong{display:block;font-size:18px;line-height:1.2;font-weight:750;letter-spacing:-.3px}
.match-copy p{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;font-size:13px;line-height:1.5;margin:8px 0 0}
.play-page:has(#matches-dialog[open]){overflow:clip}
@media(max-width:1100px){
 .main-header{gap:20px}.primary-nav .menu-item{padding-inline:12px}.menu-title{font-size:25px}.menu-subtitle{font-size:12px}
 .main-header .brand{font-size:24px}.main-header .brand-logo{width:40px;height:40px}.main-header .brand-tagline{font-size:12px}
}
@media(min-width:761px) and (max-height:680px){.play-page{--board-size:min(calc(100svh - var(--header-height) - 140px),calc(100vw - 356px))}}
@media(max-width:760px){
 .main-header{height:144px;margin:0 12px;display:grid;grid-template-columns:1fr;grid-template-rows:52px 76px;gap:4px;padding-top:4px}
 .main-header .site-title{order:0;justify-self:end}
 .main-header .brand{order:0;justify-self:end;font-size:24px;gap:8px}.main-header .brand-logo{width:38px;height:38px}.main-header .brand-tagline{font-size:11px;line-height:15px;margin-top:2px}
 .primary-nav{width:100%;max-width:none;gap:4px}
 .primary-nav .menu-item{min-height:70px;padding:8px 6px;gap:5px;border-radius:8px;justify-content:flex-start}
 .menu-title{font-size:21px;letter-spacing:-.65px}.menu-subtitle{font-size:12px;line-height:1.25}
 .play-page{--header-height:144px;--board-size:min(calc(100vw - 24px),calc(100svh - var(--header-height) - 230px))}
 .play-page .workspace{grid-template-rows:64px minmax(0,1fr) 40px auto;padding-top:6px;gap:4px}
 .play-page .sidebar-title{display:none}
 .play-page .side-choice{top:6px;flex-direction:row;align-items:center;gap:10px;font-size:11px}
 .play-page .side-choice select{min-width:90px;font-size:13px}
 .play-page .tablebase-choice{top:43px;font-size:12px}
 .play-page .free-note{bottom:48px}
 .play-page .move-feedback:not(:empty){bottom:61px}
 .about-page .about-main{padding-top:22px}
 #matches-dialog{width:calc(100vw - 20px);max-height:calc(100svh - 20px);padding:18px;border-radius:12px}
 .matches-heading h2{font-size:28px;letter-spacing:-.8px}.matches-heading .eyebrow{font-size:10px}
 #close-matches{font-size:12px;min-height:36px;padding:7px 10px}
 #matches-intro{font-size:14px;margin:12px 0 18px}.matches-grid{grid-template-columns:1fr;gap:10px}
 .match-card{grid-template-columns:88px minmax(0,1fr);gap:12px;padding:12px}.match-preview{width:88px}
 .match-copy strong{font-size:17px}.match-kind{font-size:10px;margin-bottom:5px}.match-copy p{font-size:12px;margin-top:6px}
}
@media(max-width:380px){.primary-nav .menu-item{padding-inline:4px}.menu-title{font-size:19px}.menu-subtitle{font-size:12px}}
@media(prefers-reduced-motion:reduce){.primary-nav .menu-item,.match-card{transition:none}.primary-nav .menu-item:hover{transform:none}}
/* Primary destinations are page views, never modal windows. */
[hidden]{display:none!important}
.page-view{box-sizing:border-box;min-height:calc(100svh - var(--header-height));margin:0;padding:30px 24px 40px;max-width:none;width:100%}
#editor-dialog.page-view{width:100%;max-width:none;max-height:none;overflow:visible;border:0;border-radius:0;padding:24px 32px 30px;margin:0;background:var(--paper)}
#editor-dialog .editor-layout{grid-template-columns:minmax(0,1.15fr) minmax(340px,.85fr);gap:48px;max-width:1500px;margin:auto}
#editor-dialog .editor-canvas{top:18px}
#editor-dialog .editor-board-frame{max-width:min(100%,calc(100svh - 240px));margin:auto}
#editor-dialog .editor-board-actions{max-width:min(100%,calc(100svh - 240px));margin:10px auto 0}
#editor-dialog .editor-header,#editor-dialog #editor-intro,#editor-dialog .editor-bottom{max-width:1500px;margin-left:auto;margin-right:auto}
#editor-dialog .editor-bottom{bottom:0;border-top:1px solid #b1bea1;box-shadow:0 -8px 16px #f4f2edbb;padding:14px 0;z-index:3}
#editor-dialog .editor-section-label{font-size:13px}
#editor-dialog #editor-intro,#editor-dialog .editor-hint,#editor-dialog .editor-test-presets p,#editor-dialog .editor-play-settings label,#editor-dialog #editor-start-hint{font-size:14px}
#editor-dialog input:not([type=checkbox]),#editor-dialog select{font-size:15px}
#about-view{padding:0 24px 40px}#about-view .about-main{padding-top:24px}
.play-page[data-view=about] .sidebar-title,.play-page[data-view=editor] .sidebar-title{display:none}
@media(max-width:760px){
 .page-view{padding:22px 14px 30px}
 #editor-dialog.page-view{padding:20px 14px 0}
 #editor-dialog .editor-layout{grid-template-columns:1fr;gap:16px}
 #editor-dialog .editor-board-frame,#editor-dialog .editor-board-actions{max-width:100%}
 #editor-dialog .editor-canvas{position:static}
 #editor-dialog .editor-bottom{bottom:0}
 #about-view{padding:0 0 30px}
}
#editor-dialog .editor-board-frame,#editor-dialog .editor-board-actions{max-width:min(100%,calc(100svh - 300px))}
@media(max-width:760px){#editor-dialog .editor-board-frame,#editor-dialog .editor-board-actions{max-width:100%}}
/* Five equal destinations, including the full-page Settings view. */
.primary-nav{grid-template-columns:repeat(5,minmax(0,1fr));max-width:1060px}
@media(min-width:761px) and (max-width:1100px){.main-header{gap:16px;margin-inline:18px}.primary-nav{gap:4px}.primary-nav .menu-item{padding-inline:9px}.menu-title{font-size:22px}.menu-subtitle{font-size:12px}.main-header .brand{font-size:22px}.main-header .brand-logo{width:35px;height:35px}.main-header .brand-tagline{font-size:11px}}
@media(max-width:760px){.primary-nav .menu-item{padding-inline:4px}.menu-title{font-size:18px;letter-spacing:-.6px}.menu-subtitle{font-size:11px;line-height:1.25}}
@media(max-width:380px){.primary-nav .menu-item{padding-inline:3px}.menu-title{font-size:16px;letter-spacing:-.55px}.menu-subtitle{font-size:10px}}
