:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0; background: #0f0f0f; color: #f1f1f1;
  font-family: -apple-system, system-ui, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: #0f0f0f; padding: 12px 16px calc(12px);
  padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid #272727;
}
.topbar h1 { margin: 0; font-size: 18px; }
.feed { display: grid; gap: 16px; padding: 16px; max-width: 900px; margin: 0 auto; }
.status { opacity: .6; text-align: center; }
.card { cursor: pointer; border-radius: 12px; overflow: hidden; background: #1a1a1a; }
.card:active { opacity: .8; }
.thumb-wrap { position: relative; aspect-ratio: 16/9; background: #000; }
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.meta { padding: 10px 12px 14px; }
.meta .title { font-size: 15px; font-weight: 600; line-height: 1.3; margin: 0 0 4px; }
.meta .sub { font-size: 13px; opacity: .65; margin: 0; }
.player { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.95);
  display: flex; align-items: center; justify-content: center; }
.player.hidden { display: none; }
.player-frame { width: 100%; max-width: 1000px; aspect-ratio: 16/9; }
.player-frame iframe { width: 100%; height: 100%; border: 0; }
.close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 16px;
  z-index: 21; background: #272727; color: #fff; border: 0; border-radius: 50%;
  width: 40px; height: 40px; font-size: 18px; cursor: pointer; }

/* --- Boutons topbar (refresh + paramètres) --- */
.topbar { display: flex; align-items: center; justify-content: space-between; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.refresh, .gear {
  background: none; border: none; color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.refresh { font-size: 28px; }
.refresh:active, .gear:active { background: #272727; }
.refresh:active { transform: rotate(90deg); }
.refresh.spinning { animation: spin .6s linear; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* --- Vue Paramètres (plein écran séparé, pas de section inline) --- */
.settings {
  position: fixed; inset: 0; z-index: 15;
  background: #0f0f0f; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.settings.hidden { display: none; }
.settings-topbar {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 8px;
  background: #0f0f0f; padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid #272727;
}
.settings-topbar h2 { margin: 0; font-size: 17px; }
.back {
  background: none; border: none; color: #fff; font-size: 22px;
  cursor: pointer; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.back:active { background: #272727; }
.settings-body { max-width: 600px; margin: 0 auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); }
.settings-body section { margin-bottom: 28px; }
.settings-body h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; opacity: .6; margin: 0 0 10px; }
.hint { font-size: 13px; opacity: .55; margin: 0 0 12px; }

.channel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.channel-row {
  display: flex; align-items: center; gap: 8px;
  background: #1a1a1a; border-radius: 10px; padding: 10px 12px;
}
.channel-row .channel-info { flex: 1; min-width: 0; }
.channel-row .channel-name { font-size: 14px; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-row .channel-id { font-size: 12px; opacity: .5; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-row .row-btn {
  background: #272727; border: none; color: #fff; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px; font-size: 15px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.channel-row .row-btn:disabled { opacity: .3; cursor: default; }
.channel-row .row-btn.delete { color: #ff6b6b; }

.add-channel-form { display: flex; flex-direction: column; gap: 8px; }
.add-channel-form textarea {
  width: 100%; background: #1a1a1a; border: 1px solid #333; color: #fff;
  border-radius: 8px; padding: 10px 12px; font-size: 14px; font-family: inherit;
  resize: vertical;
}
.add-channel-form button {
  align-self: flex-end;
  background: #272727; border: none; color: #fff; border-radius: 8px;
  padding: 10px 18px; font-size: 14px; cursor: pointer; flex-shrink: 0;
}
.field-error { color: #ff6b6b; font-size: 13px; margin: 8px 0 0; }
.field-error.hidden { display: none; }

.field-label { display: block; font-size: 13px; opacity: .7; margin: 0 0 6px; }
.preset-select, .recent-hours-input {
  width: 100%; background: #1a1a1a; border: 1px solid #333; color: #fff;
  border-radius: 8px; padding: 10px 12px; font-size: 14px; font-family: inherit;
}
.recent-hours-field { margin-top: 14px; }
.recent-hours-field.hidden { display: none; }

.save-btn {
  width: 100%; background: #3b82f6; color: #fff; border: none;
  border-radius: 10px; padding: 14px; font-size: 15px; font-weight: 600;
  cursor: pointer; margin-bottom: 12px;
}
.save-btn:active { opacity: .85; }
.save-btn:disabled { opacity: .5; cursor: default; }

.settings-footer { text-align: center; margin-top: 20px; }
.kofi-link {
  display: inline-block; color: #f1f1f1; opacity: .7; text-decoration: none;
  font-size: 13px; padding: 8px 14px; border: 1px solid #333; border-radius: 20px;
}
.kofi-link:active { opacity: 1; }

/* date de publication sous les cartes vidéo */
.card .date {
  font-size: 0.75rem;
  color: #888;
  margin: 2px 0 0;
}
