:root {
  --primary: #A8E6CF;
  --primary-dark: #111111;
  --sky: #BDE8F7;
  --pink: #F7C6D9;
  --beige: #E9E0D2;
  --neutral: #F3F3F3;
  --bg: #ffffff;
  --card-bg: #ffffff;
  --text: #111111;
  --text-secondary: #4b5563;
  --border: #e2ebe6;
  --shadow: 0 1px 3px rgba(17,17,17,.06), 0 1px 2px rgba(17,17,17,.04);
  --shadow-md: 0 4px 18px rgba(17,17,17,.08);
  --radius: 14px;
  --radius-sm: 10px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #FFFFFF 0%, #F8FCFB 40%, #EAF8F2 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  background-attachment: fixed;
}

.app-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  position: relative;
}

.bg-glow {
  position: fixed;
  top: -220px;
  left: -220px;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, rgba(168,230,207,.35), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.bg-glow-2 {
  left: auto;
  right: -220px;
  top: auto;
  bottom: -220px;
  background: radial-gradient(circle, rgba(189,232,247,.35), transparent 70%);
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: 999px;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #111111;
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge-primary { background: #A8E6CF; }
.badge-secondary { background: #BDE8F7; }
.badge-accent { background: #F7C6D9; }
.badge-neutral { background: #F3F3F3; color: #333333; }
.badge-dark { background: #111111; color: #FFFFFF; }

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  display: inline-block;
  animation: pulse-dot 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(22,163,74,.4); }
  50% { opacity: .7; box-shadow: 0 0 0 5px rgba(22,163,74,0); }
}

/* ===== Header ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

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

.channel-avatar-wrapper {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--primary);
  flex-shrink: 0;
  background: var(--neutral);
}

.channel-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.brand-name {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -.3px;
}

.brand-row .badge {
  padding: 2px 9px;
  font-size: 11px;
  gap: 0;
}

.channel-stats {
  font-size: .8rem;
  color: var(--text-secondary);
  margin-top: 1px;
  font-weight: 500;
}

.header-right .badge {
  padding: 6px 14px;
  font-size: 12px;
}

/* ===== Hero ===== */
.hero-section {
  text-align: center;
  margin-bottom: 26px;
}

.hero-section .badge {
  margin-bottom: 12px;
}

.hero-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 10px;
  letter-spacing: -.5px;
}

.hero-highlight {
  background: linear-gradient(135deg, #6fd8b3, #a8e6cf);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto;
  font-weight: 500;
}

/* ===== Welcome card ===== */
.welcome-guide-card {
  display: flex;
  gap: 12px;
  background: rgba(168,230,207,.22);
  border: 1px solid rgba(168,230,207,.65);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
}

.welcome-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.welcome-content strong {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
}

.welcome-content p {
  font-size: .88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-top: 3px;
}

/* ===== Search ===== */
.search-box {
  display: flex;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 6px 6px 16px;
  align-items: flex-end;
  transition: border-color .2s, box-shadow .2s;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(168,230,207,.45);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: 'Montserrat', sans-serif;
  font-size: .95rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  resize: none;
  padding: 10px 0;
  min-height: 24px;
  max-height: 120px;
  line-height: 1.5;
}

.search-input::placeholder {
  color: #9aa8a3;
}

.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #111111;
  cursor: pointer;
  transition: background .2s, transform .1s, color .2s;
  flex-shrink: 0;
}

.search-btn:hover {
  background: #7fd6b2;
}

.search-btn:active {
  transform: scale(.95);
}

/* ===== Suggestions ===== */
.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.suggestion-pill {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  font-family: 'Montserrat', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .2s;
}

.suggestion-pill:hover {
  border-color: var(--primary);
  color: #0d7a5c;
  background: rgba(168,230,207,.3);
}

/* ===== Loading ===== */
.loading-card {
  display: flex;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
  margin-top: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.loading-text {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.skeleton-line {
  height: 12px;
  background: var(--border);
  border-radius: 6px;
  width: 100%;
  animation: pulse 1.4s ease-in-out infinite;
}

.skeleton-line--short { width: 60%; }
.skeleton-line--medium { width: 80%; }

@keyframes pulse {
  0%, 100% { opacity: .4; }
  50% { opacity: .8; }
}

/* ===== Result ===== */
.result-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 16px;
  animation: fadeIn .3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(168,230,207,.14);
}

.result-avatar-wrapper {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--primary);
  flex-shrink: 0;
  background: var(--neutral);
}

.result-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-brand {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: .92rem;
  color: var(--text);
  display: block;
}

.result-label {
  margin-top: 3px;
  padding: 3px 10px;
  font-size: 11px;
  display: inline-flex;
}

.copy-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .2s;
  flex-shrink: 0;
}

.copy-btn:hover {
  background: var(--neutral);
  color: var(--text);
}

.result-content {
  padding: 18px;
  line-height: 1.75;
  font-size: .95rem;
  color: var(--text);
}

.result-content p {
  margin-bottom: 12px;
}

.result-content p:last-child {
  margin-bottom: 0;
}

.result-content h1, .result-content h2, .result-content h3 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  margin: 14px 0 8px;
}

.result-content ul, .result-content ol {
  padding-left: 22px;
  margin-bottom: 12px;
}

.result-content a {
  color: #0d7a5c;
}

.result-content code {
  background: var(--neutral);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: .88em;
}

/* ===== Error ===== */
.error-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fdf2f4;
  border: 1px solid #f9d3dc;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  animation: fadeIn .3s ease-out;
}

.error-icon {
  font-size: 1.2rem;
}

.error-text {
  font-size: .9rem;
  color: #b0264d;
  font-weight: 500;
}

/* ===== Sources ===== */
.sources-section {
  margin-bottom: 32px;
  animation: fadeIn .3s ease-out;
}

.sources-title {
  font-family: 'Montserrat', sans-serif;
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sources-title .badge {
  padding: 4px 12px;
  font-size: 11px;
}

.source-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}

.source-thumb {
  width: 92px;
  height: 52px;
  border-radius: 7px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--neutral);
}

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

.source-body {
  flex: 1;
  min-width: 0;
}

.source-title {
  font-size: .84rem;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-time {
  font-size: .76rem;
  color: var(--text-secondary);
}

.source-link {
  font-family: 'Montserrat', sans-serif;
  font-size: .78rem;
  font-weight: 600;
  color: #0d7a5c;
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.source-link:hover {
  text-decoration: underline;
}

/* ===== Footer ===== */
.app-footer {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.app-footer p {
  font-size: .8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

@media (max-width: 640px) {
  .app-container { padding: 16px 14px 32px; }
  .hero-title { font-size: 1.6rem; }
  .app-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .header-right { align-self: flex-start; }
  .suggestion-pill { font-size: .78rem; padding: 6px 12px; }
  .source-card { flex-wrap: wrap; }
  .source-link { margin-left: auto; }
}
