:root {
  color-scheme: dark;
  --bg: #111316;
  --panel: #1b1f23;
  --panel-soft: #23282e;
  --text: #f5f7fa;
  --muted: #a8b0b8;
  --line: #343b43;
  --accent: #21c187;
  --accent-strong: #16a06e;
  --warning: #ffbf47;
  --danger: #ff6978;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(140deg, rgba(33, 193, 135, 0.12), transparent 35%),
    linear-gradient(320deg, rgba(255, 191, 71, 0.11), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  width: min(1440px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
}

.player-stage,
.side-panel {
  min-width: 0;
}

.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
}

.brand-mark {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #061511;
  font-weight: 900;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(27, 31, 35, 0.78);
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(33, 193, 135, 0.14);
}

.screen {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 320px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(rgba(17, 19, 22, 0.56), rgba(17, 19, 22, 0.72)),
    url("./assets/video-console.png") center / cover no-repeat,
    #080a0c;
  box-shadow: var(--shadow);
}

.screen::after {
  position: absolute;
  inset: auto 0 0;
  height: 92px;
  pointer-events: none;
  content: "";
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.42));
}

.screen-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 28px;
  text-align: center;
}

.screen-placeholder[hidden],
#videoFrame[hidden],
#htmlVideo[hidden] {
  display: none;
}

.play-symbol {
  width: 74px;
  height: 74px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: rgba(33, 193, 135, 0.92);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}

.play-symbol::before {
  display: block;
  width: 0;
  height: 0;
  margin: 23px 0 0 29px;
  border-block: 14px solid transparent;
  border-left: 20px solid #061511;
  content: "";
}

.screen h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(26px, 4vw, 48px);
  line-height: 1.12;
}

.screen p {
  max-width: 560px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

#videoFrame,
#htmlVideo {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 210px 150px;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 31, 35, 0.88);
}

.input-wrap,
.select-wrap,
.route-form {
  display: grid;
  gap: 7px;
}

.input-wrap label,
.select-wrap span,
.route-form label {
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  background: #11161a;
  color: var(--text);
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(33, 193, 135, 0.16);
}

.url-field {
  position: relative;
  min-width: 0;
}

.url-field input {
  width: 100%;
  padding-right: 48px;
}

.clear-url-button {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  transform: translateY(-50%);
}

.clear-url-button:hover,
.clear-url-button:focus-visible {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--text);
}

.clear-url-button[hidden] {
  display: none;
}

.primary-button,
.route-form button {
  min-height: 46px;
  align-self: end;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #051511;
  font-weight: 800;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-button:hover,
.route-form button:hover {
  background: #35d497;
}

.button-icon {
  width: 0;
  height: 0;
  border-block: 7px solid transparent;
  border-left: 11px solid #051511;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.panel-block,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 31, 35, 0.9);
  padding: 16px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-block h2 {
  margin: 0;
  font-size: 18px;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 18px;
}

.route-list,
.history-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.route-item,
.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.route-item.active {
  border-color: rgba(33, 193, 135, 0.72);
  background: rgba(33, 193, 135, 0.1);
}

.item-main {
  min-width: 0;
}

.item-main strong,
.item-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-main span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.small-actions {
  display: inline-flex;
  gap: 6px;
}

.small-actions button {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #14191e;
  color: var(--text);
}

.small-actions button:hover {
  border-color: var(--accent);
}

.small-actions .danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.route-form {
  margin-top: 16px;
}

.compact {
  max-height: 320px;
  overflow: auto;
}

.history-item {
  cursor: pointer;
}

.history-item:hover {
  border-color: var(--accent);
}

.notice {
  color: var(--muted);
  line-height: 1.65;
}

.notice strong {
  color: var(--warning);
}

.notice p {
  margin: 8px 0 0;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notice {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding: 12px 0;
  }

  .brand-bar,
  .control-panel {
    grid-template-columns: 1fr;
  }

  .brand-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .control-panel,
  .side-panel {
    grid-template-columns: 1fr;
  }

  .screen {
    min-height: 260px;
  }

  .screen h1 {
    font-size: 28px;
  }
}
