/* ===================================================================
   IrisKids — Kids Comptines
   Veilleuse douce + lecteur YouTube
   =================================================================== */

* { box-sizing: border-box; }

:root {
  --veil:        #9bd4ff;
  --bg-deep:     #0b1228;
  --bg-mid:      #1a2244;
  --card-bg:     rgba(15, 23, 42, .82);
  --card-line:   rgba(255, 255, 255, .08);
  --text-main:   #f8fafc;
  --text-soft:   #cbd5f5;
  --accent:      #06b6d4;
  --accent-soft: #67e8f9;
}

body {
  margin: 0;
  font-family: var(--ik-font, 'Baloo 2', system-ui, sans-serif);
  color: var(--text-main);
  background:
    radial-gradient(ellipse at 50% -10%, var(--veil) 0%, transparent 35%),
    radial-gradient(ellipse at 100% 100%, rgba(124, 58, 237, .25) 0%, transparent 40%),
    linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-deep) 60%, #050816 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background 1s ease;
}

/* L'ik-header est sur fond cyan, on garde son style original mais on ajuste l'ombre */
.ik-header {
  box-shadow: 0 4px 20px rgba(6, 182, 212, .35);
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--ik-header-h, 52px) + 18px) 18px 32px;
}

/* === HERO === */
.hero {
  text-align: center;
  padding: 6px 0 18px;
}
.hero-emoji {
  font-size: 56px;
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 6px 18px rgba(6, 182, 212, .5));
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.hero-title {
  font-size: 1.9rem;
  font-weight: 800;
  margin: 8px 0 2px;
  background: linear-gradient(135deg, #67e8f9 0%, #c4b5fd 60%, #fbcfe8 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -.01em;
}
.hero-sub {
  margin: 0;
  font-size: .95rem;
  color: var(--text-soft);
  opacity: .85;
}

/* === Lecteur === */
.player-card {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 22px;
  padding: 14px 14px 16px;
  margin-bottom: 18px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.player-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}
.player-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.player-frame iframe[src=""] { visibility: hidden; }

/* Placeholder si aucune comptine n'est encore chargée */
.player-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  text-align: center;
  padding: 16px;
}
.placeholder-emoji {
  font-size: 44px;
  line-height: 1;
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .85; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.08); }
}
.placeholder-text {
  margin: 0;
  font-size: .95rem;
  color: var(--text-soft);
}
.player-card.is-playing .player-placeholder { display: none; }

.player-meta {
  margin-top: 12px;
}
.track-title {
  margin: 0 0 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  min-height: 1.5em;
}

.player-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  border: 1px solid var(--card-line);
  background: rgba(255, 255, 255, .06);
  color: var(--text-main);
  font-family: inherit;
  font-size: .95rem;
  font-weight: 700;
  border-radius: 14px;
  cursor: pointer;
  transition: background .15s, transform .12s, border-color .15s, opacity .15s;
}
.ctrl-btn:hover  { background: rgba(255, 255, 255, .12); border-color: var(--accent-soft); }
.ctrl-btn:active { transform: scale(.97); }
.ctrl-btn:disabled { opacity: .35; cursor: not-allowed; }
.ctrl-label { white-space: nowrap; }

/* === Veilleuse === */
.veil-card {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 20px;
  padding: 14px 16px 14px;
  margin-bottom: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.veil-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.veil-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.veil-sub {
  margin: 2px 0 0;
  font-size: .82rem;
  color: var(--text-soft);
  opacity: .8;
}
#color-picker {
  flex-shrink: 0;
  width: 56px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--card-line);
  background: transparent;
  cursor: pointer;
}
.veil-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.preset {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .25);
  cursor: pointer;
  padding: 0;
  transition: transform .12s, border-color .15s;
}
.preset:hover  { transform: scale(1.08); border-color: rgba(255, 255, 255, .6); }
.preset:active { transform: scale(.92); }
.preset.active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .35); }

/* === Liste de comptines === */
.tracks-section {
  margin-bottom: 22px;
}
.section-label {
  margin: 0 4px 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: .01em;
}

.track-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.track-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 10px 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--card-line);
  border-radius: 16px;
  color: var(--text-main);
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: transform .15s cubic-bezier(.34, 1.56, .64, 1), background .15s, border-color .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.track-tile:hover {
  background: rgba(255, 255, 255, .1);
  border-color: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(6, 182, 212, .2);
}
.track-tile:active { transform: scale(.96); }
.track-tile.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, .25), rgba(124, 58, 237, .2));
  border-color: var(--accent-soft);
  box-shadow: 0 10px 26px rgba(6, 182, 212, .3);
}

.tile-emoji {
  font-size: 32px;
  line-height: 1;
}
.tile-title {
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.2;
}
.tile-status {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-soft);
  text-transform: uppercase;
  letter-spacing: .06em;
  height: 1em;
}

.track-loading {
  text-align: center;
  font-size: .9rem;
  color: var(--text-soft);
  padding: 20px;
}
.track-loading.hidden { display: none; }

/* === Footer === */
.footer {
  margin-top: 16px;
  text-align: center;
  font-size: .82rem;
  color: var(--text-soft);
  opacity: .75;
  line-height: 1.6;
}
.footer p { margin: 4px 0; }
.footer .small { font-size: .72rem; opacity: .8; }

/* === Responsive === */
@media (max-width: 380px) {
  .track-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 1.6rem; }
}

@media (min-width: 600px) {
  .player-controls { grid-template-columns: repeat(2, minmax(0, 200px)); justify-content: center; }
}
