:root {
  color-scheme: dark;
  font-family: Georgia, 'Times New Roman', serif;
  background: #161514;
  color: #fff0cc;
  --gold: #d7a257;
  --light-gold: #ffdc8c;
  --dark-gold: #77502b;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid #fff1af; outline-offset: 4px; }
.lobby {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template: auto minmax(0, 1fr) auto / minmax(150px, 17vw) minmax(0, 1fr);
  min-height: 100svh;
  min-height: 100dvh;
  padding: 16px clamp(20px, 3vw, 54px);
  gap: 12px clamp(18px, 4vw, 70px);
}
.scenery, .scenery-mobile, .mist, .bronze-frame {
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}
.scenery, .scenery-mobile {
  background: linear-gradient(180deg, #09101788, transparent 26%, #1a101621 62%, #130e0de8),
    var(--scene, none) center 62% / cover no-repeat, #20272a;
}
.scenery-mobile { display: none; }
.mist {
  inset: 2% 1%;
  opacity: .5;
  background: var(--effect, none) center / cover no-repeat;
  animation: drift 22s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translateX(1%); opacity: .32; } }
.bronze-frame {
  inset: 7px;
  z-index: 4;
  border: 5px ridge #9a643a;
  outline: 2px solid #241711;
  box-shadow: inset 0 0 0 1px #f6b06a88, inset 0 0 42px #120c08a0;
}
.bronze-frame i {
  position: absolute;
  width: 46px;
  height: 46px;
  border: 2px solid #b78146;
  border-radius: 7px 0 60% 0;
  background: repeating-radial-gradient(ellipse at 10% 10%, #3d281a 0 4px, #c5914a 5px 6px, #533222 7px 9px);
}
.bronze-frame i:nth-child(2) { right: 0; transform: scaleX(-1); }
.bronze-frame i:nth-child(3) { bottom: 0; transform: scaleY(-1); }
.bronze-frame i:nth-child(4) { right: 0; bottom: 0; transform: scale(-1); }
.lobby-header {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.brand {
  position: relative;
  margin: 0;
  color: #ffdb91;
  text-align: center;
  white-space: nowrap;
  font-size: clamp(30px, 5.4vw, 78px);
  font-style: italic;
  letter-spacing: -.04em;
  text-shadow: 1px 2px #8e411a, 2px 4px #351407, 0 0 22px #d88d3f6b, 0 4px 14px #000;
}
.brand img { display: block; width: min(43vw, 400px); height: clamp(48px, 9vw, 113px); object-fit: contain; }
.back-link, .server-tag {
  justify-self: start;
  padding: .55em .8em;
  border: 1px solid #8e6239;
  border-radius: 4px;
  background: #1b1412e8;
  color: #ffe7ad;
  text-decoration: none;
}
.server-tag { justify-self: end; text-align: right; }
.sidebar {
  align-self: stretch;
  padding: clamp(8px, 1.4vw, 20px);
  border: 3px double #9d7043;
  background: linear-gradient(135deg, #36281de8, #171312ed);
  box-shadow: 0 4px 20px #08070696, inset 0 0 20px #0006;
}
.sidebar h2 { font-size: clamp(18px, 2vw, 26px); margin: 0 0 14px; color: var(--light-gold); }
.server-list, .school-buttons { display: grid; gap: 7px; }
.server-button, .school-button, .sub-button, .pages button {
  padding: 8px 10px;
  border: 1px solid #946335;
  border-radius: 5px;
  background: linear-gradient(#39261b, #1d1411);
}
.server-button { text-align: left; }
.server-button strong, .server-button small { display: block; }
.server-button small { margin-top: 5px; color: #bce5af; }
.server-button[data-status="maintenance"] small { color: #e6b5a4; }
.server-button meter { display: block; width: 100%; }
.school-group + .school-group { margin-top: 5px; }
.school-group h3 {
  margin: 0 0 2px;
  padding: 1px 6px;
  border-bottom: 1px solid #91683e85;
  color: var(--light-gold);
  font-size: clamp(14px, 2vh, 22px);
}
.school-group h3 span { color: var(--element); margin-right: .35em; }
.school-buttons { gap: 0; }
.school-button { text-align: left; border-color: transparent; background: transparent; padding: 2px 7px; min-height: 26px; }
.school-button::before { content: '◇'; margin-right: .45em; color: #c48d4b; }
.school-button[aria-pressed="true"], .server-button[aria-pressed="true"] {
  border-color: #ffcf75;
  background: linear-gradient(#6f4322, #392212);
  box-shadow: inset 0 0 12px #ffc46848, 0 0 8px #ffb3326f;
}
.lobby-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 0;
}
.lobby-status:not(:empty) {
  z-index: 1;
  padding: 6px 15px;
  border: 1px solid #a17847;
  border-radius: 4px;
  background: #1a130fe8;
  text-align: center;
}
.lobby-status:empty { display: none; }
.stands {
  --columns: 3;
  display: grid;
  grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
  justify-content: center;
  gap: clamp(10px, 3vw, 42px);
  width: min(100%, 920px);
}
.stands:empty { display: none; }
.lobby[data-mode="creation"] .stands { --columns: 2; width: min(100%, 820px); }
.stand {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  height: clamp(270px, 61vh, 690px);
  padding: 10px 8px 8px;
  border: 1px solid #b78748cc;
  border-radius: 26px 26px 12px 12px;
  background: linear-gradient(180deg, #13151a66, #17131044 70%, #21130faa);
  box-shadow: inset 0 0 0 3px #231b15a0, inset 0 0 0 4px #bc8b4f61, 0 8px 22px #0c08088a;
  transition: border-color .18s, box-shadow .18s;
}
.stand.has-frame {
  border-color: transparent;
  border-radius: 0;
  background: var(--card-frame) center / 100% 100% no-repeat;
}
.stand[aria-pressed="true"] {
  border-color: #ffe5a6;
  box-shadow: inset 0 0 0 2px #ffce6b82, inset 0 0 32px #ffb33f46, 0 0 18px #ffb342b0;
}
.stand[aria-pressed="true"].has-frame { border-color: transparent; }
.stand::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  width: 8px;
  height: 8px;
  background: #d6a15b;
  box-shadow: 0 0 5px #220e09;
  transform: translateX(-50%) rotate(45deg);
}
.stand[aria-pressed="true"]::before { background: #ffe8ab; }
.stand-check {
  position: absolute;
  z-index: 1;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #ffe190;
  border-radius: 50%;
  background: #581f0f;
  box-shadow: 0 0 11px #ffbc4c;
}
.figure { position: relative; min-height: 0; }
.footlight, .pedestal {
  position: absolute;
  bottom: 3%;
  left: 6%;
  width: 88%;
  height: 11%;
  border-radius: 50%;
}
.pedestal {
  background: repeating-radial-gradient(ellipse at 50% 45%, #372a25 0 40%, #876241 43% 44%, #27201e 50% 64%, #b18753 67% 69%, #2c211b 73%);
  border: 1px solid #ad824d;
  box-shadow: 0 7px 0 #38291e, 0 9px 0 #8b6238, 0 13px 6px #0f0c0aa0;
}
.pedestal.has-asset {
  height: 17%;
  bottom: 0;
  background: var(--pedestal) center / contain no-repeat;
  border: 0;
  box-shadow: none;
}
.footlight {
  display: none;
  background: radial-gradient(ellipse, #ffcd7ccc, #ffac2350 45%, transparent 70%);
}
.stand[aria-pressed="true"] .footlight { display: block; }
.portrait {
  position: absolute;
  bottom: 9%;
  left: calc(50% + var(--shift-x, 0%));
  max-width: 100%;
  max-height: 96%;
  transform: translate(-50%, calc(var(--foot-gap, 2%) + var(--shift-y, 0%))) scale(var(--scale, 1));
  transform-origin: 50% var(--foot, 98%);
  filter: brightness(.83) drop-shadow(0 6px 5px #0009);
  animation: reveal .18s ease-out both;
}
.stand[aria-pressed="true"] .portrait { filter: drop-shadow(0 0 12px #ffc66a86); }
.portrait.silhouette { filter: brightness(.11) sepia(.7) drop-shadow(0 0 1px #d6a765) drop-shadow(0 0 4px #f9bc55a0); }
.stand[aria-pressed="true"] .portrait.silhouette { filter: brightness(.15) drop-shadow(0 0 2px #ffd88b); }
.portrait.silhouette.custom { filter: drop-shadow(0 0 2px #ebae57a0); }
@keyframes reveal { from { opacity: .35; } to { opacity: 1; } }
.stand-label {
  z-index: 1;
  margin: 3px 2px 1px;
  padding: 5px 3px;
  overflow-wrap: anywhere;
  border: 3px double #ac7a43;
  border-radius: 9px;
  background: linear-gradient(#382316, #1f1510);
  color: #fff1c8;
  font-size: clamp(14px, 2.1vw, 25px);
}
.stand-label strong, .stand-label small { display: block; }
.stand-label small { color: #f2cb84; font-size: .65em; }
.pages { display: flex; align-items: center; gap: 12px; }
.pages span { text-shadow: 0 1px 3px #000; }
.lobby-actions { grid-column: 1 / -1; align-self: end; }
.lobby-actions form {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
}
.primary {
  position: relative;
  min-width: min(290px, 95%);
  min-height: 56px;
  padding: 6px 24px;
  border: 5px double #ffe098;
  border-radius: 13px 5px 13px 5px;
  background: var(--primary, linear-gradient(#ad2c13, #7a130b 52%, #480e09)) center / 100% 100% no-repeat;
  box-shadow: inset 0 0 0 1px #ffb546, inset 0 0 13px #ff7d2f87, 0 3px 9px #120502, 0 0 0 2px #462415;
  color: #ffecc0;
  font-size: clamp(21px, 3vw, 37px);
  font-weight: bold;
  text-shadow: 0 2px 3px #2e0d06;
}
.primary:hover:not(:disabled) { filter: brightness(1.17); }
.name-field { display: grid; gap: 3px; min-width: min(245px, 100%); }
.name-field input {
  padding: 10px 11px;
  border: 1px solid #c59559;
  border-radius: 5px;
  background: #211812;
  color: #fff0cc;
  font-size: 16px;
}
#name-error { color: #ffd4c2; font: 13px/1.3 system-ui, sans-serif; }
#name-error:not(:empty) { max-width: 310px; }
@media (max-width: 720px) {
  .lobby { grid-template: auto auto 1fr auto / minmax(0, 1fr); padding: 14px 12px 12px; gap: 9px; }
  .bronze-frame { inset: 3px; border-width: 2px; }
  .bronze-frame i { width: 21px; height: 21px; }
  .lobby-header { padding: 0 4px; grid-template-columns: 1fr auto 1fr; }
  .brand { font-size: clamp(24px, 6.3vw, 42px); }
  .brand img { width: clamp(130px, 40vw, 250px); height: 48px; }
  .back-link, .server-tag { font-size: 12px; }
  .sidebar { padding: 6px; }
  .sidebar h2 { font-size: 15px; margin: 0 0 5px; }
  .server-list { grid-auto-flow: column; grid-auto-columns: minmax(115px, 1fr); overflow-x: auto; padding: 3px; }
  .school-list { display: flex; gap: 6px; overflow-x: auto; padding: 3px; }
  .school-group { min-width: max-content; }
  .school-group + .school-group { margin-top: 0; }
  .school-button { min-height: 29px; }
  .scenery-mobile[data-active="true"] { display: block; }
  .mist { display: none; }
  .stands { gap: 6px; }
  .stand { padding: 4px 2px; height: clamp(155px, 43svh, 360px); border-radius: 13px 13px 7px 7px; }
  .stand-label { font-size: clamp(12px, 3.5vw, 18px); margin-inline: 0; }
  .stand-check { top: 6px; right: 6px; width: 22px; height: 22px; }
  .lobby-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding: 5px 0 max(6px, env(safe-area-inset-bottom));
    background: #1a100ed9;
  }
  .lobby-actions form { gap: 6px; }
  .name-field { grid-template-columns: auto 1fr; align-items: center; width: 100%; padding: 0 6px; }
  #name-error { grid-column: 1 / -1; }
  .primary { min-height: 43px; }
}
@media (prefers-reduced-motion: reduce) {
  .mist, .portrait { animation: none; }
  .stand { transition: none; }
}
