* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body, html {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 15%, #121526 0%, #090a12 50%, #030305 100%);
  color: #ffffff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  user-select: none;
}

#bubbleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: auto;
}

.back-button {
  position: fixed;
  top: calc(1.5rem + env(safe-area-inset-top, 0px));
  left: calc(1.5rem + env(safe-area-inset-left, 0px));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #e0e0e0;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  background: rgba(18, 20, 32, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.65rem 1.25rem;
  border-radius: 50px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: all 0.25s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.back-button:hover, .back-button:active {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateX(-3px);
}

.yt-page-wrapper {
  position: relative;
  z-index: 2;
  width: 100vw;
  height: 100%;
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  pointer-events: none;
}

.yt-card-container {
  width: 100%;
  max-width: 780px;
  pointer-events: auto;
}

.yt-card {
  display: flex;
  flex-direction: column;
  background: rgba(18, 20, 32, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 1.25rem;
  text-decoration: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.yt-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 51, 75, 0.5);
  box-shadow: 0 15px 45px rgba(255, 51, 75, 0.25);
}

.yt-thumbnail-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

.yt-thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.yt-play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.3s ease;
}

.yt-play-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #ff0033;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 25px rgba(255, 0, 51, 0.6);
  transition: transform 0.3s ease;
}

.yt-play-btn svg {
  width: 26px;
  height: 26px;
  color: #ffffff;
  margin-left: 3px;
}

.yt-live-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.75);
  color: #ff334b;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid rgba(255, 51, 75, 0.3);
}

.yt-card-info {
  margin-top: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.yt-meta-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.2rem;
}

.sub-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 51, 75, 0.12);
  border: 1px solid rgba(255, 51, 75, 0.35);
  color: #ff4a5f;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  border-radius: 50px;
}

.sub-dot {
  width: 6px;
  height: 6px;
  background: #ff334b;
  border-radius: 50%;
  box-shadow: 0 0 8px #ff334b;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.yt-card-title {
  font-size: clamp(1.05rem, 3.5vw, 1.45rem);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
}

.yt-card-subtitle {
  font-size: 0.88rem;
  color: #8f94a6;
}

@media (max-width: 600px) {
  .back-button {
    top: calc(1rem + env(safe-area-inset-top, 0px));
    left: calc(1rem + env(safe-area-inset-left, 0px));
    padding: 0.5rem 0.95rem;
    font-size: 0.85rem;
  }
  .yt-card {
    padding: 0.85rem;
    border-radius: 16px;
  }
  .yt-play-btn {
    width: 50px;
    height: 50px;
  }
  .yt-play-btn svg {
    width: 20px;
    height: 20px;
  }
}

html, body {
  min-height: 100%;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  background: #111412;
  color: #f0f1e8;
  font-family: 'Space Grotesk', sans-serif;
  user-select: auto;
}

body {
  min-height: 100vh;
  background-image: radial-gradient(ellipse at 15% 5%, rgba(173, 71, 37, 0.18), transparent 35%), linear-gradient(135deg, #191d19, #0e1110 65%);
}

.back-button {
  position: absolute;
  top: 1.25rem;
  left: 1.5rem;
  color: #d4d8cb;
  background: #202521;
  border: 1px solid #39413a;
  border-radius: 3px;
  padding: 0.55rem 0.8rem;
  box-shadow: none;
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
}

.back-button:hover, .back-button:active { transform: translateX(-2px); }

.page-shell {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 5.4rem 0 3rem;
}

.page-heading {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 2rem;
  margin: 0 auto 1.8rem;
  max-width: 1180px;
  text-align: center;
  animation: enter-up 500ms ease both;
}

.eyebrow, .channel-link, .archive-count, .archive-channel-link, .keyboard-hint,
.tv-topline, .tv-brandline, .tuning-readout, .now-playing > a {
  font-family: 'DM Mono', monospace;
  letter-spacing: 0;
}

.eyebrow {
  color: #e0784d;
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.4;
}

.page-heading h1 {
  margin-top: 0.35rem;
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  line-height: 1.08;
  font-weight: 600;
}

.channel-link, .archive-channel-link, .now-playing > a {
  color: #f0b05c;
  font-size: 0.69rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.channel-link:hover, .archive-channel-link:hover, .now-playing > a:hover { color: #fff1c7; }

.studio-layout {
  display: block;
  width: min(96vw, calc(90vw + 4rem), calc(90vh * 16 / 9 + 4rem));
  margin: 0 auto;
}

.tv-column { width: 100%; min-width: 0; animation: enter-up 650ms 70ms ease both; }

.tv-set {
  position: relative;
  isolation: isolate;
  width: 100%;
  padding: 1rem 1.15rem 0.8rem;
  background: linear-gradient(145deg, #333a32, #222823 58%, #191e1b);
  border: 1px solid #4c5549;
  border-radius: 18px 18px 12px 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42), inset 0 1px rgba(255,255,255,0.08);
}

.tv-set.is-model-loading { background: transparent; border-color: transparent; box-shadow: none; }
.tv-set.has-3d-model { background: transparent; border-color: transparent; box-shadow: none; }

.tv-model-canvas {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 24px 26px rgba(0, 0, 0, 0.48));
}

.tv-set > :not(.tv-model-canvas) { position: relative; z-index: 1; }

.tv-topline, .tv-brandline {
  min-height: 1.7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #c1c8b9;
  font-size: 0.65rem;
  font-weight: 500;
}

.power-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.35rem;
  border: 1px solid transparent;
  color: #8e9889;
  background: transparent;
  font: 500 0.65rem 'DM Mono', monospace;
  cursor: pointer;
}

.power-toggle:hover { border-color: #606a5c; color: #f0f1e8; }
.power-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.power-toggle::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #656c61; }
.tv-set.is-powered .power-toggle { color: #f0b05c; }
.tv-set.is-powered .power-toggle::before { background: #f08b51; box-shadow: 0 0 10px #ec7147; }
.power-toggle:focus-visible { outline: 2px solid #f0b05c; outline-offset: 2px; }

.screen-frame {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 0.7rem;
  background: #111512;
  border: 1px solid #121713;
  border-radius: 15px;
  box-shadow: inset 0 3px 14px rgba(0,0,0,0.8), 0 1px rgba(255,255,255,0.08);
}

.has-3d-model .screen-frame { width: 76%; }

.tv-screen {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  flex: 0 1 100%;
  aspect-ratio: 16 / 9;
  margin-inline: auto;
  isolation: isolate;
  border-radius: 10% / 12%;
  background: radial-gradient(ellipse, #18231d, #080b09 74%);
  box-shadow: inset 0 0 35px rgba(0,0,0,0.82), 0 0 20px rgba(127, 203, 131, 0.1);
  transition: box-shadow 250ms ease, filter 250ms ease;
}

.tv-screen:not(.is-powered) { background: #050705; box-shadow: inset 0 0 45px rgba(0,0,0,0.95); }
.tv-screen:not(.is-powered) canvas { opacity: 0; }
.tv-screen:not(.is-powered) .scanlines { opacity: 0.16; }
.tv-screen[data-filter="mono"] { filter: grayscale(1); }
.tv-screen[data-filter="amber"] { filter: sepia(0.85) saturate(1.8) hue-rotate(345deg); }
.tv-screen[data-filter="green"] { filter: sepia(1) saturate(1.8) hue-rotate(65deg); }

.tv-screen iframe, .tv-screen canvas, .scanlines, .switch-flash, .screen-message {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.tv-screen iframe { z-index: 1; border: 0; }
.tv-screen canvas { z-index: 2; pointer-events: none; opacity: 0.13; mix-blend-mode: screen; }

.scanlines {
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0.22) 0, rgba(0,0,0,0.22) 1px, transparent 1px, transparent 4px);
  box-shadow: inset 0 0 40px rgba(0,0,0,0.55);
}

.switch-flash { z-index: 4; opacity: 0; pointer-events: none; background: #d9ffd4; }
.tv-screen.is-switching .switch-flash { animation: channel-flash 340ms steps(4, end); }

.screen-message {
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  color: #b9efb1;
  background: #080b09;
  font: 500 clamp(0.85rem, 2vw, 1.3rem) 'DM Mono', monospace;
  text-shadow: 0 0 15px #78e276;
}

.screen-message span { color: #788d76; font-size: 0.62rem; text-shadow: none; }
.screen-message.is-visible { display: flex; }

.tv-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.25rem 0.15rem;
}

.tuning-controls { display: flex; align-items: center; gap: 0.75rem; }
.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #606a5c;
  border-radius: 50%;
  color: #e8e9de;
  background: #252b26;
  font: 400 1.7rem/1 'Space Grotesk', sans-serif;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.icon-button:hover { transform: scale(1.06); border-color: #e0784d; background: #343b34; }
.icon-button:focus-visible, .color-button:focus-visible, .video-select:focus-visible, a:focus-visible { outline: 2px solid #f0b05c; outline-offset: 3px; }

.tuning-readout { min-width: 6rem; display: flex; flex-direction: column; gap: 0.15rem; }
#channel-number { color: #f0b05c; font-size: 0.69rem; }
#video-date { color: #929a8c; font-size: 0.58rem; }

.color-controls { display: flex; gap: 0.38rem; }
.color-button {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid #50594e;
  border-radius: 50%;
  background: #1a201b;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}

.color-button:hover { transform: translateY(-2px); }
.color-button.is-active { border-color: #f0b05c; box-shadow: 0 0 0 2px rgba(240,176,92,0.13); }
.color-dot { width: 13px; height: 13px; border-radius: 50%; }
.color-dot-rgb { background: conic-gradient(#f56758, #edcf5e, #78cf7b, #6ab6e8, #bd82e2, #f56758); }
.color-dot-mono { background: linear-gradient(135deg, #f2f2f2, #555); }
.color-dot-amber { background: #f2a64e; }
.color-dot-green { background: #83d578; }
.tv-brandline { padding: 0.45rem 0.25rem 0; color: #879083; font-size: 0.57rem; }

.now-playing { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: 1.3rem 0.3rem 0; }
.now-playing h2 { max-width: 650px; margin-top: 0.3rem; font-size: clamp(1.05rem, 2.1vw, 1.45rem); line-height: 1.25; font-weight: 500; }
.now-playing > a { padding-bottom: 0.2rem; }
.keyboard-hint { margin: 1.1rem 0 0 0.3rem; color: #788176; font-size: 0.62rem; }
.keyboard-hint span { color: #db7950; padding: 0 0.25rem; }

.archive-panel {
  min-width: 0;
  width: min(90vw, 1100px);
  margin: 2rem auto 0;
  padding: 1.2rem 1.2rem 1rem;
  background: rgba(31, 37, 32, 0.72);
  border: 1px solid #394239;
  border-radius: 5px;
  animation: enter-up 650ms 150ms ease both;
}

.archive-heading { display: flex; align-items: end; justify-content: space-between; gap: 0.8rem; padding-bottom: 0.9rem; border-bottom: 1px solid #394239; }
.archive-heading h2 { margin-top: 0.2rem; font-size: 1.2rem; font-weight: 500; }
.archive-count { color: #a5ad9d; font-size: 0.67rem; }
.archive-status { min-height: 2.2rem; padding: 0.7rem 0 0.35rem; color: #a6ad9f; font-size: 0.77rem; line-height: 1.4; }

.video-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: min(58vh, 570px);
  overflow-y: auto;
  list-style: none;
  padding: 0.35rem 0.25rem 0.9rem 0;
  scrollbar-color: #626e5f #202620;
  scrollbar-width: thin;
}

.video-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.5rem; padding: 0.55rem 0.6rem; border-left: 2px solid transparent; background: rgba(9, 13, 10, 0.25); }
.video-row.is-active { border-left-color: #e0784d; background: rgba(224,120,77,0.1); }
.video-select { min-width: 0; padding: 0; border: 0; color: #e8e9df; background: transparent; text-align: left; cursor: pointer; }
.video-select:hover .video-name { color: #f0b05c; }
.video-index { display: block; margin-bottom: 0.16rem; color: #8d9988; font: 0.58rem 'DM Mono', monospace; }
.video-name { display: -webkit-box; overflow: hidden; color: #e0e3d9; font-size: 0.8rem; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.video-open { display: grid; place-items: center; width: 30px; height: 30px; color: #f0b05c; text-decoration: none; font-size: 1rem; }
.video-open:hover { color: #fff1c7; }
.archive-channel-link { display: inline-block; padding-top: 0.75rem; border-top: 1px solid #394239; }

@keyframes enter-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes channel-flash { 0% { opacity: 0.95; } 22% { opacity: 0.08; } 46% { opacity: 0.75; } 72% { opacity: 0.03; } 100% { opacity: 0; } }

@media (max-width: 820px) {
  .page-shell { padding: 5rem 0 2.5rem; }
  .studio-layout { width: 100%; }
  .archive-panel { width: min(90vw, 1100px); }
  .video-list { max-height: 380px; }
}

@media (max-width: 520px) {
  .back-button { top: 0.8rem; left: 0.8rem; }
  .page-shell { padding: 4.4rem 0 2rem; }
  .page-heading { align-items: center; flex-direction: column; gap: 0.8rem; margin-bottom: 1.1rem; }
  .tv-set { padding: 0.5rem 0.35rem 0.45rem; border-radius: 12px 12px 8px 8px; }
  .screen-frame, .tv-set.has-3d-model .screen-frame { width: 100%; padding: 0.2rem; }
  .tv-controls { gap: 0.4rem; }
  .tuning-controls { gap: 0.45rem; }
  .icon-button { width: 32px; height: 32px; }
  .tuning-readout { min-width: 4.8rem; }
  .color-controls { gap: 0.22rem; }
  .color-button { width: 28px; height: 28px; }
  .now-playing { align-items: start; flex-direction: column; gap: 0.65rem; }
  .archive-panel { padding: 1rem 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}