/* OneStonks styles. Mobile-first: base rules are for phones, @media (min-width) adds desktop. */
:root {
    --bg: #f6f7fb; --surface: #ffffff; --text: #1b1f2a; --muted: #5d6578;
    --accent: #14784a; --accent-2: #3a4bd6; --border: #dde1ec; --warn: #b7791f; --err: #c53030;
    --up: #16844f; --down: #c53030;
    --tab-h: 3.5rem;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
}
:root { color-scheme: light; }
/* Dark: when the device asks for it (unless the player picked light), or when the player picked dark (theme.js sets data-theme). */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1218; --surface: #181d27; --text: #e7eaf2; --muted: #98a1b6;
        --accent: #36c283; --accent-2: #8a98ff; --border: #2a3142; --warn: #e0a84a; --err: #ff7b7b;
        --up: #36c283; --down: #ff7b7b; color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0f1218; --surface: #181d27; --text: #e7eaf2; --muted: #98a1b6;
        --accent: #36c283; --accent-2: #8a98ff; --border: #2a3142; --warn: #e0a84a; --err: #ff7b7b;
        --up: #36c283; --down: #ff7b7b; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    /* room for the fixed bottom tab bar on phones */
    padding-bottom: calc(var(--tab-h) + var(--safe-b));
}
a { color: var(--accent-2); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .5rem 0 .75rem; }
h2 { font-size: 1.2rem; margin: 1.2rem 0 .6rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.up { color: var(--up); } .down { color: var(--down); }
.num { font-variant-numeric: tabular-nums; }

/* ---- top bar / banner ---- */
.fakebar { position: relative; display: flex; align-items: center; justify-content: center; min-height: calc(2.75rem + var(--safe-t)); background: var(--warn); color: #111; text-align: center; font-size: .8rem; padding: var(--safe-t) 3rem 0; }
.fakebar-x { position: absolute; right: 0; top: var(--safe-t); bottom: 0; width: 2.75rem; border: 0; background: none; color: #111; font: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer; border-radius: 0; }
.fakebar-x:hover { background: rgba(0, 0, 0, .12); }
.fakebar-x:focus-visible { outline: 2px solid #111; outline-offset: -4px; }
.topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 1rem; padding: .45rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
@supports (backdrop-filter: blur(1px)) {
    .topbar { background: color-mix(in srgb, var(--surface) 78%, transparent); -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px); }
}
.brand { font-weight: 800; font-size: 1.25rem; text-decoration: none; color: var(--text); letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.topnav { display: none; gap: .25rem; align-items: center; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.topnav a, .topnav .navbtn {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 .9rem; border-radius: 99px; border: 1px solid transparent;
    color: var(--muted); font: inherit; font-size: .95rem; font-weight: 600; text-decoration: none; background: none; cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s;
}
.topnav a:hover, .topnav .navbtn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.topnav a[aria-current=page] { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.topnav a:focus-visible, .topnav .navbtn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.topnav .nav-cta { background: var(--accent); color: #fff; border-color: var(--accent); }
.topnav .nav-cta:hover { background: color-mix(in srgb, var(--accent) 86%, #000); color: #fff; }
.topnav .nav-cta[aria-current=page] { background: var(--accent); color: #fff; }
.topnav .navbtn { border-color: var(--border); }
.nav-sep { width: 1px; height: 1.4rem; margin: 0 .4rem; background: var(--border); }
.topnav .adm { font-size: .88rem; font-weight: 500; }
.topnav .nav-count { margin-left: .4rem; }
/* The bell on phones: alerts have no tab, so they sit in the top bar. */
.bell { margin-left: auto; position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 99px; color: var(--muted); text-decoration: none; }
.bell:hover, .bell[aria-current=page] { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.bell svg { width: 1.4rem; height: 1.4rem; }
.bell .nav-count { position: absolute; top: .15rem; right: .05rem; margin: 0; min-width: 1.15rem; font-size: .68rem; line-height: 1.15rem; padding: 0 .25rem; }

/* ---- bottom tab bar (phones) ---- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
    background: var(--surface); border-top: 1px solid var(--border);
    padding-bottom: var(--safe-b); height: calc(var(--tab-h) + var(--safe-b));
}
.tabbar > a, .tabbar summary {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
    min-height: 44px; color: var(--muted); text-decoration: none; font-size: .72rem;
}
.tabbar > a, .tabbar summary { position: relative; transition: color .15s; }
.tabbar > a[aria-current=page] { color: var(--accent); font-weight: 700; }
.tabbar > a[aria-current=page]::before {
    content: ''; position: absolute; top: .3rem; width: 3.6rem; height: 2rem; border-radius: 99px;
    background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.tabbar svg { position: relative; width: 1.45rem; height: 1.45rem; }
.tabbar span { position: relative; }
@supports (backdrop-filter: blur(1px)) {
    .tabbar { background: color-mix(in srgb, var(--surface) 82%, transparent); -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px); }
}

/* "More" tab (phones): admin pages, alerts, guide, log out. */
.tabbar details { flex: 1; display: flex; }
.tabbar summary { cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; }
.tabbar summary::-webkit-details-marker { display: none; }
.tabbar details[open] > summary { color: var(--accent); }
.tabmore-dot { position: absolute; top: .55rem; left: calc(50% + .45rem); width: .55rem; height: .55rem; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.morepanel {
    position: absolute; left: .6rem; right: .6rem; bottom: calc(100% + .5rem); z-index: 21;
    max-height: 65vh; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .4rem;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
}
.morepanel a, .morepanel button {
    display: flex; align-items: center; justify-content: space-between; width: 100%; box-sizing: border-box;
    min-height: 44px; padding: 0 .8rem; border: 0; border-radius: 10px; background: none;
    color: var(--text); font: inherit; font-size: .95rem; text-align: left; text-decoration: none; cursor: pointer;
}
.morepanel a:hover, .morepanel button:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.morepanel a[aria-current=page] { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 700; }
.morepanel hr { border: 0; border-top: 1px solid var(--border); margin: .3rem 0; }
.morepanel .more-h { margin: .3rem .8rem .1rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.morepanel .nav-count { margin-left: .5rem; }
.morepanel form { margin: 0; }
/* ---- layout ---- */
main { max-width: 960px; margin: 0 auto; padding: 1rem 1rem 2rem; }
footer { max-width: 960px; margin: 0 auto; padding: 1rem; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--border); }
.install { margin-bottom: .75rem; }
.hero h1 { font-size: clamp(1.7rem, 7vw, 2.8rem); }
.hero p { color: var(--muted); max-width: 40rem; }
.cards { display: grid; grid-template-columns: 1fr; gap: .75rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }
.card h3 { margin: 0 0 .3rem; }
a.card { display: block; text-decoration: none; color: inherit; }
a.card { transition: border-color .15s, box-shadow .15s, transform .15s; }
a.card:hover, a.card:focus-visible { border-color: var(--accent); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 16%, transparent); transform: translateY(-1px); }
a.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The call to action at the foot of a Stonkverse card: tells the visitor the whole card is a link. */
.card-cta { display: flex; align-items: center; justify-content: space-between; margin: .8rem 0 0; padding-top: .7rem; border-top: 1px solid var(--border); color: var(--accent); font-weight: 700; }
.card-arrow { transition: transform .15s; }
a.card:hover .card-arrow, a.card:focus-visible .card-arrow { transform: translateX(4px); }
@media (prefers-reduced-motion: reduce) { a.card, .card-arrow { transition: none; } a.card:hover, a.card:focus-visible { transform: none; } a.card:hover .card-arrow, a.card:focus-visible .card-arrow { transform: none; } }
.tag { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); }
.narrow { max-width: 28rem; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.panel h2 { margin-top: 0; }
.panel.danger { border-color: var(--err); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* ---- buttons & forms (44px touch targets, 16px inputs so iOS does not zoom) ---- */
.btn {
    background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: .7rem 1.1rem;
    font: inherit; font-weight: 600; cursor: pointer; min-height: 44px; text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center;
}
.btn-alt { background: var(--accent-2); color: #fff; }
.btn-danger { background: var(--err); color: #fff; }
.btn-sell { background: var(--down); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: .3rem .8rem; min-height: 44px; font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--accent-2); cursor: pointer; font: inherit; padding: .5rem 0; min-height: 44px; }
form.inline { display: inline-flex; gap: .6rem; align-items: center; margin: 0; }
label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; }
label small { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select {
    padding: .65rem .7rem; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); color: var(--text); font: inherit; min-height: 44px; width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
/* The eye on a password box (shown only when scripts run). */
.pw { position: relative; display: block; }
.pw input { width: 100%; padding-right: 3rem; }
.pw-eye { position: absolute; top: 0; right: 0; bottom: 0; width: 44px; display: flex; align-items: center; justify-content: center; padding: 0; background: none; border: 0; border-radius: 0 10px 10px 0; color: var(--muted); cursor: pointer; }
.pw-eye:hover { color: var(--text); }
.pw-eye[hidden] { display: none; }
.pw-eye .eye-off { display: none; }
.pw-eye[aria-pressed=true] .eye-on { display: none; }
.pw-eye[aria-pressed=true] .eye-off { display: block; }
label.check { flex-direction: row; gap: .6rem; align-items: flex-start; font-weight: 400; }
label.check input { margin-top: .3rem; width: auto; min-height: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- flashes ---- */
.flash { padding: .65rem .9rem; border-radius: 10px; margin-bottom: .6rem; border: 1px solid var(--border); background: var(--surface); }
.flash-ok { border-color: var(--accent); }
.flash-warn { border-color: var(--warn); }
.flash-error { border-color: var(--err); color: var(--err); }

/* ---- admin settings ---- */
fieldset { border: 1px solid var(--border); border-radius: 12px; margin: 0 0 1rem; padding: .5rem 1rem; background: var(--surface); min-width: 0; }
legend { padding: 0 .5rem; font-weight: 700; }
.setting { display: flex; flex-direction: column; gap: .4rem; padding: .6rem 0; border-bottom: 1px solid var(--border); font-weight: 400; }
.setting:last-child { border-bottom: 0; }
.setting-name small { display: block; color: var(--muted); }
.setting input[type=checkbox] { width: 1.4rem; height: 1.4rem; min-height: 0; }

/* ---- market (M3) ---- */
.avatar { width: 2.5rem; height: 2.5rem; border-radius: 50%; flex: none; }
.avatar-lg { width: 4rem; height: 4rem; }
.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.rows li + li { border-top: 1px solid var(--border); }
.row { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; text-decoration: none; color: inherit; min-height: 56px; }
a.row:hover { background: var(--bg); }
.row .grow { flex: 1; min-width: 0; }
/* Names may use two lines before the ellipsis (a single line hid half of long names on phones); .full is for sentences that must be read whole (notifications, orders, proposals). */
.row .name { font-weight: 600; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.row .name.full { display: block; overflow: visible; -webkit-line-clamp: unset; line-clamp: unset; }
.row .sub { color: var(--muted); font-size: .85rem; }
.row .sub .held { color: var(--text); font-weight: 600; }
.row .right { text-align: right; }
.price-big { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.head { display: flex; gap: .9rem; align-items: center; margin-bottom: 1rem; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .9rem; }
.stat .k { color: var(--muted); font-size: .8rem; }
.stat .v { font-weight: 700; font-size: 1.1rem; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.seg label { flex-direction: row; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 10px; min-height: 44px; cursor: pointer; background: var(--surface); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent); color: #fff; }
.seg label.sell:has(input:checked) { border-color: var(--down); background: var(--down); }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: .3rem .8rem; min-height: 36px; font: inherit; cursor: pointer; }
.quote { background: var(--bg); border: 1px dashed var(--border); border-radius: 10px; padding: .6rem .8rem; min-height: 4.2rem; font-size: .92rem; }
.quote .warn { color: var(--warn); }

/* ---- desktop ---- */
@media (min-width: 768px) {
    body { padding-bottom: 0; }
    .tabbar { display: none; }
    .topnav { display: flex; }
    .bell { display: none; }
    .topbar { padding: .45rem 1.5rem; }
    main { padding-top: 1.5rem; }
    .cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
    .setting { flex-direction: row; justify-content: space-between; align-items: center; gap: 1rem; }
    .setting input[type=text] { width: 9rem; text-align: right; }
    input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select { width: auto; }
    .stack input[type=text], .stack input[type=email], .stack input[type=password], .stack input[type=date], .stack input[type=number], .stack select { width: 100%; }
    .stats { grid-template-columns: repeat(4, 1fr); }
    h1 { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- M5: game surface ---- */
/* Section tabs inside a Stonkverse: pills like the top bar; on a narrow screen they scroll sideways instead of being cut off. */
.subnav { display: flex; gap: .35rem; margin: 0 0 1rem; padding: .15rem 0 .35rem; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
    flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 1rem; border-radius: 99px; border: 1px solid transparent;
    color: var(--muted); font-weight: 600; font-size: .95rem; text-decoration: none; white-space: nowrap; transition: background-color .15s, color .15s;
}
.subnav a:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.subnav a[aria-current=page] { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.subnav a:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.row-wrap { display: flex; align-items: center; }
.row-wrap .row { flex: 1; min-width: 0; }
.star-form { margin: 0; }
.star { background: none; border: 0; color: var(--border); font-size: 1.5rem; line-height: 1; cursor: pointer; min-width: 44px; min-height: 44px; padding: 0; }
.star.on { color: #e0a84a; }
.star:hover { color: #e0a84a; }
.star-lg { font-size: 2rem; }

.changes { display: flex; gap: .4rem 1.1rem; flex-wrap: wrap; margin: .35rem 0 .8rem; font-size: .95rem; }

.chart-tabs { display: flex; gap: .4rem; margin-bottom: .4rem; }
.chart-tabs button { background: var(--bg); border: 1px solid var(--border); color: var(--muted); border-radius: 99px; padding: .25rem .8rem; min-height: 36px; font: inherit; cursor: pointer; }
.chart-tabs button.on { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.chart-svg { width: 100%; height: 220px; display: block; touch-action: pan-y; background: var(--bg); border-radius: 10px; }
.chart-line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-line.up { stroke: var(--up); } .chart-line.down { stroke: var(--down); }
.chart-area { stroke: none; opacity: .12; } .chart-area.up { fill: var(--up); } .chart-area.down { fill: var(--down); }
.chart-ref { stroke: var(--border); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.chart-cursor { stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-info { min-height: 1.6rem; margin-top: .4rem; font-size: .9rem; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; border: 1px solid var(--border); border-radius: 99px; padding: .15rem .7rem; margin: 0 .3rem .3rem 0; background: var(--bg); }
h3 { font-size: 1.05rem; margin: 1rem 0 .5rem; }

.seg-link { display: flex; align-items: center; justify-content: center; text-align: center; border: 1px solid var(--border); border-radius: 10px; min-height: 44px; text-decoration: none; color: var(--text); background: var(--surface); padding: 0 .5rem; }
.seg-link.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.board { list-style: none; margin: 0 0 1rem; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.board-row { display: flex; align-items: center; gap: .8rem; padding: .65rem .9rem; border-top: 1px solid var(--border); min-height: 48px; }
.board-row:first-child { border-top: 0; }
.board-row.me { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); font-weight: 700; }
.board-row .rank { width: 2rem; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.board-row:nth-child(-n+3) .rank { color: var(--accent); font-weight: 800; }
.board-row .who-name { flex: 1; min-width: 0; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
details.panel summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: .4rem; }

/* ---- M6: governance ---- */
textarea { padding: .65rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; width: 100%; resize: vertical; }
.prop .row { min-height: 0; }
.prop-actions { display: flex; align-items: center; gap: .8rem; padding: 0 .9rem .7rem 4.15rem; }
.tag.frozen { border-color: var(--warn); color: var(--warn); }
.nav-count { display: inline-block; min-width: 1.3rem; padding: 0 .35rem; margin-left: .25rem; border-radius: 99px; background: var(--accent); color: #fff; font-size: .75rem; text-align: center; }
.char-admin + .char-admin { border-top: 1px solid var(--border); }
.char-admin-forms { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; padding: 0 .9rem .8rem; }

/* ---- M7: profiles, cards, image packs ---- */
.card-img { display: block; max-width: 100%; height: auto; border-radius: 14px; margin: .6rem 0; }
details input[type=text] { width: 100%; font-size: .85rem; }
.pack-grid { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .6rem; }
.pack-grid li { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }

/* ---- M8: legal pages, consent banner ---- */
.legal { max-width: 46rem; }
.legal h2 { font-size: 1.15rem; margin: 1.4rem 0 .4rem; }
.guide { max-width: 52rem; }
.guide h2 { font-size: 1.4rem; margin-top: 2.2rem; padding-top: .6rem; border-top: 1px solid var(--border); }
.guide h3 { font-size: 1.05rem; margin: 1.3rem 0 .3rem; }
.guide-jump { display: flex; flex-wrap: wrap; gap: 0 1rem; margin: .4rem 0 0; }
.guide-jump a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .3rem; }
.guide pre.code { overflow-x: auto; padding: .75rem 1rem; border: 1px solid var(--border); border-radius: .6rem; background: var(--surface); font-size: .85rem; line-height: 1.45; }
.guide pre.code code { white-space: pre; }
.guide code { overflow-wrap: anywhere; }
.guide-toc { margin: .8rem 0 0; border: 1px solid var(--border); border-radius: .6rem; background: var(--surface); }
.guide-toc summary { cursor: pointer; padding: 0 1rem; min-height: 44px; display: flex; align-items: center; font-weight: 700; }
.guide-toc ol { margin: 0; padding: 0 1rem .8rem 2.2rem; }
.guide-toc ol ol { padding: .1rem 0 .2rem 1.2rem; list-style: none; }
.guide-toc li { margin: 0; }
.guide-toc a { display: inline-flex; align-items: center; min-height: 44px; }
.guide-toc li li a { font-size: .92rem; color: var(--muted); }
.guide .glossary dt { font-weight: 700; margin-top: .6rem; }
.guide .glossary dd { margin: 0 0 0 1rem; }
.guide .legal-table td:first-child, .guide .legal-table th:first-child { white-space: nowrap; }
@media (max-width: 40rem) { .guide .legal-table td:first-child, .guide .legal-table th:first-child { white-space: normal; } .guide .legal-table { display: block; overflow-x: auto; } }
.legal-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: .5rem 0 1rem; }
.legal-table th, .legal-table td { border: 1px solid var(--border); padding: .45rem .6rem; text-align: left; vertical-align: top; }
.foot-links { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-bottom: .6rem; }
.consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--border); padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between; }
.consent p { margin: 0; flex: 1 1 18rem; font-size: .9rem; }
.consent-actions { display: flex; gap: .6rem; }
.ad-slot { margin: 1rem 0; text-align: center; min-height: 0; }
.pf-avatar { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.4rem; color: #fff; background: var(--accent-2); margin-bottom: .5rem; box-sizing: border-box; }
.pf-avatar.frame-gold { box-shadow: 0 0 0 4px #e0a84a; }
.pf-avatar.frame-aurora { box-shadow: 0 0 0 4px #7af0c8, 0 0 14px #7af0c8; }
.pf-avatar.frame-neon { box-shadow: 0 0 0 4px #ff4fd8, 0 0 14px #ff4fd8; }
/* Frames earned by inviting friends (D137) */
.pf-avatar.frame-friend { box-shadow: 0 0 0 4px #6ab7ff; }
.pf-avatar.frame-scout { box-shadow: 0 0 0 4px #c7803f; }
.pf-avatar.frame-recruiter { box-shadow: 0 0 0 4px #b8c0cc, 0 0 0 7px #6b7385; }
.pf-avatar.frame-captain { box-shadow: 0 0 0 4px #ffd24a, 0 0 0 7px #b7791f; }
.pf-avatar.frame-legend { box-shadow: 0 0 0 4px #ff6b5e, 0 0 0 7px #ffd24a, 0 0 16px #ff6b5e; }
.pf-avatar { margin: 4px 4px .8rem; }
.notif.unread .row { border-left: 3px solid var(--accent); }

/* ---- Post-M9: accessibility fixes (found by scripts/a11y-check.mjs) ---- */
/* Dark scheme: the accent colours are light, so text on them must be dark to reach 4.5:1. */
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) .btn, :root:not([data-theme="light"]) .btn-alt, :root:not([data-theme="light"]) .btn-danger, :root:not([data-theme="light"]) .btn-sell, :root:not([data-theme="light"]) .seg-link.on, :root:not([data-theme="light"]) .chart-tabs button.on, :root:not([data-theme="light"]) .nav-count, :root:not([data-theme="light"]) .pf-avatar, :root:not([data-theme="light"]) .topnav .nav-cta, :root:not([data-theme="light"]) .topnav .nav-cta:hover, :root:not([data-theme="light"]) .topnav .nav-cta[aria-current=page] { color: #0b0f14; }
}
:root[data-theme="dark"] .btn, :root[data-theme="dark"] .btn-alt, :root[data-theme="dark"] .btn-danger, :root[data-theme="dark"] .btn-sell, :root[data-theme="dark"] .seg-link.on, :root[data-theme="dark"] .chart-tabs button.on, :root[data-theme="dark"] .nav-count, :root[data-theme="dark"] .pf-avatar, :root[data-theme="dark"] .topnav .nav-cta, :root[data-theme="dark"] .topnav .nav-cta:hover, :root[data-theme="dark"] .topnav .nav-cta[aria-current=page] { color: #0b0f14; }

.brand { display: inline-block; padding: .55rem 0; }
.foot-links a { display: inline-block; padding: .8rem .3rem; }
a.link { display: inline-flex; align-items: center; min-height: 44px; }
.chart-tabs button { min-height: 44px; }
summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
input[type=date]:focus-within { outline: 3px solid var(--accent-2); outline-offset: 2px; }

/* Logged-in trade form fixes (a11y-check now audits it). */
.chip { min-height: 44px; padding: .4rem 1rem; }
.star { color: var(--muted); }
.star.on, .star:hover { color: #b7791f; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--accent-2); outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) .seg label:has(input:checked) { color: #0b0f14; }
:root:not([data-theme="light"]) .star.on, :root:not([data-theme="light"]) .star:hover { color: #e0a84a; }
}
:root[data-theme="dark"] .seg label:has(input:checked) { color: #0b0f14; }
:root[data-theme="dark"] .star.on, :root[data-theme="dark"] .star:hover { color: #e0a84a; }


/* ---- Chart tools (indicators) ---- */
.chart-rsi { width: 100%; height: 70px; display: block; background: var(--bg); border-radius: 10px; margin-top: .3rem; }
.ind-line { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.ind-sma { stroke: #d9822b; }
.ind-ema { stroke: #8e44d6; }
.ind-bb { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.ind-band { fill: var(--muted); opacity: .12; stroke: none; }
.ind-rsi { stroke: var(--accent-2); }
.chart-cost { stroke: #d9822b; stroke-width: 1.4; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.chart-order { stroke-width: 1.4; stroke-dasharray: 6 3; vector-effect: non-scaling-stroke; }
.order-buy { stroke: var(--up); } .order-sell { stroke: var(--down); }
.ref-hi, .ref-lo { stroke-dasharray: 1 3; }
.chart-notes { min-height: 0; font-size: .85rem; }
.chart-tools { margin-top: .4rem; }
.metric-tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; margin: 0 0 1rem; }
@media (min-width: 640px) { .metric-tabs { grid-template-columns: repeat(6, 1fr); } }
.mood { margin: .2rem 0 .8rem; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank-row { display: grid; grid-template-columns: 1.6rem 36px 1fr auto; align-items: center; gap: .6rem; padding: .5rem 0; min-height: 52px; text-decoration: none; color: var(--text); border-top: 1px solid var(--border); }
.rank li:first-child .rank-row { border-top: 0; }
.rank-row:hover .rank-name strong { text-decoration: underline; }
.rank-n { color: var(--muted); text-align: right; font-size: .85rem; }
.rank-main { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.rank-name { overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.rank-track { display: block; height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.rank-bar { display: block; height: 100%; border-radius: 4px; background: var(--accent-2); }
.rank-bar.up { background: var(--up); }
.rank-bar.down { background: var(--down); }
.rank-val { text-align: right; font-weight: 700; white-space: nowrap; }
.adv-card { padding: .4rem 1rem; }
details.adv > summary { cursor: pointer; min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: .6rem; list-style: none; }
details.adv > summary::-webkit-details-marker { display: none; }
.adv-title small, .adv-title .muted { font-size: .85rem; }
.adv-chev { width: .6rem; height: .6rem; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(45deg); transition: transform .15s; margin-right: .4rem; flex: none; }
details.adv[open] > summary .adv-chev { transform: rotate(-135deg); }
details.adv > details.panel { margin: .4rem 0 .8rem; background: transparent; border-style: dashed; }
.tool-grid { display: grid; grid-template-columns: 1fr; gap: .1rem; }
.tool-grid .check { min-height: 44px; display: flex; align-items: center; gap: .5rem; }
.swatch { display: inline-block; width: 1.2rem; height: 0; border-top: 3px solid; margin-right: .4rem; vertical-align: middle; }
.sw-sma { border-color: #d9822b; } .sw-ema { border-color: #8e44d6; } .sw-bb { border-color: var(--muted); border-top-style: dashed; }
@media (min-width: 768px) { .tool-grid { grid-template-columns: 1fr 1fr; } }
.seg.seg3 { grid-template-columns: repeat(3, 1fr); }
.podium { list-style: none; margin: 0; padding: 0; }
.podium li { display: flex; gap: .6rem; align-items: center; min-height: 40px; }
.overrides { display: block; } .overrides a { margin-right: .6rem; }
a.badge { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }

.search-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .5rem 0 1rem; }
.search-form input[type=search] { flex: 1 1 12rem; min-height: 44px; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
.search-form select { min-height: 44px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin: 1rem 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Local image pack page */
.pack-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; min-height: 8rem; padding: 1rem; border: 2px dashed var(--border); border-radius: 14px; text-align: center; cursor: pointer; background: var(--bg); }
.pack-drop.over, .pack-drop:focus-within { border-color: var(--accent-2); }
.pack-drop input[type=file] { max-width: 100%; }
.pack-row { display: flex; align-items: center; gap: .7rem; padding: .5rem .2rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pack-row:first-child { border-top: 0; }
.pack-row input[type=text] { width: 100%; min-height: 44px; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
.pack-search { width: 100%; min-height: 44px; padding: .5rem .7rem; margin-bottom: .6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }

/* Info tips (D93): a label with a small "i" button. Hover or keyboard focus on desktop, tap on phones and tablets. */
.tip { display: inline-flex; align-items: center; gap: .3rem; }
.tip-l { border-bottom: 1px dotted var(--muted); cursor: help; }
.tip-i { position: relative; display: inline-grid; place-items: center; flex: none; width: 1.15rem; height: 1.15rem; border: 1px solid var(--muted); border-radius: 50%;
         color: var(--muted); font: 700 .7rem/1 system-ui, sans-serif; font-style: normal; cursor: pointer; }
.tip-i::before { content: ""; position: absolute; inset: -.85rem; }   /* the tap target is about 44px even though the icon is small */
.tip-i:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.tip-pop { position: fixed; z-index: 1000; width: max-content; max-width: min(18rem, calc(100vw - 16px)); padding: .55rem .7rem; border-radius: 10px; background: var(--text); color: var(--bg);
           font-size: .85rem; font-weight: 400; line-height: 1.35; text-align: left; box-shadow: 0 6px 20px rgba(0, 0, 0, .28); pointer-events: none; }
.tip-pop[hidden] { display: none; }


.head a[data-pack-many] { display: inline-block; padding: .7rem .4rem; min-height: 44px; box-sizing: border-box; }

/* "Make it yours" card: tinted, with a clear round close button in the top right corner. */
.nudge { position: relative; padding-right: 3.6rem; border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.nudge[hidden] { display: none; }
.nudge-x { position: absolute; top: .5rem; right: .5rem; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
           border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.nudge-x:hover, .nudge-x:focus-visible { border-color: var(--accent); color: var(--accent); }

/* The trade quote as a small table */
.quote table.q { width: 100%; border-collapse: collapse; }
.quote table.q th, .quote table.q td { padding: .18rem 0; vertical-align: baseline; font-weight: 400; }
.quote table.q th { text-align: left; color: var(--muted); padding-right: .8rem; white-space: nowrap; }
.quote table.q td { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.quote table.q .up { color: var(--ok, var(--accent)); }
.quote table.q .down { color: var(--err); }
.limit-why { font-size: .9rem; }
.limit-why summary { cursor: pointer; color: var(--muted); }
.limit-why[hidden] { display: none; }
.votes { margin-top: 1rem; }
.votes > summary { cursor: pointer; padding: .4rem 0; }
.votes .btn { min-width: 3.4rem; }
.limit-why summary::before { content: "\24D8\00a0"; }

/* ---- Light / dark / automatic switch in the top bar (D114) ---- */
.themebtn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: .25rem; padding: 0; border: 0; border-radius: 99px; background: none; color: var(--muted); cursor: pointer; }
.themebtn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.themebtn svg { width: 1.3rem; height: 1.3rem; display: none; }
.themebtn[data-mode="auto"] .ic-auto, .themebtn[data-mode="light"] .ic-light, .themebtn[data-mode="dark"] .ic-dark { display: block; }

/* ---- Guide: on wide screens the contents sit in a column beside the text and follow the page (D115) ---- */
.guide h2, .guide h3, .tocpage h2, .tocpage legend { scroll-margin-top: 5rem; }
.guide-toc a[aria-current="true"] { color: var(--accent); font-weight: 700; }
@media (min-width: 75rem) {
    .tocpage:has(> .guide-toc) { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; column-gap: 2rem; }
    .tocpage:has(> .guide-toc) > * { grid-column: 1; }
    .tocpage:has(> .guide-toc) > .guide-toc { grid-column: 2; grid-row: 1 / span 400; align-self: start; position: sticky; top: 5rem; margin: 0; max-height: calc(100vh - 6.5rem); overflow-y: auto; }
    article.guide:has(> .guide-toc) { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; column-gap: 2.5rem; max-width: 74rem; }
    article.guide:has(> .guide-toc) > * { grid-column: 1; }
    article.guide:has(> .guide-toc) > .guide-toc { grid-column: 2; grid-row: 1 / span 400; align-self: start; position: sticky; top: 5rem; margin: 3.2rem 0 0; max-height: calc(100vh - 6.5rem); overflow-y: auto; }
}
@media (min-width: 75rem) {
    .guide-toc li li a { min-height: 30px; font-size: .88rem; }
    .guide-toc > ol > li > a { min-height: 36px; }
}

/* ---- The little stonks tribute in the guide (D117) ---- */
.guide .tribute { margin: .8rem 0 1rem; }
.guide .tribute img { display: block; width: 100%; max-width: 24rem; height: auto; border-radius: 10px; }
.guide .tribute figcaption { font-size: .85rem; margin-top: .35rem; }

/* ---- Market hours (D118) ---- */
.hours-open { margin: .2rem 0 .8rem; }
.flash.hours small { display: inline-block; margin-top: .25rem; }
.hours-admin label.check { display: flex; flex-direction: row; align-items: center; gap: .5rem; }
.hours-admin .row { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: end; }
.hours-admin .row > label { flex: 1 1 11rem; }
.hours-admin .btn-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }

/* Medium screens: tighter pills so the admin links fit on one row (D110, D118). */
@media (min-width: 48rem) and (max-width: 75rem) {
    .topnav a, .topnav .navbtn { padding: 0 .45rem; }
    .topnav .adm { font-size: .82rem; }
    .topnav { gap: 0; }
    .nav-sep { margin: 0 .2rem; }
}
.hours-admin input[type=datetime-local], .hours-admin input[type=time] { font: inherit; width: 100%; min-height: 44px; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }

.lang-inline { display: inline-flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.lang-inline select { width: auto; }

/* The occasional "tell us what you think" note (D129): shown rarely, so it is allowed to stand out (tinted card, accent edge, like "Make it yours"); never a modal.
   Not named .nudge: that class belongs to the "Make it yours" card above. */
.fbnote { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .8rem .8rem .8rem 1rem; margin: 0 0 1.1rem; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-left: 4px solid var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 12%, transparent); }
.fbnote-text { flex: 1 1 15rem; font-weight: 600; }
.fbnote-actions { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.fbnote .btn { flex: none; }
.fbnote form { flex: none; margin: 0; }
.fbnote-x { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.fbnote-x:hover, .fbnote-x:focus-visible { border-color: var(--accent); color: var(--accent); }

/* Market state on the home cards: a colored dot beside the words (green open, amber closed: a normal state, not an alarm). The text itself stays in the normal ink so contrast holds. */
.dot { display: inline-block; width: .6em; height: .6em; border-radius: 50%; margin-right: .4em; }
.dot-open { background: var(--up); }
.dot-closed { background: var(--warn); }

/* "Preview" label beside the logo while the site is young (setting preview_mode): small, always there, not dismissable; it links to the feedback page. */
.brandwrap { display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; white-space: nowrap; }
.preview-badge { display: inline-flex; align-items: center; min-height: 1.5rem; padding: 0 .55rem; border: 1px solid var(--warn); border-radius: 999px; color: var(--text); background: color-mix(in srgb, var(--warn) 16%, transparent); font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }
@media (max-width: 26rem) { .preview-badge { padding: 0 .4rem; font-size: .62rem; letter-spacing: .03em; } .brandwrap { gap: .35rem; } }
.preview-badge { max-width: 8.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-badge:hover, .preview-badge:focus-visible { background: color-mix(in srgb, var(--warn) 30%, transparent); }

/* The suggestion form on the home page: a quiet row with a chevron (like "Advanced trading") that disappears once open; "Cancel" folds it again (D132). */
details.suggest-form > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: .6rem; min-height: 44px; margin: .4rem 0 .6rem; padding: 0 .9rem; border: 1px solid var(--border); border-radius: 10px; color: var(--accent); font-weight: 600; }
details.suggest-form > summary::-webkit-details-marker { display: none; }
details.suggest-form > summary:hover { border-color: var(--accent); }
details.suggest-form[open] > summary { display: none; }
.suggest-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.btn-link { border: 0; background: none; padding: .5rem .3rem; min-height: 44px; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }
.btn-link:hover { color: var(--text); }

.pack-row > form.inline { margin-left: auto; }
.icon-x { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.icon-x:hover, .icon-x:focus-visible { border-color: var(--accent); color: var(--accent); }

/* Amount slider (trade form and swap): sits under the % chips, which stay */
.slide-row { display: flex; align-items: center; gap: .8rem; }
.slider { flex: 1; min-width: 0; min-height: 44px; margin: 0; padding: 0; accent-color: var(--accent); background: transparent; border: 0; cursor: pointer; }
.slide-out { min-width: 3.2rem; text-align: right; color: var(--muted); font-size: .92rem; }

/* Swap: stonk picker */
.swap-results { list-style: none; margin: -.4rem 0 0; padding: .25rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.swap-results[hidden] { display: none; }
.swap-results button { display: flex; width: 100%; align-items: baseline; gap: .6rem; text-align: left; border: 0; background: transparent; color: var(--text); font: inherit; padding: .5rem .6rem; min-height: 44px; border-radius: 8px; cursor: pointer; }
.swap-results button:hover, .swap-results button:focus-visible { background: var(--bg); outline: none; }
.swap-results .sr-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swap-results .sr-price { color: var(--muted); font-variant-numeric: tabular-nums; }
.swap-results .sr-none { padding: .6rem; color: var(--muted); }

/* Swap: the panel is just a title and two buttons until one is chosen */
.seg .seg-btn { display: flex; align-items: center; justify-content: center; text-align: center; border: 1px solid var(--border); border-radius: 10px; min-height: 44px; padding: .3rem .5rem; cursor: pointer; background: var(--surface); color: var(--text); font: inherit; }
.seg .seg-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.seg .seg-btn:disabled { opacity: .5; cursor: not-allowed; }
.seg .seg-btn:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
:root:not([data-theme="light"]) .seg .seg-btn[aria-pressed="true"] { color: #0b0f14; }
#swap-panel h2 { margin-bottom: .6rem; }

/* Achievements (D135): the grid on the Account page and the toast that slides in when one is unlocked */
.ach-grid { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem; }
.ach { display: flex; gap: .7rem; align-items: flex-start; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.ach.got { border-color: var(--accent); }
.ach.locked { border-style: dashed; }
.ach.locked .ach-ic { filter: grayscale(1); opacity: .5; }
.ach-ic { font-size: 1.7rem; line-height: 1; }
.ach-tx { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.ach-tx span { font-size: .9rem; }
.toasts { position: fixed; z-index: 1000; top: calc(3.6rem + env(safe-area-inset-top)); right: 1rem; width: min(22rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: .7rem; align-items: center; padding: .7rem .9rem; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; box-shadow: 0 8px 28px rgba(0, 0, 0, .28); transition: transform .4s cubic-bezier(.2, .8, .2, 1), opacity .4s; transform: translateX(0); opacity: 1; }
.toast.pre, .toast.leaving { position: absolute; top: 0; left: 0; right: 0; transform: translateX(115%); opacity: 0; pointer-events: none; }
.toast-ic { font-size: 2rem; line-height: 1; }
.toast-tx { display: flex; flex-direction: column; gap: .05rem; min-width: 0; font-size: .88rem; }
.toast-tx small { color: var(--accent); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: .66rem; }
.toast-tx strong { font-size: 1rem; }
@media (prefers-reduced-motion: reduce) { .toast { transition: opacity .2s; } .toast.pre, .toast.leaving { transform: none; } }

/* ---- News carousel and maintenance (D136) ---- */
.news { margin: 0 0 1.1rem; }
.news-track { display: grid; }
.news-card { --nc: var(--accent-2); display: flex; align-items: flex-start; gap: .8rem; padding: .85rem .6rem .85rem .9rem; margin: 0 0 .6rem; border: 1px solid color-mix(in srgb, var(--nc) 45%, var(--border)); border-left: 4px solid var(--nc); border-radius: 12px; background: color-mix(in srgb, var(--nc) 11%, var(--surface)); box-shadow: 0 2px 10px color-mix(in srgb, var(--nc) 10%, transparent); }
.news-info { --nc: var(--accent-2); } .news-success { --nc: var(--accent); } .news-warning { --nc: var(--warn); } .news-critical { --nc: var(--err); }
.news-ic { flex: none; width: 1.7rem; height: 1.7rem; margin-top: .1rem; color: var(--nc); }
.news-tx { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.news-lv { display: block; font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--text); opacity: .75; }
.news-title { display: block; font-size: 1.02rem; }
.news-tx p { margin: .2rem 0 0; font-size: .92rem; }
.news-link { display: inline-block; margin-top: .35rem; font-weight: 600; }
.news-x { flex: none; width: 44px; height: 44px; margin: -.3rem 0 0 0; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: none; color: var(--text); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.news-x:hover, .news-x:focus-visible { background: color-mix(in srgb, var(--nc) 20%, transparent); }
/* With scripts: the notices stack in one cell (the box is as tall as the tallest) and only the current one shows. */
.news-js .news-track > .news-card { grid-area: 1 / 1; margin-bottom: 0; opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility 0s linear .35s; }
.news-js .news-track > .news-card.on { opacity: 1; visibility: visible; transition: opacity .35s ease; }
.news-nav { display: flex; align-items: center; justify-content: center; gap: .3rem; margin-top: .45rem; }
.news-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); cursor: pointer; }
.news-btn svg { width: 18px; height: 18px; }
.news-btn:hover, .news-btn:focus-visible { border-color: var(--accent); color: var(--accent); }
.news-btn .ic-play, .news-btn[aria-pressed="true"] .ic-pause { display: none; }
.news-btn[aria-pressed="true"] .ic-play { display: block; }
.news-dots { display: flex; align-items: center; }
.news-dot { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; background: none; cursor: pointer; }
.news-dot i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--muted); background: transparent; transition: background .2s, border-color .2s; }
.news-dot[aria-current="true"] i { background: var(--accent-2); border-color: var(--accent-2); }
.news-dot:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; border-radius: 50%; }
/* The admin list shows each notice as players see it, plus what the admin needs. */
.news-item .news-card { margin-bottom: .5rem; }
.news-meta { font-size: .85rem; }
.news-form-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.news-form-row > label { flex: 1 1 12rem; }
.news-guide { margin: 0; padding-left: 1.2rem; font-size: .85rem; }
.news-when { border: 1px solid var(--border); border-radius: 10px; padding: .6rem .8rem .8rem; }
/* Admin only: the site is closed to everybody else. */
.maintbar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .3rem .8rem; padding: calc(.5rem + var(--safe-t)) 1rem .5rem; background: var(--err); color: #fff; text-align: center; font-size: .85rem; }
.maintbar a { color: inherit; font-weight: 700; padding: .4rem .2rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .maintbar { color: #0b0f14; } }
:root[data-theme="dark"] .maintbar { color: #0b0f14; }
/* The page visitors get meanwhile. */
.maint-body { display: grid; min-height: 100vh; place-items: center; padding: 1rem; }
.maint { max-width: 34rem; text-align: center; }
.maint-brand { font-size: 1.4rem; font-weight: 800; margin: 0 0 1rem; }
.maint-brand span { color: var(--accent); }
.maint-ic { width: 4.5rem; height: 4.5rem; margin: 0 auto 1rem; padding: 1rem; border-radius: 50%; color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 14%, var(--surface)); border: 1px solid var(--border); }
.maint-ic svg { width: 100%; height: 100%; }
.maint-note { padding: .7rem .9rem; border: 1px solid var(--border); border-left: 4px solid var(--accent-2); border-radius: 10px; background: var(--surface); text-align: left; }
.maint-until { font-weight: 700; }

/* ---- Invite friends (D137) ---- */
.invite-box { margin: .8rem 0; }
.invite-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.invite-row input { flex: 1 1 14rem; min-width: 0; }
.invite-friends { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .3rem .8rem; }
.invite-friends li { display: flex; flex-direction: column; }
.invite-cta { margin: .4rem 0 0; }
