:root {
  --accent: #d7ff64;
  --tv-gutter-x: clamp(28px, 4vw, 96px);
  --tv-gutter-y: clamp(16px, 2.4vh, 42px);
  color: #f6f7f2;
  background: #070b0d;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  scroll-padding-top: 34px;
  scroll-padding-bottom: 52px;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  overscroll-behavior: none;
  background:
    linear-gradient(180deg, #070b0d 0%, #0b1214 46%, #060809 100%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus,
input:focus {
  outline: none;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 76% 8%, rgb(79 157 141 / 24%), transparent 36%),
    radial-gradient(circle at 18% 36%, rgb(198 243 91 / 9%), transparent 30%);
}

.tv-shell {
  width: min(3400px, 100%);
  margin: 0 auto;
  padding:
    calc(var(--tv-gutter-y) + env(safe-area-inset-top))
    calc(var(--tv-gutter-x) + env(safe-area-inset-right))
    calc(var(--tv-gutter-y) + 30px + env(safe-area-inset-bottom))
    calc(var(--tv-gutter-x) + env(safe-area-inset-left));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: clamp(46px, 5.4vh, 62px);
  margin-bottom: clamp(10px, 1.5vh, 18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: #d7ff64;
  color: #10180d;
  font-size: 14px;
  font-weight: 900;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 17px;
}

.brand-copy small {
  color: #91a09c;
  font-size: 12px;
}

.top-actions,
.hero-actions,
.suggestion-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-action,
.secondary-action,
.round-action,
.player-back {
  min-height: 46px;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 999px;
  background: rgb(16 25 26 / 72%);
  padding: 0 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.hero {
  position: relative;
  height: clamp(310px, 43vh, 620px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 8px;
  background: #111819;
  box-shadow: 0 24px 70px rgb(0 0 0 / 38%);
}

.hero-poster,
.hero-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-poster {
  object-fit: cover;
}

.hero-shade {
  background:
    linear-gradient(90deg, rgb(5 8 9 / 98%) 0%, rgb(5 8 9 / 94%) 44%, rgb(5 8 9 / 68%) 66%, rgb(5 8 9 / 10%) 90%),
    linear-gradient(0deg, rgb(5 8 9 / 70%), transparent 52%);
}

.hero-content {
  position: relative;
  display: flex;
  width: min(760px, 58%);
  min-height: inherit;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 4vh, 76px);
}

.kicker,
.section-kicker {
  margin: 0;
  color: #d7ff64;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
}

.hero h1 {
  margin: clamp(8px, 1.2vh, 12px) 0;
  font-size: clamp(34px, 4.2vw, 76px);
  line-height: .98;
  letter-spacing: 0;
}

.hero-synopsis {
  max-width: 640px;
  margin: 0;
  color: #c7d0cc;
  font-size: clamp(14px, 1.15vw, 19px);
  line-height: 1.62;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: clamp(12px, 1.8vh, 20px) 0 clamp(14px, 2.1vh, 24px);
}

.tag {
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 999px;
  background: rgb(255 255 255 / 7%);
  padding: 7px 12px;
  color: #d7dfdc;
  font-size: 13px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  min-height: clamp(44px, 5.4vh, 54px);
  align-items: center;
  gap: 9px;
  padding: 0 24px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.primary-action {
  border: 0;
  border-radius: 14px;
  background: #d7ff64;
  color: #10180d;
}

.action-icon {
  font-size: 13px;
}

.episode-peek {
  position: absolute;
  right: clamp(24px, 3vw, 54px);
  bottom: clamp(22px, 3.2vh, 40px);
  display: grid;
  min-width: 94px;
  justify-items: end;
  gap: 2px;
  color: #dbe4df;
}

.episode-peek strong {
  font-size: clamp(30px, 2.3vw, 44px);
  line-height: 1;
}

.peek-label,
.episode-peek span:last-child {
  color: #a9b5b0;
  font-size: 12px;
}

.agent-console {
  display: grid;
  grid-template-columns: minmax(220px, .66fr) minmax(340px, 1.34fr);
  gap: clamp(10px, 1.5vh, 18px) clamp(18px, 2vw, 30px);
  align-items: center;
  margin: clamp(12px, 2vh, 28px) 0 clamp(18px, 3vh, 40px);
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 8px;
  background: linear-gradient(135deg, rgb(20 30 30 / 94%), rgb(10 15 16 / 94%));
  padding: clamp(11px, 1.7vh, 24px) clamp(16px, 1.8vw, 28px);
}

.agent-heading {
  display: flex;
  align-items: center;
  gap: 13px;
}

.agent-heading strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}

.agent-heading p {
  margin: 0;
  color: #8e9b97;
  font-size: 13px;
}

.agent-pulse {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #d7ff64;
  box-shadow: 0 0 0 7px rgb(215 255 100 / 12%);
}

.agent-form {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 10px;
}

.agent-form input {
  min-width: 0;
  min-height: clamp(44px, 5.4vh, 56px);
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 13px;
  background: rgb(0 0 0 / 23%);
  padding: 0 17px;
  color: #f8faf7;
}

.agent-form input::placeholder {
  color: #74827e;
}

.send-action {
  min-width: 48px;
  min-height: clamp(44px, 5.4vh, 52px);
  border: 0;
  border-radius: 13px;
  background: #d7ff64;
  color: #11180e;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
}

.suggestion-row {
  grid-column: 2;
  flex-wrap: wrap;
  margin-top: -8px;
}

.suggestion {
  min-height: 38px;
  border: 1px solid rgb(255 255 255 / 11%);
  border-radius: 999px;
  background: transparent;
  padding: 0 14px;
  color: #aeb9b5;
  font-size: 13px;
  cursor: pointer;
}

.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: clamp(12px, 2vh, 26px) 0 6px;
}

.category-pill {
  min-height: clamp(38px, 5vh, 48px);
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 999px;
  background: rgb(13 20 21 / 82%);
  padding: 0 20px;
  color: #aeb9b5;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.category-pill.is-active {
  border-color: rgb(215 255 100 / 58%);
  background: rgb(215 255 100 / 12%);
  color: #d7ff64;
}

.catalog-sections {
  display: grid;
  gap: clamp(20px, 3vh, 34px);
}

.catalog-more {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: clamp(18px, 2.8vh, 32px);
  border-top: 1px solid rgb(255 255 255 / 10%);
  padding-top: clamp(16px, 2.4vh, 26px);
}

.catalog-status {
  margin: 0;
  color: #8d9a95;
  font-size: 14px;
}

.catalog-more .secondary-action {
  min-width: 138px;
  border: 1px solid rgb(215 255 100 / 34%);
  border-radius: 999px;
  background: rgb(215 255 100 / 10%);
  color: #d7ff64;
  cursor: pointer;
}

.catalog-more .secondary-action:disabled {
  border-color: rgb(255 255 255 / 10%);
  background: rgb(255 255 255 / 4%);
  color: #68736f;
  cursor: default;
}

.catalog-shelf {
  min-width: 0;
}

.shelf-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.shelf-heading h2 {
  margin: 7px 0 0;
  font-size: clamp(22px, 2.1vw, 36px);
  letter-spacing: 0;
}

.catalog-count {
  color: #82908b;
  font-size: 13px;
}

.catalog-row {
  display: flex;
  gap: clamp(14px, 1.4vw, 22px);
  overflow-x: auto;
  padding: 10px 4px 20px;
  scrollbar-color: #4f5d58 #0a0f10;
  scroll-snap-type: x proximity;
}

.catalog-row::-webkit-scrollbar {
  display: none;
}

.drama-card {
  position: relative;
  aspect-ratio: 16 / 9;
  width: clamp(220px, min(18vw, 29vh), 420px);
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 8px;
  background: #101718;
  padding: 0;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.drama-card img,
.card-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.drama-card img {
  object-fit: cover;
  transition: transform 220ms ease;
}

.card-shade {
  background: linear-gradient(0deg, rgb(3 6 7 / 94%) 0%, rgb(3 6 7 / 8%) 65%);
}

.card-copy {
  position: absolute;
  inset: auto 18px 17px;
}

.card-copy strong {
  display: block;
  overflow: hidden;
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-copy span {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: #aeb9b5;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-index {
  position: absolute;
  top: 14px;
  left: 14px;
  border-radius: 999px;
  background: rgb(5 9 10 / 78%);
  padding: 6px 9px;
  color: #d7ff64;
  font-size: 11px;
  font-weight: 800;
}

@media (min-width: 2400px) {
  .tv-shell {
    padding-right: clamp(72px, 5vw, 160px);
    padding-left: clamp(72px, 5vw, 160px);
  }

  .drama-card {
    width: clamp(360px, 18vw, 520px);
  }

  .catalog-row {
    gap: 22px;
  }
}

@media (min-width: 700px) and (max-height: 760px) {
  .tv-shell {
    --tv-gutter-y: 14px;
    --tv-gutter-x: clamp(24px, 3.4vw, 50px);
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 13px;
  }

  .brand-copy strong {
    font-size: 16px;
  }

  .topbar {
    min-height: 42px;
    margin-bottom: 10px;
  }

  .nav-action,
  .secondary-action,
  .round-action,
  .player-back {
    min-height: 40px;
    padding: 0 16px;
    font-size: 14px;
  }

  .hero {
    height: clamp(286px, 46vh, 340px);
  }

  .hero-content {
    width: min(680px, 62%);
    padding: 24px 30px;
  }

  .hero h1 {
    margin: 7px 0;
    font-size: clamp(34px, 4vw, 48px);
  }

  .hero-synopsis {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 14px;
    line-height: 1.5;
  }

  .tag-row {
    margin: 10px 0 12px;
  }

  .tag {
    padding: 5px 10px;
    font-size: 12px;
  }

  .primary-action,
  .secondary-action {
    min-height: 42px;
    padding: 0 18px;
    font-size: 14px;
  }

  .agent-console {
    margin: 10px 0 14px;
    padding: 10px 16px;
  }

  .agent-heading strong {
    font-size: 15px;
  }

  .agent-heading p,
  .suggestion {
    font-size: 12px;
  }

  .agent-form input {
    min-height: 42px;
  }

  .send-action {
    min-height: 42px;
  }

  .suggestion-row {
    margin-top: 0;
  }

  .suggestion {
    min-height: 34px;
  }

  .category-nav {
    margin: 10px 0 2px;
  }

  .category-pill {
    min-height: 36px;
    padding: 0 16px;
    font-size: 13px;
  }

  .catalog-sections {
    gap: 18px;
  }

  .catalog-more {
    margin-top: 14px;
    padding-top: 14px;
  }

  .shelf-heading {
    margin-bottom: 8px;
  }

  .shelf-heading h2 {
    margin-top: 4px;
    font-size: 24px;
  }

  .catalog-row {
    padding-bottom: 12px;
  }

  .drama-card {
    width: clamp(220px, 25vw, 300px);
  }

  .episode-picker {
    padding: 18px;
  }

  .episode-dialog {
    max-height: min(90vh, 620px);
  }

  .episode-dialog-header {
    padding: 15px 18px;
  }

  .episode-dialog-header h2 {
    font-size: 24px;
  }

  .episode-list {
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 8px;
    padding: 14px 18px 18px;
  }

  .episode-option {
    min-height: 54px;
  }

  .player-topbar,
  .player-controls {
    padding: 18px 24px;
  }

  .player-controls {
    padding-bottom: 22px;
  }
}

.player {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #000;
}

.player video,
.danmaku-layer,
.player-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.player video {
  background: #000;
  object-fit: contain;
}

.player video.is-portrait {
  object-fit: contain;
  padding: 0 max(2vw, 16px);
  box-sizing: border-box;
}

.danmaku-layer {
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.danmaku-item {
  position: absolute;
  left: 100%;
  max-width: 76%;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgb(0 0 0 / 52%);
  text-shadow:
    -2px -2px 0 #000,
    2px -2px 0 #000,
    -2px 2px 0 #000,
    2px 2px 0 #000;
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
  animation: danmaku-scroll linear forwards;
  will-change: transform;
}

.danmaku-item.is-fixed {
  left: 50%;
  background: rgb(0 0 0 / 62%);
  transform: translateX(-50%);
  animation-name: danmaku-fixed;
}

.danmaku-item.is-fixed.is-bottom {
  top: auto !important;
  bottom: 12%;
}

@keyframes danmaku-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-100vw - 100%)); }
}

@keyframes danmaku-fixed {
  0% { opacity: 0; transform: translateX(-50%) translateY(-5px); }
  8%, 92% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(4px); }
}

.player.is-danmaku-hidden .danmaku-layer {
  display: none;
}

.player-shade {
  pointer-events: none;
  background: linear-gradient(180deg, rgb(0 0 0 / 78%), transparent 24%, transparent 68%, rgb(0 0 0 / 88%));
}

.player-topbar,
.player-controls {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  display: flex;
  align-items: center;
}

.player-topbar {
  top: 0;
  gap: 18px;
  padding: 26px 34px;
}

.player-title {
  display: grid;
  gap: 4px;
}

.player-title strong {
  font-size: 20px;
}

.player-title span {
  color: #b0bbb7;
  font-size: 13px;
}

.player-controls {
  bottom: 0;
  gap: 20px;
  padding: 26px 34px 34px;
}

.round-action {
  min-width: 68px;
  border-color: rgb(255 255 255 / 18%);
  background: rgb(16 24 25 / 82%);
}

.round-action.secondary {
  color: #c9d3ce;
}

.player-progress {
  display: grid;
  flex: 1;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  color: #c3cdc8;
  font-size: 12px;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgb(255 255 255 / 19%);
}

.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  background: #d7ff64;
}

.is-loading {
  opacity: .72;
}

.catalog-empty {
  min-width: min(420px, 80vw);
  margin: 0;
  border: 1px dashed rgb(255 255 255 / 16%);
  border-radius: 8px;
  padding: 30px;
  color: #9ba8a3;
}

.episode-picker {
  position: fixed;
  inset: 0;
  z-index: 16;
  display: grid;
  place-items: center;
  background: rgb(3 6 7 / 78%);
  padding: 28px;
}

.episode-dialog {
  display: grid;
  width: min(1120px, 100%);
  max-height: min(82vh, 820px);
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 8px;
  background: #101718;
  box-shadow: 0 30px 90px rgb(0 0 0 / 52%);
}

.episode-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgb(255 255 255 / 10%);
  padding: 22px 24px;
}

.episode-dialog-header h2 {
  margin: 6px 0 0;
  font-size: clamp(24px, 2.4vw, 38px);
}

.episode-dialog-meta {
  margin: 6px 0 0;
  color: #99a6a1;
  font-size: 13px;
}

.episode-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
  overflow-y: auto;
  padding: 20px 24px 26px;
  scrollbar-color: #54605b #0a0f10;
}

.episode-option {
  display: grid;
  min-height: 62px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 7px;
  background: #151e1f;
  padding: 9px 10px;
  cursor: pointer;
}

.episode-option strong {
  font-size: 19px;
}

.episode-option span {
  overflow: hidden;
  width: 100%;
  color: #92a09b;
  font-size: 11px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.episode-option.is-focused {
  transform: translateY(-3px);
}

.player.is-controls-hidden .player-topbar,
.player.is-controls-hidden .player-controls,
.player.is-controls-hidden .player-shade {
  opacity: 0;
  pointer-events: none;
}

.player-topbar,
.player-controls,
.player-shade {
  transition: opacity 180ms ease;
}

.toast {
  position: fixed;
  right: 30px;
  bottom: 28px;
  z-index: 30;
  max-width: 380px;
  transform: translateY(16px);
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 12px;
  background: rgb(11 17 18 / 94%);
  padding: 13px 16px;
  color: #e8eeea;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

[data-focus].is-focused,
[data-focus]:focus-visible {
  outline: 4px solid #d7ff64;
  outline-offset: 4px;
  box-shadow: 0 0 0 9px rgb(215 255 100 / 13%);
}

.drama-card.is-focused {
  transform: translateY(-5px) scale(1.018);
}

.drama-card.is-focused img {
  transform: scale(1.055);
}

@media (max-width: 960px) {
  .tv-shell {
    padding: 18px 20px 52px;
  }

  .hero {
    min-height: 430px;
  }

  .hero-content {
    width: 80%;
    padding: 38px 34px;
  }

  .agent-console {
    grid-template-columns: 1fr;
  }

  .suggestion-row {
    grid-column: 1;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    gap: 10px;
  }

  .brand {
    flex: 0 0 auto;
  }

  .brand-copy {
    display: none;
  }

  .top-actions {
    gap: 6px;
  }

  .nav-action {
    min-height: 40px;
    padding: 0 12px;
    font-size: 13px;
  }

  .hero {
    min-height: 460px;
  }

  .hero-shade {
    background:
      linear-gradient(180deg, rgb(5 8 9 / 8%) 0%, rgb(5 8 9 / 44%) 38%, rgb(5 8 9 / 96%) 76%, #050809 100%);
  }

  .hero-content {
    width: 100%;
    justify-content: end;
    padding: 34px 22px 74px;
  }

  .hero h1 {
    font-size: 48px;
  }

  .episode-peek {
    display: none;
  }

  .episode-picker {
    padding: 12px;
  }

  .episode-dialog-header {
    align-items: flex-start;
    padding: 18px;
  }

  .episode-list {
    grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
    padding: 16px 18px 20px;
  }

  .catalog-row {
    gap: 12px;
  }

  .drama-card {
    width: min(78vw, 320px);
  }

  .category-nav {
    gap: 7px;
  }

  .category-pill {
    min-height: 40px;
    padding: 0 14px;
    font-size: 13px;
  }

  .player-topbar,
  .player-controls {
    padding-right: 18px;
    padding-left: 18px;
  }

  .player-controls {
    gap: 10px;
  }

  .round-action {
    min-width: 58px;
    padding: 0 12px;
  }
}

@media (min-width: 700px) and (max-width: 960px) and (max-height: 760px) {
  .tv-shell {
    padding: 14px 20px 44px;
  }

  .hero {
    height: clamp(286px, 46vh, 340px);
    min-height: 0;
  }

  .hero-content {
    width: min(680px, 72%);
    padding: 24px 30px;
  }

  .agent-console {
    grid-template-columns: minmax(190px, .7fr) minmax(300px, 1.3fr);
    gap: 10px 18px;
    margin: 10px 0 14px;
    padding: 10px 16px;
  }

  .suggestion-row {
    grid-column: 2;
  }

  .drama-card {
    width: clamp(220px, 25vw, 280px);
  }
}

@media (min-width: 1000px) and (orientation: landscape) {
  .tv-shell {
    --tv-gutter-y: clamp(14px, 1.8vh, 30px);
    --tv-gutter-x: clamp(30px, 3.4vw, 92px);
    display: grid;
    grid-template-areas:
      "topbar topbar"
      "hero agent"
      "category category"
      "catalog catalog";
    grid-template-columns: minmax(0, 1.72fr) minmax(340px, .78fr);
    align-items: stretch;
    gap: clamp(8px, 1.2vh, 16px) clamp(14px, 1.5vw, 28px);
  }

  .topbar {
    grid-area: topbar;
    min-height: clamp(40px, 4.4vh, 52px);
    margin-bottom: 0;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 13px;
  }

  .brand-copy strong {
    font-size: 16px;
  }

  .nav-action,
  .secondary-action,
  .round-action,
  .player-back {
    min-height: 40px;
    padding: 0 17px;
    font-size: 14px;
  }

  .hero {
    grid-area: hero;
    height: clamp(208px, 26vh, 330px);
    box-shadow: 0 18px 52px rgb(0 0 0 / 34%);
  }

  .hero-content {
    width: min(760px, 88%);
    padding: clamp(18px, 2.4vh, 30px) clamp(22px, 2.4vw, 42px);
  }

  .hero h1 {
    margin: 7px 0;
    font-size: clamp(32px, 3.4vw, 58px);
  }

  .hero-synopsis {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: clamp(13px, .95vw, 17px);
    line-height: 1.5;
  }

  .tag-row {
    margin: 8px 0 10px;
  }

  .tag {
    padding: 5px 10px;
    font-size: 12px;
  }

  .primary-action,
  .secondary-action {
    min-height: 40px;
    padding-right: 19px;
    padding-left: 19px;
    font-size: 14px;
  }

  .episode-peek {
    right: clamp(18px, 2vw, 34px);
    bottom: clamp(16px, 2vh, 26px);
  }

  .agent-console {
    grid-area: agent;
    grid-template-columns: 1fr;
    align-content: center;
    gap: 9px;
    margin: 0;
    padding: clamp(14px, 1.8vh, 22px) clamp(16px, 1.5vw, 24px);
  }

  .agent-heading strong {
    font-size: 15px;
  }

  .agent-heading p {
    font-size: 12px;
  }

  .agent-form {
    grid-template-columns: 1fr 46px;
    gap: 8px;
  }

  .agent-form input,
  .send-action {
    min-height: 42px;
  }

  .suggestion-row {
    grid-column: 1;
    gap: 7px;
    margin-top: 0;
  }

  .suggestion {
    min-height: 32px;
    padding: 0 11px;
    font-size: 12px;
  }

  .category-nav {
    grid-area: category;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0;
    overflow-x: auto;
  }

  .category-pill {
    min-height: 36px;
    padding: 0 16px;
    font-size: 13px;
  }

  .catalog-section {
    grid-area: catalog;
    min-width: 0;
  }

  .catalog-sections {
    gap: 18px;
  }

  .shelf-heading {
    align-items: center;
    margin-bottom: 8px;
  }

  .shelf-heading h2 {
    margin-top: 3px;
    font-size: clamp(22px, 1.8vw, 32px);
  }

  .catalog-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(220px, 14vw, 420px), 1fr));
    gap: clamp(10px, 1vw, 16px);
    overflow: visible;
    padding: 8px 4px 12px;
    scroll-snap-type: none;
  }

  .drama-card {
    width: 100%;
    scroll-snap-align: none;
  }

  .card-copy {
    inset: auto 14px 13px;
  }

  .card-copy strong {
    font-size: 17px;
  }

  .card-copy span {
    margin-top: 3px;
    font-size: 12px;
  }

  .catalog-more {
    margin-top: 14px;
    padding-top: 14px;
  }
}

/* 电视首页：左右片库一览，中间保留对话，搜索固定在底部中央。 */
.tv-shell {
  display: grid;
  grid-template-areas: none;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(8px, 1.1vh, 14px);
  height: 100vh;
  overflow: hidden;
  padding-bottom: calc(176px + env(safe-area-inset-bottom));
}

.topbar {
  grid-area: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 0;
}

.topbar .brand {
  margin-right: auto;
}

.topbar .top-actions {
  margin-left: auto;
}

.category-nav {
  min-width: 0;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-nav::-webkit-scrollbar,
.catalog-list::-webkit-scrollbar,
.agent-chat::-webkit-scrollbar {
  display: none;
}

.category-pill {
  min-height: 38px;
  padding: 0 15px;
  font-size: 13px;
}

.catalog-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

.catalog-tools .catalog-status {
  max-width: 270px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-tools .secondary-action {
  min-height: 38px;
  padding: 0 17px;
  font-size: 13px;
}

.content-board {
  grid-area: auto;
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(12px, 1.2vw, 22px);
}

.catalog-pane,
.agent-panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 9%);
  border-radius: 8px;
  background: rgb(10 16 17 / 78%);
}

.catalog-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 14px;
}

.pane-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
  padding: 0 2px 11px;
}

.pane-heading h2 {
  margin: 3px 0 0;
  font-size: clamp(20px, 1.5vw, 28px);
  line-height: 1.1;
}

.catalog-count {
  flex: 0 0 auto;
  font-size: 12px;
}

.catalog-list {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  align-content: start;
  gap: 8px;
  overflow-y: auto;
  padding: 11px 2px 2px;
  scrollbar-width: none;
}

.drama-card {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 58px;
  aspect-ratio: auto;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 6px;
  background: rgb(255 255 255 / 3%);
  padding: 7px 9px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drama-card:hover,
.drama-card.is-focused {
  border-color: rgb(215 255 100 / 48%);
  background: rgb(215 255 100 / 8%);
  transform: translateX(3px);
}

.drama-card .card-poster {
  position: static;
  width: 72px;
  height: 42px;
  grid-row: auto;
  inset: auto;
  border-radius: 5px;
  object-fit: cover;
  background: #111819;
  transform: none;
}

.drama-card.is-focused .card-poster {
  transform: none;
}

.card-index {
  position: absolute;
  top: 5px;
  left: 61px;
  display: grid;
  width: 25px;
  height: 18px;
  place-items: center;
  border-radius: 4px;
  background: rgb(4 8 9 / 88%);
  padding: 0;
  color: #d7ff64;
  font-size: 9px;
}

.card-copy {
  position: relative;
  inset: auto;
  min-width: 0;
}

.card-copy strong {
  font-size: 14px;
  line-height: 1.25;
}

.card-copy span {
  margin-top: 3px;
  font-size: 11px;
}

.card-meta {
  display: none;
}

.catalog-empty {
  grid-column: 1 / -1;
  margin: 0;
  color: #8d9a95;
  font-size: 13px;
  line-height: 1.7;
}

.agent-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    linear-gradient(180deg, rgb(20 31 30 / 94%), rgb(8 13 14 / 94%));
}

.agent-panel-header {
  display: flex;
  align-items: center;
  gap: 13px;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
  padding: 16px 18px 14px;
}

.agent-panel-header strong {
  display: block;
  margin-bottom: 3px;
  font-size: 16px;
}

.agent-panel-header p {
  margin: 0;
  color: #8e9b97;
  font-size: 12px;
}

.agent-chat {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 11px;
  overflow-y: auto;
  padding: 16px 18px 18px;
  scrollbar-width: none;
}

.chat-message {
  width: min(92%, 520px);
  border: 1px solid rgb(255 255 255 / 9%);
  border-radius: 8px;
  background: rgb(255 255 255 / 4%);
  padding: 11px 13px;
}

.chat-message.is-user {
  align-self: flex-end;
  border-color: rgb(215 255 100 / 24%);
  background: rgb(215 255 100 / 10%);
}

.chat-message.is-assistant {
  align-self: flex-start;
}

.chat-role {
  display: block;
  margin-bottom: 5px;
  color: #d7ff64;
  font-size: 11px;
  font-weight: 800;
}

.chat-message p {
  margin: 0;
  color: #dbe3df;
  font-size: 13px;
  line-height: 1.62;
}

.agent-dock {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 20;
  grid-area: auto;
  display: grid;
  width: min(760px, 52vw);
  gap: 8px;
  transform: translateX(-50%);
}

.agent-dock .suggestion-row {
  display: flex;
  grid-column: auto;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 0;
}

.agent-dock .suggestion {
  min-height: 32px;
  padding: 0 12px;
  background: rgb(9 15 16 / 92%);
  font-size: 12px;
}

.agent-dock .agent-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px;
  gap: 8px;
  border: 1px solid rgb(215 255 100 / 34%);
  border-radius: 15px;
  background: rgb(7 12 13 / 96%);
  padding: 6px;
  box-shadow: 0 18px 54px rgb(0 0 0 / 58%);
}

.agent-dock .agent-form input {
  min-height: 48px;
  border: 0;
  background: transparent;
  padding: 0 14px;
  font-size: 15px;
}

.agent-dock .send-action {
  min-width: 50px;
  min-height: 48px;
  border-radius: 11px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.page-action {
  min-width: 78px;
  min-height: 32px;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 999px;
  background: rgb(9 15 16 / 92%);
  padding: 0 14px;
  color: #dbe3df;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.page-action:disabled {
  border-color: rgb(255 255 255 / 7%);
  color: #59635f;
  cursor: default;
}

.page-indicator {
  min-width: 76px;
  color: #d7ff64;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 1100px) {
  .content-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .catalog-list {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .agent-dock {
    width: min(680px, 62vw);
  }

  .drama-card {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .drama-card .card-poster {
    width: 62px;
    height: 38px;
  }

  .card-index {
    left: 51px;
  }
}

@media (max-width: 900px) {
  .tv-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding-bottom: 162px;
  }

  .topbar {
    justify-content: flex-start;
  }

  .topbar .brand,
  .topbar .top-actions {
    margin: 0;
  }

  .content-board {
    grid-template-columns: 1fr;
  }

  .agent-panel {
    order: -1;
    min-height: 360px;
  }

  .catalog-pane {
    max-height: 70vh;
  }

  .catalog-list {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .agent-dock {
    width: calc(100% - 32px);
  }
}

@media (max-width: 560px) {
  .catalog-list {
    grid-template-columns: 1fr;
  }

  .agent-dock .suggestion-row {
    display: none;
  }
}

/* ===== 板块切换（影视 / 哔哩哔哩） ===== */
.section-tabs {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 999px;
  background: rgb(9 14 15 / 88%);
  padding: 4px;
}

.section-tab {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 0 16px;
  color: #93a09b;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.section-tab.is-active {
  background: rgb(215 255 100 / 16%);
  color: #eaffb0;
}

.section-tab:hover {
  color: #eaf3ec;
}

.media-view {
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
}

/* ===== 哔哩哔哩板块 ===== */
.bili-pane {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 1vh, 14px);
  border: 1px solid rgb(255 255 255 / 9%);
  border-radius: 8px;
  background: rgb(10 16 17 / 78%);
  padding: 14px 16px 12px;
}

.bili-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
  padding-bottom: 11px;
}

.bili-heading h2 {
  margin: 3px 0 0;
  font-size: clamp(18px, 1.4vw, 26px);
  line-height: 1.1;
}

.bili-form {
  display: grid;
  flex: 1 1 320px;
  max-width: 620px;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
  border: 1px solid rgb(215 255 100 / 26%);
  border-radius: 13px;
  background: rgb(6 11 12 / 92%);
  padding: 5px;
}

.bili-form input {
  min-height: 40px;
  border: 0;
  background: transparent;
  padding: 0 12px;
  font-size: 14px;
}

.bili-form .send-action {
  min-width: 48px;
  min-height: 40px;
  border-radius: 9px;
}

.bili-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.bili-tools .catalog-status {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bili-grid {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  padding: 2px 2px 6px;
  scrollbar-width: none;
}

.bili-grid::-webkit-scrollbar {
  display: none;
}

.bili-card {
  display: grid;
  grid-template-rows: auto auto;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 8px;
  background: rgb(255 255 255 / 3%);
  padding: 0 0 8px;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.bili-card:hover,
.bili-card.is-focused {
  border-color: rgb(215 255 100 / 46%);
  background: rgb(215 255 100 / 8%);
  transform: translateY(-2px);
}

.bili-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #101819;
}

.bili-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bili-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  border-radius: 4px;
  background: rgb(4 8 9 / 82%);
  padding: 1px 6px;
  color: #e8f6d6;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.bili-card-copy {
  display: grid;
  gap: 4px;
  padding: 8px 10px 0;
}

.bili-card-copy strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.bili-card-copy span {
  overflow: hidden;
  color: #8d9a95;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bili-empty {
  grid-column: 1 / -1;
  margin: 0;
  color: #8d9a95;
  font-size: 13px;
  line-height: 1.7;
}

.bili-pagination {
  padding-top: 2px;
}

/* ===== 哔哩哔哩播放层 ===== */
.bili-player {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  background: #04070a;
  padding: 12px clamp(10px, 2vw, 28px) 16px;
}

.bili-player-bar {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bili-player-bar .player-title {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.bili-player-bar .player-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bili-player-bar .player-title span {
  color: #8d9a95;
  font-size: 12px;
}

.bili-open-link {
  margin-left: auto;
  text-decoration: none;
}

.bili-frame-shell {
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 9%);
  border-radius: 10px;
  background: #000;
}

.bili-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ===== 玩法弹层 ===== */
.help-dialog {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  background: rgb(4 7 9 / 72%);
  padding: 18px;
}

.help-card {
  width: min(680px, 100%);
  max-height: min(78vh, 640px);
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 10px;
  background: #0d1415;
  box-shadow: 0 30px 90px rgb(0 0 0 / 62%);
}

.help-body {
  display: grid;
  max-height: calc(min(78vh, 640px) - 96px);
  gap: 10px;
  overflow-y: auto;
  padding: 16px 22px 24px;
}

.help-body p {
  margin: 0;
  color: #cfdad4;
  font-size: 14px;
  line-height: 1.7;
}

.help-body strong {
  color: #e9f6c8;
}

.help-body code {
  border-radius: 4px;
  background: rgb(255 255 255 / 8%);
  padding: 1px 5px;
  font-size: 13px;
}

.qr-inline {
  display: flex;
  flex: none;
  align-items: center;
  margin-left: auto;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  background: #ffffff;
  padding: 6px 11px 6px 6px;
  cursor: pointer;
  box-shadow: 0 8px 26px rgb(0 0 0 / 45%);
}

.qr-inline canvas {
  display: block;
  width: clamp(88px, 4.4vw, 104px);
  height: clamp(88px, 4.4vw, 104px);
  image-rendering: pixelated;
}

.qr-inline-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.qr-inline-hint {
  color: #16202a;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  white-space: nowrap;
}

.qr-inline-code {
  color: #16202a;
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.15;
  white-space: nowrap;
}

.qr-inline-code[hidden] {
  display: none;
}

.qr-inline:focus-visible {
  box-shadow:
    0 0 0 3px rgb(215 255 100 / 80%),
    0 8px 26px rgb(0 0 0 / 45%);
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.history-label {
  color: #7d8c88;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  min-width: 0;
}

.history-chip {
  max-width: 26ch;
  overflow: hidden;
  border: 1px dashed rgb(255 255 255 / 20%);
  border-radius: 999px;
  background: rgb(9 15 16 / 80%);
  padding: 4px 12px;
  color: #aeb9b5;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.history-chip:focus-visible {
  border-color: rgb(215 255 100 / 70%);
  color: #e9f6c8;
}

.history-clear {
  border: 0;
  background: none;
  padding: 2px 6px;
  color: #6f7f7b;
  font-size: 11px;
  cursor: pointer;
}

.history-clear:focus-visible {
  color: #d7ff64;
}

.chat-tag {
  margin-left: 2px;
  border-radius: 6px;
  background: rgb(215 255 100 / 16%);
  padding: 1px 6px;
  color: #d7ff64;
  font-size: 11px;
  font-weight: 700;
}

.qr-card {
  width: min(780px, 100%);
}

.qr-body {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 22px 26px 28px;
}

.qr-frame {
  flex: none;
  border-radius: 14px;
  background: #ffffff;
  padding: 14px;
  box-shadow: 0 18px 50px rgb(0 0 0 / 45%);
}

#qr-canvas {
  display: block;
  width: clamp(180px, 30vh, 300px);
  height: auto;
  image-rendering: pixelated;
}

.qr-side {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.qr-url {
  margin: 0;
  color: #e9f6c8;
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(15px, 1.5vw, 19px);
  word-break: break-all;
}

.qr-hint {
  margin: 0;
  color: #9fb0ab;
  font-size: 14px;
  line-height: 1.7;
}

.qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.qr-actions .secondary-action {
  align-items: center;
  display: inline-flex;
  color: #e8f3f5;
  text-decoration: none;
}

@media (max-width: 720px) {
  .qr-inline {
    display: none;
  }
}

@media (max-width: 900px) {
  .bili-pane {
    min-height: 62vh;
  }

  .qr-body {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    padding: 18px;
  }

  .qr-frame {
    align-self: center;
  }

  #qr-canvas {
    width: min(64vw, 260px);
  }

  .bili-grid {
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  }

  .bili-tools {
    margin-left: 0;
  }
}

@media (max-width: 560px) {
  .section-tab {
    min-height: 30px;
    padding: 0 12px;
    font-size: 12px;
  }

  .bili-grid {
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  }
}

/* ===== 投屏模式 ===== */
.cast-switch {
  display: inline-flex;
  flex: none;
  gap: 3px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 999px;
  background: rgb(9 15 16 / 72%);
  padding: 3px;
}

.cast-mode {
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 6px 13px;
  color: #9aaba6;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.cast-mode.is-active {
  background: #d7ff64;
  color: #0b1013;
}

.cast-mode:focus-visible {
  outline: 2px solid rgb(215 255 100 / 75%);
  outline-offset: 2px;
}

.cast-stage {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
  background:
    radial-gradient(circle at 50% 12%, rgb(215 255 100 / 8%), transparent 55%),
    #070b0d;
}

.cast-stage[hidden] {
  display: none;
}

.cast-stage-card {
  display: grid;
  justify-items: center;
  gap: 16px;
  width: min(640px, 100%);
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 26px;
  background: rgb(11 17 19 / 88%);
  padding: clamp(22px, 4vh, 40px) clamp(18px, 4vw, 40px);
  text-align: center;
  box-shadow: 0 30px 90px rgb(0 0 0 / 55%);
}

.cast-stage-card h2 {
  margin: 0;
  color: #eef7d7;
  font-size: clamp(20px, 2.4vw, 30px);
}

.cast-code {
  color: #d7ff64;
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(44px, 8vw, 92px);
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1;
  text-shadow: 0 0 32px rgb(215 255 100 / 25%);
}

.cast-stage-qr canvas {
  display: block;
  width: clamp(150px, 24vh, 220px);
  height: auto;
  border-radius: 14px;
  background: #ffffff;
  padding: 10px;
  image-rendering: pixelated;
}

.cast-stage-status {
  margin: 0;
  color: #cfe0da;
  font-size: 14px;
  font-weight: 600;
}

.cast-stage-status.is-online {
  color: #d7ff64;
}

.cast-stage-hint {
  margin: 0;
  max-width: 46ch;
  color: #8b9b96;
  font-size: 13px;
  line-height: 1.7;
}

.cast-stage-card .secondary-action {
  padding: 9px 20px;
}

.cast-pair-card {
  width: min(520px, 100%);
}

.cast-pair-body {
  display: grid;
  gap: 14px;
  padding: 18px 22px 24px;
}

.cast-pair-tip {
  margin: 0;
  color: #a9b8b3;
  font-size: 13px;
  line-height: 1.7;
}

.cast-pair-form {
  display: flex;
  gap: 10px;
}

.cast-pair-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 12px;
  background: rgb(255 255 255 / 5%);
  padding: 10px 14px;
  color: #eef7d7;
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 20px;
  letter-spacing: 0.18em;
}

.cast-pair-form input:focus {
  border-color: rgb(215 255 100 / 60%);
  outline: none;
}

.cast-pair-status {
  margin: 0;
  min-height: 18px;
  color: #ff9d8a;
  font-size: 12px;
}

.cast-pair-alt {
  justify-self: start;
  border: 0;
  background: none;
  padding: 0;
  color: #8b9b96;
  font-size: 12px;
  text-decoration: underline dotted;
  cursor: pointer;
}

.cast-remote {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 110;
  width: min(760px, calc(100vw - 24px));
  border: 1px solid rgb(215 255 100 / 22%);
  border-radius: 16px;
  background: rgb(9 15 16 / 96%);
  padding: 10px 14px;
  box-shadow: 0 18px 50px rgb(0 0 0 / 55%);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.cast-remote[hidden] {
  display: none;
}

.cast-remote-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.cast-remote-head strong {
  color: #eef7d7;
  font-size: 13px;
}

.cast-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: #67736f;
}

.cast-dot.is-online {
  background: #d7ff64;
  box-shadow: 0 0 0 4px rgb(215 255 100 / 14%);
}

.cast-remote-code {
  color: #8fa09b;
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
}

.cast-remote-state {
  max-width: 48%;
  margin-left: auto;
  overflow: hidden;
  color: #c7d3cf;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cast-remote-disconnect {
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 8%);
  padding: 5px 10px;
  color: #cfdad4;
  font-size: 12px;
  cursor: pointer;
}

.cast-remote-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.cast-remote-controls[hidden] {
  display: none;
}

.cast-remote-btn {
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 10px;
  background: rgb(255 255 255 / 4%);
  padding: 7px 13px;
  color: #e9f6c8;
  font-size: 13px;
  cursor: pointer;
}

.cast-remote-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.cast-remote-progress {
  margin-left: auto;
  color: #8b9b96;
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
}

.cast-exit-float {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 130;
  border: 1px solid rgb(215 255 100 / 40%);
  border-radius: 999px;
  background: rgb(9 15 16 / 92%);
  padding: 8px 14px;
  color: #d7ff64;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.cast-exit-float[hidden] {
  display: none;
}

body.is-cast-controller .tv-shell {
  padding-bottom: 104px;
}

@media (max-width: 720px) {
  .cast-remote {
    width: calc(100vw - 16px);
    padding: 9px 11px;
  }

  .cast-remote-state {
    max-width: 100%;
    margin-left: 0;
    order: 5;
    width: 100%;
  }

  .cast-code {
    font-size: clamp(38px, 13vw, 64px);
  }
}
