/* Ronron — styles de base (le vrai design viendra plus tard) */
:root {
  --bg: #FBF7F2; --card: #FFFFFF; --ink: #3E3A4A; --muted: #8A8496; --line: #EEE7DE;
  --accent: #7C6BB0; --accent-soft: #ECE7F7; --sage: #8FB9A8; --sage-soft: #E6F1EC;
  --peach: #F4B9A0; --body: #F3E6DA; --body-line: #E2CFBE;
  --radius: 20px; --shadow: 0 2px 10px rgba(62, 58, 74, .06);
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1E1B26; --card: #2A2634; --ink: #EDE9F5; --muted: #A49DB3; --line: #3A3546;
    --accent: #A897DD; --accent-soft: #3A3350; --sage: #8FB9A8; --sage-soft: #2C3A35;
    --body: #4A4052; --body-line: #5C5066; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.4; }
body { padding: env(safe-area-inset-top) 0 calc(84px + env(safe-area-inset-bottom)); min-height: 100vh; }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.6rem; margin: 8px 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); font-size: .9rem; }
a { color: var(--accent); }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); border: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

button, .btn { font: inherit; border: 0; border-radius: 999px; padding: 12px 18px; background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; }
button.ghost, .btn.ghost { background: var(--accent-soft); color: var(--accent); }
button.plain { background: transparent; color: var(--muted); padding: 8px 12px; }
button.danger { background: #F6E0DC; color: #B0503C; }
button:disabled { opacity: .5; }
button.block, .btn.block { width: 100%; }
button.icon { width: 44px; height: 44px; padding: 0; background: var(--card); color: var(--ink); border: 1px solid var(--line); font-size: 1.2rem; }

input, textarea, select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px; width: 100%; }
textarea { min-height: 110px; resize: vertical; }

/* Barre de date */
.datebar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.datebar .label { text-align: center; flex: 1; font-weight: 600; }
.datebar .label small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }

/* Curseurs du check-in */
.metric { margin: 14px 0; }
.metric .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.metric .val { font-weight: 700; font-size: 1.1rem; min-width: 3ch; text-align: right; }
.metric .val.empty { color: var(--muted); font-weight: 400; font-size: .85rem; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 10px; border-radius: 99px; padding: 0; border: 0;
  background: linear-gradient(90deg, #BFE3C9, #F7E3A1, #F4B9A0, #E58C8C); }
input[type=range].inv { background: linear-gradient(90deg, #E58C8C, #F4B9A0, #F7E3A1, #BFE3C9); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.2); }
input[type=range].unset::-webkit-slider-thumb { border-color: var(--line); background: var(--bg); }
input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 8px 14px; min-height: 40px; font-size: .95rem; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.saved { font-size: .8rem; color: var(--sage); opacity: 0; transition: opacity .3s; }
.saved.show { opacity: 1; }

/* Pastilles de respiration */
.dots { display: flex; gap: 8px; font-size: 1.4rem; }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--sage); }
.dot.on { background: var(--sage); }

/* Onglets du bas */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; align-items: flex-end;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; color: var(--muted); text-decoration: none; padding: 4px 0; }
.tabs a .ico { font-size: 1.35rem; filter: grayscale(1); opacity: .7; }
.tabs a.active { color: var(--accent); font-weight: 600; }
.tabs a.active .ico { filter: none; opacity: 1; }
.tabs a.breathe-tab .ico { width: 54px; height: 54px; margin-top: -26px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--sage), var(--accent)); filter: none; opacity: 1; box-shadow: 0 4px 14px rgba(124,107,176,.35); font-size: 1.6rem; }

/* Segments */
.seg { display: flex; background: var(--accent-soft); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { flex: 1; background: transparent; color: var(--accent); min-height: 38px; padding: 8px; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* Carte du corps */
.bodymap { width: 100%; height: auto; display: block; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.bodymap .silhouette { fill: var(--body); stroke: var(--body-line); stroke-width: 2; }
.bodymap .limb { stroke: var(--body); stroke-linecap: round; fill: none; }
.bodymap .limb-line { stroke: var(--body-line); stroke-linecap: round; fill: none; }
.bodymap .joint { cursor: pointer; }
.bodymap .joint circle.hit { fill: transparent; }
.bodymap .joint circle.dot { stroke: var(--muted); stroke-width: 1.5; fill: var(--card); transition: r .15s; }
.bodymap .joint:hover circle.dot { stroke: var(--accent); stroke-width: 2.5; }
.bodymap .joint circle.ring { fill: none; stroke: #6FA3D9; stroke-width: 2.5; stroke-dasharray: 3 3; }
.bodymap .side { fill: var(--muted); font-size: 13px; font-weight: 600; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; margin-right: 4px; border: 1px solid var(--line); }

/* Feuille du bas (bottom sheet) */
.sheet-bg { position: fixed; inset: 0; background: rgba(30, 27, 38, .35); z-index: 20; animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--card); border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; max-height: 88vh; overflow: auto; animation: up .25s ease-out; }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 12px; }
.big-num { font-size: 2.6rem; font-weight: 700; text-align: center; line-height: 1; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* Journal */
.entry { border-left: 4px solid var(--accent-soft); padding: 4px 0 4px 12px; margin: 10px 0; }
.entry .meta { font-size: .8rem; color: var(--muted); display: flex; justify-content: space-between; }
.entry .text { white-space: pre-wrap; }
.tag { display: inline-block; font-size: .75rem; background: var(--sage-soft); color: var(--ink); border-radius: 99px; padding: 2px 8px; margin: 4px 4px 0 0; }

/* Respirer */
.breathe { position: fixed; inset: 0; z-index: 15; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #E9F3EE, #DCD5EE 70%, #CFC6E8); color: #3E3A4A; padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); }
@media (prefers-color-scheme: dark) { .breathe { background: radial-gradient(circle at 50% 40%, #2E3A36, #2A2540 70%, #1E1B26); color: #EDE9F5; } }
.breathe .stage { position: relative; width: min(80vw, 360px); aspect-ratio: 1; }
.breathe .stage svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.breathe .cue { font-size: 1.8rem; font-weight: 600; margin-top: 24px; min-height: 2.4rem; letter-spacing: .02em; }
.breathe .sub { color: inherit; opacity: .7; margin-top: 4px; }
.breathe .controls { position: absolute; bottom: calc(24px + env(safe-area-inset-bottom)); display: flex; gap: 12px; }
.breathe .controls button { background: rgba(255,255,255,.55); color: #3E3A4A; }
.breathe .close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 16px; background: rgba(255,255,255,.55); color: #3E3A4A; width: 44px; padding: 0; }

/* Suivi */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal div { aspect-ratio: 1; border-radius: 6px; background: var(--line); font-size: .6rem; display: grid; place-items: center; color: rgba(0,0,0,.45); }
.cal .head { background: none; color: var(--muted); font-size: .7rem; aspect-ratio: auto; }
.cal .today { outline: 2px solid var(--accent); }
.bar { height: 10px; border-radius: 9px; background: linear-gradient(90deg, #F7E3A1, #E58C8C); }
.chart { width: 100%; height: 160px; }
.stat { text-align: center; flex: 1; }
.stat b { display: block; font-size: 1.5rem; }

.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 99px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 30; }
.toast.show { opacity: 1; transform: translateX(-50%); }

.login { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 12px; }
.login .cat { font-size: 4rem; }
.login form { width: 100%; max-width: 320px; display: grid; gap: 10px; }
