:root { color-scheme: dark; font-family: "Segoe UI", sans-serif; }
*, *::before, *::after { box-sizing: border-box; }
html { min-width: 0; }
body { margin: 0; min-width: 0; min-height: 100vh; min-height: 100dvh; background: #09060f; color: #f6f3ff; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
img, svg, video { max-width: 100%; height: auto; }
p, h1, h2, li, label, button, a, .note, .error, .lead { overflow-wrap: anywhere; min-width: 0; }
.topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.6rem 0.8rem; padding: 0.7rem 0.8rem; background: #120818; position: sticky; top: 0; z-index: 4; }
.brand { display: grid; gap: 0.1rem; min-width: 0; }
.live { margin: 0; color: #f0c14a; font-weight: 700; }
.account { position: relative; margin-left: auto; min-width: 0; max-width: 100%; }
#account-button { max-width: 100%; min-width: 8.5rem; white-space: normal; }
html:has(body.panel-open), body.panel-open { overflow: hidden; }
.panel { position: fixed; z-index: 5; left: max(0.6rem, env(safe-area-inset-left)); right: max(0.6rem, env(safe-area-inset-right)); top: calc(4.4rem + env(safe-area-inset-top)); width: auto; min-width: min(20rem, calc(100vw - 1.2rem)); max-height: calc(100dvh - 5.2rem - env(safe-area-inset-bottom)); overflow-x: clip; overflow-y: auto; overscroll-behavior: contain; padding: 1rem 1.1rem; border-radius: 16px; background: #1c1030; box-shadow: 0 18px 48px #000; }
#who { overflow-wrap: normal; word-break: normal; }
main { width: min(100%, 72rem); margin: 0 auto; padding: 0.75rem; min-width: 0; }
.stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; align-items: start; min-width: 0; }
.broadcast, .chatbox, .seat, .board { min-width: 0; }
.broadcast, .chatbox { display: grid; gap: 0.6rem; align-content: start; }
.board { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
.seat { display: grid; gap: 0.28rem; min-height: 5.2rem; padding: 0.55rem; border-radius: 14px; background: #1c1030; }
.seat.human { box-shadow: inset 0 0 0 2px #f0c14a; }
.seat.out { opacity: 0.55; }
.seat img { width: 100%; max-height: 4.2rem; object-fit: contain; }
.hp { height: 0.38rem; border-radius: 999px; background: #2a1844; overflow: hidden; }
.hp span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff5d73, #3ee6a2); }
#stream-card { min-height: min(52dvh, 36rem); display: grid; place-items: center; text-align: center; padding: 1.2rem; gap: 0.4rem; }
#stream-card[hidden], #live[hidden], #screen[hidden], #youtube-box[hidden], .stream-tools button[hidden] { display: none; }
.stream-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.stream-tools button { width: auto; flex: 1 1 8rem; }
#youtube-box iframe { width: 100%; aspect-ratio: 16 / 9; max-height: 12rem; border: 0; border-radius: 16px; }
.chatlog { list-style: none; margin: 0; padding: 0; max-height: 16rem; overflow: auto; }
.botline { color: #9ad7ff; }
@media (min-width: 520px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  html:has(body.panel-open), body.panel-open { overflow: auto; }
  .account { max-width: none; }
  .panel {
    position: fixed;
    left: auto;
    right: max(0.8rem, env(safe-area-inset-right));
    top: calc(4.2rem + env(safe-area-inset-top));
    width: min(32rem, calc(100vw - 1.6rem));
    min-width: min(28rem, calc(100vw - 1.6rem));
    max-height: min(40rem, calc(100dvh - 5rem));
  }
  .stage { grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem); align-items: stretch; }
  .board { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .chatlog { max-height: calc(100dvh - 16rem); }
}
h1, h2 { line-height: 1.15; }
h1 { font-size: 1.8rem; margin: 0.2rem 0 0.6rem; }
h2 { font-size: 1.2rem; margin: 0; }
.eyebrow { letter-spacing: 0.14em; text-transform: uppercase; color: #9ad7ff; font-size: 0.78rem; }
.lead, .note, #who { color: #d5cce8; line-height: 1.45; }
form, section { display: grid; gap: 0.8rem; margin-top: 1.2rem; min-width: 0; }
label { display: grid; gap: 0.35rem; font-size: 0.95rem; }
.check { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
input, select, button { font: inherit; width: 100%; max-width: 100%; min-width: 0; min-height: 2.75rem; border-radius: 12px; border: 1px solid #6d5c99; background: #1c1030; color: inherit; padding: 0.75rem 0.8rem; }
input[type="checkbox"] { width: 1.15rem; min-height: 1.15rem; margin-top: 0.2rem; }
input[type="file"] { min-height: 3rem; }
button { background: #6d4dff; border-color: transparent; font-weight: 700; white-space: normal; }
img { width: 100%; max-height: 16rem; object-fit: contain; background: #09060f; border-radius: 16px; }
.screen-wrap { position: relative; min-width: 0; background: #09060f; border-radius: 16px; }
#screen-full { position: absolute; z-index: 2; top: 0.55rem; right: 0.55rem; width: auto; min-height: 2.4rem; padding: 0.4rem 0.7rem; }
#screen, #live { width: 100%; max-height: min(72dvh, 40rem); aspect-ratio: 16 / 9; object-fit: contain; background: #09060f; border-radius: 16px; box-shadow: 0 0 0 1px #3a2a62; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem; position: sticky; top: -0.9rem; z-index: 2; background: #1c1030; padding: 0.2rem 0 0.45rem; }
#account-close { width: 2.6rem; min-width: 2.6rem; min-height: 2.6rem; padding: 0; }
.screen-wrap:fullscreen, .screen-wrap.screen-fill { border-radius: 0; width: 100%; height: 100%; background: #000; display: grid; place-items: center; }
.screen-wrap.screen-fill { position: fixed; inset: 0; z-index: 40; width: 100vw; height: 100dvh; }
.screen-wrap:fullscreen #screen-full, .screen-wrap.screen-fill #screen-full { position: absolute; top: 0.8rem; right: 0.8rem; z-index: 2; }
.screen-wrap:fullscreen #screen, .screen-wrap.screen-fill #screen, .screen-wrap:fullscreen #live, .screen-wrap.screen-fill #live { width: min(100vw, calc(100dvh * 16 / 9)); height: auto; max-width: 100%; max-height: 100dvh; aspect-ratio: 16 / 9; object-fit: contain; border-radius: 0; box-shadow: none; }
.code { font-size: clamp(1.5rem, 9vw, 2.4rem); letter-spacing: 0.08em; margin: 0; line-height: 1.2; }
.error { color: #ffb4a8; margin: 0; }
ol { margin: 0; padding-left: 1.4rem; display: grid; gap: 0.35rem; }
[hidden] { display: none !important; }