:root {
    color-scheme: light;
    --bg:#f5f7fc; --panel:#fff; --text:#1b2240; --muted:#51607b; --line:#ced7e9;
    --brand:#34469e; --on:#fff; --key:#e8edfa; --hero:#242f69;
    --exact:#374ba5; --present:#9b482b; --absent:#535e76;
}
@media(prefers-color-scheme:dark) {
    :root:not([data-theme]) {
        color-scheme:dark;
        --bg:#111729; --panel:#1a233b; --text:#f4f6ff; --muted:#bdc9e4; --line:#475678;
        --brand:#c5ceff; --on:#202954; --key:#2c395c; --hero:#242f69;
    }
}
:root[data-theme=dark] {
    color-scheme:dark;
    --bg:#111729; --panel:#1a233b; --text:#f4f6ff; --muted:#bdc9e4; --line:#475678;
    --brand:#c5ceff; --on:#202954; --key:#2c395c; --hero:#242f69;
}
* {box-sizing:border-box}
[hidden] {display:none !important}
body {margin:0;background:var(--bg);color:var(--text);font:1rem/1.55 system-ui,sans-serif}
a {color:var(--brand)}
button,.primary {font:inherit;font-weight:650;min-height:44px;cursor:pointer;border-radius:.7rem;border:1px solid var(--line);padding:.5rem .8rem;color:var(--text);background:var(--panel)}
:focus-visible {outline:3px solid var(--brand);outline-offset:3px}
.wrap {width:min(68rem,calc(100% - 2rem));margin-inline:auto}
.top {border-bottom:1px solid var(--line);background:var(--panel)}
.top-inner {display:flex;align-items:center;justify-content:space-between;gap:.5rem;min-height:4.2rem}
.brand {display:flex;align-items:center;gap:.65rem;white-space:nowrap;text-decoration:none;color:var(--text);font-weight:750}
.brand-logo {display:grid;place-items:center;width:clamp(7.5rem,32vw,9rem);height:1.6rem;overflow:hidden;position:relative}
.brand-logo img {position:absolute;top:50%;width:100%;height:auto;transform:translateY(-50%);filter:brightness(0)}
.brand-section {border-inline-start:1px solid var(--line);padding-inline-start:.65rem}
#theme {display:grid;place-items:center;flex:none;width:44px;height:44px;padding:0}
#theme svg {width:21px;height:21px}
#theme:hover {background:var(--key)}
:root[data-theme=dark] .brand-logo img {filter:brightness(0) invert(1)}
@media(prefers-color-scheme:dark) {
    :root:not([data-theme]) .brand-logo img {filter:brightness(0) invert(1)}
}
.skip {position:absolute;left:1rem;top:-7rem;background:var(--panel);padding:.7rem;z-index:2}
.skip:focus {top:.25rem}
h1,h2 {letter-spacing:-.045em;line-height:1.05;margin:0}
h1 {font-size:clamp(2.2rem,6vw,4.5rem)}
h2 {font-size:clamp(1.65rem,4vw,2.8rem)}
p {margin:.75rem 0}
.portal-intro {padding:clamp(2.3rem,8vw,5rem) 0 1.85rem}
.portal-intro p,.intro p,.foot {color:var(--muted)}
.catalog {display:grid;gap:1rem}
.feature {display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--line);border-radius:1.5rem;overflow:hidden;background:var(--panel)}
.feature-copy {padding:clamp(1.25rem,5vw,3.5rem)}
.category {margin:0 0 .75rem;color:var(--brand);font-weight:750}
.primary {display:inline-flex;align-items:center;text-decoration:none;border-color:transparent;background:var(--brand);color:var(--on);margin-top:.65rem}
.cover {min-height:14rem;display:grid;grid-template-columns:repeat(3,minmax(0,4rem));place-content:center;gap:.6rem;padding:1rem;background:radial-gradient(at 28% 78%,#5b69b5,var(--hero));color:#fff}
.cover span {display:grid;place-items:center;aspect-ratio:1;border:1px solid #8792ca;background:#344581;border-radius:.65rem;font-size:1.5rem;font-weight:800;transform:rotate(-8deg)}
.cover span:nth-child(2n) {transform:rotate(8deg);background:#27443f;border-color:#70a99b}
.foot {display:flex;flex-wrap:wrap;gap:.65rem 1rem;margin-block:2rem 1rem;border-top:1px solid var(--line);padding-top:1rem;font-size:.875rem}
.game {display:grid;grid-template-columns:1fr minmax(0,32rem);align-items:start;gap:clamp(1rem,6vw,5rem);margin-top:2rem}
.intro h1 {margin-top:1rem}
.intro .tagline {font-weight:750;color:var(--text)}
.legend {list-style:none;padding:0;display:grid;gap:.35rem}
.legend li {display:flex;align-items:center;gap:.45rem;font-size:.875rem}
.legend b {display:inline-grid;place-items:center;width:1.55rem;height:1.55rem;border-radius:.4rem}
.panel {background:var(--panel);border:1px solid var(--line);border-radius:1.2rem;padding:clamp(.5rem,3vw,1.2rem)}
.modes {display:flex;justify-content:center;gap:.35rem;margin-bottom:.8rem}
.modes button[aria-pressed=true],#submit {background:var(--brand);color:var(--on)}
#board {max-width:22rem;margin:auto;display:grid;gap:.25rem}
.guess {display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:.25rem}
.tile {position:relative;display:grid;place-items:center;min-height:clamp(34px,8vw,45px);background:var(--bg);border:1px solid var(--line);border-radius:.42rem;font-size:1.2rem;font-weight:750}
.tile small {position:absolute;right:.2rem;bottom:.08rem;font-size:.62rem}
.exact {background:var(--exact)!important;color:#fff}
.present {background:var(--present)!important;color:#fff}
.absent {background:var(--absent)!important;color:#fff}
#status {text-align:center;min-height:1.4em;color:var(--muted);margin:.45rem 0}
#keyboard {display:grid;gap:.22rem}
.keyrow {display:flex;justify-content:center;gap:.17rem}
.keyrow button {flex:1;min-width:0;max-width:3rem;background:var(--key);padding:0;font-size:.875rem;touch-action:manipulation}
.keyrow button:last-child[data-action] {max-width:4rem;flex:1.5}
#actions {display:flex;justify-content:center;gap:.5rem;margin-top:.7rem}
dialog {width:min(26rem,calc(100% - 1.2rem));padding:1.1rem;background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:1rem}
dialog::backdrop {background:#111729b9}
dialog form {float:right}
dialog dl {display:grid;grid-template-columns:1fr 1fr;gap:.5rem}
dialog dl div {background:var(--key);padding:.6rem;border-radius:.6rem}
dialog dd {margin:0;font-size:1.35rem;font-weight:800}
@media(max-width:680px) {
    .game {grid-template-columns:1fr;width:min(31rem,calc(100% - 1rem));margin-top:1rem;gap:.8rem}
    .intro {padding-inline:.3rem}
    .legend {display:flex;flex-wrap:wrap}
    .feature {grid-template-columns:1fr}
    .cover {min-height:10rem}
    .brand {font-size:.95rem}
}

.games-back {
    display:inline-flex;
    align-items:center;
    justify-self:start;
    gap:.4rem;
    min-height:44px;
    padding:.35rem .65rem;
    border:1px solid var(--line);
    border-radius:.7rem;
    background:var(--panel);
    color:var(--text);
    font-size:.875rem;
    font-weight:700;
    text-decoration:none;
    white-space:nowrap;
}
.games-back::before {
    content:"";
    flex:none;
    width:2.1rem;
    height:1rem;
    background:currentColor;
    -webkit-mask:url("./games-back.svg") center / contain no-repeat;
    mask:url("./games-back.svg") center / contain no-repeat;
}
.games-back:hover {background:var(--key);border-color:var(--brand)}
.games-back:active {border-color:var(--text)}
.licenses {max-width:45rem;padding-block:2rem}
.licenses h1 {margin-block:1rem 1.5rem}
.licenses h2 {font-size:1.5rem}
.licenses li + li {margin-top:.45rem}
