:root {
  color-scheme: dark;
  font-family: 'Manrope', 'Microsoft YaHei', sans-serif;
  --ink: #e9eee9;
  --muted: #8d9991;
  --line: #2a332e;
  --panel: #151c18;
  --field: #101612;
  --lime: #c4f267;
  --orange: #f47e54;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: #101513;
  background-image: linear-gradient(90deg, transparent 49.95%, #ffffff05 50%, transparent 50.05%), radial-gradient(ellipse at 18% 0%, #243229 0, transparent 38%);
}

button, input { font: inherit; }
button { color: inherit; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5.2vw, 84px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  width: 21px;
  height: 21px;
  position: relative;
  display: inline-block;
  border: 1px solid var(--lime);
  transform: rotate(45deg);
}

.brand-mark::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  top: 6px;
  left: 6px;
  background: var(--lime);
}

.brand-light { color: var(--lime); }
.topbar-note, .eyebrow, .settings-index, .meta-label, .page-footer, .latency-tag, .player-live { font-family: 'DM Mono', monospace; }

.topbar-note {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #aab5ad;
  font-size: 10px;
  letter-spacing: 0;
}

.signal-dot, .latency-tag span, .player-live span {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: var(--lime);
}

.layout {
  width: min(1320px, calc(100% - 48px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 315px;
  gap: clamp(32px, 5vw, 74px);
  margin: 58px auto 72px;
  animation: arrive 520ms ease-out both;
}

.section-heading, .settings-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--lime);
  font-size: 9px;
  letter-spacing: 1.3px;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(25px, 3vw, 34px); line-height: 1.2; }
h2 { margin-bottom: 0; font-size: 19px; line-height: 1.3; }

.latency-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid #39483e;
  color: #c4d2c8;
  font-size: 9px;
}

.latency-tag span { width: 6px; height: 6px; }

.player-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid #344039;
  background: #080b09;
  box-shadow: 0 22px 65px #0005;
}

.player-shell::before, .player-shell::after {
  content: '';
  position: absolute;
  z-index: 1;
  width: 13px;
  height: 13px;
  pointer-events: none;
}

.player-shell::before { top: 10px; left: 10px; border-top: 1px solid var(--lime); border-left: 1px solid var(--lime); }
.player-shell::after { right: 10px; bottom: 10px; border-right: 1px solid var(--lime); border-bottom: 1px solid var(--lime); }

.player-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  background-image: linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px);
  background-size: 36px 36px;
}

.placeholder-symbol {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid #51634f;
  background: #172019;
}

.placeholder-symbol span {
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 10px solid var(--lime);
}

.placeholder-title { margin-bottom: 6px; font-size: 15px; font-weight: 700; }
.placeholder-copy { max-width: 350px; margin-bottom: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }

#remote-video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #080b09; object-fit: contain; }

.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); background: #101612; }
.mode-button { min-height: 34px; border: 0; color: #8d9991; background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.mode-button.is-selected { color: #11170e; background: var(--lime); }
.mode-description { margin: 15px 0 14px; color: #9ba79e; font-size: 11px; line-height: 1.65; }
.mode-panel { margin-top: 16px; }
.mode-panel label { display: block; margin-bottom: 9px; color: #d3dbd5; font-size: 11px; font-weight: 600; }
.mode-panel .primary-button { width: 100%; }
.mode-panel .text-button { width: 100%; margin-top: 4px; }

.player-live {
  position: absolute;
  top: 16px;
  left: 17px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  background: #121915e8;
  color: white;
  font-size: 9px;
}

.player-live span { background: var(--orange); animation: pulse 1.6s ease-out infinite; }

.stream-meta {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.meta-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 9px; }
.stream-title-block strong { display: block; font-size: 13px; font-weight: 600; }
.stream-hint { margin: 0; color: var(--muted); font-size: 11px; text-align: right; }

.settings-column {
  align-self: start;
  padding: 24px 22px 20px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #1a231d, var(--panel) 54%);
}

.settings-heading { align-items: center; margin-bottom: 29px; }
.settings-index { color: #6f7a72; font-size: 9px; }

.settings-form { display: flex; flex-direction: column; }
.settings-form label { margin-bottom: 9px; color: #d3dbd5; font-size: 11px; font-weight: 600; }
.settings-form label:not(:first-child) { margin-top: 20px; }

.input-with-prefix {
  min-width: 0;
  height: 42px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #354139;
  background: var(--field);
  color: #7e8a81;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
}

.input-with-prefix > span:first-child { padding-left: 10px; }
.input-suffix { padding-right: 9px; white-space: nowrap; }
.input-with-prefix input { min-width: 0; width: 100%; height: 100%; padding: 0 2px; border: 0; outline: 0; color: var(--ink); background: transparent; font-family: inherit; font-size: 11px; }
.input-with-prefix:focus-within, .text-input:focus { border-color: var(--lime); }
.input-with-prefix input::placeholder, .text-input::placeholder { color: #59645d; }

.text-input {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  border: 1px solid #354139;
  outline: 0;
  color: var(--ink);
  background: var(--field);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
}

.form-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 23px; }
.primary-button { min-height: 43px; border: 0; color: #10150e; background: var(--lime); font-size: 12px; font-weight: 800; cursor: pointer; transition: background 140ms ease, transform 140ms ease; }
.primary-button:hover { background: #d2ff7b; transform: translateY(-1px); }
.text-button { min-height: 36px; border: 1px solid transparent; color: #b7c1ba; background: transparent; font-size: 11px; cursor: pointer; }
.text-button:hover:not(:disabled) { color: var(--lime); }
.text-button:disabled { color: #606b63; cursor: not-allowed; }
.form-feedback { min-height: 17px; margin: 8px 0 0; color: var(--lime); font-size: 10px; line-height: 1.6; }
.form-feedback[data-state='error'] { color: #ff9a79; }

.setup-divider { height: 1px; margin: 5px 0 16px; background: var(--line); }
.setup-footnote { display: grid; grid-template-columns: 17px 1fr; gap: 9px; align-items: start; }
.footnote-mark { width: 15px; height: 15px; border: 1px solid #718071; border-radius: 50%; color: #aab6ab; font: 10px/13px 'DM Mono', monospace; text-align: center; }
.setup-footnote p { margin: 0; color: #859188; font-size: 10px; line-height: 1.7; }

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(20px, 5.2vw, 84px);
  border-top: 1px solid var(--line);
  color: #68746c;
  font-size: 8px;
}

@keyframes arrive { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #f47e5488; } 100% { box-shadow: 0 0 0 7px #f47e5400; } }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr) 280px; gap: 25px; }
  .settings-column { padding: 20px 17px; }
  .input-suffix { display: none; }
}

@media (max-width: 700px) {
  .topbar { height: 62px; padding-inline: 18px; }
  .topbar-note { font-size: 8px; }
  .layout { width: calc(100% - 36px); grid-template-columns: 1fr; gap: 30px; margin: 34px auto 46px; }
  .section-heading { margin-bottom: 15px; }
  .player-placeholder { background-size: 25px 25px; }
  .placeholder-symbol { width: 45px; height: 45px; margin-bottom: 12px; }
  .placeholder-title { font-size: 13px; }
  .placeholder-copy { max-width: 270px; font-size: 10px; }
  .stream-meta { min-height: 67px; }
  .stream-hint { max-width: 45%; font-size: 10px; }
  .settings-column { padding: 21px 19px 17px; }
  .input-suffix { display: inline; }
  .page-footer { padding-inline: 18px; font-size: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}