/* Relicus: dark stone, marble, bronze and gold. */
:root {
  --bg: #15110d;
  --bg2: #1c1611;
  --panel: #221b14;
  --panel2: #2b2219;
  --line: #4a3b2a;
  --line2: #66513a;
  --text: #efe6d4;
  --muted: #a89a84;
  --gold: #d4a843;
  --gold2: #f0d27a;
  --red: #9b2226;
  --red2: #c0392b;
  --green: #5fae6e;
  --marble: #efe9dc;
  --head: 'Cinzel', Georgia, serif;
  --body: 'Alegreya Sans', system-ui, sans-serif;
  --r: 10px;
  --pad: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(155, 34, 38, .14), transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(212, 168, 67, .08), transparent 50%);
  color: var(--text);
  font: 17px/1.4 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--gold2); }
h1, h2, h3 { font-family: var(--head); font-weight: 700; letter-spacing: .04em; margin: 0; }
.hidden { display: none !important; }

/* ---------- buttons and fields ---------- */
.btn {
  appearance: none; border: 1px solid var(--line2); background: linear-gradient(#3a2e22, #2b2219);
  border-radius: 8px; padding: 9px 16px; cursor: pointer; font-weight: 700; letter-spacing: .02em;
  transition: filter .12s, transform .06s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn.gold { background: linear-gradient(#e7bf58, #b8892a); color: #1b130a; border-color: #f0d27a; }
.btn.red { background: linear-gradient(#b3292e, #7d1a1d); border-color: #c0392b; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.small { padding: 5px 11px; font-size: 15px; }
.btn.big { padding: 11px 6px; font-size: 16px; }
.field { display: block; margin: 0 0 12px; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.field input, .field textarea {
  width: 100%; background: #120e0a; border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--gold); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 15px; color: var(--muted); margin: 4px 0 14px; }
.check input { margin-top: 3px; accent-color: var(--gold); }
.err { color: #ff8a80; min-height: 1.3em; font-size: 15px; margin: 0 0 8px; }
.ok { color: var(--green); }

/* ---------- sign-in screen ---------- */
.auth { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; overflow-y: auto; }
.auth .scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
.auth-inner { position: relative; z-index: 1; width: 100%; max-width: 420px; padding: 24px var(--pad) 32px; margin: auto; }
.auth .logo { display: block; margin: 0 auto 6px; max-width: 100%; }
.tagline { text-align: center; font-family: var(--head); color: var(--gold2); letter-spacing: .12em; font-size: 15px; margin: 0 0 18px; text-shadow: 0 2px 8px #000; }
.card {
  background: rgba(28, 22, 17, .92); border: 1px solid var(--line); border-radius: 14px; padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5); backdrop-filter: blur(4px);
}
.card h2 { font-size: 20px; margin-bottom: 14px; color: var(--gold2); }
.tabs2 { display: flex; gap: 6px; margin-bottom: 16px; }
.tabs2 button { flex: 1; }
.tabs2 .on { border-color: var(--gold); color: var(--gold2); }
.linkish { background: none; border: 0; color: var(--gold2); cursor: pointer; padding: 0; text-decoration: underline; font-size: 15px; }

/* ---------- lobby frame: menu bar, pages ---------- */
.lobby { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr; grid-template-columns: 1fr; }
.topbar {
  display: flex; align-items: center; gap: 18px; padding: 0 var(--pad); height: 50px; border-bottom: 1px solid var(--line);
  background: linear-gradient(#251c14, #1a140f); box-shadow: 0 2px 10px rgba(0, 0, 0, .4); position: relative; z-index: 5;
}
.brand .logo { height: 30px; width: auto; display: block; }
.topnav { display: flex; gap: 2px; align-self: stretch; }
.topnav button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 0 14px; cursor: pointer; color: var(--muted); font-weight: 700; font-size: 16px; }
.topnav button:hover { color: var(--text); }
.topnav button.on { color: var(--gold2); border-bottom-color: var(--gold); background: linear-gradient(transparent, rgba(212, 168, 67, .08)); }
.spacer { flex: 1; }
.me-wrap { position: relative; }
.me-chip {
  display: flex; align-items: center; gap: 5px; cursor: pointer; background: #15100c; border: 1px solid var(--line2);
  border-radius: 999px; padding: 3px 10px 3px 5px; font-weight: 700;
}
.me-chip:hover { border-color: var(--gold); }
.me-chip .pname { margin: 0 3px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 6px; min-width: 170px; box-shadow: 0 12px 30px #000; z-index: 20; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: rgba(255, 255, 255, .06); }
.svg { display: contents; }
.mnav { display: none; }
.pages { min-height: 0; position: relative; }
.page { display: none; height: 100%; min-height: 0; padding: 10px; }
.lobby[data-page="games"] .page-games, .lobby[data-page="chat"] .page-games,
.lobby[data-page="clans"] .page-clans, .lobby[data-page="rankings"] .page-rankings, .lobby[data-page="players"] .page-players, .lobby[data-page="help"] .page-help, .lobby[data-page="config"] .page-config { display: grid; }
.page-rankings, .page-players, .page-clans, .page-help, .page-config { overflow-y: auto; align-content: start; justify-items: center; }

/* framed boxes, like Artifact's panels */
.box { background: linear-gradient(#211a13, #1b150f); border: 1px solid var(--line); border-radius: 10px; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.box.wide { width: 100%; max-width: 980px; }
.box-head { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--line); background: linear-gradient(#2c2219, #231b14); }
.box-head h2 { font-size: 16px; color: var(--gold2); display: flex; align-items: center; gap: 8px; }
.box-head h2::before { content: ''; width: 8px; height: 8px; background: var(--gold); transform: rotate(45deg); display: inline-block; }
.box-pad { padding: 14px; }

/* ---------- the Games page: games panel / divider / chat ---------- */
.page-games { grid-template-rows: var(--top, 56%) 12px minmax(150px, 1fr); }
.splitter { cursor: row-resize; display: flex; align-items: center; justify-content: center; touch-action: none; }
.splitter span { width: 46px; height: 4px; border-radius: 2px; background: var(--line2); }
.splitter:hover span { background: var(--gold); }
.gbody { display: grid; grid-template-columns: 120px minmax(0, 1.25fr) minmax(280px, 1fr); flex: 1; min-height: 0; }
.gleft { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 10px; border-right: 1px solid var(--line); }
.gleft .medal { display: flex; justify-content: center; margin-bottom: 4px; }
.gleft .btn { padding: 8px 6px; font-size: 15px; }
.gleft .btn.big { padding: 11px 6px; font-size: 16px; }
.gmid { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.cats { display: flex; gap: 4px; padding: 10px 10px 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.cats button { background: #17110c; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer; color: var(--muted); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.cats button.on { border-color: var(--gold); color: var(--gold2); background: #2b2117; }
.cdot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; }
.cdot.c-blitz { background: var(--red2); }
.cdot.c-standard { background: var(--gold); }
.cdot.c-beginner { background: var(--green); }
.cdot.c-special { background: #9b59d0; }
.cdot.c-mine { background: #3d7bd9; }
.cat-row { display: none; }
.glist { overflow-y: auto; min-height: 0; flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.grow {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 0; border: 1px solid var(--line); border-radius: 8px;
  background: #1d1610; cursor: pointer; position: relative; overflow: hidden; flex: none;
}
.grow:hover { border-color: var(--line2); background: #241b13; }
.grow.sel { border-color: var(--gold); background: linear-gradient(90deg, #33271a, #241b13); }
.grow .kbar { align-self: stretch; width: 4px; background: var(--gold); flex: none; }
.grow.k-blitz .kbar { background: var(--red2); }
.grow.k-beginner .kbar { background: var(--green); }
.grow.k-special .kbar { background: #9b59d0; }
.gtext { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; }
.gname { font-weight: 700; font-size: 16px; }
.gchips { display: flex; gap: 4px; flex-wrap: wrap; }
.gside { text-align: right; flex: none; }
.gstat { display: none; }
.gstat2 { font-size: 14px; color: var(--gold2); font-variant-numeric: tabular-nums; font-weight: 700; }
.gwho { font-size: 13px; color: var(--muted); }
.grow-act { display: none; }
.chip { font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.chip.live { color: #fff; background: var(--red); border-color: var(--red2); }
.chip.open { color: #1b130a; background: var(--gold); border-color: var(--gold2); }
.chip.ranked { color: #f3dca0; background: #5a4520; border-color: #8b6a2c; }
.chip.joined { color: #dce8ff; background: #23406b; border-color: #3d7bd9; }
.chip.k-blitz { color: #ffb3a8; border-color: #8a2a22; }
.chip.k-standard { color: #f0d27a; border-color: #7a5d22; }
.chip.k-beginner { color: #a8e0b2; border-color: #2f6b3c; }
.chip.k-lonewolf { color: #d6d9de; border-color: #6a6f78; }
.chip.k-special { color: #d9b8f2; border-color: #6b3d8f; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

/* Game Details */
.gright { display: flex; flex-direction: column; min-height: 0; }
.dtabs { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); }
.dtabs button { background: none; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; padding: 6px 12px; cursor: pointer; color: var(--muted); font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.dtabs button.on { color: var(--gold2); border-color: var(--line); background: #241b13; margin-bottom: -1px; }
.dbody { overflow-y: auto; min-height: 0; flex: 1; padding: 12px; }
.details h3 { font-size: 19px; margin-bottom: 6px; }
.details .desc { color: var(--muted); font-size: 15px; margin: 8px 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin: 10px 0; }
.stat { background: #17110c; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; min-width: 0; }
.stat .slabel { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat b { display: block; font-size: 18px; font-family: var(--head); color: var(--text); font-variant-numeric: tabular-nums; text-transform: capitalize; }
.stat .ssub { display: block; font-size: 12px; color: var(--muted); }
.stat.hero { border-color: #8b6a2c; background: linear-gradient(#3a2b18, #241a10); grid-column: span 2; }
.stat.hero b { font-size: 24px; color: var(--gold2); }
.drow { display: grid; grid-template-columns: 86px 1fr; gap: 8px; font-size: 14px; padding: 5px 0; border-top: 1px solid rgba(74, 59, 42, .5); }
.drow .dl { color: var(--muted); }
.joined { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.lrow { display: flex; gap: 10px; align-items: center; font-size: 14px; padding: 4px 0; }
.lrow .chip { min-width: 84px; text-align: center; }

/* bottom: players online + chat */
.cbox { flex-direction: row; }
.people { width: 240px; flex: none; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.people-head { padding: 9px 12px; border-bottom: 1px solid var(--line); font-family: var(--head); font-size: 14px; color: var(--gold2); }
.count { color: var(--muted); font-family: var(--body); font-size: 13px; }
.plist { overflow-y: auto; flex: 1; padding: 6px; }
.prow { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.prow:hover { background: rgba(255, 255, 255, .04); }
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.chat-scroll { overflow-y: auto; flex: 1; min-height: 0; }
.chat-log { padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.msg { line-height: 1.35; overflow-wrap: anywhere; font-size: 16px; }
.msg .time { color: #77695a; font-size: 12px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.msg.sys { color: var(--gold2); font-style: italic; }
.msg.tell { background: rgba(155, 34, 38, .14); border-left: 3px solid var(--red2); padding: 3px 8px; border-radius: 4px; }
.msg.notice { color: var(--muted); font-style: italic; }
.chat-form { display: flex; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; background: #120e0a; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; outline: none; }
.chat-form input:focus { border-color: var(--gold); }
.rooms { display: flex; gap: 4px; padding: 0 10px 8px; }
.rooms button { background: #17110c; border: 1px solid var(--line); border-radius: 6px; padding: 4px 12px; cursor: pointer; color: var(--muted); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.rooms button.on { border-color: var(--gold); color: var(--gold2); background: #2b2117; }
.unread { background: var(--red2); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; }

/* names, badges, shields */
.plate { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; background: none; border: 0; padding: 0; font-weight: 700; color: var(--text); vertical-align: baseline; }
.plate:hover .pname { text-decoration: underline; }
.badge { flex: none; vertical-align: -2px; }
.plate .role { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--gold); border: 1px solid var(--gold); border-radius: 4px; padding: 0 4px; margin-left: 3px; }
.shield { flex: none; display: block; }

/* other pages */
.find { display: flex; gap: 8px; margin-bottom: 16px; }
.find input { flex: 1; min-width: 0; background: #120e0a; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; outline: none; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.pcard { display: flex; gap: 10px; align-items: center; background: #1d1610; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; text-align: left; }
.pcard:hover { border-color: var(--gold); }
.pc-text { display: flex; flex-direction: column; min-width: 0; }
.pc-name { font-weight: 700; display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.ranks { width: 100%; border-collapse: collapse; }
.ranks th { text-align: left; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.ranks td { padding: 7px 8px; border-bottom: 1px solid rgba(74, 59, 42, .5); }
.ranks .num { text-align: right; font-variant-numeric: tabular-nums; }
.ranks .rank { width: 40px; color: var(--gold2); font-family: var(--head); }
.rk-player { display: inline-flex; align-items: center; gap: 8px; }
.help { max-width: 720px; }
.help-sec { margin-bottom: 18px; }
.help-sec h3 { font-size: 17px; color: var(--gold2); margin-bottom: 4px; }
.help-sec p { margin: 0; color: var(--text); }
.phone-only { display: none; }
.sheet-head { display: flex; justify-content: flex-end; padding: 6px 6px 0; }
.section-h { font-family: var(--head); color: var(--muted); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 8px; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.dim { color: var(--muted); font-size: 14px; }

/* ---------- profile ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); display: flex; align-items: center; justify-content: center; z-index: 50; padding: var(--pad); }
.modal { width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--bg2); border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 30px 80px #000; }
.cover { height: 96px; position: relative; background: var(--pc, #8e1b1b); overflow: hidden; }
.cover svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.prof-head { display: flex; align-items: flex-end; gap: 14px; padding: 0 20px; margin-top: -40px; position: relative; }
.prof-head .shield { filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .6)); }
.prof-name { padding-bottom: 6px; min-width: 0; }
.prof-name h2 { font-size: 24px; overflow-wrap: anywhere; }
.prof-name .title { color: var(--gold2); font-family: var(--head); font-size: 15px; }
.prof-body { padding: 14px 20px 20px; }
.pstats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 6px 0 16px; }
.pstats .stat { text-align: center; }
.pstats .stat b { color: var(--gold2); }
.awards { display: grid; gap: 6px; margin-bottom: 16px; }
.award { display: flex; gap: 10px; align-items: center; background: var(--panel); border-radius: 8px; padding: 6px 10px; }
.award small { color: var(--muted); display: block; }
.bio { white-space: pre-wrap; color: var(--text); margin: 0 0 16px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.swatch { width: 32px; height: 32px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--gold2); }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: #2b2219; border: 1px solid var(--gold); color: var(--text); padding: 10px 16px; border-radius: 10px;
  transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { border-color: var(--red2); }

/* ---------- narrower desktops ---------- */
@media (max-width: 1100px) {
  .gbody { grid-template-columns: 110px minmax(0, 1fr) minmax(250px, .9fr); }
  .people { width: 200px; }
  .topnav button { padding: 0 10px; }
}

/* ---------- phones: one page at a time, menu bar at the bottom ---------- */
@media (max-width: 760px), (max-height: 460px) {
  :root { --pad: 12px; }
  body { font-size: 16px; }
  .lobby { grid-template-rows: auto 1fr auto; }
  .topbar { height: 46px; gap: 10px; }
  .brand .logo { height: 24px; }
  .topnav { display: none; }
  .me-chip .badge { display: none; }
  .mnav {
    display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); background: #1a140f;
    padding-bottom: env(safe-area-inset-bottom); grid-row: 3;
  }
  .mnav button { position: relative; background: none; border: 0; padding: 7px 0 8px; color: var(--muted); font-weight: 700; font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
  .mnav button.on { color: var(--gold2); }
  .mnav svg { width: 22px; height: 22px; }
  .mnav .dot { position: absolute; top: 5px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--red2); }
  .page { padding: 8px; }
  /* Games page: just the list, as cards; a game's details open as a sheet */
  .page-games { grid-template-rows: 1fr; }
  .lobby[data-page="games"] .splitter, .lobby[data-page="games"] .cbox { display: none; }
  .lobby[data-page="chat"] .gpanel, .lobby[data-page="chat"] .splitter, .lobby[data-page="chat"] .people { display: none; }
  .gpanel .box-head { display: none; }
  .gbody { grid-template-columns: 1fr; }
  .gleft, .gright, .cats { display: none; }
  .gmid { border-right: 0; }
  .cat-row { display: flex; gap: 8px; padding: 8px; border-bottom: 1px solid var(--line); }
  .cat-select { flex: 1; min-width: 0; background: #17110c; color: var(--text); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; font-weight: 700; }
  .grow { padding: 10px 10px 10px 0; }
  .grow.sel { border-color: var(--line); background: #1d1610; }
  .gtext { flex-direction: column; align-items: flex-start; }
  .gstat { display: block; font-size: 13px; color: var(--gold2); font-weight: 700; font-variant-numeric: tabular-nums; }
  .gside { display: none; }
  .grow-act { display: inline-block; flex: none; padding: 8px 14px; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal.sheet { max-height: 88vh; border-radius: 14px 14px 0 0; }
  .phone-only { display: flex; }
  .more-actions { gap: 8px; margin-bottom: 18px; }
  #toast { bottom: 84px; }
}
@media (max-width: 460px) { .pstats { grid-template-columns: repeat(3, 1fr); } }
/* phones held sideways: the menu becomes a rail down the left side */
@media (max-height: 460px) and (orientation: landscape) {
  .lobby { grid-template-columns: 74px 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / 3; height: 40px; }
  .mnav { grid-row: 2; grid-column: 1; grid-template-columns: 1fr; grid-auto-rows: 1fr; border-top: 0; border-right: 1px solid var(--line); padding-bottom: 0; }
  .mnav button { padding: 4px 0; font-size: 11px; justify-content: center; }
  .mnav svg { width: 18px; height: 18px; }
  .pages { grid-row: 2; grid-column: 2; }
  .page { padding: 6px; }
  .auth { justify-content: flex-start; }
  .auth-inner { padding-top: 12px; }
  .auth .logo { height: 40px; }
  .tagline { margin-bottom: 10px; }
  .modal-back { align-items: center; padding: 8px; }
  .modal.sheet { border-radius: 14px; max-height: 96vh; }
  #toast { bottom: 20px; }
}
/* the lobby's "Back to game" button, and keeping the top bar on one line on phones */
#back-btn { white-space: nowrap; }
.me-chip .pname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
@media (max-width: 420px) {
  #back-btn { padding: 5px 8px; font-size: 13px; }
  .me-chip .pname { max-width: 70px; }
}

/* ---------- Game Config (Super Admins) ---------- */
.page-config .box.wide { max-width: 1180px; width: 100%; max-height: 100%; }
.page-config .box-pad { overflow-y: auto; min-height: 0; flex: 1; padding-bottom: 0; }
.page-config .box-head { display: flex; align-items: center; justify-content: space-between; }
.cfg-open { margin-bottom: 12px; }
.cfg { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.cfg-side { display: flex; flex-direction: column; gap: 8px; }
.cfg-h { display: flex; justify-content: space-between; align-items: center; font-family: var(--head); color: var(--gold2); margin-top: 6px; }
.cfg-list { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto; }
.cfg-item { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03); color: var(--text); font: inherit; cursor: pointer; }
.cfg-item.series { cursor: default; }
.cfg-item span { font-size: 12px; color: var(--muted); }
.cfg-item.on { border-color: var(--gold); background: rgba(201, 162, 74, .12); }
.cfg-item .row-actions { margin-top: 4px; }
.cfg-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cfg-title h3 { margin: 0; font-family: var(--head); color: var(--gold2); }
.cfg-warn { font-size: 12px; color: #f0b36a; }
.cfg-form { display: flex; flex-direction: column; gap: 10px; }
.cfg-g { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 12px; margin: 0; }
.cfg-g legend { padding: 0 6px; color: var(--gold2); font-weight: 700; font-size: 13px; }
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; }
.cfg-f { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--muted); }
.cfg-f.wide, .cfg-relics.wide { grid-column: 1 / -1; }
.cfg-f input:not([type=checkbox]), .cfg-f select { padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line2); background: #15100c; color: var(--text); font: inherit; font-size: 14px; }
.cfg-f input[type=checkbox] { width: 18px; height: 18px; accent-color: #c9a24a; }
.cfg-f input:disabled, .cfg-f select:disabled { opacity: .5; }
.cfg-f small { font-size: 11px; opacity: .8; }
.cfg-relics { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.cfg-c { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.cfg-c input { width: 17px; height: 17px; accent-color: #c9a24a; }
.cfg-actions { position: sticky; bottom: 0; background: var(--panel); padding: 8px 0; flex-wrap: wrap; }
@media (max-width: 760px) {
  .cfg { grid-template-columns: 1fr; }
  .cfg-list { max-height: 30vh; }
  .cfg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.recent { display: flex; flex-direction: column; gap: 3px; margin-bottom: 14px; }
.rrow { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: baseline; font-size: 13px; padding: 3px 0; border-bottom: 1px solid var(--line); }
.rrow b { color: var(--muted); } .rrow.won b { color: var(--gold2); } .rrow small { color: var(--muted); }

.cfg-note { font-size: 12px; opacity: .8; }
.cfg-note.wide { grid-column: 1 / -1; }

/* a player's Hero on their profile */
.hero { margin: 0 0 16px; }
.hero-top { display: flex; gap: 10px; align-items: center; }
.hero-lvl { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 2px solid var(--gold2); display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(#3a2c1c, #1b140d); line-height: 1; }
.hero-lvl small { font-size: 10px; opacity: .7; }
.hero-lvl b { font-size: 18px; color: var(--gold2); }
.hero-who { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.hero-name { font: inherit; font-weight: 700; font-size: 15px; }
input.hero-name { background: transparent; border: 1px solid transparent; border-radius: 4px; color: inherit; padding: 1px 4px; margin-left: -5px; max-width: 220px; }
input.hero-name:hover, input.hero-name:focus { border-color: var(--line2, #6b5636); outline: none; }
.hero-bar { display: block; height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.hero-bar i { display: block; height: 100%; background: var(--gold2); }
.hero-talents { display: grid; gap: 5px; margin-top: 10px; }
.hero-tier { display: grid; grid-template-columns: 40px 1fr 1fr; gap: 5px; align-items: stretch; }
.hero-tier.locked { opacity: .45; }
.hero-at { font-size: 11px; opacity: .75; align-self: center; }
.hero-t { text-align: left; font: inherit; color: inherit; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.12); border-radius: 6px; padding: 4px 6px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
button.hero-t { cursor: pointer; }
button.hero-t:hover { border-color: var(--gold2); }
.hero-t.on { border-color: var(--gold2); background: rgba(226,179,60,.16); }
.hero-t b { font-size: 12px; }
.hero-t small { font-size: 10.5px; opacity: .75; line-height: 1.25; }
.hero-note { font-size: 12px; margin: 8px 0 0; }
@media (max-width: 480px) { .hero-tier { grid-template-columns: 1fr 1fr; } .hero-at { grid-column: 1 / -1; } }

/* ---- clans ---- */
.ptag { color: var(--gold2); font-weight: 600; font-size: .86em; margin-left: 3px; white-space: nowrap; }
.clan-tabs { padding: 0; margin-bottom: 14px; }
.clan-tabs .dot, .clan-tabs i.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-left: 6px; }
.clan-pane { display: flex; flex-direction: column; gap: 10px; }
.clan-pane p { margin: 0; }
.clan-head { color: var(--muted); }
.clan-head a, .clan-pane a { color: var(--gold2); }
.clan-scroll { overflow-x: auto; }
.clan-members tr.me td { background: rgba(201, 162, 74, .08); }
.clan-acts { text-align: right; white-space: nowrap; }
.clan-acts .btn { margin-left: 4px; }
.clan-on { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #5a5046; margin-right: 7px; }
.clan-on.on { background: #5fbf6a; }
.clan-score { margin: 4px 0; }
.clan-foot { justify-content: flex-start; margin-top: 6px; }
.clan-offer { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--gold); border-radius: 8px; background: rgba(201, 162, 74, .1); }
.clan-names { display: flex; flex-wrap: wrap; gap: 6px; }
.clan-ban { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: 8px; }
.clan-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.clan-card { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0, 0, 0, .2); cursor: pointer; color: var(--text); }
.clan-card:hover { border-color: var(--gold); }
.clan-card b { font-family: var(--head); color: var(--gold2); font-size: 16px; }
.clan-card span { font-size: 13px; color: var(--muted); }
.clan-view-head { display: flex; align-items: center; gap: 10px; }
.clan-view-head h3, .clan-title { margin: 0; font-family: var(--head); color: var(--gold2); }
.clan-title { margin-bottom: 10px; }
.clan-log { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.clan-log small { color: var(--muted); }
.clan-ranks input[type="text"], .clan-ranks td:first-child input { width: 130px; background: #120e0a; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; color: var(--text); }
.clan-ranks td, .clan-ranks th { text-align: center; padding: 5px 4px; }
.clan-ranks td:first-child, .clan-ranks th:first-child { text-align: left; }
.clan-legend { font-size: 13px; color: var(--muted); display: grid; gap: 2px; margin: 10px 0; }
.clan-legend b { color: var(--text); }
.clan-modal .modal { max-width: 640px; }
.clan-modal select { width: 100%; background: #120e0a; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; color: var(--text); }
@media (max-width: 760px) { .clan-acts { white-space: normal; } .clan-acts .btn { margin: 2px 0 2px 4px; } }
.clan-pane { min-width: 0; }
.clan-pane .find { flex-wrap: wrap; margin-bottom: 0; }
.clan-pane .find input { flex: 1 1 160px; }
.pstats.clan-score { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
.plate .pname, .ptag { white-space: nowrap; }
.clan-foot { flex-wrap: wrap; }
