/* =========================================================
   ALMANAC — a daily ritual of intention & evidence
   Aesthetic: warm editorial almanac · paper & ink
   Display: Fraunces · Body: Spectral
   Two themes: dawn (warm light) · dusk (deep calm)
   ========================================================= */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* the hidden attribute must always win over class-level `display` rules
   (overlays/modals below set display:grid, which would otherwise override it) */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100svh; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
input:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px;
}
ul { list-style: none; }
::selection { background: var(--accent); color: var(--paper); }

/* ---------- theme tokens ---------- */
:root {
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Spectral", Georgia, serif;
  --maxw: 36rem;
  --ease: cubic-bezier(.2,.7,.2,1);
  --radius: 18px;
}

html[data-theme="dawn"] {
  --paper:      #f1e6d1;
  --paper-2:    #ead9bd;
  --surface:    #fbf4e6;
  --surface-2:  #f6ecd8;
  --ink:        #2c2317;
  --ink-soft:   #6f6049;
  --ink-faint:  #9a8a70;
  --accent:     #bf4d28;   /* terracotta */
  --accent-2:   #d99036;   /* amber */
  --line:       rgba(44,35,23,.16);
  --line-soft:  rgba(44,35,23,.08);
  --shadow:     22px 30px 60px -34px rgba(60,40,18,.55);
  --shadow-sm:  8px 12px 26px -16px rgba(60,40,18,.5);
  --orb:        radial-gradient(circle at 50% 50%, rgba(225,150,55,.55), rgba(225,150,55,0) 62%);
  --orb-pos:    78% -8%;
  --grain-op:   .05;
}

html[data-theme="dusk"] {
  --paper:      #14131d;
  --paper-2:    #100f18;
  --surface:    #1e1c2a;
  --surface-2:  #24222f;
  --ink:        #ede3cf;
  --ink-soft:   #a99f8c;
  --ink-faint:  #756b5e;
  --accent:     #e2a85a;   /* candle gold */
  --accent-2:   #9a8bd0;   /* dusk lavender */
  --line:       rgba(237,227,207,.15);
  --line-soft:  rgba(237,227,207,.07);
  --shadow:     22px 34px 70px -32px rgba(0,0,0,.7);
  --shadow-sm:  8px 14px 30px -16px rgba(0,0,0,.65);
  --orb:        radial-gradient(circle at 50% 50%, rgba(154,139,208,.4), rgba(154,139,208,0) 60%);
  --orb-pos:    16% -10%;
  --grain-op:   .08;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(120% 80% at 50% -20%, var(--surface-2), transparent 60%),
    linear-gradient(180deg, var(--paper), var(--paper-2));
  background-attachment: fixed;
  line-height: 1.5;
  transition: background-color .7s var(--ease), color .7s var(--ease);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- atmosphere ---------- */
.atmosphere { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb {
  position: absolute; width: 75vmax; height: 75vmax; left: var(--orb-pos);
  top: -20vmax; background: var(--orb);
  transition: background .8s var(--ease); filter: blur(4px);
  animation: drift 26s ease-in-out infinite alternate;
}
.vignette { position: absolute; inset: 0; box-shadow: inset 0 0 22vmax -6vmax rgba(0,0,0,.32); }
@keyframes drift { to { transform: translate3d(-3vmax, 3vmax, 0) scale(1.05); } }

.grain {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 1; pointer-events: none; opacity: var(--grain-op);
  mix-blend-mode: overlay;
}

/* =========================================================
   shared atoms
   ========================================================= */
.kicker {
  font-family: var(--font-body);
  font-size: .68rem; font-weight: 500;
  letter-spacing: .26em; text-transform: uppercase;
  color: var(--accent);
}
.ink-accent { color: var(--accent); font-style: italic; }

.btn-primary {
  font-family: var(--font-display);
  font-size: .98rem; font-weight: 500; letter-spacing: .01em;
  color: var(--paper); background: var(--ink);
  padding: .72em 1.4em; border-radius: 100px;
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), background .3s, box-shadow .3s;
}
.btn-primary:hover { transform: translateY(-2px); background: var(--accent); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  font-family: var(--font-display); font-size: .95rem;
  color: var(--ink-soft); padding: .72em 1.1em; border-radius: 100px;
  border: 1px solid var(--line); transition: border-color .3s, color .3s, background .3s;
}
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-soft); background: var(--surface); }

.link-toggle {
  font-family: var(--font-body); font-style: italic; font-size: .9rem;
  color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-thickness: 1px; padding: 2px 0;
}
.link-toggle:hover { color: var(--ink); }

/* =========================================================
   ONBOARDING
   ========================================================= */
.onboarding {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: 7vh 1.4rem;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--surface-2), transparent 55%),
    linear-gradient(180deg, var(--paper), var(--paper-2));
}
.onboard-stage { width: 100%; max-width: 30rem; text-align: center; position: relative; z-index: 2; }
.onboard-rail { display: flex; gap: .5rem; justify-content: center; margin-bottom: 3.5rem; }
.onboard-rail .dot {
  width: 7px; height: 7px; border-radius: 50%;
  border: 1px solid var(--accent); transition: all .4s var(--ease);
}
.onboard-rail .dot.is-active { background: var(--accent); transform: scale(1.25); }

.onboard-screen { display: none; animation: riseIn .7s var(--ease) both; }
.onboard-screen.is-active { display: block; }
.onboard-mark { font-size: 2.4rem; color: var(--accent); margin-bottom: 1.4rem; line-height: 1; }
.onboard-title {
  font-family: var(--font-display);
  font-optical-sizing: auto; font-weight: 340;
  font-size: clamp(2.4rem, 11vw, 3.6rem); line-height: .98;
  letter-spacing: -.02em; margin-bottom: 1.4rem;
}
.onboard-title em { font-style: italic; color: var(--accent); font-weight: 380; }
.onboard-body {
  font-size: 1.08rem; color: var(--ink-soft); line-height: 1.65;
  max-width: 26rem; margin: 0 auto;
}
.onboard-body strong { color: var(--ink); font-weight: 600; }
.onboard-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 3.5rem;
}

/* =========================================================
   MASTHEAD
   ========================================================= */
.app { position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto;
  padding: max(2rem, env(safe-area-inset-top)) 1.3rem calc(6.5rem + env(safe-area-inset-bottom)); }

.masthead { padding-top: .5rem; }
.masthead-row { display: flex; align-items: center; justify-content: space-between; }
.masthead-brand { display: flex; align-items: baseline; gap: .55rem; }
.brand-ornament { color: var(--accent); font-size: 1rem; }
.brand-name {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.55rem; letter-spacing: .02em;
}
.theme-toggle {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); display: grid; place-items: center;
  font-size: 1.1rem; color: var(--accent);
  transition: border-color .3s, transform .5s var(--ease), background .3s;
}
.theme-toggle:hover { border-color: var(--accent); transform: rotate(28deg); background: var(--surface); }
.tt-dawn { display: none; } .tt-dusk { display: none; }
html[data-theme="dawn"] .tt-dusk { display: block; }
html[data-theme="dusk"] .tt-dawn { display: block; }

.masthead-rule { display: flex; flex-direction: column; gap: 3px; margin: 1rem 0 .8rem; }
.masthead-rule span { height: 1px; background: var(--line); }
.masthead-rule span:last-child { opacity: .5; }
.masthead-date {
  font-family: var(--font-body); font-style: italic;
  color: var(--ink-soft); font-size: .98rem; letter-spacing: .01em;
}

/* =========================================================
   VIEWS
   ========================================================= */
.view { display: none; padding-top: 1.8rem; }
.view.is-active { display: block; }
.view-head { margin-bottom: 1.6rem; }
.view-title {
  font-family: var(--font-display); font-weight: 360;
  font-size: clamp(1.9rem, 7.5vw, 2.5rem); line-height: 1.04;
  letter-spacing: -.02em; margin-top: .3rem;
}

/* ---------- reveal animation ---------- */
.reveal { animation: riseIn .8s var(--ease) both; animation-delay: calc(var(--d, 0) * .12s + .05s); }
@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* =========================================================
   TODAY — ritual cards + connecting loop
   ========================================================= */
.today-thread { position: relative; padding-top: 1.4rem; }

.ritual {
  position: relative; background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 1.5rem 1.4rem 1.6rem; box-shadow: var(--shadow);
  overflow: hidden;
}
.ritual::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: .85;
}
.ritual--evening { background: var(--surface-2); }
.ritual-head { display: flex; gap: .9rem; align-items: flex-start; margin-bottom: 1.2rem; }
.ritual-glyph {
  font-size: 1.5rem; color: var(--accent); line-height: 1;
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
}
.ritual-title {
  font-family: var(--font-display); font-weight: 380;
  font-size: 1.4rem; line-height: 1.05; letter-spacing: -.01em; margin-top: .2rem;
}

/* connecting seal between the two rituals */
.loop-seal {
  position: relative; height: 56px; display: grid; place-items: center; margin: -2px 0;
}
.loop-seal::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
  width: 0; border-left: 2px dotted var(--line);
}
.loop-seal span {
  position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; color: var(--paper);
  background: var(--accent); box-shadow: var(--shadow-sm);
  font-size: .9rem; transform: rotate(-8deg);
}

/* ---------- intention display ---------- */
.intention {
  font-family: var(--font-display); font-weight: 340;
  font-size: 1.45rem; line-height: 1.34; letter-spacing: -.012em;
}
.intention .seg-who { font-style: italic; color: var(--accent); }
.intention .seg-fixed { color: var(--ink-soft); }
.intention .drop { float: left; font-size: 3.1rem; line-height: .8; padding: .06em .12em 0 0;
  color: var(--accent); font-weight: 500; font-style: normal; }

.intention-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; }
.intention-trans {
  margin-top: .8rem; font-style: italic; color: var(--ink-soft); font-size: 1rem;
  padding-left: .9rem; border-left: 2px solid var(--line);
}

.ritual-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.3rem; }
.pill {
  font-family: var(--font-body); font-size: .85rem; letter-spacing: .02em;
  padding: .5em 1em; border-radius: 100px; border: 1px solid var(--line);
  color: var(--ink-soft); transition: all .25s var(--ease); display: inline-flex; gap: .4rem; align-items: center;
}
.pill:hover { border-color: var(--accent); color: var(--ink); }
.pill.is-on { background: var(--accent); border-color: var(--accent); color: var(--paper); }

/* identity switcher chips */
.id-switch { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.id-chip {
  font-size: .85rem; padding: .45em .9em; border-radius: 100px;
  border: 1px solid var(--line); color: var(--ink-soft);
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: all .25s var(--ease);
}
.id-chip:hover { border-color: var(--accent); color: var(--ink); }
.id-chip.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.id-chip--add { border-style: dashed; color: var(--accent); }

/* empty states */
.empty {
  text-align: center; padding: 1.2rem .5rem;
}
.empty p { color: var(--ink-soft); font-style: italic; margin-bottom: 1.1rem; line-height: 1.55; }

/* ---------- evening wins ---------- */
.wins-list { display: flex; flex-direction: column; gap: .7rem; }
.win-row {
  display: flex; gap: .7rem; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: .15rem .15rem .15rem .9rem;
  transition: border-color .25s;
}
.win-row:focus-within { border-color: var(--accent); }
.win-num {
  font-family: var(--font-display); font-style: italic; color: var(--accent-2);
  font-size: 1.05rem; padding-top: .65rem; width: 1rem; flex: none; text-align: center;
}
.win-input {
  flex: 1; background: none; border: none; padding: .7rem .2rem; font-size: 1rem;
  line-height: 1.4;
}
.win-input::placeholder { color: var(--ink-faint); font-style: italic; }
.win-tagbtn {
  align-self: stretch; padding: 0 .85rem; font-size: .72rem; letter-spacing: .04em;
  color: var(--ink-faint); border-left: 1px solid var(--line-soft); white-space: nowrap;
  display: flex; align-items: center; gap: .3rem; transition: color .25s;
}
.win-tagbtn:hover { color: var(--accent); }
.win-tagbtn.is-tagged { color: var(--accent); }
.win-del { padding: 0 .8rem; color: var(--ink-faint); font-size: 1rem; align-self: stretch; }
.win-del:hover { color: var(--accent); }

.win-tagmenu {
  display: flex; flex-wrap: wrap; gap: .4rem; padding: .2rem 0 .4rem 1.9rem;
}
.tag-opt {
  font-size: .78rem; padding: .35em .8em; border-radius: 100px;
  border: 1px solid var(--line); color: var(--ink-soft); transition: all .2s;
}
.tag-opt:hover, .tag-opt.is-on { background: var(--accent); border-color: var(--accent); color: var(--paper); }

.win-add {
  align-self: flex-start; margin-top: .3rem;
  font-family: var(--font-body); font-style: italic; color: var(--accent);
  display: inline-flex; gap: .4rem; align-items: center; font-size: .95rem;
}
.win-add:hover { color: var(--ink); }
.wins-floor { font-size: .85rem; color: var(--ink-soft); font-style: italic; margin-top: 1rem; line-height: 1.5; }

/* closed-loop badge on a logged win */
.loop-closed {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem;
  color: var(--accent); font-style: italic; margin-top: .1rem;
}
.loop-closed::before { content: "❋"; font-style: normal; }

/* =========================================================
   TIMELINE
   ========================================================= */
.calendar {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 1.2rem 1.1rem 1.4rem; box-shadow: var(--shadow-sm);
  margin-bottom: 1.8rem;
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.cal-month { font-family: var(--font-display); font-size: 1.2rem; font-weight: 400; }
.cal-nav { display: flex; gap: .3rem; }
.cal-nav button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  color: var(--ink-soft); transition: all .25s; }
.cal-nav button:hover { border-color: var(--accent); color: var(--accent); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint);
  text-align: center; padding-bottom: .4rem; }
.cal-cell {
  aspect-ratio: 1; border-radius: 9px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; position: relative;
  font-size: .8rem; color: var(--ink-soft); transition: background .25s, color .25s;
}
.cal-cell.is-empty { visibility: hidden; }
.cal-cell.has-wins { color: var(--ink); cursor: pointer; }
.cal-cell.has-wins:hover { background: var(--surface-2); }
.cal-cell.is-today { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--ink); }
.cal-dots { display: flex; gap: 2px; height: 5px; }
.cal-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.cal-cell.has-intent::after {
  content: ""; position: absolute; top: 5px; right: 5px; width: 5px; height: 5px;
  border-radius: 50%; background: var(--accent-2);
}

/* timeline entries */
.timeline-list { display: flex; flex-direction: column; gap: 1.3rem; }
.tl-day {
  border-left: 2px solid var(--line); padding-left: 1.2rem; position: relative;
}
.tl-day::before {
  content: "❋"; position: absolute; left: -.72rem; top: -.1rem; font-size: .75rem;
  color: var(--accent); background: var(--paper); padding: 2px 0;
}
.tl-date { font-family: var(--font-display); font-size: 1.05rem; font-weight: 400; margin-bottom: .2rem; }
.tl-intent { font-style: italic; color: var(--ink-soft); font-size: .95rem; margin-bottom: .7rem; line-height: 1.45; }
.tl-intent b { color: var(--accent); font-weight: 500; font-style: normal; }
.tl-wins { display: flex; flex-direction: column; gap: .45rem; }
.tl-win { display: flex; gap: .55rem; align-items: baseline; font-size: 1rem; line-height: 1.4; }
.tl-win::before { content: "—"; color: var(--accent-2); flex: none; }
.tl-win .tag { font-size: .72rem; color: var(--accent); font-style: italic; margin-left: .3rem; white-space: nowrap; }

/* =========================================================
   IDENTITIES
   ========================================================= */
.identity-list { display: flex; flex-direction: column; gap: 1.1rem; }
.identity-card {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 1.3rem 1.3rem 1.1rem; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.identity-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.identity-statement {
  font-family: var(--font-display); font-weight: 340; font-size: 1.2rem; line-height: 1.32;
  letter-spacing: -.01em; margin-bottom: .9rem;
}
.identity-statement .seg-who { font-style: italic; color: var(--accent); }
.identity-statement .seg-fixed { color: var(--ink-soft); }
.identity-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-top: .9rem; border-top: 1px solid var(--line-soft); }
.identity-count { font-style: italic; color: var(--ink-soft); font-size: .92rem; }
.identity-count b { color: var(--accent); font-style: normal; font-weight: 600; font-size: 1.1rem; }
.identity-actions { display: flex; gap: .4rem; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  color: var(--ink-soft); display: grid; place-items: center; font-size: .85rem; transition: all .25s; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.evidence { margin-top: .9rem; display: none; flex-direction: column; gap: .5rem; }
.evidence.is-open { display: flex; animation: riseIn .5s var(--ease) both; }
.evidence-item { display: flex; gap: .55rem; align-items: baseline; font-size: .96rem; color: var(--ink); }
.evidence-item::before { content: "✓"; color: var(--accent); flex: none; font-size: .85rem; }
.evidence-item time { color: var(--ink-faint); font-size: .78rem; font-style: italic; margin-left: auto; white-space: nowrap; }
.evidence-empty { font-style: italic; color: var(--ink-faint); font-size: .9rem; }

.add-identity-btn {
  width: 100%; padding: 1.1rem; border: 1.5px dashed var(--line); border-radius: var(--radius);
  color: var(--accent); font-family: var(--font-display); font-size: 1.05rem;
  transition: all .25s; background: var(--surface);
}
.add-identity-btn:hover { border-color: var(--accent); background: var(--surface-2); }

/* =========================================================
   WEEK
   ========================================================= */
.week-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-bottom: 1.6rem; }
.stat {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 14px;
  padding: 1.1rem .6rem; text-align: center; box-shadow: var(--shadow-sm);
}
.stat-num { font-family: var(--font-display); font-size: 2rem; font-weight: 380; color: var(--accent); line-height: 1; }
.stat-label { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); margin-top: .5rem; }

.week-section { margin-bottom: 1.8rem; }
.week-section h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.15rem; margin-bottom: .8rem; }
.week-wins { display: flex; flex-direction: column; gap: .5rem; }
.week-win { display: flex; gap: .55rem; align-items: baseline; font-size: 1rem; line-height: 1.4; }
.week-win::before { content: "❋"; color: var(--accent); font-size: .7rem; flex: none; }

.reflect-box {
  width: 100%; min-height: 7rem; resize: vertical; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem;
  font-size: 1.02rem; line-height: 1.55; font-style: italic; color: var(--ink);
}
.reflect-box::placeholder { color: var(--ink-faint); }
.week-share { margin-top: 1.4rem; display: flex; justify-content: center; }

.week-empty { text-align: center; padding: 2rem 1rem; color: var(--ink-soft); font-style: italic; line-height: 1.6; }

/* =========================================================
   SETTINGS
   ========================================================= */
.settings-body { display: flex; flex-direction: column; gap: 1.1rem; }
.set-group {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; box-shadow: var(--shadow-sm);
}
.set-group h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.1rem; margin-bottom: .4rem; }
.set-group p { color: var(--ink-soft); font-size: .92rem; line-height: 1.55; margin-bottom: 1rem; }
.set-group p:last-child { margin-bottom: 0; }
.set-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.set-pill {
  font-size: .9rem; padding: .55em 1.1em; border-radius: 100px; border: 1px solid var(--line);
  color: var(--ink); transition: all .25s; display: inline-flex; gap: .4rem; align-items: center;
}
.set-pill:hover { border-color: var(--accent); color: var(--accent); }
.privacy-note {
  display: flex; gap: .7rem; align-items: flex-start; font-size: .9rem; color: var(--ink-soft);
  font-style: italic; line-height: 1.55;
}
.privacy-note span { color: var(--accent); font-size: 1.1rem; font-style: normal; }
.switch-row { display: flex; align-items: center; gap: .7rem; font-size: .95rem; color: var(--ink); cursor: pointer; }
.switch-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.switch-row em { color: var(--ink-faint); font-size: .85rem; }
.time-input { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .4rem .6rem; }

/* =========================================================
   TABBAR
   ========================================================= */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: max(.9rem, env(safe-area-inset-bottom));
  z-index: 20; display: flex; gap: .15rem; padding: .35rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line); border-radius: 100px;
  box-shadow: var(--shadow); backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: .5rem .62rem; border-radius: 100px; color: var(--ink-faint);
  font-size: .58rem; letter-spacing: .06em; text-transform: uppercase;
  transition: color .25s, background .25s; min-width: 52px;
}
.tab-glyph { font-size: 1.05rem; line-height: 1; }
.tab:hover { color: var(--ink-soft); }
.tab.is-active { color: var(--paper); background: var(--accent); }

/* =========================================================
   READ-ALOUD OVERLAY
   ========================================================= */
.aloud {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 2rem 1.6rem;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--surface-2), transparent 60%),
    linear-gradient(180deg, var(--paper), var(--paper-2));
  animation: fadeIn .5s var(--ease) both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.aloud-close { position: absolute; top: 1.4rem; right: 1.4rem; font-size: 1.2rem; color: var(--ink-soft);
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); }
.aloud-inner { max-width: 30rem; text-align: center; }
.aloud-sentence {
  font-family: var(--font-display); font-weight: 320; font-optical-sizing: auto;
  font-size: clamp(2rem, 9vw, 3.2rem); line-height: 1.18; letter-spacing: -.02em;
  margin: 1.5rem 0; animation: riseIn 1s var(--ease) both .15s;
}
.aloud-sentence .seg-who { font-style: italic; color: var(--accent); }
.aloud-sentence .seg-fixed { color: var(--ink-soft); }
.aloud-trans { font-style: italic; color: var(--ink-soft); font-size: 1.2rem; margin-bottom: 1.6rem; line-height: 1.4; }
.aloud-check { display: inline-flex; align-items: center; gap: .6rem; font-size: 1.05rem; color: var(--ink);
  margin-top: 1rem; cursor: pointer; }
.aloud-check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* =========================================================
   MODALS (editor + share)
   ========================================================= */
.modal {
  position: fixed; inset: 0; z-index: 45; display: grid; place-items: end center;
  padding: 0; background: rgba(20,12,4,.4); backdrop-filter: blur(3px);
  animation: fadeIn .3s var(--ease) both;
}
@media (min-width: 600px) { .modal { place-items: center; padding: 2rem; } }
.modal-card {
  width: 100%; max-width: 32rem; max-height: 92svh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px 22px 0 0; padding: 1.8rem 1.5rem calc(1.8rem + env(safe-area-inset-bottom));
  box-shadow: var(--shadow); position: relative;
  animation: sheetUp .45s var(--ease) both;
}
@media (min-width: 600px) { .modal-card { border-radius: 22px; } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-close { position: absolute; top: 1.2rem; right: 1.2rem; font-size: 1rem; color: var(--ink-faint);
  width: 36px; height: 36px; border-radius: 50%; transition: color .25s; }
.modal-close:hover { color: var(--accent); }
.modal-title { font-family: var(--font-display); font-weight: 380; font-size: 1.5rem; line-height: 1.1;
  letter-spacing: -.01em; margin: .3rem 0 .5rem; }
.modal-note { color: var(--ink-soft); font-style: italic; font-size: .95rem; margin-bottom: 1.4rem; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.6rem; }

/* framed inputs */
.frame {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .5rem;
  padding: .85rem 1rem; background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: 12px; margin-bottom: .7rem; transition: border-color .25s;
}
.frame:focus-within { border-color: var(--accent); }
.frame-fixed { font-family: var(--font-display); font-style: italic; color: var(--ink-soft); font-size: 1.05rem; }
.frame-input { flex: 1; min-width: 8rem; background: none; border: none; font-size: 1.05rem;
  font-family: var(--font-display); color: var(--accent); }
.frame-input::placeholder { color: var(--ink-faint); font-style: italic; }
.frame--trans { margin-top: .2rem; }
.frame--trans .frame-input { color: var(--ink); }

.preview-line {
  margin: 1.2rem 0; padding: 1.1rem 1.2rem; border-radius: 12px;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border: 1px dashed var(--line); font-family: var(--font-display);
  font-size: 1.15rem; line-height: 1.4; font-weight: 340; min-height: 2rem;
}
.preview-line .seg-who { font-style: italic; color: var(--accent); }
.preview-line .seg-fixed { color: var(--ink-soft); }
.preview-line:empty::before { content: "Your statement appears here…"; color: var(--ink-faint); font-style: italic; }

.starter-label { margin-bottom: .7rem; }
.starters { display: flex; flex-wrap: wrap; gap: .5rem; }
.starter {
  font-size: .85rem; padding: .45em .9em; border-radius: 100px; border: 1px solid var(--line);
  color: var(--ink-soft); font-style: italic; transition: all .25s;
}
.starter:hover { border-color: var(--accent); color: var(--accent); }

/* share */
.modal-card--share { max-width: 26rem; }
.share-canvas-wrap { border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); margin: 1rem 0 1.2rem;
  border: 1px solid var(--line); }
#shareCanvas { width: 100%; height: auto; display: block; }

/* =========================================================
   TOAST
   ========================================================= */
.toast {
  position: fixed; bottom: calc(6rem + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%) translateY(10px);
  z-index: 60; background: var(--ink); color: var(--paper); font-size: .92rem;
  padding: .7rem 1.2rem; border-radius: 100px; box-shadow: var(--shadow);
  opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none;
  font-style: italic; max-width: 90vw; text-align: center;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* =========================================================
   responsive niceties
   ========================================================= */
@media (min-width: 600px) {
  .app { padding-top: 3rem; }
  .intention { font-size: 1.6rem; }
  .today-thread { padding-top: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  .orb { animation: none; }
}
