@font-face { font-family: 'Fraunces'; src: url('../fonts/fraunces-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('../fonts/fraunces-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('../fonts/fraunces-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('../fonts/manrope-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('../fonts/manrope-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('../fonts/manrope-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #F3EADB;
  --paper: #FBF6EE;
  --ink: #2A241D;
  --muted: #7C6F60;
  --line: #E4D6C2;
  --terra: #C2603A;
  --terra-ink: #FFF7EF;
  --sun: #E2A548;
  --leaf: #587A52;
  --ocean: #2E6170;
  --sand: #D8C29F;
  --berry: #93374A;
  --accent: var(--terra);
  --good: #4F7A48;
  --shadow: 0 1px 0 rgba(42, 36, 29, .04), 0 8px 24px -12px rgba(90, 60, 30, .18);
  --radius: 22px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1D1A16;
    --paper: #272320;
    --ink: #F1E8DA;
    --muted: #A8998A;
    --line: #3A342E;
    --terra: #DB7A52;
    --terra-ink: #1D1A16;
    --sun: #E8B261;
    --leaf: #7FA175;
    --ocean: #5C93A2;
    --sand: #B79F7B;
    --berry: #C2607A;
    --good: #8DB884;
    --shadow: 0 8px 24px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
em { font-style: italic; }

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) 18px calc(env(safe-area-inset-bottom) + 110px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
body.no-tabs .view { padding-bottom: calc(env(safe-area-inset-bottom) + 32px); }

.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 8px 2px 6px; }
.top .grow { flex: 1; }
.top h1, .welcome h1, .recipe-hero h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 8vw, 36px);
  line-height: 1.08;
  letter-spacing: -.01em;
  font-weight: 400;
}
.top h1 em, .welcome h1 em { color: var(--terra); }
.kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.kicker::first-letter { text-transform: uppercase; }
.lede { color: var(--muted); font-size: 17px; margin-top: 14px; max-width: 30ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.good { color: var(--good); }

.avatar {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--serif);
  font-size: 20px;
}

.card {
  position: relative;
  overflow: hidden;
  background: var(--paper);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.card-title { font-family: var(--serif); font-size: 21px; line-height: 1.2; }
.card h3 { font-family: var(--serif); font-size: 18px; line-height: 1.25; }
.count { color: var(--muted); font-size: 14px; white-space: nowrap; }
.count strong { color: var(--ink); font-size: 17px; }
.slot {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.spaced { margin-top: 4px; }
.meta { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.section-title { font-family: var(--serif); font-size: 22px; margin-top: 14px; padding: 0 2px; }

.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.inline { width: 15px; height: 15px; vertical-align: -2px; }

.wax {
  position: absolute;
  pointer-events: none;
  background:
    radial-gradient(circle, transparent 0 5px, currentColor 5px 6.5px, transparent 6.5px 10px, currentColor 10px 11px, transparent 11px) 0 0 / 26px 26px,
    radial-gradient(circle, currentColor 0 2px, transparent 2.5px) 13px 13px / 26px 26px;
}
.wax-card {
  color: var(--sun);
  opacity: .22;
  width: 190px; height: 190px;
  right: -60px; top: -70px;
  border-radius: 50%;
}
.wax-hero {
  color: currentColor;
  opacity: .14;
  width: 260px; height: 260px;
  right: -90px; top: -90px;
  border-radius: 50%;
}

.welcome { position: relative; padding: 48px 4px 12px; }
.welcome .wax-hero { color: var(--terra); opacity: .13; right: -110px; top: -40px; }
.welcome > :not(.wax) { position: relative; }

.menu-list { list-style: none; margin: 4px 0 0; padding: 0; position: relative; }
.menu-item { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.menu-item:first-child { border-top: 0; }
.menu-link { flex: 1; display: flex; flex-direction: column; padding: 12px 0; min-width: 0; }
.menu-name { font-size: 16.5px; font-weight: 600; }

.icon-btn {
  width: 44px; height: 44px;
  flex: none;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}
.icon-btn:active { background: var(--line); }
.icon-btn.solid { background: var(--terra); color: var(--terra-ink); }
.icon-btn.solid .ico { stroke-width: 2.2; }

.glasses { display: flex; gap: 4px; }
.glass {
  flex: 1 1 0;
  max-width: 40px;
  aspect-ratio: 3 / 4;
  padding: 4px;
  border: 0;
  background: transparent;
}
.glass svg { width: 100%; height: 100%; }
.glass .g-out { fill: none; stroke: var(--ocean); stroke-width: 1.6; opacity: .45; }
.glass .g-in { fill: var(--ocean); opacity: 0; transition: opacity .2s; }
.glass.full .g-out { opacity: 1; }
.glass.full .g-in { opacity: .85; }
.note { font-size: 14px; }

.move { flex-direction: row; align-items: center; gap: 18px; }
.move-ring { position: relative; width: 84px; height: 84px; flex: none; }
.move-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.move-ring circle { fill: none; stroke-width: 7; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--leaf); stroke-linecap: round; transition: stroke-dashoffset .6s; }
.move-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.move-body { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }

.tip { background: var(--ink); color: var(--bg); }
.tip .slot { color: var(--sun); }
.tip p:not(.slot) { opacity: .88; }
.tip .link { color: var(--sun); }
@media (prefers-color-scheme: dark) {
  .tip { background: #35291F; color: var(--ink); box-shadow: inset 0 0 0 1px #4A3A2C; }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--terra);
  color: var(--terra-ink);
  font-weight: 700;
  font-size: 16px;
}
.btn:active { transform: scale(.98); }
.btn-small { min-height: 40px; padding: 0 18px; font-size: 14.5px; margin-top: 4px; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.link { background: none; border: 0; padding: 6px 0; color: var(--terra); font-weight: 700; font-size: 14.5px; text-align: left; }
.link.danger { color: var(--berry); }

.install { background: var(--paper); border: 1.5px dashed var(--sand); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; font-size: 14.5px; }
.install-actions { display: flex; align-items: center; gap: 16px; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.form { gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend { font-size: 13.5px; font-weight: 600; color: var(--muted); padding: 0; }
input:not([type=radio]):not([type=checkbox]), select {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  font-size: 16px;
  outline: none;
  appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}
input:focus, select:focus { border-color: var(--terra); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }

.choices { display: flex; flex-direction: column; gap: 8px; }
.choice, .chip-check { position: relative; }
.choice input, .chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: block;
  padding: 15px 18px;
  border-radius: 16px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  font-weight: 600;
}
.choice input:checked + span { border-color: var(--terra); background: color-mix(in srgb, var(--terra) 10%, var(--paper)); }
.choice input:focus-visible + span, .chip-check input:focus-visible + span { outline: 2px solid var(--terra); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip, .chip-check span {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  font-size: 14.5px;
  font-weight: 600;
}
.chip.on, .chip-check input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips.mine .link { margin-left: 4px; color: var(--muted); }

.add-row { display: flex; gap: 10px; align-items: center; }
.add-row input { flex: 1; }
.add-row .icon-btn { width: 52px; height: 52px; }

.match { gap: 12px; }
.match-head { display: flex; gap: 14px; align-items: center; }
.swatch {
  width: 52px; height: 52px; flex: none;
  border-radius: 16px;
  display: grid; place-items: center;
  font-family: var(--serif); font-style: italic; font-size: 26px;
  position: relative; overflow: hidden;
}
.bar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--leaf); border-radius: 6px; }

.tone-terra { background: var(--terra); color: #FFF4EA; }
.tone-sun { background: var(--sun); color: #3A2710; }
.tone-leaf { background: var(--leaf); color: #F2F7EE; }
.tone-ocean { background: var(--ocean); color: #EEF7F9; }
.tone-sand { background: var(--sand); color: #3A2D1C; }
.tone-berry { background: var(--berry); color: #FFF0F2; }

.segmented {
  display: flex; gap: 6px;
  overflow-x: auto;
  margin: 0 -18px;
  padding: 2px 18px 4px;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented a {
  flex: none;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--paper);
}
.segmented a.on { background: var(--ink); color: var(--bg); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 6px; }
.tile-art {
  aspect-ratio: 1 / 1.05;
  border-radius: var(--radius);
  display: grid; place-items: center;
  font-family: var(--serif); font-style: italic; font-size: 64px; line-height: 1;
  position: relative; overflow: hidden;
  margin-bottom: 4px;
}
.tile-art::after, .swatch::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .16;
  background:
    radial-gradient(circle, transparent 0 5px, currentColor 5px 6.5px, transparent 6.5px 10px, currentColor 10px 11px, transparent 11px) 0 0 / 26px 26px;
  -webkit-mask: radial-gradient(circle at 100% 0, #000 0 45%, transparent 46%);
  mask: radial-gradient(circle at 100% 0, #000 0 45%, transparent 46%);
}
.tile-art span, .swatch span { position: relative; z-index: 1; }
.tile-name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.tile-fav { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, .85); display: grid; place-items: center; color: var(--berry); }
.tile-fav .ico { width: 17px; height: 17px; fill: currentColor; }

.recipe-hero {
  position: relative; overflow: hidden;
  margin: calc(-20px - env(safe-area-inset-top)) -18px 0;
  padding: calc(env(safe-area-inset-top) + 14px) 22px 28px;
  border-radius: 0 0 32px 32px;
  display: flex; flex-direction: column; gap: 6px;
}
.recipe-hero .kicker { color: inherit; opacity: .75; margin: 22px 0 0; }
.recipe-hero .meta { color: inherit; opacity: .85; margin-top: 6px; }
.hero-bar { display: flex; justify-content: space-between; position: relative; }
.glass-btn { background: rgba(255, 255, 255, .22); color: inherit; }
.glass-btn.fav .ico { fill: currentColor; }

.callout {
  border-left: 3px solid var(--leaf);
  background: color-mix(in srgb, var(--leaf) 9%, var(--paper));
  border-radius: 0 18px 18px 0;
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.callout .slot { color: var(--leaf); }

.ingredients { list-style: none; margin: 0; padding: 0; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
.ingredients li { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--line); }
.ingredients li:first-child { border-top: 0; }
.ingredients .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sand); flex: none; margin: 0 4px; }
.ingredients li.have { color: var(--good); }
.ingredients li.have .ico { width: 15px; height: 15px; stroke-width: 2.4; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; display: flex; flex-direction: column; gap: 16px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; }
.steps li::before {
  content: counter(s);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--terra);
  color: var(--terra);
  font-family: var(--serif);
  font-size: 17px;
}
.steps li { padding-top: 0; line-height: 1.55; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 110px; margin-top: 4px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.day .col { flex: 1; width: 100%; max-width: 26px; background: var(--line); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.day .col span { width: 100%; background: var(--leaf); border-radius: 8px; min-height: 0; }
.day small { font-size: 12px; font-weight: 700; color: var(--muted); }
.day.now small { color: var(--terra); }

.timer { align-items: stretch; }
.clock {
  font-family: var(--serif);
  font-size: 72px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: 1.1;
  padding: 10px 0;
}
.timer-actions { display: flex; gap: 10px; }
.timer-actions .btn { flex: 1; }

.manual summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.manual summary::-webkit-details-marker { display: none; }
.manual summary::after { content: '+'; font-size: 22px; line-height: 1; color: var(--terra); }
.manual[open] summary::after { content: '–'; }
.manual[open] summary { margin-bottom: 14px; }

.history { list-style: none; margin: 0; padding: 0; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--line); font-size: 15px; }
.history li:first-child { border-top: 0; }
.history li span:first-child { font-weight: 600; }

.level { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.level-douce { background: color-mix(in srgb, var(--leaf) 16%, transparent); color: var(--leaf); }
.level-moderee { background: color-mix(in srgb, var(--sun) 22%, transparent); color: color-mix(in srgb, var(--sun) 55%, var(--ink)); }
.level-soutenue { background: color-mix(in srgb, var(--terra) 16%, transparent); color: var(--terra); }
.activity { gap: 8px; }

.soon { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }

.tips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.tips .num { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--terra); }

.chart { width: 100%; height: auto; margin: 4px 0; }
.chart .line { fill: none; stroke: var(--terra); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: color-mix(in srgb, var(--terra) 12%, transparent); stroke: none; }
.chart circle { fill: var(--paper); stroke: var(--terra); stroke-width: 2; }

.file-btn { cursor: pointer; }

.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 520px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px;
  border-radius: 28px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 10px 30px -10px rgba(60, 40, 20, .35), inset 0 0 0 1px var(--line);
  z-index: 10;
}
.tabbar:empty { display: none; }
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px 6px;
  border-radius: 22px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.tabbar a.on { color: var(--terra); background: color-mix(in srgb, var(--terra) 11%, transparent); }

@media (min-width: 520px) {
  .grid { grid-template-columns: 1fr 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
