/* Ten Tables online: app shell, chat, party, support, pages, overlays.
   Builds on the tokens and components in site.css. */

:root {
  --dock-w: 340px;
  --topbar-h: 58px;
  --lc-red: #c62f2f;
  --lc-yellow: #e2b52c;
  --lc-green: #2f8f4e;
  --lc-blue: #2f6bb3;
  --mention: rgb(236 208 138 / 0.18);
  --danger: #c43c3c;
  --danger-hi: #d95252;
}

.boot { min-height: 100vh; display: grid; place-items: center; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
.boot-msg { color: var(--ivory-2); font-family: var(--font-ui); letter-spacing: 0.06em; }
.js-ready .boot-hint { display: none; }

.muted { color: var(--ivory-2); }
.block { display: block; }
.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.row.wrap { flex-wrap: wrap; }
.row > input, .row > select { flex: 1 1 10rem; min-width: 0; }
.pos { color: var(--win); }
.neg { color: var(--loss); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.loading { color: var(--ivory-2); padding: 1rem 0; }
code, .hash { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.82em; word-break: break-all; }
.hash { display: block; background: var(--veil); padding: 0.25rem 0.4rem; border-radius: 3px; color: var(--ivory); }
select { width: auto; max-width: 100%; }
textarea {
  width: 100%; resize: vertical; min-height: 2.6rem; font: inherit; line-height: 1.4; color: var(--ivory);
  background: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0.5rem 0.6rem;
}
textarea:hover { border-color: var(--brass); }
input[type="search"] { min-height: 44px; padding: 0.45rem 0.7rem; border-radius: var(--radius); background: var(--ink); color: var(--ivory); border: 1px solid var(--line-strong); font: inherit; }

.btn-danger { background: var(--danger); border-color: var(--danger-hi); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hi); border-color: #f07a7a; }
.btn-show { min-width: 4.5rem; }
.btn.is-active { border-color: var(--brass); background: var(--felt); }

.badge {
  display: inline-block; margin-left: 0.35rem; padding: 0 0.35rem; border-radius: 3px; vertical-align: 0.1em;
  font-family: var(--font-ui); font-weight: 700; font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.5;
}
.badge-owner { background: var(--brass); color: var(--ink); }
.badge-admin { background: #e07a5f; color: var(--ink); }
.badge-mod { background: var(--player); color: var(--ink); }
.badge-bot { background: var(--ivory-2); color: var(--ink); }
.badge-system { background: var(--felt-hi); color: var(--ivory); }
.badge-lead { background: var(--brass-hi); color: var(--ink); }
.badge-party { background: var(--player); color: var(--ink); font-size: 0.75rem; }
.lvl {
  display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.25rem; padding: 0 0.25rem; margin-right: 0.3rem;
  border-radius: 3px; background: var(--felt-lo); border: 1px solid var(--line-strong); color: var(--brass-hi);
  font-family: var(--font-ui); font-weight: 700; font-size: 0.72rem; font-variant-numeric: tabular-nums; vertical-align: 0.05em;
}

/* ---------- Sign in ---------- */

.gate-card { width: min(100%, 30rem); }
.auth-panel { text-align: left; }
.gate-form .field { display: grid; gap: 0.35rem; }
.gate-form .code-row input { font-size: 1.05rem; letter-spacing: normal; text-align: left; padding-inline: 0.7rem; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 6px; background: var(--veil); border: 1px solid var(--line); }
.seg-btn {
  flex: 1 1 auto; min-height: 40px; padding: 0.35rem 0.8rem; border: 0; border-radius: 4px; cursor: pointer;
  background: transparent; color: var(--ivory); font-family: var(--font-ui); font-weight: 600; letter-spacing: 0.04em;
}
.seg-btn[aria-selected="true"] { background: var(--brass); color: var(--ink); }
.seg-btn:hover:not([aria-selected="true"]) { background: rgb(255 255 255 / 0.06); }
.linklike { font: inherit; }

/* ---------- Top bar ---------- */

.topbar-inner { grid-template-columns: auto 1fr auto; }
.balance { flex-wrap: wrap; }
.free { display: flex; align-items: center; }
.btn-free { min-height: 36px; font-variant-numeric: tabular-nums; }
.btn-free.is-ready { background: var(--brass); color: var(--ink); border-color: var(--brass-hi); }
.btn-free.is-ready:hover:not(:disabled) { background: var(--brass-hi); color: var(--ink); }
.btn-free:disabled { opacity: 0.8; cursor: default; }
.brand { justify-self: center; }
.top-actions { align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.online-count { font-family: var(--font-ui); font-weight: 600; font-size: 0.85rem; color: var(--ivory-2); letter-spacing: 0.04em; white-space: nowrap; }
.unread {
  display: inline-grid; place-items: center; min-width: 1.2rem; height: 1.2rem; padding: 0 0.3rem; margin-left: 0.35rem; border-radius: 0.6rem;
  background: var(--danger); color: #fff; font-size: 0.72rem; font-weight: 700; letter-spacing: 0;
}
.unread[hidden] { display: none; }
.menu { position: relative; }
.menu-btn { gap: 0.3rem; text-transform: none; letter-spacing: 0.02em; }
.menu-btn .lvl { margin-right: 0; }
.caret { font-size: 0.8rem; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 14rem; margin: 0; padding: 0.35rem; list-style: none;
  background: var(--room-3); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 16px 32px var(--shadow);
}
.menu-item {
  display: block; width: 100%; text-align: left; padding: 0.6rem 0.75rem; border: 0; border-radius: 4px; background: none;
  color: var(--ivory); text-decoration: none; font: inherit; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--felt); color: var(--ivory); }

.announce, .netbar, .breakbar {
  padding-block: 0.55rem; text-align: center; font-weight: 500;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.announce { background: var(--felt); border-bottom: 1px solid var(--line-strong); }
.announce-warn { background: #5a3a12; }
.announce-win { background: #1f5a37; }
.netbar { background: #5a3a12; }
.breakbar { background: var(--room-3); border-bottom: 1px solid var(--line); color: var(--ivory); }

/* ---------- Layout with chat dock ---------- */

.layout { display: grid; grid-template-columns: minmax(0, 1fr); flex: 1; align-items: start; }
.layout-main { min-width: 0; display: flex; flex-direction: column; min-height: calc(100vh - var(--topbar-h)); }
@media (min-width: 1180px) {
  body.chat-open .layout { grid-template-columns: minmax(0, 1fr) var(--dock-w); }
}

.dock {
  position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); height: calc(100vh - var(--topbar-h) - env(safe-area-inset-top, 0px));
  display: flex; flex-direction: column; min-width: 0;
  background: var(--room-2); border-left: 1px solid var(--line);
}
@media (max-width: 1179px) {
  .dock {
    position: fixed; z-index: 35; right: 0; top: 0; bottom: 0; height: auto; width: min(100%, 26rem);
    padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px);
    box-shadow: -20px 0 40px var(--shadow);
  }
}
.dock-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); }
.dock-title { font-size: var(--step-1); }
.chat-tabs { display: flex; gap: 4px; padding: 0.5rem 0.9rem 0; }
.chat-tab {
  flex: 1; min-height: 40px; border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; background: transparent;
  color: var(--ivory-2); font-family: var(--font-ui); font-weight: 600; letter-spacing: 0.05em; cursor: pointer;
}
.chat-tab[aria-selected="true"] { background: var(--room-3); color: var(--ivory); border-color: var(--line-strong); }
.tab-unread { display: inline-block; margin-left: 0.35rem; min-width: 1.1rem; padding: 0 0.25rem; border-radius: 0.55rem; background: var(--danger); color: #fff; font-size: 0.7rem; }
.tab-unread[hidden] { display: none; }
.chat-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--room-3); margin-inline: 0.9rem; border: 1px solid var(--line-strong); border-top: 0; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 0.4rem 0.6rem; list-style: none; display: grid; align-content: start; gap: 0.15rem; }
.chat-msg { padding: 0.35rem 0.4rem; border-radius: 4px; }
.chat-msg.is-mention { background: var(--mention); }
.chat-msg.is-system .chat-text { color: var(--brass-hi); }
.chat-meta { display: flex; align-items: center; gap: 0.15rem; flex-wrap: wrap; font-size: 0.85rem; }
.chat-name {
  background: none; border: 0; padding: 0; color: var(--brass-hi); font-family: var(--font-ui); font-weight: 700; font-size: 0.95rem; cursor: pointer;
}
.chat-name:hover { text-decoration: underline; }
.chat-name.is-site { color: var(--ivory); cursor: default; }
.chat-msg.is-mine .chat-name { color: var(--win); }
.chat-time { margin-left: auto; color: var(--ivory-2); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.chat-more {
  min-width: 28px; min-height: 28px; border: 0; border-radius: 4px; background: none; color: var(--ivory-2); cursor: pointer; font-size: 1rem; line-height: 1;
}
.chat-more:hover { background: var(--felt); color: var(--ivory); }
.chat-text { overflow-wrap: anywhere; line-height: 1.4; }
.mention { color: var(--brass-hi); font-weight: 600; }
.mention.is-me { background: var(--brass); color: var(--ink); border-radius: 3px; padding: 0 0.15rem; }
.chat-empty { padding: 1rem; display: grid; gap: 0.75rem; justify-items: start; color: var(--ivory-2); }
.chat-empty[hidden] { display: none; }
.chat-form { padding: 0.6rem 0.9rem 0.9rem; display: grid; gap: 0.35rem; }
.chat-form-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.chat-hint { font-size: 0.8rem; color: var(--ivory-2); min-height: 1.2em; }
.chat-input:disabled { opacity: 0.6; }
.quote { margin: 0; padding: 0.6rem 0.8rem; border-left: 3px solid var(--brass); background: var(--veil); overflow-wrap: anywhere; }

/* ---------- Support ---------- */

.support-fab {
  position: fixed; z-index: 34; left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 48px; padding: 0.4rem 1rem 0.4rem 0.45rem;
  border-radius: 24px; border: 1px solid var(--brass-hi); background: var(--brass); color: var(--ink); cursor: pointer;
  font-family: var(--font-ui); font-weight: 700; letter-spacing: 0.05em; box-shadow: 0 8px 20px var(--shadow);
}
.support-fab:hover { background: var(--brass-hi); }
/* on game pages the bet controls sit at the bottom: support moves into the name menu */
body[data-route="play"] .support-fab { display: none; }
.support-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--brass-hi); font-family: var(--font-display); font-size: 1.15rem; }
.support-panel {
  position: fixed; z-index: 36; left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  width: min(24rem, calc(100vw - 32px)); max-height: min(34rem, calc(100vh - 120px)); display: flex; flex-direction: column;
  background: var(--room-2); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 20px 40px var(--shadow); overflow: hidden;
}
.support-panel[hidden] { display: none; }
.sup-intro { padding: 0.6rem 0.9rem 0; font-size: 0.9rem; color: var(--ivory-2); }
.sup-list { flex: 1; min-height: 6rem; overflow-y: auto; margin: 0.6rem 0.9rem 0; padding: 0.5rem; list-style: none; display: grid; align-content: start; gap: 0.5rem; background: var(--room-3); border-radius: 6px; }
.sup-msg { padding: 0.5rem 0.65rem; border-radius: 8px; max-width: 90%; overflow-wrap: anywhere; }
.sup-msg.is-mine { justify-self: end; background: var(--felt); }
.sup-msg.is-staff { justify-self: start; background: var(--rail); }
.sup-meta { font-size: 0.78rem; color: var(--ivory-2); margin-bottom: 0.15rem; }
.sup-empty { color: var(--ivory-2); font-size: 0.9rem; }
.sup-form { padding: 0.6rem 0.9rem 0.9rem; display: grid; gap: 0.4rem; }
.sup-form .row { justify-content: space-between; }

/* ---------- Dialogs ---------- */

.dlg {
  width: min(34rem, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--room-2); color: var(--ivory); box-shadow: 0 30px 60px var(--shadow);
}
.dlg-wide { width: min(40rem, calc(100vw - 32px)); }
.dlg::backdrop { background: rgb(0 0 0 / 0.6); }
.dlg-inner { padding: 1.25rem 1.35rem; display: grid; gap: 1rem; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.dlg-title { font-size: var(--step-2); }
.dlg-body { display: grid; gap: 0.8rem; }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }

/* ---------- Party ---------- */

.party-start { display: flex; }
.or { display: flex; align-items: center; gap: 0.75rem; color: var(--ivory-2); font-family: var(--font-ui); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.8rem; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.party-join { display: grid; gap: 0.35rem; }
.code-input { font-family: var(--font-ui); font-weight: 700; font-size: 1.2rem; letter-spacing: 0.12em; text-transform: uppercase; }
.party-code { display: grid; gap: 0.4rem; justify-items: start; padding: 0.9rem; border-radius: 8px; background: var(--veil); border: 1px solid var(--line-strong); }
.code-big { font-family: var(--font-ui); font-weight: 700; font-size: 2rem; letter-spacing: 0.16em; color: var(--brass-hi); font-variant-numeric: tabular-nums; }
.party-sub { font-size: var(--step-1); }
.party-members { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.party-member {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.6rem; border-radius: 6px; background: var(--room-3);
}
.party-member .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ivory-2); opacity: 0.5; }
.party-member.is-online .dot { background: var(--win); opacity: 1; }
.pm-name { font-weight: 600; overflow-wrap: anywhere; }
.pm-where { grid-column: 3; font-size: 0.85rem; color: var(--ivory-2); }
.pm-actions { grid-column: 4; grid-row: 1 / span 2; display: flex; gap: 0.3rem; flex-wrap: wrap; justify-content: flex-end; }
.party-lead { display: grid; gap: 0.6rem; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.party-btn.is-active { background: var(--player); color: var(--ink); border-color: var(--player); }

/* ---------- Lobby ---------- */

.lobby-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; max-width: none; }
.lobby-head > div:first-child { max-width: 46rem; display: grid; gap: 0.6rem; }
.lobby-tools .search { width: min(100%, 18rem); }
.party-note { padding: 0.75rem 1rem; border-radius: 8px; border: 1px dashed var(--line-strong); color: var(--ivory-2); }
.wins { display: grid; gap: 0.5rem; }
.wins-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.25rem; }
.win-item {
  flex: none; display: flex; gap: 0.4rem; align-items: baseline; padding: 0.4rem 0.75rem; border-radius: 6px;
  background: var(--room-2); border: 1px solid var(--line); white-space: nowrap; font-size: 0.92rem;
}
.win-mult { color: var(--brass-hi); font-family: var(--font-ui); font-weight: 700; }
.win-ago { color: var(--ivory-2); font-size: 0.8rem; }
.groups { display: grid; gap: 2rem; }
.group { display: grid; gap: 0.9rem; }
.group-head { display: grid; gap: 0.2rem; }
.group-title { font-size: var(--step-3); }
.group-blurb { color: var(--ivory-2); }
.tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr)); }
@media (min-width: 1040px) { .tiles { grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); } }
.tile-art { position: relative; }
.tile-closed {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgb(0 0 0 / 0.62);
  font-family: var(--font-ui); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
}
.tile-closed[hidden] { display: none; }
.is-closed .tile { opacity: 0.85; }
.tile-count { color: var(--win); }
.tile-name { font-size: var(--step-1); }

/* ---------- Game frame ---------- */

.game-head { display: grid; gap: 0.5rem; }
.game-switch { font-size: 0.95rem; }
.game-body { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr) 17rem; align-items: start; }
@media (max-width: 1100px) { .game-body { grid-template-columns: minmax(0, 1fr); } }
body.chat-open .game-body { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1600px) { body.chat-open .game-body { grid-template-columns: minmax(0, 1fr) 16rem; } }
.game-main { display: grid; gap: 1.1rem; min-width: 0; }
.game-side { display: grid; gap: 0.9rem; min-width: 0; }
@media (max-width: 1100px) { .game-side { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); } }
body.chat-open .game-side { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.side-box { padding: 0.85rem 0.95rem; border-radius: 10px; background: var(--room-2); border: 1px solid var(--line); display: grid; gap: 0.5rem; align-content: start; min-width: 0; }
.side-title { font-family: var(--font-ui); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85rem; color: var(--ivory-2); }
.here-list, .feed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; max-height: 16rem; overflow-y: auto; }
.here-list li { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: baseline; }
.here-list li.is-me .here-name { color: var(--win); font-weight: 600; }
.here-note { margin-left: auto; color: var(--ivory-2); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.feed-item { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: baseline; font-size: 0.92rem; }
.feed-name { font-weight: 600; }
.feed-amt { color: var(--ivory-2); }
.feed-item.is-win .feed-amt { color: var(--win); }
.feed-mult { margin-left: auto; font-family: var(--font-ui); font-weight: 700; color: var(--brass-hi); }
.fair-line { display: grid; gap: 0.2rem; font-size: 0.85rem; }
.game-closed { display: grid; gap: 0.75rem; padding: 1.5rem; border-radius: 12px; background: var(--room-2); border: 1px solid var(--line); }
.notice-bar { padding: 0.6rem 0.9rem; border-radius: 6px; background: #5a3a12; }
.game-status:empty { display: none; }

/* round clock */
.phase { display: grid; gap: 0.35rem; margin-bottom: 0.9rem; }
.phase-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.phase-text { font-family: var(--font-display); font-weight: 600; font-size: var(--step-2); }
.phase-secs { font-family: var(--font-ui); font-weight: 700; font-size: 1.3rem; font-variant-numeric: tabular-nums; color: var(--brass-hi); }
.phase-track { height: 6px; border-radius: 3px; background: rgb(0 0 0 / 0.35); overflow: hidden; }
.phase-fill { display: block; height: 100%; width: 100%; background: var(--brass); transform-origin: left; transform: scaleX(var(--p, 0)); }
.phase[data-phase="running"] .phase-text { color: var(--brass-hi); }
.phase[data-phase="idle"] .phase-text { color: var(--ivory-2); }

/* ---------- Pages ---------- */

.page { display: grid; gap: 1.1rem; max-width: 60rem; }
.page-title { font-size: var(--step-4); letter-spacing: -0.015em; outline: none; }
.sub { font-size: var(--step-2); margin-top: 0.5rem; }
.card-box { padding: 1rem 1.1rem; border-radius: 10px; background: var(--room-2); border: 1px solid var(--line); display: grid; gap: 0.7rem; }
.danger-box { border-color: rgb(196 60 60 / 0.6); }
.stack-form { display: grid; gap: 0.45rem; max-width: 36rem; }
.stack-form .btn { justify-self: start; margin-top: 0.3rem; }
.prose { display: grid; gap: 0.7rem; max-width: 70ch; color: var(--ivory-2); }
.kv { display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); gap: 0.4rem 1rem; margin: 0; }
.kv dt { color: var(--ivory-2); }
.kv dd { margin: 0; min-width: 0; }
@media (max-width: 640px) { .kv { grid-template-columns: minmax(0, 1fr); } .kv dd { margin-bottom: 0.4rem; } }
.data-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 0.5rem 0.6rem; text-align: left; border-bottom: 1px solid var(--line); }
.data-table thead th { font-family: var(--font-ui); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.78rem; color: var(--ivory-2); }
.data-table .num { text-align: right; }
.data-table tr.is-me { background: rgb(146 227 176 / 0.08); }
.data-table .rank { font-family: var(--font-ui); font-weight: 700; color: var(--brass-hi); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.75rem; margin: 0; }
.stat-grid > div { padding: 0.7rem 0.8rem; border-radius: 8px; background: var(--room-3); border: 1px solid var(--line); }
.stat-grid dt { font-family: var(--font-ui); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.75rem; color: var(--ivory-2); }
.stat-grid dd { margin: 0.2rem 0 0; font-family: var(--font-ui); font-weight: 700; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.ach-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.6rem; }
.ach { display: grid; gap: 0.15rem; padding: 0.7rem 0.8rem; border-radius: 8px; border: 1px dashed var(--line); color: var(--ivory-2); }
.ach.is-got { border-style: solid; border-color: var(--brass); background: var(--room-2); color: var(--ivory); }
.ach-at { font-size: 0.8rem; color: var(--ivory-2); }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.profile { display: grid; gap: 1rem; }
.profile-head { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.profile-actions { margin-left: auto; }
.avatar { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--felt); border: 2px solid var(--brass); font-family: var(--font-display); font-size: 1.6rem; }
.profile-name { font-family: var(--font-display); font-weight: 600; font-size: var(--step-3); }
.level-bar { display: grid; gap: 0.3rem; }
.meter { height: 10px; border-radius: 5px; background: var(--veil); overflow: hidden; border: 1px solid var(--line); }
.meter-fill { display: block; height: 100%; background: var(--brass); transform-origin: left; transform: scaleX(var(--p, 0)); }

/* ---------- Overlays ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; overflow-y: auto;
  padding-block: calc(1.5rem + env(safe-area-inset-top, 0px)) calc(1.5rem + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: rgb(7 20 15 / 0.96);
}
.overlay[hidden] { display: none; }
.overlay-card {
  width: min(100%, 32rem); display: grid; gap: 1rem; justify-items: center; text-align: center;
  padding: 2rem 1.5rem; border-radius: 14px; background: var(--room-2); border: 1px solid var(--line-strong);
}
.overlay-card .stack-form { width: 100%; text-align: left; }
.ov-kicker { font-family: var(--font-ui); font-weight: 600; text-transform: uppercase; letter-spacing: 0.16em; color: var(--brass-hi); font-size: 0.85rem; }
.ov-title { font-size: var(--step-4); outline: none; }
.ov-text { color: var(--ivory); max-width: 40ch; }
.ov-count { font-family: var(--font-ui); font-weight: 700; font-size: var(--step-2); color: var(--brass-hi); font-variant-numeric: tabular-nums; }
.ov-staff { font-size: 0.9rem; }

/* ---------- Toasts above the support button ---------- */

.toasts { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 50; }
.toast-warn { border-color: var(--loss); }
.toast-info { border-color: var(--line-strong); }

/* ---------- Small screens ---------- */

@media (max-width: 900px) {
  .brand { display: none; }
  .topbar-inner { grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; }
  .online-count { display: none; }
  .free-label { font-size: 0.78rem; }
  .support-text { display: none; }
  .support-fab { padding: 0.4rem; }
}
@media (max-width: 640px) {
  .balance { gap: 0.4rem; }
  .balance-chip { width: 28px; height: 28px; }
  .top-actions { gap: 0.3rem; }
  .top-actions .btn-small { padding-inline: 0.5rem; }
  .menu-name { max-width: 6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .party-member { grid-template-columns: auto auto minmax(0, 1fr); }
  .pm-actions { grid-column: 1 / -1; grid-row: auto; justify-content: flex-start; }
  .page-title { font-size: var(--step-3); }
}

.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
