@font-face { font-family: 'Fraunces'; src: url('assets/fonts/Fraunces-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('assets/fonts/Inter-Regular.ttf') format('truetype'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('assets/fonts/Inter-SemiBold.ttf') format('truetype'); font-weight: 600 700; font-display: swap; }

/* Themes — values from lib/themes.dart (GsTheme). Default: Soft Cloud. */
:root, :root[data-theme="cloud"] {
  --bg1: #F6E8EE; --bg2: #E7E3F5; --bg3: #FBE9DC; --bg3-rgb: 251,233,220;
  --accent: #B39DDB; --accent-rgb: 179,157,219; --accent-deep: #8B73C7;
  --ink-rgb: 42,36,64;
  --soft-a: .62; --mute-a: .38;
  --glass-a: .16; --glass-strong-a: .26; --glass-border-a: .34;
  --g1: .18; --g2: .04; --gs1: .28; --gs2: .10;
  --shine: .35; --blob-a: .30;
  --dashed: rgba(0,0,0,.10);
  --btn-bg: rgb(var(--ink-rgb)); --btn-fg: #fff; --btn-shadow: rgba(var(--ink-rgb), .22);
  --chip-fg: #fff; --sh-a: 1;
}
:root[data-theme="ocean"] {
  --bg1: #D6EEF3; --bg2: #C7E3ED; --bg3: #EAF4F1; --bg3-rgb: 234,244,241;
  --accent: #7FBFD1; --accent-rgb: 127,191,209; --accent-deep: #3F8FA8;
  --ink-rgb: 27,56,69;
}
:root[data-theme="moon"] {
  --bg1: #1A1730; --bg2: #11102A; --bg3: #251F40; --bg3-rgb: 37,31,64;
  --accent: #C8C2F5; --accent-rgb: 200,194,245; --accent-deep: #9B94E0;
  --ink-rgb: 246,244,255;
  --soft-a: .72; --mute-a: .45;
  --glass-a: .08; --glass-strong-a: .14; --glass-border-a: .16;
  --g1: .10; --g2: .03; --gs1: .16; --gs2: .06;
  --shine: .18; --blob-a: .22;
  --dashed: rgba(255,255,255,.30);
  --btn-bg: #F6F4FF; --btn-fg: #1A1730; --btn-shadow: rgba(255,255,255,.22);
  --chip-fg: #1A1730;
}

/* 1rem == 16 design px on a 390 x 600 design canvas; scales with width AND height. */
html { height: 100%; font-size: clamp(10px, min(4.1026vw, 2.6667vh), 18.4px); }
body { height: 100%; margin: 0; overflow: hidden; background: var(--bg2); }
*, *::before, *::after { box-sizing: border-box; }

#app {
  --ink: rgb(var(--ink-rgb));
  --ink-soft: rgba(var(--ink-rgb), var(--soft-a));
  --ink-mute: rgba(var(--ink-rgb), var(--mute-a));
  position: relative; width: 100%; height: 100%; overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: linear-gradient(171deg, var(--bg1) 0%, var(--bg2) 50%, var(--bg3) 100%);
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s;
}
.bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; }
.b1 { left: -9rem; top: -7.75rem; width: 25.5rem; height: 25.5rem;
  background: radial-gradient(circle closest-side, rgba(var(--accent-rgb), var(--blob-a)) 0%, rgba(var(--accent-rgb), calc(var(--blob-a) * .42)) 45%, rgba(var(--accent-rgb), 0) 88%); }
.b2 { right: -7.75rem; bottom: -9rem; width: 23rem; height: 23rem;
  background: radial-gradient(circle closest-side, rgba(var(--bg3-rgb), var(--blob-a)) 0%, rgba(var(--bg3-rgb), calc(var(--blob-a) * .42)) 45%, rgba(var(--bg3-rgb), 0) 88%); }

.screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; animation: screenIn .28s ease-out both; }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }

button { font: inherit; color: inherit; border: 0; background: none; padding: 0; margin: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }
.emoji, .mood-tile .e, .mood-dot, .breath span, .sum-bubble span {
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; line-height: 1; }

/* NavBar (widgets/nav_bar.dart) — status-bar inset removed */
.nav { flex: none; display: flex; align-items: center; padding: .625rem 1rem .25rem; }
.nav-slot { flex: none; width: 2.75rem; height: 2.75rem; min-width: 40px; min-height: 40px; }
.nav-title { flex: 1; margin: 0; text-align: center; font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Glass (widgets/glass.dart) */
.glass, .glass-pill, .pill-btn {
  background:
    linear-gradient(163deg, rgba(255,255,255,var(--shine)) 0%, rgba(255,255,255,calc(var(--shine) * .55)) 35%, rgba(255,255,255,calc(var(--shine) * .2)) 70%, rgba(255,255,255,0) 100%),
    linear-gradient(160deg, rgba(255,255,255,var(--g1)), rgba(255,255,255,var(--g2)));
  border: .5px solid rgba(255,255,255,var(--glass-border-a));
  box-shadow: 0 1px 6px rgba(60,40,100,.04), 0 8px 24px rgba(60,40,100,.05);
  -webkit-backdrop-filter: blur(32px); backdrop-filter: blur(32px);
}
.glass.strong {
  background:
    linear-gradient(163deg, rgba(255,255,255,var(--shine)) 0%, rgba(255,255,255,calc(var(--shine) * .55)) 35%, rgba(255,255,255,calc(var(--shine) * .2)) 70%, rgba(255,255,255,0) 100%),
    linear-gradient(160deg, rgba(255,255,255,var(--gs1)), rgba(255,255,255,var(--gs2)));
  -webkit-backdrop-filter: blur(44px); backdrop-filter: blur(44px);
}
.glass-pill, .pill-btn {
  background: linear-gradient(160deg, rgba(255,255,255,var(--g1)), rgba(255,255,255,var(--g2)));
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(60,40,100,.05), 0 4px 12px rgba(60,40,100,.06);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.pill-btn { display: flex; align-items: center; justify-content: center; color: rgba(var(--ink-rgb), .85); transition: transform .12s; }
.pill-btn:active { transform: scale(.94); }
.sparkle { flex: none; fill: var(--accent-deep); }
.eyebrow { font-size: .75rem; letter-spacing: .125rem; font-weight: 600; color: var(--ink-mute); }
.eyebrow.accent { color: var(--accent-deep); }

/* SoftButton (widgets/button.dart) */
.foot { flex: none; padding: .75rem 1.375rem 1.125rem; }
.soft-btn {
  width: 100%; height: 3.5rem; min-height: 42px; border-radius: 1.75rem;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: 1.0625rem; font-weight: 600; letter-spacing: -.0125rem;
  box-shadow: 0 .375rem 1.125rem var(--btn-shadow);
  transition: transform .12s ease-out, opacity .2s;
}
.soft-btn:active { transform: scale(.975); }
.soft-btn:disabled { opacity: .4; cursor: default; }
.soft-btn:disabled:active { transform: none; }

/* ---------- Mood check-in ---------- */
.mood-body { flex: 1; min-height: 0; padding: .5rem 1.375rem 0; display: flex; flex-direction: column; overflow: hidden; }
.display { margin: 0; font-family: 'Fraunces', Georgia, serif; font-weight: 400; font-size: 2rem; line-height: 1.05; }
.sub { margin: .375rem 0 0; font-size: .875rem; color: var(--ink-soft); }
.mood-grid { margin: 1.375rem auto 0; width: 100%; max-width: 23rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: .625rem; }
.mood-tile {
  aspect-ratio: 1; min-width: 0; border-radius: 1.5rem; padding: .375rem .25rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .125rem;
  background: rgba(255,255,255,var(--glass-a));
  border: .5px solid rgba(255,255,255,var(--glass-border-a));
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  transition: transform .22s ease-out, background-color .22s, box-shadow .22s;
}
.mood-tile .e { font-size: 1.625rem; }
.mood-tile .l { font-size: max(7.5px, .625rem); font-weight: 500; color: var(--ink-soft); white-space: nowrap; max-width: 100%; overflow: hidden; letter-spacing: -.01em; }
.mood-tile[aria-pressed="true"] {
  transform: scale(1.04);
  background: rgba(255,255,255,var(--glass-strong-a));
  border: 2px solid var(--accent);
  box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.18);
}
.dashed {
  margin-top: 1.375rem; padding: .875rem; border-radius: 1.125rem;
  background: rgba(255,255,255,var(--glass-a)); border: .5px solid var(--dashed);
  display: flex; align-items: center; gap: .625rem;
  font-size: .75rem; line-height: 1.35; color: var(--ink-soft);
}
.meta-row { margin-top: auto; padding-top: .5rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.preview-label { font-size: max(8px, .625rem); color: var(--ink-mute); line-height: 1.3; }
.preview-label b { font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.swatches { flex: none; display: flex; }
.swatch { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.swatch i { width: 1.375rem; height: 1.375rem; min-width: 18px; min-height: 18px; border-radius: 50%;
  border: 1.5px solid rgba(var(--ink-rgb), .18); transition: transform .18s ease-out, box-shadow .18s; }
.swatch[aria-pressed="true"] i { transform: scale(1.12); box-shadow: 0 0 0 2px var(--bg2), 0 0 0 3.5px var(--accent-deep); }

/* ---------- Writing ---------- */
.write-body { flex: 1; min-height: 0; padding: .25rem 1.375rem .5rem; display: flex; flex-direction: column; }
.mood-row { flex: none; display: flex; align-items: center; gap: .625rem; min-width: 0; }
.mood-pill { flex: none; display: inline-flex; align-items: center; gap: .5rem; padding: .375rem .75rem .375rem .375rem; font-size: .8125rem; font-weight: 500; }
.mood-dot { width: 1.75rem; height: 1.75rem; border-radius: 50%; background: rgba(255,255,255,var(--glass-strong-a)); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.drift { font-size: max(8px, .6875rem); color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.write-card { position: relative; flex: 1; min-height: 0; margin-top: .75rem; border-radius: 1.75rem; padding: 1.25rem 1.125rem .75rem;
  display: flex; flex-direction: column; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.write-card:focus-within { border-color: rgba(var(--accent-rgb), .9); box-shadow: 0 0 0 1.5px rgba(var(--accent-rgb), .55), 0 8px 24px rgba(60,40,100,.05); }
.prompt { flex: none; padding-bottom: .75rem; }
.prompt[hidden] { display: none; }
.prompt-text { margin-top: .375rem; font-family: 'Fraunces', Georgia, serif; font-size: 1.375rem; line-height: 1.2; }
.fade-scroll { flex: 1; min-height: 0; overflow: hidden; }
.fade-text { font-family: 'Fraunces', Georgia, serif; font-size: 1.375rem; line-height: 1.5; letter-spacing: -.00625rem; font-weight: 400;
  white-space: pre-wrap; overflow-wrap: normal; padding-top: .25rem; }
.fade-text.placeholder { color: var(--ink-mute); white-space: normal; }
.fade-text[hidden] { display: none; }
.fade-text .w { display: inline-block; white-space: nowrap; }
.fade-text .c { display: inline-block; white-space: pre; will-change: opacity;
  transition: transform .22s linear, opacity .18s linear, filter .18s linear; }
.fade-text .c.gone { opacity: 0; visibility: hidden; transition: none; }
.caret { display: inline-block; width: 2px; height: 1.375rem; margin-left: 1px; border-radius: 1px; background: var(--accent-deep);
  vertical-align: middle; animation: caret 1.2s linear infinite alternate; }
@keyframes caret { from { opacity: .5; } to { opacity: 1; } }
.status { flex: none; margin-top: .375rem; display: flex; align-items: center; gap: .375rem; font-size: max(8px, .6875rem); color: var(--ink-mute); }
.status .dot { width: .375rem; height: .375rem; border-radius: 50%; background: var(--accent-deep); }

/* Real input: invisible, covers the whole card so a tap anywhere opens the keyboard
   (the app does the same with an off-screen TextField + its own text rendering). */
#ta { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; margin: 0; padding: 1.25rem 1.125rem;
  border: 0; outline: 0; resize: none; background: transparent; color: transparent; caret-color: transparent;
  font-family: 'Fraunces', Georgia, serif; font-size: max(16px, 1.375rem); line-height: 1.5;
  overflow: hidden; border-radius: inherit; opacity: .01;
  -webkit-user-select: text; user-select: text; touch-action: manipulation; -webkit-appearance: none; appearance: none; cursor: text; }
#ta::selection { background: transparent; color: transparent; }
.tap-hint { position: absolute; z-index: 3; left: 50%; bottom: 2.5rem; transform: translateX(-50%); pointer-events: none;
  padding: .5rem .875rem; border-radius: 999px; white-space: nowrap;
  font-size: max(10px, .75rem); font-weight: 600; color: var(--btn-fg); background: var(--btn-bg);
  box-shadow: 0 .25rem .75rem var(--btn-shadow); opacity: .92; transition: opacity .2s;
  animation: hint 2.4s ease-in-out infinite; }
@keyframes hint { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-.25rem); } }
#ta:focus ~ .tap-hint { opacity: 0; }

.prompt-btn { flex: none; margin-top: .75rem; width: 100%; min-height: 40px; border-radius: 1.125rem; padding: .75rem 1rem;
  display: flex; align-items: center; gap: .625rem; text-align: left; font-size: .8125rem; color: var(--ink-soft); transition: transform .12s; }
.prompt-btn:active { transform: scale(.985); }
#s-write .foot { padding-top: .5rem; }

/* Soft keyboard open (visual viewport shrunk): give the page the room */
#app.kb .prompt-btn { display: none; }
#app.kb .foot { padding-bottom: .5rem; padding-top: .25rem; }
#app.kb .soft-btn { height: 2.875rem; }
#app.kb .nav { padding-top: .25rem; }

/* ---------- Letting go ---------- */
.letgo { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 1.375rem; text-align: center; }
.halo { position: relative; width: 12.5rem; height: 12.5rem; display: flex; align-items: center; justify-content: center; }
.ring { position: absolute; left: 50%; top: 50%; width: 8.75rem; height: 8.75rem; margin: -4.375rem 0 0 -4.375rem; border-radius: 50%;
  border: 1.5px solid var(--accent); opacity: 0; animation: ripple 2.4s linear infinite; }
.r1 { animation-delay: -.6s; } .r2 { animation-delay: -1.2s; } .r3 { animation-delay: -1.8s; }
@keyframes ripple { from { transform: scale(.95); opacity: .7; } to { transform: scale(1.25); opacity: 0; } }
.breath { width: 8.75rem; height: 8.75rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle closest-side, rgba(255,255,255,.10) 0%, rgba(255,255,255,0) 85%);
  animation: breath 3.5s linear infinite alternate; }
:root[data-theme="moon"] .breath { background: radial-gradient(circle closest-side, rgba(255,255,255,.12) 0%, rgba(255,255,255,0) 85%); }
.breath span { font-size: 3.5rem; }
@keyframes breath { from { transform: scale(.8); } to { transform: scale(1.2); } }
.letgo-title { margin: 1.875rem 0 0; max-width: 17.5rem; font-family: 'Fraunces', Georgia, serif; font-size: 1.625rem; line-height: 1.25; opacity: .6; transition: opacity .8s; }
.letgo-title.settle { opacity: 1; }
.letgo-sub { margin: .75rem 0 0; max-width: 15rem; font-size: .8125rem; line-height: 1.4; color: var(--ink-soft); }

/* ---------- Soft summary ---------- */
.sum-body { flex: 1; min-height: 0; padding: .25rem 1.375rem 0; display: flex; flex-direction: column; align-items: stretch; justify-content: center; overflow: hidden; }
.sum-bubble { align-self: center; flex: none; width: 6.5rem; height: 6.5rem; border-radius: 1.95rem; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 .5rem 1.75rem rgba(0,0,0,.05); animation: sumPulse 4s linear infinite alternate; }
.sum-bubble span { font-size: 3.5rem; }
@keyframes sumPulse { from { transform: scale(.94); } to { transform: scale(1); } }
.sum-mood { margin-top: .875rem; text-align: center; font-family: 'Fraunces', Georgia, serif; font-size: 2rem; line-height: 1.15; }
.sum-date { margin-top: .25rem; text-align: center; font-size: .8125rem; letter-spacing: .025rem; color: var(--ink-mute); }
.sum-card { margin-top: 1.125rem; border-radius: 1.5rem; padding: 1.25rem; }
.sum-text { margin-top: .5rem; font-family: 'Fraunces', Georgia, serif; font-size: 1.0625rem; line-height: 1.5; }
.tags-card { margin-top: .875rem; border-radius: 1.375rem; padding: 1rem; }
.tags { margin-top: .625rem; display: flex; flex-wrap: wrap; gap: .375rem; }
.tag { padding: .375rem .75rem; border-radius: 999px; background: rgb(var(--ink-rgb)); color: var(--chip-fg); font-size: .8125rem; font-weight: 500; }

/* Lifecycle + accessibility */
#app.paused *, #app.paused *::before, #app.paused *::after { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  .ring { animation: none; opacity: .35; }
  .r1 { transform: scale(1.05); opacity: .25; } .r2 { transform: scale(1.15); opacity: .15; } .r3 { display: none; }
  .breath, .sum-bubble, .tap-hint, .caret { animation: none; }
  .screen.active { animation: none; }
  .mood-tile, .fade-text .c { transition: opacity .18s linear; }
}
