:root {
  --bg: #fff5f7;
  --rose: #ffd6e0;
  --rose-deep: #f27a9b;
  --rouge: #e0496f;
  --text: #5a2b3a;
  --muted: #a8788a;
  --radius: 28px;
  --shadow: 0 10px 30px rgba(224, 73, 111, 0.15);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: linear-gradient(160deg, #fff5f7 0%, #ffe3ea 100%) fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.app { max-width: 720px; margin: 0 auto; padding: 20px 16px 40px; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 14px; color: var(--rouge); }
.muted { color: var(--muted); }
.error { color: var(--rouge); }
.card {
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-top: 20px;
}
.top, .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row h2 { margin: 0; }
button, .btn {
  font: inherit; border: 0; cursor: pointer; display: inline-block; text-align: center;
  background: var(--rose-deep); color: #fff; text-decoration: none;
  padding: 12px 22px; border-radius: 999px;
}
button:hover, .btn:hover { background: var(--rouge); }
button.link { background: transparent; color: var(--muted); padding: 6px 10px; }
.pill {
  font-size: 0.85rem; color: var(--rouge); text-decoration: none;
  background: var(--rose); padding: 8px 14px; border-radius: 999px;
}
.flash { margin: 16px 0 0; padding: 12px 16px; border-radius: 18px; background: var(--rose); }
.flash.error { color: var(--rouge); }
.login { max-width: 380px; margin: 14vh auto 0; text-align: center; }
.login form { display: grid; gap: 14px; margin-top: 18px; text-align: left; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 0.9rem; }
input {
  font: inherit; color: var(--text);
  border: 2px solid var(--rose); border-radius: 16px;
  padding: 12px 14px; background: #fff; outline: none;
}
input:focus { border-color: var(--rose-deep); }

/* Compteurs : les slides sont empilées dans une même case, animées depuis le côté choisi */
.counter { user-select: none; -webkit-user-select: none; }
.viewport { display: grid; overflow: hidden; border-radius: 20px; touch-action: pan-y; cursor: pointer; }
.slide { grid-area: 1 / 1; visibility: hidden; text-align: center; padding: 8px 4px; }
.slide.active { visibility: visible; }
.slide .emoji { font-size: 2.2rem; }
.slide h2 { margin: 6px 0 18px; font-weight: 600; }
.units { display: flex; justify-content: center; gap: 10px; }
.unit { background: var(--rose); border-radius: 20px; padding: 12px 6px; min-width: 64px; }
.unit b { display: block; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.unit span { font-size: 0.75rem; color: var(--muted); }
.done { font-size: 1.4rem; padding: 20px 0; }
.dots { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rose); border: 0; padding: 0; }
.dot:hover { background: var(--rose-deep); }
.dot.active { background: var(--rouge); }
@media (min-width: 600px) { .unit { min-width: 84px; } .unit b { font-size: 2.2rem; } }

/* Outfits */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.tile { margin: 0; }
.tile img, .tile .empty {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block;
  border-radius: 22px; background: var(--rose);
}
.tile .empty { display: grid; place-items: center; font-size: 2.2rem; color: var(--muted); }
.tile figcaption { text-align: center; font-size: 0.85rem; color: var(--muted); margin-top: 8px; }
form#upload-form .btn { width: 100%; }

/* Visionneuse */
.tile img.zoomable { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(60, 20, 35, 0.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 16px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: calc(100% - 80px); object-fit: contain; border-radius: 16px; }
.lb-actions { display: flex; gap: 12px; padding-bottom: env(safe-area-inset-bottom); }
.lb-close { background: rgba(255, 255, 255, 0.2); }

/* Accueil : liens */
.links { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.linkcard {
  display: grid; gap: 4px; text-decoration: none; color: var(--text);
  background: var(--rose); border-radius: 22px; padding: 16px;
}
.linkcard span { font-size: 1.6rem; }
.linkcard small { color: var(--muted); }

/* Questions et quiz */
.small { font-size: 0.85rem; }
.bigq { font-size: 1.25rem; line-height: 1.4; margin: 0 0 18px; color: var(--rouge); font-weight: 600; }
.stack { display: grid; gap: 12px; }
textarea {
  font: inherit; color: var(--text); width: 100%; resize: vertical;
  border: 2px solid var(--rose); border-radius: 18px; padding: 14px; background: #fff; outline: none;
}
textarea:focus { border-color: var(--rose-deep); }
.answer { background: #fff; border-radius: 20px; padding: 14px 16px; margin-top: 12px; }
.answer.mine { background: var(--rose); }
.answer p { margin: 6px 0 0; line-height: 1.5; }
fieldset.qz { border: 0; margin-left: 0; margin-right: 0; }
fieldset.qz legend { font-weight: 600; padding: 0; margin-bottom: 12px; float: left; width: 100%; }
fieldset.qz .opt { clear: both; }
.opt { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-top: 8px; border-radius: 18px; background: #fff; color: var(--text); font-size: 1rem; cursor: pointer; }
.opt input { accent-color: var(--rouge); }
.opt:has(input:checked) { background: var(--rose); }
details.score { background: var(--rose); border-radius: 20px; padding: 14px 16px; margin-top: 12px; }
details.score summary { font-weight: 600; font-size: 1.1rem; cursor: pointer; }
ul.detail { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
ul.detail li { background: #fff; border-radius: 16px; padding: 12px 14px; line-height: 1.4; }

/* Étape 4 */
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; }
button.ghost { background: transparent; color: var(--muted); border: 2px solid var(--rose); }
button.ghost:hover { background: var(--rose); color: var(--text); }
.sect { margin: 28px 4px 0; }
.links { grid-template-columns: 1fr 1fr; }
details.addbox summary { cursor: pointer; font-weight: 600; color: var(--rouge); }
details.addbox form { margin-top: 16px; }
.memory img { width: 100%; max-height: 420px; object-fit: cover; border-radius: 22px; display: block; margin-bottom: 14px; cursor: zoom-in; }
.memory h2 { margin-bottom: 4px; }
.memory p { line-height: 1.5; }
.scale { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: block; }
.chip input[type="radio"] { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; cursor: pointer; }
.chip span {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--rose); color: var(--text); font-weight: 600;
}
.chip:has(input:checked) span { background: var(--rouge); color: #fff; }
.chip:has(input:focus-visible) span { outline: 3px solid var(--rose-deep); }

/* Étape 5 : accueil réorganisé, calepin, photos de semaine */
.daily-view { cursor: default; }
.dslide { text-align: left; padding: 4px 0; }
.center { text-align: center; }
/* Encart quotidien : onglets + panneau entourés d'un même cadre rouge */
.daily { margin-top: 20px; }
.tabs { display: flex; gap: 6px; position: relative; z-index: 1; }
.tab {
  flex: 1; position: relative; font-size: 0.95rem; font-weight: 600; padding: 14px 8px;
  background: var(--rose); color: var(--muted);
  border: 2px solid transparent; border-bottom: 0; border-radius: 20px 20px 0 0;
}
.tab:hover { background: var(--rose); color: var(--rouge); }
.tab.active {
  background: #fff; color: var(--rouge); border-color: var(--rouge);
  margin-bottom: -2px; padding-bottom: 16px;
}
.badge {
  display: inline-block; width: 9px; height: 9px; margin-left: 6px; border-radius: 50%;
  background: var(--rouge); vertical-align: middle;
}
.tab.active .badge { background: var(--rose-deep); }
.panel {
  background: #fff; border: 2px solid var(--rouge); border-radius: 22px; padding: 18px;
  box-shadow: var(--shadow);
}
.daily:has(.tab:first-child.active) .panel { border-top-left-radius: 0; }
.daily:has(.tab:last-child.active) .panel { border-top-right-radius: 0; }
.status { margin: -6px 0 14px; color: var(--muted); font-size: 0.9rem; }
.block { display: block; width: 100%; }
.stack .block + .block { margin-top: 0; }
#qtext { min-height: 110px; }
a.linkrow, .linkrow {
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text);
}
a.card.linkrow:hover { background: #fff; }
.linkrow .ico { font-size: 1.8rem; }
.linkrow b { display: block; }
.linkrow small { display: block; color: var(--muted); margin-top: 2px; }
.linkrow.inner { background: var(--rose); border-radius: 22px; padding: 16px; }
.sketchprev, .sketch img {
  width: 100%; border-radius: 22px; display: block; background: #fffdf9; border: 2px solid var(--rose);
}
.sketch img { cursor: zoom-in; margin-bottom: 8px; }
#pad {
  width: 100%; height: auto; display: block; touch-action: none; cursor: crosshair;
  background: #fffdf9; border: 2px solid var(--rose); border-radius: 22px;
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
}
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.swatch { width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--rose); }
.swatch:hover { opacity: 0.85; }
.swatch.active { box-shadow: 0 0 0 3px var(--text); }
.size { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; background: var(--rose); border-radius: 50%; }
.size i { display: block; background: var(--text); border-radius: 50%; }
.size.active { background: var(--rose-deep); }
.tool { padding: 8px 14px; background: var(--rose); color: var(--text); font-size: 0.9rem; }
.tool:hover { background: var(--rose-deep); color: #fff; }
.tool.active { background: var(--rouge); color: #fff; }
.send { width: 100%; margin-top: 16px; }
.photogrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.photogrid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 16px; cursor: zoom-in; display: block; }

/* Calepin : styles et fonds */
.toolbar .label { font-size: 0.8rem; color: var(--muted); margin-right: 2px; }
.brush { padding: 8px 14px; background: var(--rose); color: var(--text); font-size: 0.9rem; }
.brush:hover { background: var(--rose-deep); color: #fff; }
.brush.active { background: var(--rouge); color: #fff; }
.bgsw { width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--rose); }
.bgsw.active { box-shadow: 0 0 0 3px var(--text); }
.swatch.neon { box-shadow: 0 0 10px 2px currentColor, 0 0 0 2px var(--rose); }

/* Anti-débordement sur téléphone */
.card, .answer, .stack, .stack > *, label, fieldset { min-width: 0; }
.answer p, .bigq, .card p { overflow-wrap: anywhere; }
input[type="text"], input[type="date"], input[type="file"], textarea { width: 100%; max-width: 100%; min-width: 0; }
input[type="file"] { padding: 10px; font-size: 0.85rem; background: #fff; }
input[type="date"] { -webkit-appearance: none; appearance: none; min-height: 48px; }
input[type="radio"], input[type="checkbox"] { width: auto; padding: 0; border: 0; }
html, body { overflow-x: hidden; }
