/* =========================================================================
 * timer.css — Minuteur de l'enfant : préréglages, réglage libre,
 *   anneau de décompte et scènes animées (dents, douche, étoiles).
 * ========================================================================= */

/* ---------- Carte du tableau de bord (grille : voir kidspace.css) ---------- */
.timer-card .shop-icon { display: inline-block; animation: tmWobble 3s ease-in-out infinite; }
@keyframes tmWobble { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-14deg); } 90% { transform: rotate(12deg); } 95% { transform: rotate(-6deg); } }

/* ---------- Préréglages ---------- */
.tm-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tm-preset {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 10px; cursor: pointer;
  background: #fff; border: 5px solid color-mix(in srgb, var(--tc) 35%, white); border-radius: 26px;
  box-shadow: 0 8px 0 color-mix(in srgb, var(--tc) 40%, white), var(--shadow); font-family: inherit; color: var(--ink); font-size: 1.15rem;
  transition: transform .12s, box-shadow .12s;
}
.tm-preset:active { transform: translateY(6px); box-shadow: 0 2px 0 color-mix(in srgb, var(--tc) 40%, white); }
.tm-preset-icon { font-size: 3.6rem; line-height: 1; width: 1.6em; height: 1.6em; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--tc) 16%, white); }
.tm-preset-time { background: var(--tc); color: #fff; font-weight: 700; border-radius: 99px; padding: 3px 14px; }

/* ---------- Réglage libre ---------- */
.tm-custom { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.tm-dials { display: flex; align-items: center; gap: 14px; }
.tm-dial { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tm-dial small { color: var(--muted); font-weight: 600; }
.tm-val { font-size: 4rem; font-weight: 700; min-width: 2.2ch; text-align: center; line-height: 1; font-variant-numeric: tabular-nums; }
.tm-colon { font-size: 3.4rem; font-weight: 700; color: var(--muted); margin-bottom: 34px; }
.tm-step {
  width: 84px; height: 60px; border-radius: 18px; border: 0; cursor: pointer; font-size: 1.6rem; font-family: inherit;
  background: color-mix(in srgb, var(--tc) 16%, white); color: var(--tc); box-shadow: 0 4px 0 color-mix(in srgb, var(--tc) 30%, white);
}
.tm-step:active { transform: translateY(4px); box-shadow: none; }
.tm-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tm-chip { border: 0; border-radius: 99px; padding: 10px 18px; min-height: 48px; font-family: inherit; font-size: 1.05rem; font-weight: 600; cursor: pointer; background: var(--line); color: var(--ink); }
.tm-chip:active { background: color-mix(in srgb, var(--tc) 25%, white); }
.tm-go { width: min(420px, 100%); }

/* ---------- Décompte ---------- */
.tm-run, .tm-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.tm-title { margin: 0; font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
.tm-zone { margin: 0; min-height: 1.6em; font-size: 1.35rem; font-weight: 700; color: var(--tc); }
.tm-stage { position: relative; width: min(340px, 82vw); aspect-ratio: 1; }
.tm-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.tm-ring circle { fill: none; stroke-width: 18; }
.tm-ring-bg { stroke: color-mix(in srgb, var(--tc) 14%, white); }
.tm-ring-fg { stroke: var(--tc); stroke-linecap: round; transition: stroke-dashoffset .25s linear, stroke .4s; }
.tm-run.hurry .tm-ring-fg { stroke: #ff5c8a; }
.tm-scene { position: absolute; inset: 13%; border-radius: 50%; overflow: hidden; background: color-mix(in srgb, var(--tc) 8%, white); display: grid; place-items: center; }
.tm-left { margin: 4px 0 0; font-size: clamp(3.4rem, 9vw, 5rem); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.tm-run.hurry .tm-left { color: #ff5c8a; animation: tmBeat 1s ease-in-out infinite; }
.tm-run.paused .tm-left { opacity: .45; animation: tmBlink 1.2s steps(2) infinite; }
.tm-run.paused .scene * { animation-play-state: paused !important; }
.tm-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }
@keyframes tmBeat { 50% { transform: scale(1.12); } }
@keyframes tmBlink { 50% { opacity: .15; } }

/* ---------- Fin ---------- */
.tm-done { padding: 30px 0; }
.tm-done h2 { margin: 0; font-size: clamp(2rem, 5vw, 3rem); }
.tm-done p { margin: 0; font-size: 1.35rem; }
.tm-done-icon { font-size: 7rem; line-height: 1; animation: tmJump .9s ease-in-out infinite; }
@keyframes tmJump { 0%, 100% { transform: translateY(0) scale(1); } 40% { transform: translateY(-24px) scale(1.08, .95); } 60% { transform: translateY(0) scale(1.05, .92); } }

/* ---------- Scène : dents ---------- */
.scene { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.mouth {
  width: 72%; aspect-ratio: 1.45; border-radius: 45% 45% 50% 50% / 40% 40% 60% 60%; background: #c2185b;
  display: flex; flex-direction: column; justify-content: space-between; padding: 8% 7%; position: relative; box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .15);
}
.teeth-row { display: flex; gap: 3%; justify-content: center; position: relative; z-index: 1; }
.tooth { flex: 1; aspect-ratio: .8; background: #f3e9c6; border-radius: 30% 30% 45% 45%; position: relative; transition: background .4s, box-shadow .4s; }
.teeth-row.bottom .tooth { border-radius: 45% 45% 30% 30%; }
.tooth.cur { background: #fff; box-shadow: 0 0 0 3px #7fdcff; animation: tmScrub .35s ease-in-out infinite alternate; }
.tooth.clean { background: #fff; }
.tooth.clean::after { content: '✨'; position: absolute; top: -55%; left: 50%; transform: translateX(-50%); font-size: .8rem; animation: tmTwinkle 1.4s ease-in-out infinite; }
.teeth-row.bottom .tooth.clean::after { top: auto; bottom: -55%; }
.tongue { position: absolute; left: 25%; right: 25%; bottom: 14%; height: 30%; background: #ff7aa8; border-radius: 50% 50% 40% 40%; }
.brush { position: absolute; font-size: 3.4rem; z-index: 2; transition: top .6s, left .6s; animation: tmBrush .35s ease-in-out infinite alternate; }
.brush[data-z="hd"] { top: 22%; left: 16%; }
.brush[data-z="hg"] { top: 22%; left: 58%; }
.brush[data-z="bg"] { top: 52%; left: 58%; }
.brush[data-z="bd"] { top: 52%; left: 16%; }
.tb-bubble { position: absolute; bottom: 18%; width: 16px; height: 16px; border-radius: 50%; background: rgba(255, 255, 255, .85); border: 2px solid #bfeaff; animation: tmRise 2.4s ease-in infinite; }
.tb-bubble.b1 { left: 22%; } .tb-bubble.b2 { left: 42%; width: 22px; height: 22px; animation-delay: .6s; }
.tb-bubble.b3 { left: 62%; animation-delay: 1.2s; } .tb-bubble.b4 { left: 78%; width: 12px; height: 12px; animation-delay: 1.8s; }
@keyframes tmBrush { from { transform: translateX(-10px) rotate(-8deg); } to { transform: translateX(10px) rotate(8deg); } }
@keyframes tmScrub { to { transform: translateY(-2px); } }
@keyframes tmRise { 0% { transform: translateY(0) scale(.6); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-170px) scale(1.1); opacity: 0; } }
@keyframes tmTwinkle { 50% { opacity: .3; transform: translateX(-50%) scale(.7); } }

/* ---------- Scène : douche ---------- */
.scene-shower { background: linear-gradient(#e3f6ff, #c7ecff); }
.shower-head { position: absolute; top: 6%; left: 50%; transform: translateX(-50%) scaleX(-1); font-size: 3rem; }
.drop { position: absolute; top: 24%; left: var(--x); width: 5px; height: 16px; border-radius: 0 0 6px 6px; background: #3a86ff; opacity: .75; animation: tmDrop .9s linear infinite; animation-delay: var(--d); }
.shower-kid { position: absolute; bottom: 8%; left: 50%; transform: translateX(-50%); font-size: 4.2rem; animation: tmSway 2.2s ease-in-out infinite; }
.soap { position: absolute; font-size: 1.6rem; animation: tmRise 3s ease-in infinite; bottom: 20%; }
.soap.s1 { left: 22%; } .soap.s2 { left: 70%; animation-delay: 1s; } .soap.s3 { left: 46%; animation-delay: 2s; }
@keyframes tmDrop { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: .8; } 100% { transform: translateY(170px); opacity: 0; } }
@keyframes tmSway { 50% { transform: translateX(-50%) rotate(6deg); } }

/* ---------- Scène : autres activités ---------- */
.fun-icon { font-size: 5.5rem; animation: tmJump 1.4s ease-in-out infinite; }
.fun-star { position: absolute; top: 50%; left: 50%; font-size: 1.6rem; animation: tmOrbit 6s linear infinite; }
.fun-star.f2 { animation-delay: -2s; } .fun-star.f3 { animation-delay: -4s; }
@keyframes tmOrbit { from { transform: rotate(0) translateX(95px) rotate(0); } to { transform: rotate(360deg) translateX(95px) rotate(-360deg); } }

@media (prefers-reduced-motion: reduce) {
  .scene *, .tm-done-icon, .timer-card .shop-icon { animation-duration: 4s !important; }
}

/* ---------- Petits écrans ---------- */
@media (max-width: 1000px) { .tm-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .tm-val { font-size: 3.2rem; }
  .tm-step { width: 70px; }
  .brush { font-size: 2.6rem; }
  .fun-star { display: none; }
}
