:root{font-family:system-ui,Segoe UI,sans-serif;color:#e9e3d5;background:#10151b}*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 50% 0%,#29303b,#10151b 70%)}header{display:flex;justify-content:space-between;align-items:center;padding:17px max(3vw,20px);border-bottom:1px solid #45505b;background:#10161bd9;gap:12px;flex-wrap:wrap}.brand{font-size:25px;letter-spacing:3px;font-weight:900;color:#e6c77b}.brand small{display:block;font-size:9px;letter-spacing:3px;color:#b7b4aa}nav{display:flex;align-items:center;gap:10px}button,select,input{font:inherit}button{cursor:pointer;color:#e9e3d5;background:#303d4a;border:1px solid #657587;border-radius:8px;padding:10px 15px}button:hover{border-color:#e6c77b;background:#3b4b5b}button:disabled{opacity:.4;cursor:default}.pill{font-size:11px;color:#cbbd9d;border:1px solid #626153;border-radius:20px;padding:8px}main{max-width:1260px;margin:auto;padding:24px 24px 50px}.hero{text-align:center;padding:40px 0 28px}.eyebrow{font-size:12px;letter-spacing:3px;color:#e6c77b}.hero h1{font-family:Georgia,serif;font-size:clamp(42px,7vw,82px);margin:12px 0}.hero em{color:#e6c77b}.elements{color:#aab9bf;font-size:13px;margin:20px}.setup{display:grid;grid-template-columns:1fr 1fr;gap:35px;align-items:center;background:#1c242dbd;padding:30px;border:1px solid #46505b;border-radius:18px}.setup label{display:block;margin:18px 0}.setup input,.setup select{display:block;width:100%;padding:12px;background:#10171f;color:#fff;border:1px solid #607080;border-radius:8px;margin-top:8px}.setup button{margin:5px 7px 5px 0}.showcase{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:15px}.showcase p{width:100%;text-align:center}.card{padding:0;border:0;background:none;display:block;width:128px;max-width:100%;border-radius:6px;overflow:hidden;transition:transform .15s,filter .15s}.card:hover{transform:translateY(-4px);filter:brightness(1.12);background:none;border:0}.card img{display:block;width:100%;height:auto}.card.back{aspect-ratio:2/3;background:#334151;display:grid;place-items:center}.tablehead{margin-bottom:22px}.tablehead h1{font-family:Georgia,serif;font-size:42px;margin:10px 0}.scoreline{font-size:20px}.scoreline strong{color:#e6c77b}.note{font-size:13px;color:#aab8c5}.note a{color:#e6c77b}.draftcounts{margin:20px 0;color:#e6c77b}.draft{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:15px}.pile{background:#202b35;border:1px solid #3f5361;border-radius:12px;padding:12px;display:flex;align-items:center;flex-direction:column;gap:12px}.pile .card{width:min(100%,155px)}.boards{display:grid;grid-template-columns:1fr 1fr;gap:24px}.boardpanel{background:#1d2832;border:1px solid #455767;border-radius:15px;padding:17px}.boardpanel h2{margin:0 0 16px;font-size:21px}.boardpanel h2 small{font-size:12px;color:#e6c77b;float:right}.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}.slot{min-height:155px;background:#111a23;border:1px dashed #546576;border-radius:9px;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:5px;cursor:pointer}.slot.legal{outline:2px solid #4d936b}.slot.scoring{background:#3b3925;border:1px solid #e6c77b}.slot.recent-build{outline:3px solid #36b17a}.slot.recent-attack{outline:3px solid #d65353}.slot .card{width:min(100%,110px)}.slot .empty{font-size:38px;color:#607080}.stack{font-size:11px;color:#b9c4c9;margin-top:4px}.totals{margin-top:15px;font-size:13px;color:#c8c1a5}.hand{margin:30px 0;background:#1e2933;padding:20px;border-radius:15px}.handcards{display:flex;gap:12px;flex-wrap:wrap}.handitem.selected{outline:3px solid #e6c77b;border-radius:7px}.result{margin:25px 0;padding:24px;background:#2a332c;border:1px solid #e6c77b;border-radius:12px}.result button{margin-right:12px}.error{color:#ffb0a6}footer{text-align:center;color:#778895;font-size:11px;padding:24px}dialog{max-width:650px;width:90%;background:#1d2832;color:#f3eee1;border:1px solid #e6c77b;border-radius:15px;line-height:1.6}dialog::backdrop{background:#000b}@media(max-width:760px){.setup,.boards{grid-template-columns:1fr}.draft{grid-template-columns:repeat(2,minmax(0,1fr))}.slot{min-height:110px}.slot .card{width:80px}.brand{font-size:19px}main{padding:15px}}
/* Mobile-specific layout */
body{padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);overscroll-behavior:none}button{touch-action:manipulation;min-height:44px} .card{min-height:0;touch-action:manipulation} .card:hover{transform:none} .collection-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:15px}#detail .card{width:min(75vw,300px);margin:auto}#detail form{margin-bottom:10px} .slot.legal{outline:2px solid #79d6a3;background:#18362d} .handitem.selected{transform:translateY(-4px)}
@media(max-width:900px){header{padding:8px 12px;gap:5px}.brand{font-size:17px;letter-spacing:2px}nav{gap:5px}nav button{font-size:12px;padding:6px 9px}.pill{display:none}main{padding:10px 10px 20px}.hero{padding:20px 0 12px}.hero h1{font-size:38px}.setup{padding:16px;gap:16px}.setup button{width:100%}.tablehead{margin-bottom:8px}.tablehead h1{font-size:24px;margin:5px 0}.tablehead p{font-size:12px;margin:4px 0}.eyebrow{font-size:9px;letter-spacing:1px}.scoreline{font-size:15px}.boards{grid-template-columns:1fr 1fr;gap:7px}.boardpanel{padding:6px;border-radius:8px;min-width:0}.boardpanel h2{font-size:12px;margin:0 0 6px;overflow-wrap:anywhere}.boardpanel h2 small{float:none;display:block;font-size:9px}.grid{gap:3px}.slot{min-height:0;aspect-ratio:0.66;padding:2px;border-radius:4px;position:relative}.slot .card{width:100%;max-height:100%}.slot .empty{font-size:20px}.stack{position:absolute;bottom:0;right:0;background:#10151be8;font-size:8px;padding:2px;border-radius:3px}.totals{font-size:9px;margin-top:5px}.hand{margin:10px 0;padding:8px;position:sticky;bottom:0;z-index:2;background:#1e2933f5}.hand h2{font-size:14px;margin:0}.hand p{font-size:10px;margin:4px 0}.handcards{justify-content:center;gap:10px}.hand .card{width:70px}.draft{grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}.pile{padding:4px;gap:4px}.pile button:not(.card){font-size:10px;padding:4px;width:100%}.draftcounts{font-size:12px;margin:8px 0}footer{padding:8px;font-size:9px}}
@media(orientation:landscape) and (max-height:550px){main{padding:5px 10px}.boards{max-width:520px;margin:auto}.slot{aspect-ratio:1}.slot .card{width:48px}.hand{position:fixed;right:8px;bottom:8px;width:135px}.handcards{gap:4px}.hand .card{width:37px}.tablehead h1{font-size:18px}.tablehead .note{display:none}.draft{grid-template-columns:repeat(8,minmax(0,1fr))}.pile .card{max-width:80px}}
/* v0.2: let the document scroll in an embedded mobile browser. */
html{height:auto;min-height:100%;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:auto}
body{height:auto;min-height:100%;overflow:visible;overscroll-behavior:auto;touch-action:pan-y pinch-zoom}
#app{min-width:0;min-height:100%;overflow:visible}
main{min-width:0;padding-bottom:24px}
nav{flex-wrap:wrap}dialog{max-height:85vh;max-height:85dvh;overflow-y:auto}
@media(max-width:900px){.hero{padding:10px 0}.hero h1{font-size:clamp(27px,7vw,38px);margin:6px 0}.hero p,.elements{margin:8px 0}.setup{grid-template-columns:minmax(0,1fr);gap:10px;padding:12px}.setup h2{font-size:18px;margin:4px 0}.setup label{margin:10px 0}.setup button{margin:4px 0}.showcase .card{width:75px}.showcase{gap:8px}.hand{position:static;width:auto;right:auto;bottom:auto}.draft{grid-template-columns:repeat(2,minmax(0,1fr))}.pile .card{width:min(100%,120px)}.pile button:not(.card){font-size:12px}.slot .card img{max-height:100%;object-fit:contain}}
@media(orientation:landscape) and (max-height:550px){header{padding:5px 10px}.hero{padding:5px 0}.hero h1{font-size:28px}.setup{grid-template-columns:minmax(0,1fr) minmax(0,0.6fr)}.boards{max-width:600px;margin:auto}.slot{aspect-ratio:1.2;min-height:0}.slot .card{width:auto;height:100%;max-width:100%}.slot .card img{height:100%;width:auto;max-width:100%;object-fit:contain}.hand{position:static;width:auto;margin:8px auto;max-width:600px}.hand .card{width:60px}.draft{grid-template-columns:repeat(4,minmax(0,1fr))}.pile .card{max-width:95px}.tablehead .note{display:block}}

/* v0.3 stable draft and dedicated short-screen landscape layout */
html{scroll-behavior:auto;overflow-anchor:none} .pile .card{aspect-ratio:2/3;display:grid;place-items:center} .pile .card img{height:100%;width:100%;object-fit:contain} .pile{min-width:0} .install-help{line-height:1.5} body{padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}
@media(orientation:landscape) and (max-height:550px){
#app:is([data-phase=play],[data-phase=draft],[data-phase=result],[data-phase=finished]){height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;overflow:auto}
#app:not([data-phase=menu]) header{flex:none;padding:2px 6px;flex-wrap:nowrap;min-height:34px}#app:not([data-phase=menu]) header button{min-height:32px;padding:3px 8px}#app:not([data-phase=menu]) .brand small{display:none}#app:not([data-phase=menu]) footer{display:none}
#app:not([data-phase=menu]) main{width:100%;max-width:none;flex:1;min-height:0;margin:0;padding:4px;display:grid;gap:4px;grid-template-rows:auto minmax(0,1fr);}
#app:not([data-phase=menu]) .tablehead{margin:0;display:flex;align-items:center;justify-content:space-between;gap:5px;flex-wrap:wrap}#app:not([data-phase=menu]) .tablehead h1{font-size:14px;margin:0}#app:not([data-phase=menu]) .tablehead .note,#app:not([data-phase=menu]) .tablehead .eyebrow{display:none}#app:not([data-phase=menu]) .tablehead p{font-size:10px;margin:0} .scoreline{font-size:12px}
#app:is([data-phase=play],[data-phase=result],[data-phase=finished]) main{grid-template-columns:minmax(0,1fr) minmax(100px,24%) minmax(0,1fr);grid-template-rows:auto minmax(0,1fr)}#app:is([data-phase=play],[data-phase=result],[data-phase=finished]) .tablehead{grid-column:1/-1;grid-row:1} .boards{display:contents} .boardpanel{grid-row:2;display:flex;flex-direction:column;min-height:0;padding:3px;overflow:hidden} .boardpanel:first-child{grid-column:1}.boardpanel:last-child{grid-column:3}.boardpanel h2{margin:0 0 2px;font-size:11px}.boardpanel h2 small{display:inline;font-size:9px;margin-left:3px}.grid{flex:1;min-height:0;grid-template-rows:repeat(3,minmax(0,1fr));gap:3px}.slot{aspect-ratio:auto;min-height:0;padding:1px;overflow:hidden}.slot .card{height:100%;width:100%;min-height:0}.slot .card img{height:100%;width:100%;object-fit:contain}.totals{margin-top:2px;font-size:9px}.hand,.result{grid-column:2;grid-row:2;min-width:0;min-height:0;overflow:auto;margin:0;padding:5px;max-width:none;position:static}.handcards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px}.hand .card{width:100%;max-width:85px}.handitem{min-width:0}.hand h2,.result h2{font-size:12px}.result p{font-size:11px}.result button{font-size:11px;padding:4px;margin:2px 0;width:100%}
#app[data-phase=draft] main{grid-template-rows:auto auto minmax(0,1fr)}.draftcounts{margin:0;font-size:11px}.draft{grid-template-columns:repeat(var(--draft-piles,8),minmax(0,1fr));gap:4px;min-height:0;align-items:stretch}.pile{padding:3px;gap:3px;min-height:0;justify-content:center}.pile .card{flex:1;min-height:0;width:100%;max-width:140px;aspect-ratio:auto;overflow:hidden}.pile button:not(.card){flex:none;min-height:38px;font-size:10px;padding:2px}.pile .card img{max-height:100%;object-fit:contain}
}
