:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-strong: #e8edf2;
  --text: #17202a;
  --muted: #5c6875;
  --line: #cfd8e3;
  --accent: #0b6bcb;
  --accent-strong: #084d92;
  --ok: #176c3a;
  --warn: #9a5b00;
  --danger: #a82a2a;
  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: var(--bg);
  color: var(--text);
}

button,
select,
input {
  font: inherit;
}

button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary,
.quality-buttons button {
  background: white;
  color: var(--accent);
}

.quality-buttons button.active {
  background: var(--accent);
  color: white;
}

select,
input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
}

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

.player-column,
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.video-frame {
  background: #0c1117;
  border: 1px solid #111827;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

video {
  display: block;
  width: 100%;
  height: 100%;
  background: #0c1117;
}

.toolbar,
.quality-panel,
.status-card,
.info-grid,
.premium-panel,
.request-log {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field span,
dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.custom-url input {
  width: 100%;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
}

.status,
.muted {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.status.ok {
  color: var(--ok);
}

.status.warn {
  color: var(--warn);
}

.status.error {
  color: var(--danger);
}

.quality-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quality-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quality-buttons button {
  min-width: 104px;
}

.info-grid dl {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 12px 0 0;
}

.info-grid dl div {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 10px;
  align-items: baseline;
  border-top: 1px solid var(--panel-strong);
  padding-top: 10px;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.premium-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  margin-top: 12px;
}

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

.section-head button {
  min-height: 32px;
  padding: 0 10px;
}

.request-log {
  min-height: 220px;
  max-height: calc(100vh - 430px);
  overflow: auto;
}

.request-log ol {
  margin: 12px 0 0;
  padding-left: 20px;
}

.request-log li {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.app-footer {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    height: auto;
    min-height: 100vh;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .request-log {
    max-height: none;
  }
}
