:root {
  color-scheme: dark;
  --bg: #07152b;
  --card: #f7fbff;
  --card-soft: #dfeaf7;
  --ink: #0b1830;
  --white: #ffffff;
  --muted: #b9c7da;
  --green: #3ee08f;
  --green-dark: #087343;
  --red: #db4b4b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(62, 224, 143, .22), transparent 30%),
    linear-gradient(155deg, #07152b 0%, #0c2141 52%, #081226 100%);
  color: var(--white);
  font-size: 22px;
  line-height: 1.25;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-shell {
  width: min(100%, 860px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.kicker {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .08em;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 8vw, 58px);
  line-height: .95;
  letter-spacing: 0;
}

.admin-link {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 12px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

.last-channel {
  margin: 0 0 16px;
  padding: 14px;
  border: 2px solid rgba(62, 224, 143, .5);
  border-radius: 22px;
  background: rgba(6, 17, 35, .72);
}

.last-channel p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .08em;
}

.last-channel div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.last-channel strong {
  font-size: 26px;
}

.last-channel button,
.primary-action {
  min-height: 62px;
  padding: 0 22px;
  border: 0;
  border-radius: 18px;
  background: var(--green);
  color: #051f13;
  font-size: 23px;
  font-weight: 950;
}

.channels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.channel-card {
  min-height: 214px;
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 10px;
  border: 0;
  border-radius: 24px;
  background: var(--card);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
}

.channel-card:active {
  transform: scale(.985);
}

.logo-mark {
  width: 100%;
  min-height: 82px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(145deg, #123d77, #0a1e3c);
  color: white;
  font-size: 34px;
  font-weight: 1000;
  letter-spacing: .03em;
}

.channel-name {
  font-size: clamp(26px, 6.2vw, 32px);
  line-height: 1;
  font-weight: 950;
}

.channel-description {
  color: #40506b;
  font-size: 22px;
  font-weight: 760;
}

.tv-controls {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 24px;
  background: rgba(6, 17, 35, .66);
}

.tv-controls h2 {
  margin: 0 0 4px;
  font-size: 28px;
}

.tv-controls p {
  margin: 0 0 12px;
  color: var(--muted);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.control-grid button {
  min-height: 72px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, .16);
  color: rgba(255, 255, 255, .72);
  font-weight: 950;
}

.dialog {
  position: fixed;
  inset: 0;
  z-index: 10;
  padding: 22px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .62);
}

.dialog[hidden] { display: none; }

.dialog-card {
  width: min(100%, 620px);
  padding: 24px;
  border-radius: 28px;
  background: white;
  color: var(--ink);
  box-shadow: 0 26px 80px rgba(0, 0, 0, .45);
}

.dialog-card h2 {
  margin: 0 0 10px;
  font-size: 34px;
}

.dialog-card p:not(.kicker) {
  margin: 0 0 18px;
  font-size: 23px;
  color: #374861;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dialog-actions button {
  min-height: 62px;
  border: 0;
  border-radius: 18px;
  background: var(--card-soft);
  color: var(--ink);
  font-size: 23px;
  font-weight: 950;
}

.primary-action {
  display: grid;
  place-items: center;
  text-align: center;
}

@media (max-width: 460px) {
  .app-shell { padding-left: 12px; padding-right: 12px; }
  .channels { gap: 10px; }
  .channel-card { min-height: 198px; padding: 12px; border-radius: 20px; }
  .logo-mark { min-height: 72px; font-size: 28px; }
  .channel-description { font-size: 20px; }
  .last-channel div { grid-template-columns: 1fr; }
  .dialog-actions { grid-template-columns: 1fr; }
}
