/* Shared game-page appearance. Spelling Bee ivory is the light-mode reference. */
:root{color-scheme:light;--arena-bg:#faf6ed;--arena-surface:#fff;--arena-surface-alt:#fff9ed;--arena-text:#21334a;--arena-muted:#5b604f;--arena-line:#d5c4a4;--arena-accent:#d3a444;--arena-button:#142c4d;--arena-button-text:#fff}
:root[data-arena-mode="dark"]{color-scheme:dark;--arena-bg:#0d1729;--arena-surface:#172943;--arena-surface-alt:#1b304c;--arena-text:#f3f6fc;--arena-muted:#d2dceb;--arena-line:#536681;--arena-button:#d3a444;--arena-button-text:#14213b}
html{background:var(--arena-bg)}
body{background:var(--arena-bg)!important;color:var(--arena-text)!important}
main{color:var(--arena-text)}
main h1,main h2,main h3,main h4{color:var(--arena-text)}
main p,main .muted,main .tag,main .stat,main .status,main label,main small{color:var(--arena-muted)}
main .panel,main .mission,main .card,main .gridcards>.choice,main .feedback{background:var(--arena-surface);color:var(--arena-text);border-color:var(--arena-line)}
main .stat,main .choice{color:var(--arena-text)}
main button:not(.cell):not(.tile):not(.unit):not(.theme-swatch),main select,main input:not([type="checkbox"]):not([type="radio"]){background:var(--arena-surface);color:var(--arena-text);border-color:var(--arena-line)}
main button:not(.cell):not(.tile):not(.unit):hover{border-color:var(--arena-accent)}
main .primary,main button.primary{background:var(--arena-accent);color:#14213b;border-color:var(--arena-accent)}
main a{color:var(--arena-text)}
main a:hover{color:var(--arena-accent)}
/* Leave board cells, canvas, tile and other game-specific visuals unchanged. */
.arena-theme-toolbar{display:flex;gap:9px;align-items:center;justify-content:flex-end;flex-wrap:wrap;max-width:1020px;margin:12px auto 0;padding:0 14px;font:600 14px system-ui,sans-serif}
.arena-theme-toolbar button{border:1px solid var(--arena-line);background:var(--arena-surface);color:var(--arena-text);padding:10px 13px;border-radius:10px;min-height:44px;cursor:pointer}
.arena-theme-toolbar button:focus-visible,.arena-theme-toolbar input:focus-visible{outline:3px solid #5689d2;outline-offset:2px}
.arena-theme-dialog{position:fixed;z-index:99999;inset:0;display:grid;place-items:center;padding:18px;background:rgba(0,0,0,.55)}
.arena-theme-dialog[hidden]{display:none}
.arena-theme-inner{background:var(--arena-surface);color:var(--arena-text);border:1px solid var(--arena-line);border-radius:16px;padding:22px;width:min(100%,440px);max-height:90vh;overflow:auto;box-shadow:0 16px 50px #0004}
.arena-theme-inner h2{color:var(--arena-text);margin:0 0 14px}
.arena-theme-swatches{display:grid;grid-template-columns:repeat(4,1fr);gap:9px;margin:14px 0}
.arena-theme-swatches button{border:2px solid var(--arena-line);border-radius:10px;padding:10px 3px;min-height:52px;background:var(--arena-surface-alt);color:var(--arena-text);cursor:pointer}
.arena-theme-swatches button[aria-pressed="true"]{border-color:var(--arena-accent)}
.arena-theme-swatches button:disabled{opacity:.5;cursor:not-allowed}
.arena-theme-inner p{color:var(--arena-muted)}
:root[data-arena-premium="true"]{--arena-accent:var(--arena-premium-accent,#d3a444)}

/* Information, rules, instructions and score tiles use the same ivory/white palette.
   Higher specificity and !important replace legacy inline dark-blue guide styles. */
:root{--arena-guide-heading:#9a6a19}
:root[data-arena-mode="dark"]{--arena-guide-heading:#f0c66a}
:is(main,.shell) :is(.game-guide,.about,.instructions,.rules,.info,.information,.help,.how-to-play,.guide,.score,.scores .score,.score-card,.stat-card,.info-card,.instruction-card,.rule-card,.guide-card,.summary,.legend,.notice,.tips,.tip,.explanation,.details,.game-info,.game-rules,.game-instructions){
 background:var(--arena-surface)!important;
 color:var(--arena-text)!important;
 border-color:var(--arena-line)!important;
 box-shadow:0 5px 20px rgba(36,43,54,.07);
}
:is(main,.shell) :is(.game-guide,.about,.instructions,.rules,.info,.information,.help,.how-to-play,.guide,.score,.score-card,.stat-card,.info-card,.instruction-card,.rule-card,.guide-card,.summary,.legend,.notice,.tips,.tip,.explanation,.details,.game-info,.game-rules,.game-instructions) :is(h2,h3,h4){
 color:var(--arena-guide-heading)!important;
}
:is(main,.shell) :is(.game-guide,.about,.instructions,.rules,.info,.information,.help,.how-to-play,.guide,.score,.score-card,.stat-card,.info-card,.instruction-card,.rule-card,.guide-card,.summary,.legend,.notice,.tips,.tip,.explanation,.details,.game-info,.game-rules,.game-instructions) :is(p,li,span,strong,small,em,summary){
 color:inherit;
}
:is(main,.shell) :is(.game-guide,.about,.instructions,.rules,.info,.information,.help,.how-to-play,.guide,.score,.score-card,.stat-card,.info-card,.instruction-card,.rule-card,.guide-card,.summary,.legend,.notice,.tips,.tip,.explanation,.details,.game-info,.game-rules,.game-instructions) :is(p,li)[style*="color"]{
 color:var(--arena-text)!important;
}
:is(main,.shell) :is(.game-guide,.about,.instructions,.rules,.info,.information,.help,.how-to-play,.guide,.score,.score-card,.stat-card,.info-card,.instruction-card,.rule-card,.guide-card,.summary,.legend,.notice,.tips,.tip,.explanation,.details,.game-info,.game-rules,.game-instructions) a{
 color:var(--arena-guide-heading)!important;
}
.shell .panel,.shell .score,.shell .about,.shell .settings,.shell .note{
 background:var(--arena-surface)!important;color:var(--arena-text)!important;border-color:var(--arena-line)!important;
}
.shell .sub,.shell .note{color:var(--arena-muted)!important}
.shell .btn:not(.cell),.shell select{background:var(--arena-surface-alt);color:var(--arena-text);border-color:var(--arena-line)}
.shell .btn.primary{background:var(--arena-accent);color:#14213b;border-color:var(--arena-accent)}
/* Gameplay boards, clickable board cells, colored puzzle pieces and canvases retain game-specific contrast. */

/* Guide and recommendation sections live OUTSIDE <main> on many games.
   Override their inline navy backgrounds and low-contrast text explicitly. */
body .game-guide,body #related-games{
 background:var(--arena-surface)!important;
 color:var(--arena-text)!important;
 border:1px solid var(--arena-line)!important;
 box-shadow:0 5px 20px rgba(36,43,54,.06);
}
body .game-guide :is(h2,h3,h4),body #related-games :is(h2,h3,h4){
 color:var(--arena-guide-heading)!important;
}
body .game-guide :is(p,li,ol,ul,small,span),body #related-games>p{
 color:var(--arena-text)!important;
}
body .game-guide a{color:var(--arena-guide-heading)!important}
body #related-games a[href]{
 display:block;
 background:var(--arena-surface-alt)!important;
 color:var(--arena-text)!important;
 border-color:var(--arena-line)!important;
 text-decoration:none;
}
body #related-games a[href] strong{color:var(--arena-guide-heading)!important}
body #related-games a[href] span{color:var(--arena-text)!important}
body #related-games a[href] span:last-child{text-decoration:underline}
body #related-games a[href]:hover{border-color:var(--arena-accent)!important}
body #related-games a[href]:focus-visible{outline:3px solid var(--arena-accent);outline-offset:3px}

/* High contrast: black instructional text on white/ivory cards in light mode. */
:root:not([data-arena-mode="dark"]){--arena-guide-copy:#111111}
:root[data-arena-mode="dark"]{--arena-guide-copy:#f3f6fc}
:root:not([data-arena-mode="dark"]) body :is(.game-guide,#related-games,.about,.instructions,.rules,.information,.info-card,.instruction-card,.rule-card,.guide-card,.game-info,.game-rules,.game-instructions) {
 color:var(--arena-guide-copy)!important;
}
:root:not([data-arena-mode="dark"]) body :is(.game-guide,#related-games,.about,.instructions,.rules,.information,.info-card,.instruction-card,.rule-card,.guide-card,.game-info,.game-rules,.game-instructions) :is(p,li,ol,ul,small,span,em,b,strong,summary){
 color:var(--arena-guide-copy)!important;
}
:root:not([data-arena-mode="dark"]) body #related-games a[href],
:root:not([data-arena-mode="dark"]) body #related-games a[href] span{
 color:#111111!important;
}
:root:not([data-arena-mode="dark"]) body :is(.game-guide,#related-games) :is(h2,h3,h4),
:root:not([data-arena-mode="dark"]) body #related-games a[href] strong{
 color:#8a5c0c!important;
}

/* Keep appearance controls away from page headings and gameplay layouts. */
.arena-theme-toolbar{
 position:fixed!important;
 right:max(14px,env(safe-area-inset-right))!important;
 bottom:max(16px,env(safe-area-inset-bottom))!important;
 z-index:9990!important;
 width:auto!important;max-width:calc(100vw - 28px)!important;
 margin:0!important;padding:0!important;
}
.arena-theme-toolbar button{
 background:var(--arena-surface)!important;
 color:var(--arena-text)!important;
 border:1px solid var(--arena-line)!important;
 border-radius:999px!important;
 box-shadow:0 5px 20px rgba(0,0,0,.22)!important;
 font-weight:700!important;
}
.arena-theme-toolbar button:hover{border-color:var(--arena-accent)!important}
.arena-theme-dialog [data-arena-toggle]{
 background:var(--arena-surface-alt);color:var(--arena-text);
 border:1px solid var(--arena-line);border-radius:10px;
 padding:10px 14px;min-height:44px;cursor:pointer;
}
@media(max-width:600px){
 .arena-theme-toolbar{right:max(10px,env(safe-area-inset-right))!important;bottom:max(12px,env(safe-area-inset-bottom))!important}
 .arena-theme-toolbar button{padding:10px 12px!important;font-size:13px!important}
}
