:root {
  color-scheme: light;
  font-family:
    Inter, "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2937;
  background: #f5f7fb;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
}

button,
input {
  font: inherit;
}

.page-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.radar-card {
  width: min(100%, 720px);
  padding: clamp(28px, 6vw, 56px);
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 20px 50px rgb(15 23 42 / 8%);
}

.eyebrow {
  margin: 0 0 12px;
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  color: #111827;
  font-size: clamp(2rem, 7vw, 3.5rem);
  line-height: 1.1;
}

.description {
  margin: 20px 0 32px;
  color: #6b7280;
  font-size: 1.05rem;
  line-height: 1.7;
}

.analysis-form label {
  display: block;
  margin-bottom: 10px;
  color: #374151;
  font-weight: 700;
}

.input-group {
  display: flex;
  gap: 12px;
}

.input-group input {
  min-width: 0;
  flex: 1;
  padding: 14px 16px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.input-group input:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgb(220 38 38 / 12%);
}

.input-group button {
  padding: 14px 22px;
  border: 0;
  border-radius: 10px;
  color: #ffffff;
  background: #dc2626;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.input-group button:hover {
  background: #b91c1c;
}

.input-group button:active {
  transform: translateY(1px);
}

.input-group button:focus-visible {
  outline: 3px solid rgb(220 38 38 / 30%);
  outline-offset: 3px;
}

.status-message {
  margin: 20px 0 0;
  padding: 14px 16px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #991b1b;
  background: #fef2f2;
  font-weight: 700;
}

.status-message--error {
  border-color: #fcd34d;
  color: #92400e;
  background: #fffbeb;
}

.input-group button:disabled { cursor: wait; opacity: 0.65; }
.results-panel { margin-top: 20px; padding: 20px; border: 1px solid #dbeafe; border-radius: 12px; background: #eff6ff; }
.results-panel h2 { margin: 0 0 8px; color: #1e3a8a; font-size: 1.4rem; }
.results-panel p { margin: 0; color: #374151; line-height: 1.6; white-space: pre-wrap; }
.result-stats { display: flex; flex-wrap: wrap; gap: 18px 28px; margin: 20px 0 0; }
.result-stats div { display: grid; gap: 4px; }
.result-stats dt { color: #6b7280; font-size: 0.9rem; }
.result-stats dd { margin: 0; color: #111827; font-size: 1.2rem; font-weight: 700; }
.video-comments { margin-top: 24px; }
.video-comments h3 { margin: 0 0 10px; color: #1f2937; font-size: 1.05rem; }
.results-panel .analysis-note { margin: 0 0 12px; color: #6b7280; font-size: 0.9rem; }
.video-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.video-list li { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid #dbeafe; color: #374151; line-height: 1.5; }
.video-title { min-width: 0; overflow-wrap: anywhere; }
.video-metrics { display: flex; flex-wrap: wrap; gap: 6px 16px; color: #6b7280; font-size: 0.9rem; }
.video-relative-performance,
.video-comment-count { color: #1e3a8a; font-weight: 700; }

.radar-card { width: min(100%, 980px); }
.watchlist-heading, .channel-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.watchlist-heading { margin-bottom: 12px; }
.watchlist-summary, .channel-pending, .channel-description { margin: 0; color: #6b7280; line-height: 1.6; }
.secondary-button, .text-button { border: 1px solid #cbd5e1; border-radius: 8px; padding: 9px 14px; color: #1f2937; background: #fff; font-weight: 700; cursor: pointer; }
.secondary-button:hover, .text-button:hover { background: #f8fafc; }
.secondary-button:disabled { cursor: wait; opacity: 0.55; }
.channel-list { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; }
.channel-card { min-width: 0; padding: 18px; border: 1px solid #dbeafe; border-radius: 12px; background: #fff; }
.channel-card h3 { margin: 0; color: #1e3a8a; font-size: 1.2rem; overflow-wrap: anywhere; }
.channel-card h4 { margin: 22px 0 8px; color: #1f2937; }
.channel-card .result-stats { margin: 14px 0 0; }
.channel-card .video-list { max-height: 420px; overflow: auto; }
.video-channel-name { color: #1e3a8a; font-size: 0.9rem; }
.snapshot-controls { margin: 16px 0; padding: 14px; border: 1px solid #bfdbfe; border-radius: 10px; background: #f8fbff; }
.snapshot-controls .analysis-note { margin: 10px 0 0; }
.snapshot-button { padding: 11px 16px; border: 0; border-radius: 8px; color: #fff; background: #1d4ed8; font-weight: 700; cursor: pointer; }
.snapshot-button:hover { background: #1e40af; }
.snapshot-button:disabled { cursor: wait; opacity: 0.55; }
.video-growth-rate { color: #047857; font-weight: 700; }
.remove-channel-button { flex: 0 0 auto; }
.results-panel .analysis-note { margin-bottom: 12px; }
button:focus-visible { outline: 3px solid rgb(37 99 235 / 30%); outline-offset: 2px; }

@media (max-width: 600px) {
  .input-group {
    flex-direction: column;
  }

  .input-group button {
    width: 100%;
  }

  .video-metrics {
    flex-direction: column;
    gap: 4px;
  }

  .watchlist-heading { flex-direction: column; }
  .secondary-button { width: 100%; }
  .channel-card { padding: 14px; }
}
