:root {
  --bg: #090d14;
  --line: #2f3d52;
  --text: #e5edf7;
  --muted: #95a8bf;
  --accent: #38bdf8;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", sans-serif;
  color: var(--text);
  background:
    radial-gradient(780px 420px at -15% -25%, #2563eb2e 0%, transparent 62%),
    radial-gradient(800px 420px at 110% 120%, #06b6d42a 0%, transparent 64%),
    var(--bg);
}

.page-wrap {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  min-height: 100vh;
  padding: clamp(10px, 1.8vw, 24px);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.logo {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--accent);
}

.episode-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
  padding: 4px;
  border: 1px solid #2f3d52;
  border-radius: 12px;
  background: #111a27;
  scrollbar-width: none;
}

.episode-tabs::-webkit-scrollbar {
  display: none;
}

.episode-tab {
  flex: 0 0 auto;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #b9c9dc;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
  padding: 8px 12px;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.episode-tab:hover {
  background: #1b2a3e;
  color: #f2f7ff;
}

.episode-tab.active {
  background: linear-gradient(180deg, #2a78b8, #21527c);
  color: #f7fbff;
}

.episode-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid #3e516b;
  background: #1a2638;
  color: #dce8f7;
  font-weight: 600;
}

.app {
  display: grid;
  gap: 10px;
}

.back {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: left;
  padding: 2px;
}

.stack-layout {
  width: min(100%, 1180px);
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #182536, #111c2b);
  box-shadow: 0 18px 44px #00000040;
  overflow: hidden;
}

.hero {
  padding: 12px;
}

.video-shell {
  position: relative;
  border: 1px solid #304258;
  border-radius: 14px;
  overflow: hidden;
  background: #0a111a;
}

.episode-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #02060d;
}

.live-chip {
  position: absolute;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  letter-spacing: 0.03em;
}

.live-chip span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #fff;
}

.hero-footer {
  padding: 12px 4px 4px;
}

.hero-footer h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hero-footer p {
  margin: 8px 0 0;
  color: #b3cce2;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.5;
}

.stream-link {
  display: inline-flex;
  margin-top: 10px;
  color: #83d8ff;
  text-decoration: none;
  border-bottom: 1px dashed #4f89a6;
  font-size: 0.88rem;
}

.stream-link:hover {
  color: #bdeeff;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid #2f3b4f;
}

.head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.icon-dot {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  background: #202e42;
  color: #8ce7ff;
  border: 1px solid #3a4a62;
  flex-shrink: 0;
}

.icon-dot.red {
  color: #ff8e8e;
}

.card-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.card-head small {
  display: block;
  margin-top: 2px;
  font-size: 0.85rem;
  color: var(--muted);
}

.summary-toggle {
  border: 1px solid #3f5978;
  background: linear-gradient(180deg, #234268, #1a2f4a);
  color: #dff0ff;
  border-radius: 10px;
  min-width: 116px;
  padding: 9px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.summary-toggle:hover {
  background: linear-gradient(180deg, #295287, #1d3960);
  transform: translateY(-1px);
}

.summary-toggle:focus-visible,
.chat-input input:focus-visible,
.chat-input button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-body {
  padding: 14px;
}

.summary-panel {
  animation: reveal 0.22s ease;
}

.briefing-content {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #cfdaea;
}

.summary-loader {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.summary-loader span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #83d8ff;
  animation: summaryPulse 0.78s ease-in-out infinite;
}

.summary-loader span:nth-child(2) {
  animation-delay: 0.12s;
}

.summary-loader span:nth-child(3) {
  animation-delay: 0.24s;
}

.summary-reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: summaryReveal 2s ease forwards;
}

.briefing-content h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #f2f7ff;
}

.briefing-content h5 {
  margin: 12px 0 8px;
  font-size: 0.95rem;
  color: #dcecff;
}

.briefing-content p {
  margin: 0 0 12px;
}

.briefing-content strong {
  color: #f4f9ff;
}

.briefing-content em {
  color: #95cfff;
  font-style: italic;
}

.assistant-chat {
  min-height: 96px;
  max-height: 58vh;
  overflow: auto;
  padding: 14px;
  display: grid;
  gap: 8px;
}

.assistant-chat:not(:empty) {
  border-top: 1px solid #2f3b4f;
}

.assistant-chat:empty {
  display: none;
}

.suggested-questions {
  padding: 14px;
}

.suggested-label {
  margin: 0 0 10px;
  color: #95a8bf;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.question-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.question-chip {
  min-height: 32px;
  border: 1px solid #33445c;
  border-radius: 999px;
  background: #171f2d;
  color: #edf6ff;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 7px 12px;
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.question-chip:hover {
  background: #203047;
  border-color: #4a6a91;
  transform: translateY(-1px);
}

.question-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.msg {
  border-radius: 14px;
  padding: 10px 12px;
  line-height: 1.45;
  font-size: 0.95rem;
}

.msg strong {
  color: #f4f9ff;
  font-weight: 700;
}

.msg ul {
  margin: 0;
  padding-left: 18px;
}

.msg li + li {
  margin-top: 8px;
}

.msg.bot {
  background: #1a2739;
  border: 1px solid #33445c;
}

.msg.pending {
  opacity: 0.75;
  font-style: italic;
}

.msg.user {
  background: #16324e;
  border: 1px solid #2f5a84;
  justify-self: end;
  max-width: 90%;
}

.chat-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #2f3b4f;
  background: #0f1827;
}

.chat-input input {
  flex: 1;
  border: 1px solid #354760;
  border-radius: 10px;
  background: #152336;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  font-size: 0.95rem;
}

.chat-input input::placeholder {
  color: #7990ab;
}

.chat-input input:disabled {
  opacity: 0.6;
}

.chat-input button {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #33618f;
  background: linear-gradient(180deg, #2c75b7, #215586);
  color: #eaf5ff;
  font-size: 1rem;
  cursor: pointer;
}

.chat-input button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes summaryPulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.82);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes summaryReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .page-wrap {
    padding: 10px;
  }

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

  .episode-tabs {
    width: 100%;
  }

  .card-head {
    padding: 12px;
  }

  .summary-toggle {
    padding: 8px 11px;
    font-size: 0.8rem;
  }

  .chat-input {
    padding: 10px;
  }

  .hero {
    padding: 10px;
  }
}
