:root {
  --bg: #fff6f4;
  --bg-2: #ffeceb;
  --card: #ffffff;
  --ink: #4a2c3a;
  --ink-soft: #8a6574;
  --pink: #f4a6bb;
  --pink-deep: #e0698f;
  --rose: #ff8fab;
  --cream: #fff1d6;
  --green: #8fbf8f;
  --green-deep: #5f9a6b;
  --gold: #f2c14e;
  --line: #f5d5db;
  --shadow: 0 10px 30px -12px rgba(224, 105, 143, .35);
  --radius: 22px;
  --font-title: "Fraunces", "Georgia", serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  --bg: #2a1822; --bg-2: #341d29; --card: #3d2330; --ink: #ffe9ef; --ink-soft: #d3a9b8;
  --line: #5a3547; --shadow: 0 10px 30px -12px rgba(0,0,0,.6);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2a1822; --bg-2: #341d29; --card: #3d2330; --ink: #ffe9ef; --ink-soft: #d3a9b8;
    --line: #5a3547; --shadow: 0 10px 30px -12px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg);
  background-image: radial-gradient(circle at 15% 10%, var(--bg-2), transparent 45%),
                    radial-gradient(circle at 90% 90%, var(--bg-2), transparent 40%);
  font-family: var(--font-body); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-title); line-height: 1.15; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 4vw, 2rem); }
a { color: var(--pink-deep); }
img, svg { max-width: 100%; }
.skip { position: absolute; left: -999px; top: 0; background: var(--card); padding: .6rem 1rem; z-index: 100; border-radius: 0 0 12px 0; }
.skip:focus { left: 0; }
:focus-visible { outline: 3px solid var(--pink-deep); outline-offset: 3px; border-radius: 8px; }

.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }

/* header */
.site-header { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; }
.brand { font-family: var(--font-title); font-size: 1.25rem; font-weight: 600; text-decoration: none; color: var(--ink); display: flex; gap: 8px; align-items: center; }
.brand span { color: var(--pink-deep); }
nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; justify-content: flex-end; }
nav a { text-decoration: none; color: var(--ink-soft); padding: 7px 13px; border-radius: 999px; font-weight: 700; font-size: .95rem; display: block; }
nav a:hover { background: var(--bg-2); color: var(--ink); }
nav a[aria-current="page"] { background: var(--pink); color: #5a1d36; }
@media (max-width: 560px) { .brand b { display: none; } nav a { padding: 6px 10px; font-size: .88rem; } }

main { padding-block: 32px 64px; }
.footer { text-align: center; color: var(--ink-soft); font-size: .9rem; padding: 28px 16px 40px; border-top: 1px solid var(--line); }

/* cards & buttons */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.btn { font: inherit; font-weight: 800; border: 0; cursor: pointer; background: var(--pink-deep); color: #fff;
  padding: 12px 22px; border-radius: 999px; box-shadow: 0 6px 0 #b94d70; transition: transform .1s, box-shadow .1s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #b94d70; }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* hero */
.hero { text-align: center; padding-block: 28px 12px; }
.hero .eyebrow { color: var(--pink-deep); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: .8rem; }
.hero h1 em { color: var(--pink-deep); font-style: italic; }
.hero p { color: var(--ink-soft); max-width: 36ch; margin-inline: auto; }
.daily { margin: 28px auto 8px; max-width: 560px; text-align: center; position: relative; }
.daily::before { content: "🩷"; position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 1.6rem; background: var(--bg); border-radius: 50%; padding: 0 6px; }
.daily blockquote { margin: 0; font-family: var(--font-title); font-size: 1.3rem; font-style: italic; }
.daily small { color: var(--ink-soft); display: block; margin-top: 10px; }
.counter { display: inline-flex; gap: 8px; align-items: center; background: var(--cream); color: #7a5a1c; padding: 6px 16px; border-radius: 999px; font-weight: 800; margin-top: 14px; }

.tiles { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 36px; }
.tile { text-decoration: none; color: inherit; display: block; transition: transform .2s; }
.tile:hover { transform: translateY(-5px) rotate(-.4deg); }
.tile .ico { font-size: 2.4rem; display: block; margin-bottom: 6px; }
.tile h3 { margin-bottom: .2em; }
.tile p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.tile.soon { opacity: .65; border-style: dashed; cursor: default; }
.tile.soon:hover { transform: none; }

/* falling petals */
.petals { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.petals i { position: absolute; top: -30px; width: 14px; height: 18px; background: var(--pink); opacity: .55;
  border-radius: 80% 0 80% 0; animation: fall linear infinite; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); } }
main, .site-header, .footer { position: relative; z-index: 1; }
.site-header { z-index: 50; }
@media (prefers-reduced-motion: reduce) { .petals { display: none; } * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* favoris */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 24px; }
.tab { font: inherit; font-weight: 800; border: 2px solid var(--line); background: var(--card); color: var(--ink-soft); padding: 8px 16px; border-radius: 999px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--pink); color: #5a1d36; border-color: var(--pink); }
.favs { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.fav h3 { font-size: 1.15rem; display: flex; gap: 8px; align-items: center; }
.fav ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 7px; }
.chip { background: var(--bg-2); border: 1px solid var(--line); padding: 4px 12px; border-radius: 999px; font-size: .92rem; }
.chip.top { background: var(--pink); border-color: var(--pink); color: #5a1d36; font-weight: 800; }
.chip.no { text-decoration: line-through; opacity: .7; }
.note { color: var(--ink-soft); font-size: .9rem; margin: 10px 0 0; }

/* bucket */
.picker { text-align: center; }
.picker output { display: block; font-family: var(--font-title); font-size: 1.5rem; min-height: 2.6em; margin: 14px 0; }
.bucket-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 24px; }
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.todo input { width: 22px; height: 22px; accent-color: var(--pink-deep); flex: none; }
.todo label { cursor: pointer; flex: 1; }
.todo input:checked + label { text-decoration: line-through; color: var(--ink-soft); }
.progress { height: 12px; background: var(--bg-2); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; border: 1px solid var(--line); }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--pink-deep)); transition: width .4s; }

/* ===== GARDEN GAME ===== */
.game { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .game { grid-template-columns: 1.1fr .9fr; align-items: start; } }
.stats { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: baseline; justify-content: space-between; }
.stats .big { font-family: var(--font-title); font-size: clamp(2rem, 7vw, 3rem); line-height: 1; }
.stats .big small { font-size: .45em; color: var(--ink-soft); font-family: var(--font-body); font-weight: 700; margin-left: 6px; }
.stats .meta { color: var(--ink-soft); font-weight: 700; }
.level { margin-top: 14px; }
.level-top { display: flex; justify-content: space-between; font-weight: 800; font-size: .95rem; }

.field { position: relative; margin-top: 16px; border-radius: var(--radius); overflow: hidden; min-height: 360px;
  background: linear-gradient(#ffe6ee 0%, #fff4e4 55%, #cfe8c4 55.2%, #a9d39e 100%); border: 1px solid var(--line); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
:root[data-theme="dark"] .field { background: linear-gradient(#3a2240 0%, #5a3552 55%, #3f6a4a 55.2%, #2f5339 100%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .field { background: linear-gradient(#3a2240 0%, #5a3552 55%, #3f6a4a 55.2%, #2f5339 100%); } }
.field .sun { position: absolute; top: 14px; right: 18px; width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(#fff3b0, #ffd56b); box-shadow: 0 0 40px #ffe08a; }
.garden-row { position: absolute; left: 0; right: 0; bottom: 8px; display: flex; flex-wrap: wrap-reverse; justify-content: center; gap: 0 2px; padding: 0 10px; max-height: 58%; overflow: hidden; align-content: flex-start; }
.garden-row svg { width: 54px; height: 66px; flex: none; animation: sway 4s ease-in-out infinite; transform-origin: 50% 100%; }
.garden-row svg:nth-child(3n) { animation-delay: -1.3s; } .garden-row svg:nth-child(3n+1) { animation-delay: -2.6s; }
@keyframes sway { 50% { transform: rotate(3deg); } 0%,100% { transform: rotate(-3deg); } }
.garden-row svg.pop { animation: pop .5s ease-out; }
@keyframes pop { from { transform: scale(0) } 70% { transform: scale(1.25) } to { transform: scale(1) } }

.main-flower { position: absolute; left: 50%; top: 40%; width: clamp(150px, 38vw, 200px); transform: translate(-50%, -50%); border: 0; background: none; cursor: pointer; padding: 0; z-index: 2; transition: transform .08s; -webkit-tap-highlight-color: transparent; }
.main-flower:active, .main-flower.press { transform: translate(-50%, -50%) scale(.92); }
.main-flower svg { width: 100%; height: auto; filter: drop-shadow(0 8px 10px rgba(180, 70, 110, .35)); animation: breathe 3.5s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.04) rotate(2deg); } }
.float { position: absolute; z-index: 5; font-weight: 900; color: var(--pink-deep); text-shadow: 0 1px 0 #fff, 0 0 6px #fff; pointer-events: none; animation: up 1s ease-out forwards; font-size: 1.15rem; }
@keyframes up { to { transform: translateY(-70px); opacity: 0; } }
.visitor { position: absolute; z-index: 6; font-size: 2.6rem; border: 0; background: none; cursor: pointer; filter: drop-shadow(0 4px 4px rgba(0,0,0,.25)); animation: walk var(--dur, 9s) linear forwards; bottom: 18px; }
.visitor.left { animation-name: walkL; }
@keyframes walk { from { left: -60px; } to { left: 100%; } }
@keyframes walkL { from { left: 100%; } to { left: -60px; } }
.visitor span { display: block; animation: hop .5s ease-in-out infinite alternate; }
@keyframes hop { to { transform: translateY(-10px); } }
.buff { margin-top: 10px; min-height: 28px; font-weight: 800; color: var(--green-deep); }

.shop h2 { display: flex; justify-content: space-between; align-items: baseline; }
.shop-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.shop-list { display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; text-align: left; font: inherit; color: inherit;
  background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 8px 12px; cursor: pointer; width: 100%; }
.item:hover:not(:disabled) { border-color: var(--pink); transform: translateX(3px); }
.item:disabled { opacity: .55; cursor: not-allowed; }
.item.afford { border-color: var(--pink-deep); background: color-mix(in srgb, var(--pink) 18%, var(--card)); }
.item svg { width: 48px; height: 54px; }
.item .em { font-size: 2rem; text-align: center; }
.item b { display: block; font-size: 1.02rem; }
.item small { color: var(--ink-soft); display: block; line-height: 1.3; }
.item .cost { font-weight: 900; color: var(--pink-deep); white-space: nowrap; text-align: right; }
.item .cost em { display: block; font-style: normal; font-size: .8rem; color: var(--ink-soft); font-weight: 700; }
.item.locked { opacity: .45; filter: grayscale(1); }

.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, calc(100% + 40px)); visibility: hidden; transition: transform .35s cubic-bezier(.3,1.4,.5,1), visibility 0s .35s; background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 18px; z-index: 200; max-width: min(92vw, 460px); text-align: center; font-weight: 700; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.toast.show { transform: translate(-50%, 0); visibility: visible; transition: transform .35s cubic-bezier(.3,1.4,.5,1), visibility 0s; }
dialog { border: 0; border-radius: var(--radius); padding: 26px; max-width: min(92vw, 440px); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(74, 44, 58, .55); backdrop-filter: blur(3px); }
.ach-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ach-list li { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 14px; background: var(--bg-2); }
.ach-list li.off { opacity: .45; filter: grayscale(1); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { .visitor { animation-duration: var(--dur, 9s) !important; } }

/* ===== Focus ===== */
.focus { display: grid; gap: 18px; margin-top: 18px; }
@media (min-width: 860px) { .focus { grid-template-columns: 1.1fr .9fr; align-items: start; } }
.timer { text-align: center; }
.modes { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tab[aria-pressed="true"] { background: var(--pink); color: #5a1d36; border-color: var(--pink); }
.dial { --p: 0deg; position: relative; width: min(300px, 80vw); aspect-ratio: 1; margin: 22px auto; border-radius: 50%;
  background: conic-gradient(var(--pink-deep) var(--p), var(--bg-2) 0); display: grid; place-items: center; }
.dial::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--card); }
.dial-flower { position: absolute; left: 50%; bottom: 17%; width: 46%; transform-origin: 50% 100%; transform: translateX(-50%) scale(.25); transition: transform 1s linear; }
.dial .time { position: absolute; top: 15%; font-family: var(--font-title); font-size: 2.4rem; z-index: 1; font-variant-numeric: tabular-nums; }
.durlabel { display: inline-flex; gap: 10px; align-items: center; margin-top: 14px; font-weight: 700; color: var(--ink-soft); }
select, input[type="text"], .todo-form input { font: inherit; color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.stat { margin: 0 0 8px; }
.bouquet { display: flex; flex-wrap: wrap; gap: 2px; min-height: 40px; }
.bq svg { width: 38px; height: 46px; }
.todo-form { display: flex; gap: 8px; margin-bottom: 8px; }
.todo-form input { flex: 1; min-width: 0; }
.todo-form .btn { padding: 8px 18px; box-shadow: 0 4px 0 #b94d70; }
.icon-btn { border: 0; background: none; color: var(--ink-soft); cursor: pointer; font-size: 1rem; padding: 6px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--bg-2); color: var(--pink-deep); }

/* ===== Miam ===== */
.menu { text-align: center; margin-top: 18px; }
.options { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-bottom: 18px; font-weight: 700; }
.options input { accent-color: var(--pink-deep); width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; }
.slots { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 14px; }
.slot { background: var(--bg-2); border: 2px dashed var(--line); border-radius: 20px; padding: 16px 12px; cursor: pointer; min-height: 130px; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: transform .15s, border-color .15s; }
.slot:hover { border-color: var(--pink); transform: translateY(-3px); }
.slot[hidden] { display: none; }
.slot-ico { font-size: 2rem; }
.slot small { color: var(--ink-soft); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }
.slot b { font-family: var(--font-title); font-size: 1.15rem; line-height: 1.25; }
.slot.spinning b { opacity: .5; filter: blur(.6px); }
.cheese { color: #a8761a; font-weight: 800; margin: 0 0 14px; }

/* ===== Téléphone ===== */
/* Sur écran tactile, pas d'effet de survol qui reste « collé » après un tap. */
@media (hover: none) {
  .tile:hover, .slot:hover, .btn:hover, .item:hover:not(:disabled) { transform: none; }
  a, button, label, .slot { -webkit-tap-highlight-color: transparent; }
}
.site-header { padding-top: env(safe-area-inset-top); }

@media (max-width: 640px) {
  .wrap { width: calc(100% - 24px); }
  main { padding-block: 20px 40px; }
  .card { padding: 18px 16px; }

  /* En-tête : juste le nom, centré. Le menu part en barre d'onglets en bas, sous le pouce. */
  /* Le flou de l'en-tête rattacherait la barre fixe à l'en-tête au lieu de l'écran : on le retire ici. */
  .site-header { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
  .site-header .wrap { justify-content: center; padding-block: 12px; }
  .brand b { display: inline; }
  .site-header nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: color-mix(in srgb, var(--card) 90%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  nav ul { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; }
  nav a { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 5px; min-height: 52px;
    font-size: .64rem; border-radius: 14px; color: var(--ink-soft); }
  nav a::before { font-size: 1.35rem; line-height: 1.1; }
  nav a[href="index.html"]::before { content: "🏡"; }
  nav a[href="jeux.html"]::before { content: "🎲"; }
  nav a[href="jardin.html"]::before { content: "🌷"; }
  nav a[href="favoris.html"]::before { content: "💖"; }
  nav a[href="sorties.html"]::before { content: "✨"; }
  nav a[href="focus.html"]::before { content: "⏳"; }
  nav a[href="miam.html"]::before { content: "🍽️"; }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }

  /* Jardin : le grand bouton sur toute la largeur, les deux autres côte à côte. */
  .row-actions .btn { flex: 1 1 130px; padding-inline: 14px; white-space: nowrap; }
  #season { white-space: normal; }
  .row-actions .btn:first-child:not(:only-of-type) { flex-basis: 100%; }
  .field { min-height: 320px; }
  .item { grid-template-columns: 44px 1fr auto; gap: 10px; padding: 8px 10px; }
  .item svg { width: 40px; height: 46px; }

  /* Miam : les cases deux par deux au lieu d'une longue colonne. */
  .slots { display: flex; flex-wrap: wrap; }
  .slot { flex: 1 1 140px; min-height: 108px; padding: 12px 8px; }
  .slot-ico { font-size: 1.7rem; }
  .options { gap: 6px 14px; }
  .options label { padding: 6px 0; }

  .tiles { gap: 12px; margin-top: 24px; }
  /* Favoris : les fleurs deux par deux. */
  #flowers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 10px; }
  #flowers .fav h3 { font-size: 1rem; }
  #flowers .fav .note { font-size: .82rem; margin-top: 2px; }
  #flowers .fav > div:first-child { width: 72px !important; }
  .dial .time { font-size: 2.1rem; }
  dialog { padding: 20px; }
}

/* Zones tactiles >= 44 px (cases à cocher : tout le libellé est cliquable) */
.tab, .brand { min-height: 44px; }
.tab { display: inline-flex; align-items: center; justify-content: center; }
.options label, .todo label { display: inline-flex; align-items: center; min-height: 44px; }
.todo li { min-height: 44px; display: flex; align-items: center; gap: 10px; }
