.rooms-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px }
.rooms [hidden] { display:none }
.room-account { margin-bottom:16px }
.room-account .button { min-height:44px; white-space:normal }
.account-choices { display:flex; gap:8px; flex-wrap:wrap }
#register-form { max-width:30rem }
.match-history summary { cursor:pointer; min-height:44px; align-content:center; font-weight:bold }
.history-filter,.history-pages { display:flex; align-items:center; flex-wrap:wrap; gap:8px 12px }
.history-filter { margin-block:8px }
.history-filter #history-export { margin:0 }
#history-export-status:empty { display:block; margin:0 }
.history-pages .button { margin:0 }
.match-history time { display:block; color:var(--muted) }
.room-account ul { display:grid; list-style:none; padding:0; gap:8px }
.room-account li { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
  padding:10px; border:1px solid var(--line); border-radius:4px }
.room-account li code { display:block; overflow-wrap:anywhere; color:var(--muted) }
.room-account p:empty,.room-account ul:empty { display:none }
.rooms form,.room-action { display:grid; gap:8px; min-width:0 }
.rooms form { margin-top:14px }
.rooms select { min-height:44px; background:#101314; color:inherit; border:1px solid #464640; border-radius:4px; padding:8px; font:inherit; max-width:100% }
.rooms select:focus-visible { outline:2px solid #efb58c; outline-offset:3px }
.room-bar { display:flex; justify-content:space-between; gap:10px; flex-wrap:wrap; align-items:center }
.room-toolbar { display:flex; flex-wrap:wrap; gap:6px }
.room-reference,.room-panel { overflow-wrap:anywhere; margin-block:10px }
.room-panel { padding:12px; border:1px solid var(--line); border-radius:4px; background:var(--well) }
.room-panel .button { margin-top:6px }
.room-steps { list-style:none; display:flex; gap:8px; padding:0; flex-wrap:wrap; color:var(--muted) }
.room-steps li { padding:4px 8px; border:1px solid var(--line); border-radius:4px }
.room-steps [aria-current] { color:var(--copper); border-color:var(--rim) }
.room-action { padding-block:12px; border-top:1px solid var(--line); margin-top:12px }
.room-action .button { justify-self:start }
.room-action textarea { min-height:120px }
.room-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 16px }
.room-options input { width:90px }
.room-options label { overflow-wrap:anywhere }
.rooms .hint { color:var(--muted) }
.match-hand { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); padding:0; gap:8px; list-style:none }
.match-hand li { padding:8px; overflow-wrap:anywhere; border:1px solid var(--line) }
.match-hand button { width:100%; min-height:44px; white-space:normal }
.match-arena { list-style:none; padding:0; display:grid; gap:6px }
.match-arena li { display:flex; gap:8px; align-items:center; flex-wrap:wrap; overflow-wrap:anywhere }
.match-arena button { min-height:44px; white-space:normal }
.match-arena small { color:var(--muted) }
.hero-control { min-height:44px; max-width:100%; white-space:normal }
.ability-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px }
.ability-options .button { min-height:44px; width:100%; white-space:normal; overflow-wrap:anywhere }
.ability-options .button:focus-visible { outline:2px solid currentColor; outline-offset:3px }
.match-controls { display:flex; flex-wrap:wrap; gap:8px; margin-block:12px }
.match-controls button { min-height:44px }
.replay-controls { margin-block:0 }
@media(max-width:650px) {
  .rooms-grid,.room-options,.match-hand,.ability-options { grid-template-columns:minmax(0,1fr) }
  .hero-control { width:100% }
  .rooms .surface { padding:14px }
  .room-account li .button { width:100% }
  .account-choices .button { flex:1 1 9rem }
  #history-export { width:100% }
  .replay-controls :is(#replay-previous,#replay-next) { flex:1 1 40% }
}

.lobby-page {
  --lobby-base:#0d171e;
  --lobby-edge:#385250;
  --lobby-gold:#e8c58a;
  --lobby-mint:#9edbc9;
  background:radial-gradient(ellipse at 69% 5%,#1b3138 0%,transparent 60%),#0a1117;
}
.lobby-page .site-head { background:#0b141c; border-color:#33504c; }
.lobby-page .brand-mark { --rim:#9d8260; --copper:var(--lobby-gold); }
.lobby { color:#f3ede1; }
.lobby-masthead {
  position:relative; isolation:isolate; display:grid; align-items:center; overflow:hidden;
  padding:clamp(26px,5.5vw,72px); min-height:clamp(275px,30vw,392px);
  border:1px solid #58736d; border-radius:8px;
  background:#10262a;
  background-image:linear-gradient(90deg,#0a151e 1%,#0a151ef7 23%,#0a151e70 53%,#0a151e0c 82%),
    linear-gradient(0deg,#0b171c92,transparent 40%),url("/ui/assets/lobby-gate.webp");
  background-size:cover,cover,max(72%,640px) auto; background-position:center,center,right 47%; background-repeat:no-repeat;
  box-shadow:0 20px 60px #04090c80;
}
.lobby-masthead::after {
  content:""; position:absolute; inset:8px; border:1px solid #dcc39345; border-radius:4px;
  pointer-events:none; z-index:-1;
}
.lobby-intro { max-width:40rem; }
.lobby-intro .overline { color:var(--lobby-mint); letter-spacing:.16em; }
.lobby-intro .overline::before {
  content:""; width:7px; height:7px; rotate:45deg; background:#a8e3d0; box-shadow:0 0 14px #95f4d1a3;
}
.lobby-intro h1 {
  margin:12px 0; color:#fff4df; font:700 clamp(2.8rem,6vw,5.7rem)/1.12 var(--serif);
  letter-spacing:.04em; text-shadow:0 3px 24px #050b0deb;
}
.lobby-intro p { color:#e5dfd3; font-size:clamp(1rem,1.65vw,1.26rem); text-shadow:0 2px 8px #000; }
.lobby-formats { display:flex; flex-wrap:wrap; list-style:none; gap:8px; padding:0; margin:18px 0 0; }
.lobby-formats li {
  display:flex; align-items:center; gap:6px; padding:4px 8px; border:1px solid #b6cfc052; border-radius:4px;
  background:#12222be6; color:#e3ded2; font-size:.82rem;
}
.lobby-formats abbr { text-decoration:none; font:700 1.05rem var(--number); color:var(--lobby-gold); }
.lobby-status { display:flex; align-items:center; flex-wrap:wrap; gap:8px 16px; padding:10px 0; }
.lobby-status p { margin:0; }
.lobby-workspace { display:grid; grid-template-columns:minmax(0,.8fr) minmax(0,1.6fr); align-items:start; gap:14px; }
.lobby-workspace:has(.room-account[hidden]) { grid-template-columns:minmax(0,1fr); }
.lobby .room-account { margin:0; }
.lobby .rooms-grid { gap:14px; }
.lobby .surface {
  background:radial-gradient(ellipse at 14% 0%,#273b3c 0%,transparent 64%),linear-gradient(160deg,#17262c,#0c171f);
  border:1px solid var(--lobby-edge); box-shadow:0 9px 24px #050c1360;
}
.lobby .surface h2 { color:#f3e8d4; }
.lobby .lobby-create { border-color:#877151; }
.lobby-entry-mark {
  display:grid; place-items:center; width:34px; aspect-ratio:1; margin-bottom:10px; border:1px solid #7c6a4f;
  border-radius:4px; color:var(--lobby-gold); background:#1c2426; font-size:1.22rem;
}
.lobby-join .lobby-entry-mark { color:var(--lobby-mint); border-color:#5d8177; }
.lobby .lobby-entry form > :is(input,select) { margin-bottom:3px; }
.lobby :is(input,select,.room-panel) { border-color:#425a59; background:#0e181e; }
.lobby .button.primary {
  border-color:#ecce92; color:#211910; background:linear-gradient(#f1d7a9,#cda772);
  box-shadow:inset 0 0 0 1px #f6e2bd55;
}
.lobby .button.primary:hover:not(:disabled) { background:linear-gradient(#ffe5b9,#e6bd82); }
.lobby .match-history { overflow-x:auto; }
@media (max-width:1000px) {
  .lobby-workspace { grid-template-columns:minmax(0,1fr); }
}
@media (max-width:650px) {
  .lobby-masthead {
    min-height:232px; align-items:end; padding:22px;
    background-image:linear-gradient(90deg,#0b141baf,#0b141b18),linear-gradient(0deg,#0c161ef7 10%,#0c161e43 76%),url("/ui/assets/lobby-gate.webp");
    background-size:cover,cover,cover; background-position:center,center,66% 45%;
  }
  .lobby-intro h1 { margin:8px 0; }
  .lobby-formats { margin-top:12px; }
  .lobby .room-account .room-panel { margin-block:6px; }
  .lobby .room-account ul { margin-block:6px 0; }
}
@media (prefers-reduced-motion:no-preference) {
  .lobby-intro { animation:lobby-arrival .55s ease-out both; }
  @keyframes lobby-arrival { from { opacity:0; translate:0 9px; } }
}
