:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(103, 58, 183, 0.16), transparent 28rem),
    #0b0b0f;
  color: #f7f7fb;
}

button, input, textarea { font: inherit; }

.topbar {
  height: 68px;
  padding: 0 24px;
  background: rgba(18, 18, 24, 0.94);
  border-bottom: 1px solid #262630;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: .05em;
}

.brand-dot {
  width: 11px;
  height: 11px;
  background: #ff334e;
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(255, 51, 78, .9);
}

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

.viewer-counter {
  color: #c8c8d3;
  font-size: 14px;
}

.ghost-btn, .text-btn {
  border: 0;
  cursor: pointer;
  color: #ddddea;
}

.ghost-btn {
  background: #23232d;
  border: 1px solid #343442;
  padding: 9px 12px;
  border-radius: 9px;
}

.text-btn {
  background: transparent;
  color: #a8a8b8;
}

.layout {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.content { min-width: 0; }

.player-shell {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #24242d;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}

.player-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.offline-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  background: radial-gradient(circle, #1a1a22, #09090c);
}

.offline-overlay h2 { margin: 10px 0 6px; }

.offline-overlay p {
  margin: 0;
  color: #9b9baa;
}

.offline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #565663;
  margin: 0 auto;
}

.stream-heading {
  margin-top: 18px;
  padding: 4px 4px 10px;
}

.live-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-row h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 32px);
}

.live-badge {
  font-size: 12px;
  font-weight: 800;
  background: #e91935;
  padding: 6px 8px;
  border-radius: 6px;
}

.stream-heading p {
  margin: 8px 0 0;
  color: #a6a6b5;
}

.chat-panel {
  height: calc(100vh - 116px);
  min-height: 520px;
  background: #141419;
  border: 1px solid #25252f;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.chat-header {
  padding: 16px;
  border-bottom: 1px solid #25252f;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-header span {
  color: #888897;
  font-size: 12px;
}

.chat-messages {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.message {
  line-height: 1.35;
  word-break: break-word;
}

.message .nick {
  font-weight: 800;
  margin-right: 6px;
}

.message .time {
  color: #6f6f7d;
  font-size: 10px;
  margin-left: 6px;
}

.chat-form {
  padding: 12px;
  border-top: 1px solid #25252f;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input, textarea {
  width: 100%;
  border: 1px solid #30303b;
  background: #0e0e13;
  color: white;
  border-radius: 9px;
  padding: 11px 12px;
  outline: none;
}

input:focus, textarea:focus {
  border-color: #6f58ff;
  box-shadow: 0 0 0 3px rgba(111,88,255,.13);
}

.chat-form button, .primary-btn {
  border: 0;
  background: #6655ff;
  color: white;
  padding: 10px 15px;
  border-radius: 9px;
  font-weight: 700;
  cursor: pointer;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,.72);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  width: min(440px, 100%);
  background: #17171d;
  border: 1px solid #31313c;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  position: relative;
}

.modal-card h2 { margin-top: 0; }

.modal-card p {
  color: #a6a6b5;
}

.modal-card label {
  display: block;
  margin: 16px 0 7px;
  color: #bcbcca;
  font-size: 13px;
}

.modal-close {
  position: absolute;
  right: 13px;
  top: 10px;
  border: 0;
  background: transparent;
  color: #aaaab6;
  font-size: 26px;
  cursor: pointer;
}

.modal-card .primary-btn {
  width: 100%;
  margin-top: 12px;
}

.error-text {
  color: #ff6c7b;
  margin-top: 10px;
  min-height: 20px;
}

.success-text {
  color: #79e096;
  margin-top: 10px;
  min-height: 20px;
}

.hidden { display: none !important; }

@media (max-width: 950px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    height: 560px;
  }
}

@media (max-width: 600px) {
  .topbar { padding: 0 14px; }
  .layout { padding: 12px; }
  .viewer-counter { display: none; }
  .chat-panel { min-height: 460px; }
}
