:root {
  --bg:          #080810;
  --bg2:         #0d0d1a;
  --surface:     #12121f;
  --surface2:    #1a1a2e;
  --border:      #2a2a4a;
  --border-glow: #7c3aed;
  --text:        #d4d4f0;
  --text-dim:    #6b6b9a;
  --purple:      #7c3aed;
  --purple-light: #a855f7;
  --purple-bright:#c084fc;
  --purple-glow:  #9333ea;
  --neon:        #e879f9;
  --neon-dim:    #701a75;
  --green:       #4ade80;
  --danger:      #f87171;
  --gold:        #fbbf24;
  --font-pixel:  'Press Start 2P', monospace;
  --font-vt:     'VT323', monospace;
  --font-body:   'VT323', monospace;
  --radius:      4px;
  --radius-lg:   8px;
  --chat-w:      360px;
  --header-h:    56px;
}
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  overflow: hidden;
}
button { cursor: pointer; border: none; font-family: var(--font-pixel); }
input  { outline: none;  font-family: var(--font-body); }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--purple); border-radius: 2px; }
@keyframes pulse-border {
  0%, 100% { border-color: var(--border-glow); box-shadow: 0 0 6px var(--purple-glow); }
  50%       { border-color: var(--neon);        box-shadow: 0 0 14px var(--neon); }
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }
@keyframes fadeIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }
@keyframes float {
  0%,100%{transform:translateY(0)}
  50%{transform:translateY(-8px)}
}
@keyframes logo-glow {
  0%,100%{text-shadow:0 0 8px var(--purple),0 0 20px var(--purple-glow)}
  50%{text-shadow:0 0 16px var(--neon),0 0 40px var(--neon-dim),0 0 60px var(--purple)}
}
#root { height: 100%; display: flex; flex-direction: column; }
.home-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 24px 20px;
  text-align: center;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(124,58,237,0.18) 0%, transparent 60%), var(--bg);
  position: relative;
  overflow: hidden;
}
.home-page::before {
  content:'';
  position:absolute;
  inset:0;
  background: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,0,0,0.15) 3px, rgba(0,0,0,0.15) 4px);
  pointer-events: none;
  z-index: 0;
}
.home-page > * { position: relative; z-index: 1; }
.home-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; animation: float 4s ease-in-out infinite; }
.home-logo .logo-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--purple);
  box-shadow: 0 0 12px var(--purple);
}
.home-logo h1 {
  font-family: var(--font-pixel);
  font-size: clamp(0.75rem, 3vw, 1.1rem);
  line-height: 1.8;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--purple-bright), var(--neon));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: logo-glow 3s ease-in-out infinite;
}
.home-logo .tagline { font-family: var(--font-vt); font-size: 1.3rem; color: var(--text-dim); letter-spacing: 0.05em; }
.home-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 0 0 1px rgba(124,58,237,0.1), 0 8px 40px rgba(0,0,0,0.6);
}
.home-user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--font-vt);
  font-size: 1.2rem;
  color: var(--purple-bright);
}
.home-user-badge .dot {
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--green);
  flex-shrink: 0;
}
.join-row { display: flex; gap: 8px; }
.join-row input {
  flex: 1;
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-vt);
  font-size: 1.2rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.join-row input:focus { border-color: var(--purple); box-shadow: 0 0 8px rgba(124,58,237,0.4); }
.join-row input::placeholder { color: var(--text-dim); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  line-height: 1;
  letter-spacing: 0.05em;
  transition: all 0.15s;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.06); opacity: 0; transition: opacity 0.15s; }
.btn:hover::after { opacity: 1; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--purple); color: #fff; box-shadow: 0 0 12px rgba(124,58,237,0.5), inset 0 1px 0 rgba(255,255,255,0.12); }
.btn-primary:hover { background: var(--purple-glow); box-shadow: 0 0 20px rgba(147,51,234,0.7); }
.btn-neon { background: var(--neon-dim); color: var(--neon); border: 1px solid var(--neon); box-shadow: 0 0 10px rgba(232,121,249,0.3); }
.btn-neon:hover { background: var(--neon); color: #000; box-shadow: 0 0 20px rgba(232,121,249,0.7); }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--purple); color: var(--text); }
.btn-danger { background: #7f1d1d; color: var(--danger); border: 1px solid var(--danger); box-shadow: 0 0 8px rgba(248,113,113,0.3); }
.btn-danger:hover { background: var(--danger); color: #000; }
.btn-green { background: #14532d; color: var(--green); border: 1px solid var(--green); }
.btn-green:hover { background: var(--green); color: #000; }
.btn-sm { padding: 7px 12px; font-size: 0.5rem; }
.room-wrap { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.room-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 16px rgba(0,0,0,0.5);
  position: relative;
  z-index: 10;
  overflow-x: auto;
  overflow-y: hidden;
}
.room-header::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--purple), transparent); }
.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.header-logo img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--purple);
}
.header-logo-text {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--purple-bright);
  letter-spacing: 0.05em;
}
.header-logo-text span { color: var(--neon); }
.header-divider { width: 1px; height: 24px; background: var(--border); flex-shrink: 0; }
.header-channel { font-family: var(--font-vt); font-size: 1.2rem; color: var(--purple-bright); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 6px var(--danger); animation: blink 1.4s ease-in-out infinite; flex-shrink: 0; }
.header-spacer { flex: 1; }
.room-body { flex: 1; display: flex; overflow: hidden; min-height: 0; }
.player-area {
  flex: 1; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; overflow: hidden; min-width: 0;
}
.player-area video { width: 100%; height: 100%; object-fit: contain; display: none; }
.player-area video.active { display: block; }
.player-placeholder { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 20px; }
.player-placeholder .ph-icon { font-size: 3rem; animation: float 3s ease-in-out infinite; filter: drop-shadow(0 0 10px var(--purple)); }
.player-placeholder .ph-title { font-family: var(--font-pixel); font-size: 0.7rem; color: var(--purple-bright); line-height: 2; }
.player-placeholder .ph-sub { font-family: var(--font-vt); font-size: 1.1rem; color: var(--text-dim); }
.player-corner { position: absolute; width: 24px; height: 24px; border-color: var(--purple); border-style: solid; opacity: 0.5; }
.pc-tl { top:8px; left:8px;  border-width:2px 0 0 2px; }
.pc-tr { top:8px; right:8px; border-width:2px 2px 0 0; }
.pc-bl { bottom:8px; left:8px;  border-width:0 0 2px 2px; }
.pc-br { bottom:8px; right:8px; border-width:0 2px 2px 0; }
.chat-panel {
  width: var(--chat-w); flex-shrink: 0; background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-head {
  padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px;
  background: var(--surface2); flex-shrink: 0;
}
.chat-head-name-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.chat-head-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.chat-head-dot.connected { background: var(--green); box-shadow: 0 0 6px var(--green); animation: blink 2s ease-in-out infinite; }
.chat-head-label {
  font-family: var(--font-vt); font-size: 1.15rem; color: var(--text);
  letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-head-icons { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-shrink: 0; }
.chat-head-icon-btn {
  background: none; border: none; color: var(--text-dim); font-family: var(--font-vt);
  font-size: 1rem; line-height: 1; padding: 2px; display: flex; align-items: center; justify-content: center;
  opacity: 0.7; transition: opacity 0.15s, color 0.15s; cursor: default;
}
.chat-head-icon-btn:hover { opacity: 1; color: var(--purple-bright); }
.chat-head-viewers { font-family: var(--font-vt); font-size: 0.95rem; color: var(--text-dim); white-space: nowrap; }
.chat-messages { flex: 1; overflow-y: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.msg {
  padding: 4px 8px; border-radius: var(--radius); font-family: var(--font-vt); font-size: 1.15rem;
  line-height: 1.4; word-break: break-word; animation: fadeIn 0.2s ease; transition: background 0.15s;
}
.msg:hover { background: rgba(124,58,237,0.08); }
.msg .msg-name { font-weight: bold; margin-right: 5px; }
.msg.own-msg { background: rgba(124,58,237,0.1); border-left: 2px solid var(--purple); }
.chat-head-avatar {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--purple-bright); flex-shrink: 0;
}
.chat-head-avatar-placeholder {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg2); border: 1px solid var(--border);
}
.badge {
  display: inline-flex; align-items: center; gap: 2px; font-family: var(--font-pixel); font-size: 0.45rem;
  padding: 2px 5px; border-radius: 2px; margin-right: 3px; vertical-align: middle;
}
.badge.broadcaster { background: #78350f; color: var(--gold); border: 1px solid var(--gold); }
.badge.moderator   { background: #14532d; color: var(--green); border: 1px solid var(--green); }
.badge.subscriber  { background: #3b0764; color: var(--purple-bright); border: 1px solid var(--purple-bright); }
.badge.vip         { background: #701a75; color: var(--neon); border: 1px solid var(--neon); }
.mod-btn {
  background: transparent; border: none; cursor: pointer;
  font-size: 0.7rem; padding: 0 3px; opacity: 0.5; transition: opacity 0.15s;
}
.mod-btn:hover { opacity: 1; }
.pinned-msg {
  background: rgba(250, 204, 21, 0.08); border: 1px solid var(--gold); border-radius: var(--radius);
  padding: 8px 10px; margin-bottom: 8px; font-family: var(--font-vt);
}
.pinned-msg-head {
  display: flex; align-items: center; gap: 6px; font-size: 0.85rem;
  color: var(--gold); opacity: 0.85; margin-bottom: 4px;
}
.pinned-msg-head .pin-icon { font-size: 0.9rem; }
.pinned-msg-head .pinned-by { font-weight: bold; }
.pinned-msg-head .pinned-time { margin-left: auto; opacity: 0.7; font-size: 0.8rem; }
.pinned-msg-content { font-size: 1.15rem; color: var(--text); }
.chat-input-area {
  padding: 10px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px;
  background: var(--surface2); flex-shrink: 0;
}
.chat-input-wrap { position: relative; flex: 1; display: flex; align-items: center; min-width: 0; }
.chat-input-wrap input {
  width: 100%; padding: 11px 54px 11px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--text); font-family: var(--font-vt); font-size: 1.2rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-input-wrap input:focus { border-color: var(--purple); box-shadow: 0 0 8px rgba(124,58,237,0.35); }
.chat-input-wrap input::placeholder { color: var(--text-dim); }
.chat-input-wrap input:disabled { opacity: 0.5; }
.chat-input-wrap .emote-toggle-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 3px 4px; border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
}
.chat-input-wrap .emote-toggle-btn:hover { background: rgba(124,58,237,0.15); }
.sevenTv-badge {
  font-family: var(--font-pixel); font-size: 0.55rem; letter-spacing: 0.04em;
  color: var(--purple-bright); border: 1px solid var(--purple-bright);
  border-radius: 3px; padding: 3px 4px; line-height: 1;
  background: rgba(124,58,237,0.12);
}
.emote-toggle-btn:hover .sevenTv-badge { background: rgba(124,58,237,0.25); }
.chat-input-area .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.send-btn-round {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--purple); color: #fff; font-size: 1rem; padding: 0;
  box-shadow: 0 0 10px rgba(124,58,237,0.45);
}
.send-btn-round:hover { background: var(--purple-glow); box-shadow: 0 0 16px rgba(147,51,234,0.65); }
.send-btn-round:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.emote { height: 1.4em; vertical-align: middle; display: inline; }
.kick-login-btn {
  display: flex; align-items: center; gap: 10px; padding: 12px 24px;
  background: var(--purple); border: 1px solid var(--purple-light); border-radius: var(--radius);
  color: #fff; font-family: var(--font-pixel); font-size: 0.6rem; letter-spacing: 0.05em;
  box-shadow: 0 0 20px rgba(124,58,237,0.5); transition: all 0.2s; cursor: pointer;
  width: 100%; justify-content: center;
}
.kick-login-btn:hover { background: var(--neon-dim); border-color: var(--neon); box-shadow: 0 0 30px rgba(232,121,249,0.5); }
.logout-link { font-family: var(--font-vt); font-size: 1rem; color: var(--text-dim); cursor: pointer; text-decoration: underline; border: none; background: none; }
.logout-link:hover { color: var(--danger); }
@media (max-width: 700px) {
  :root { --chat-w: 100%; --header-h: 48px; }
  html, body { overflow: hidden; }
  .room-body { flex-direction: column; }
  .player-area { height: 220px; flex: none; width: 100%; }
  .chat-panel { flex: 1; width: 100%; border-left: none; border-top: 1px solid var(--border); }
  .room-header { padding: 0 10px; gap: 6px; }
  .btn { font-size: 0.48rem; padding: 8px 10px; }
  .btn-sm { padding: 6px 9px; font-size: 0.42rem; }
  .home-card { padding: 20px 16px; }
  .home-logo h1 { font-size: clamp(0.6rem, 4vw, 0.9rem); }
  .join-row { flex-direction: column; }
  .join-row .btn { width: 100%; }
}
.session-screen {
  height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; text-align: center; padding: 20px;
  background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(124,58,237,0.2), transparent), var(--bg);
}
.session-screen .ss-icon { font-size: 3rem; filter: drop-shadow(0 0 12px var(--green)); }
.session-screen .ss-title { font-family: var(--font-pixel); font-size: 0.7rem; color: var(--green); line-height: 2; }
.session-screen .ss-sub { font-family: var(--font-vt); font-size: 1.1rem; color: var(--text-dim); }
.pixel-bar { width: 200px; height: 8px; background: var(--border); border-radius: 2px; overflow: hidden; }
.pixel-bar-fill { height: 100%; background: linear-gradient(90deg, var(--purple), var(--neon)); border-radius: 2px; animation: load-bar 1.5s ease-in-out infinite; }
@keyframes load-bar { 0%{width:0%} 50%{width:70%} 100%{width:100%} }
.chat-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; flex: 1; padding: 20px; text-align: center; }
.chat-empty .ce-icon { font-size: 2rem; opacity: 0.4; }
.chat-empty .ce-text { font-family: var(--font-pixel); font-size: 0.5rem; color: var(--text-dim); line-height: 2.2; }
.volume-control {
  position: absolute; bottom: 10px; left: 10px; display: flex; align-items: center; gap: 8px;
  background: rgba(8,8,16,0.75); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 10px; backdrop-filter: blur(4px); z-index: 5; opacity: 0; transition: opacity 0.2s;
}
.player-area:hover .volume-control, .volume-control:focus-within { opacity: 1; }
.volume-control .vol-icon { font-size: 1rem; cursor: pointer; user-select: none; background: none; border: none; line-height: 1; padding: 0; }
.volume-control input[type="range"] {
  width: 90px; height: 4px; -webkit-appearance: none; appearance: none;
  background: var(--border); border-radius: 2px; outline: none; cursor: pointer;
}
.volume-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--purple-bright); box-shadow: 0 0 6px var(--purple); cursor: pointer;
}
.volume-control input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; border: none;
  background: var(--purple-bright); box-shadow: 0 0 6px var(--purple); cursor: pointer;
}
@media (max-width: 700px) {
  .volume-control { opacity: 1; bottom: 6px; left: 6px; padding: 5px 8px; }
  .volume-control input[type="range"] { width: 60px; }
}
.chat-input-area { position: relative; }
.emote-panel {
  position: fixed; max-height: 240px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
  display: none; flex-direction: column; padding: 10px; gap: 8px; z-index: 9999;
}
.emote-panel.open { display: flex; }
.emote-search {
  padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg2); color: var(--text); font-family: var(--font-vt); font-size: 1.05rem;
}
.emote-search:focus { border-color: var(--purple); outline: none; }
.emote-grid {
  display: grid; grid-template-columns: repeat(auto-fill, 36px); gap: 6px;
  overflow-y: auto; max-height: 180px; padding-right: 2px;
}
.emote-item {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: var(--bg2); border: 1px solid transparent; border-radius: var(--radius);
  padding: 4px; transition: border-color 0.15s, background 0.15s;
}
.emote-item:hover { border-color: var(--purple); background: var(--surface); }
.emote-item img { max-width: 100%; max-height: 100%; object-fit: contain; }
.emote-panel-empty { font-family: var(--font-vt); color: var(--text-dim); font-size: 1rem; text-align: center; padding: 12px; }
.color-picker-btn {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; flex-shrink: 0; transition: border-color 0.15s;
}
.color-picker-btn:hover { border-color: var(--purple); }
.color-picker {
  display: none; flex-wrap: wrap; gap: 6px; padding: 8px 14px;
  background: var(--surface2); border-bottom: 1px solid var(--border);
}
.color-picker.open { display: flex; }
.color-swatch {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border);
  padding: 0; transition: transform 0.12s, border-color 0.12s;
}
.color-swatch:hover { transform: scale(1.15); border-color: var(--text); }
.color-swatch--reset {
  background: var(--bg2); color: var(--text-dim); font-size: 0.7rem;
  display: flex; align-items: center; justify-content: center;
}
.admin-panel {
  background: var(--surface); border: 1px solid var(--gold); border-radius: var(--radius-lg);
  padding: 12px; margin: 8px; display: none;
}
.admin-panel.open { display: block; }
.admin-panel h3 { font-family: var(--font-pixel); font-size: 0.55rem; color: var(--gold); margin-bottom: 8px; }
.admin-panel .request-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px; background: var(--bg2); border-radius: var(--radius); margin-bottom: 4px;
  font-family: var(--font-vt); font-size: 1rem;
}
.admin-panel .request-item button { padding: 4px 10px; font-size: 0.45rem; }