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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f5f5f5;
  color: #222;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* ---- Layout ---- */

.page {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* ---- Auth screen ---- */

#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.auth-box {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}

.auth-box h1 {
  font-size: 1.6rem;
  margin-bottom: 0.25rem;
}

.auth-box .tagline {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

.auth-box h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

/* ---- Forms ---- */

.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: #444;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: #fafafa;
  transition: border-color 0.15s;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #e00;
  background: #fff;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  font-family: inherit;
}

.btn:hover {
  opacity: 0.85;
}

.btn-primary {
  background: #e00;
  color: #fff;
  width: 100%;
  justify-content: center;
  padding: 0.75rem;
  font-size: 1rem;
}

.btn-secondary {
  background: #eee;
  color: #333;
}

.btn-danger {
  background: transparent;
  color: #c00;
  border: 1px solid #e0b0b0;
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}

.btn-danger:hover {
  background: #fff0f0;
  opacity: 1;
}

.btn-link {
  background: none;
  color: #e00;
  padding: 0;
  font-size: 0.9rem;
  text-decoration: underline;
}

/* ---- Auth toggle ---- */

.auth-toggle {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.875rem;
  color: #666;
}

.auth-toggle button {
  background: none;
  border: none;
  color: #e00;
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: underline;
  font-family: inherit;
}

/* ---- Error message ---- */

.error-msg {
  background: #fff0f0;
  border: 1px solid #fcc;
  border-radius: 6px;
  color: #c00;
  font-size: 0.875rem;
  padding: 0.625rem 0.75rem;
  margin-bottom: 1rem;
}

/* ---- Dashboard header ---- */

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.dash-header h1 {
  font-size: 1.5rem;
}

.dash-intro {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border-radius: 0.5rem;
  border-left: 3px solid #ff4444;
  color: #555;
  line-height: 1.6;
  font-size: 0.95rem;
}

/* ---- Kid cards ---- */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.kid-list {
  display: grid;
  gap: 0.75rem;
}

.kid-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 1rem 1.25rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.kid-card:hover {
  border-color: #e00;
  box-shadow: 0 2px 8px rgba(220,0,0,0.1);
}

.kid-card-name {
  font-weight: 600;
  font-size: 1rem;
}

.kid-card-meta {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.25rem;
}

/* ---- Add kid form ---- */

.add-kid-form {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 1.25rem;
  margin-top: 1rem;
}

.add-kid-form h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0.75rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ---- Kid detail view ---- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  margin-bottom: 1.5rem;
  font-family: inherit;
}

.back-link:hover {
  color: #222;
}

.detail-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.detail-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.detail-card .meta {
  color: #666;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.setup-link-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #444;
  margin-bottom: 0.5rem;
}

.setup-link-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f5f5f5;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}

.setup-link-url {
  flex: 1;
  font-size: 1.3rem;
  color: #222;
  word-break: break-all;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.setup-link-hint {
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.5rem;
}

/* ---- Channel list ---- */

.channels-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.channel-list {
  list-style: none;
}

.channel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.channel-item:last-child {
  border-bottom: none;
}

.channel-name-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.channel-name {
  font-size: 0.95rem;
}

.channel-yt-link {
  font-size: 0.8rem;
  color: #ff4444;
  text-decoration: none;
}

.channel-yt-link:hover {
  text-decoration: underline;
}

.empty-channels {
  color: #888;
  font-size: 0.875rem;
  font-style: italic;
}

/* ---- Spinner / loading ---- */

.loading-inline {
  color: #888;
  font-size: 0.875rem;
}

/* ---- Spinner animation ---- */

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

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #eee;
  border-top-color: #e00;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.generating-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
  color: #555;
  font-size: 0.9rem;
}

.generating-spinner p {
  margin: 0;
}

/* ---- Suggestion cards ---- */

.suggestions-section {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.suggestions-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.suggestions-section .hint {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 1rem;
}

.suggestions-section .suggestions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.suggestion-list {
  display: grid;
  gap: 0.75rem;
}

.suggestion-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1rem;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  background: #fafafa;
}

.suggestion-info {
  flex: 1;
  min-width: 0;
}

.suggestion-info strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.suggestion-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.suggestion-yt-link {
  font-size: 0.8rem;
  color: #ff4444;
  text-decoration: none;
  white-space: nowrap;
}

.suggestion-yt-link:hover {
  text-decoration: underline;
}

.suggestion-reason {
  font-size: 0.8rem;
  color: #777;
  line-height: 1.4;
  margin: 0;
}

.suggestion-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  align-items: flex-start;
}

.btn-approve {
  background: #1a8c3c;
  color: #fff;
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
}

.btn-approve:hover {
  background: #157230;
  opacity: 1;
}

.btn-skip {
  background: #e8e8e8;
  color: #555;
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
}

.btn-skip:hover {
  background: #ddd;
  opacity: 1;
}

/* ---- Feedback input ---- */

.feedback-section {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.feedback-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.feedback-row {
  display: flex;
  gap: 0.5rem;
}

.feedback-row input {
  flex: 1;
}

.feedback-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* ---- Auth blurb ---- */

.auth-blurb {
  margin-top: 1.25rem;
  font-size: 0.8rem;
  color: #888;
  line-height: 1.5;
  text-align: center;
}

/* ---- Empty / onboarding states ---- */

.empty-state {
  color: #888;
  font-size: 0.875rem;
  font-style: italic;
}

.onboarding-hint {
  background: #f0f7ff;
  border: 1px solid #cce0ff;
  border-radius: 8px;
  color: #2c5fa8;
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

/* ---- Status bar ---- */

.status-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: #555;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green  { background: #1a8c3c; }
.dot-yellow { background: #e6a800; }
.dot-grey   { background: #bbb; }

/* ---- Setup link actions ---- */

.setup-link-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* ---- Guidelines card ---- */

.guidelines-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.guidelines-card .hint {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.75rem;
}

.saved-indicator {
  display: inline-block;
  font-size: 0.8rem;
  color: #1a8c3c;
  margin-top: 0.4rem;
}

/* ---- Add channel row ---- */

.add-channel-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.add-channel-row input {
  flex: 1;
}

/* ---- Recent videos ---- */

.recent-videos-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.video-list {
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.video-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.video-item:last-child {
  border-bottom: none;
}

.video-thumb {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: #eee;
}

.video-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.video-title {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-channel {
  font-size: 0.78rem;
  color: #888;
}

.video-badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.badge-approved {
  background: #e6f5ec;
  color: #1a8c3c;
}

.badge-rejected {
  background: #fff0f0;
  color: #c00;
}

/* ---- Interest pills ---- */

.interest-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.interest-pill {
  padding: 0.4rem 0.9rem;
  border: 2px solid #ddd;
  border-radius: 2rem;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
  user-select: none;
  font-family: inherit;
}

.interest-pill:hover {
  border-color: #ff4444;
}

.interest-pill.selected {
  background: #ff4444;
  color: #fff;
  border-color: #ff4444;
}

/* ---- Feed preview grid ---- */

.feed-preview-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.feed-preview-card .hint {
  margin-bottom: 1rem;
}

.feed-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.feed-video-card {
  background: #fafafa;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.feed-video-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #ddd;
  display: block;
}

.feed-video-card-body {
  padding: 0.5rem 0.625rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.feed-video-card-title {
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-video-card-channel {
  font-size: 0.72rem;
  color: #888;
}

.feed-video-card-actions {
  display: flex;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem 0.5rem;
}

.btn-thumb {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.5rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-thumb:hover {
  background: #f0f0f0;
}

.btn-thumb.thumb-active-up {
  background: #e6f5ec;
  border-color: #1a8c3c;
}

.btn-thumb.thumb-active-down {
  background: #fff0f0;
  border-color: #c00;
}

/* ---- Hint utility ---- */

.hint {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.5;
}
