.lobby {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
  padding: 28px 48px 22px;
  overflow: hidden;
}

.lobby-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.lobby-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(90, 102, 71, 0.07) 1px, transparent 1px) 0 0 / 80px 80px,
    linear-gradient(90deg, rgba(90, 102, 71, 0.07) 1px, transparent 1px) 0 0 / 80px 80px;
  mask-image: radial-gradient(ellipse at 65% 45%, #000 0%, transparent 72%);
  opacity: 0.55;
}

.lobby-wheel {
  position: absolute;
  right: -120px;
  top: 50%;
  width: min(66vw, 900px);
  aspect-ratio: 1;
  transform: translateY(-50%) rotate(-11deg);
  border-radius: 50%;
  background:
    repeating-conic-gradient(
      from -90deg,
      rgba(242, 169, 59, 0.13) 0deg 2.4deg,
      transparent 2.4deg 15deg
    );
  mask-image: radial-gradient(circle, #000 0 48%, rgba(0, 0, 0, 0.5) 61%, transparent 72%);
  opacity: 0.75;
}

.lobby-wheel::before,
.lobby-wheel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.lobby-wheel::before {
  inset: 9%;
  border: 1px solid rgba(242, 169, 59, 0.18);
}

.lobby-wheel::after {
  inset: 28%;
  border: 1px solid rgba(242, 169, 59, 0.12);
  background: radial-gradient(circle, rgba(242, 169, 59, 0.08), transparent 66%);
}

.lobby-glow {
  position: absolute;
  right: 8%;
  top: 22%;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 169, 59, 0.1), transparent 68%);
  filter: blur(10px);
}

.lobby-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--amber);
  color: var(--amber);
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
  background: rgba(242, 169, 59, 0.05);
}

.brand-name {
  display: flex;
  flex-direction: column;
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.18em;
  line-height: 1.1;
}

.brand-name small {
  margin-top: 3px;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--ink-faint);
}

.lobby-status {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-cond);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
}

.lobby-main {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  align-items: center;
  gap: clamp(32px, 6vw, 96px);
  width: min(1480px, 100%);
  margin: 0 auto;
}

.lobby-copy h1 {
  margin: 16px 0 22px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(58px, 7.6vw, 118px);
  line-height: 0.9;
  letter-spacing: 0.005em;
  color: var(--ink);
  text-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
}

.lobby-copy h1 span {
  color: var(--amber);
}

.lobby-copy .lede {
  max-width: 520px;
  margin: 0;
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1.8;
}

.lobby-stats {
  display: flex;
  gap: 34px;
  margin-top: 38px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  max-width: 520px;
}

.lobby-stats div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lobby-stats b {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.lobby-stats span {
  font-family: var(--font-cond);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
}

.join-panel {
  position: relative;
  width: 100%;
  max-width: 430px;
  justify-self: end;
  padding: 26px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(180deg, rgba(30, 38, 24, 0.94), rgba(17, 21, 15, 0.96));
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.55);
}

.join-panel::before,
.join-panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--amber);
  border-style: solid;
  opacity: 0.7;
}

.join-panel::before {
  left: -1px;
  top: -1px;
  border-width: 1px 0 0 1px;
}

.join-panel::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 1px 1px 0;
}

.join-panel > .panel-label {
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 15px;
}

.field span {
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.field input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b0e09;
  color: var(--ink);
  font-size: 16px;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.field input::placeholder {
  color: #5c6352;
}

.field input:focus {
  outline: none;
  border-color: var(--amber);
  background: #0d110b;
}

#roomInput {
  font-family: var(--font-mono);
  font-size: 26px;
  letter-spacing: 0.32em;
  text-align: center;
}

.join-panel .btn {
  width: 100%;
  margin-top: 10px;
  min-height: 48px;
}

.join-panel kbd {
  margin-left: auto;
  padding: 2px 5px;
  border: 1px solid rgba(10, 12, 9, 0.3);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  opacity: 0.6;
}

.form-note {
  margin: 16px 0 0;
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.6;
}

.form-error {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--red-ink);
  font-size: 12px;
}

.lobby-foot {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-family: var(--font-cond);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
}

.shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--members);
  height: 100dvh;
  overflow: hidden;
}

.rail {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #0a0d08;
}

.rail-brand {
  display: grid;
  place-items: center;
  height: var(--topbar);
  border-bottom: 1px solid var(--line);
  color: var(--amber);
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
}

.tabs {
  display: flex;
  flex-direction: column;
}

.tab {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  gap: 2px;
  height: 88px;
  color: var(--ink-faint);
  border-bottom: 1px solid rgba(51, 61, 43, 0.55);
  transition: color 0.16s ease, background 0.16s ease;
}

.tab span {
  font-family: var(--font-cond);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.tab b {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.1em;
}

.tab svg {
  width: 18px;
  height: 18px;
  margin-top: 4px;
  opacity: 0.75;
}

.tab::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: var(--amber);
  transform: scaleY(0);
  transition: transform 0.18s var(--ease-out);
}

.tab:hover {
  color: var(--ink);
  background: rgba(242, 169, 59, 0.035);
}

.tab.is-active {
  color: var(--amber);
  background: linear-gradient(90deg, rgba(242, 169, 59, 0.09), transparent 70%);
}

.tab.is-active::before {
  transform: scaleY(1);
}

.rail-room {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: auto;
  padding: 14px 4px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
}

.rail-room span {
  font-family: var(--font-cond);
  font-size: 8px;
  letter-spacing: 0.2em;
}

.rail-room b {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
}

.rail-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 8px;
  border-top: 1px solid var(--line);
}

.rail-foot .icon-btn {
  width: 100%;
  height: 36px;
}

.main {
  display: grid;
  grid-template-rows: var(--topbar) minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 13, 8, 0.55);
}

.room-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.room-title b {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--ink);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-cond);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.conn i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.conn.is-on i {
  background: var(--green);
  box-shadow: 0 0 8px rgba(143, 174, 82, 0.6);
}

.conn.is-off i {
  background: var(--red);
}

.self-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--ink-dim);
}

.members-toggle {
  display: none;
}

.content {
  position: relative;
  min-height: 0;
  padding: var(--pad);
  overflow: hidden;
}

.members {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: rgba(11, 14, 9, 0.72);
}

.members-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 16px 14px;
  border-bottom: 1px solid var(--line);
}

.members-head > span:last-child {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
}

.member-list {
  list-style: none;
  margin: 0;
  padding: 12px;
  overflow: auto;
  flex: 1;
}

.members-foot {
  padding: 12px;
  border-top: 1px solid var(--line);
}

.members-foot .btn {
  width: 100%;
  min-height: 38px;
  font-size: 12px;
}

.room-mini {
  margin-top: 10px;
  text-align: center;
  font-family: var(--font-cond);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
}

.room-mini b {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
}

@media (max-width: 1500px) {
  :root {
    --members: 218px;
    --pad: 18px;
  }

  .lobby-main {
    grid-template-columns: minmax(0, 1.1fr) minmax(330px, 0.9fr);
    gap: 44px;
  }
}

@media (max-width: 1280px) {
  :root {
    --members: 0px;
  }

  .shell {
    grid-template-columns: var(--rail) minmax(0, 1fr);
  }

  .members {
    position: fixed;
    top: var(--topbar);
    right: 0;
    bottom: 0;
    z-index: 40;
    width: 260px;
    transform: translateX(102%);
    transition: transform 0.24s var(--ease-out);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
    background: #0c100a;
    border-left: 1px solid var(--line);
  }

  .members.is-open {
    transform: translateX(0);
  }

  .members-toggle {
    display: inline-flex;
    position: relative;
    gap: 4px;
  }

  .members-badge {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--ink-faint);
  }

  .lobby {
    padding: 24px 32px 20px;
  }
}

@media (max-width: 980px) {
  :root {
    --rail: 68px;
    --topbar: 56px;
  }

  .lobby-main {
    grid-template-columns: 1fr;
    gap: 30px;
    align-content: center;
  }

  .lobby-copy h1 {
    font-size: clamp(48px, 10vw, 82px);
  }

  .join-panel {
    justify-self: start;
    max-width: 460px;
  }

  .lobby-wheel {
    right: -30vw;
    opacity: 0.4;
  }

  .lobby-stats {
    margin-top: 24px;
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .lobby {
    min-height: 100svh;
    padding: 18px 18px 16px;
    overflow: visible;
  }

  .lobby-status {
    display: none;
  }

  .lobby-copy .lede {
    font-size: 14px;
  }

  .lobby-stats {
    gap: 22px;
  }

  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 58px;
    height: 100dvh;
  }

  .rail {
    grid-row: 2;
    flex-direction: row;
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .rail-brand,
  .rail-room {
    display: none;
  }

  .tabs {
    flex: 1;
    flex-direction: row;
  }

  .tab {
    flex: 1;
    height: 58px;
    border-bottom: 0;
    border-right: 1px solid rgba(51, 61, 43, 0.4);
  }

  .tab::before {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 0;
    width: auto;
    height: 2px;
    transform: scaleX(0);
  }

  .tab.is-active::before {
    transform: scaleX(1);
  }

  .tab svg {
    display: none;
  }

  .rail-foot {
    display: flex;
    border-top: 0;
    padding: 4px;
  }

  .rail-foot .icon-btn {
    width: 38px;
  }

  .rail-foot .icon-btn:nth-child(3) {
    display: none;
  }

  .main {
    grid-row: 1;
  }

  .content {
    padding: 12px;
    overflow: auto;
  }

  .topbar {
    padding: 0 12px;
  }

  .self-name {
    display: none;
  }
}
