/* The pet web app. No inline styles anywhere (CSP): everything is here. */

:root {
  color-scheme: light;
  --bg: #fff6ee;
  --bg-2: #ffeede;
  --surface: #ffffff;
  --surface-2: #fff3ea;
  --ink: #3a2232;
  --ink-2: #634a5a;
  --muted: #8a7183;
  --line: #f0d9cb;
  --accent: #d9604a;
  --accent-hover: #c4513c;
  --accent-ink: #ffffff;
  --accent-soft: #fde2d7;
  --focus: #5b6ee1;
  --good: #3a936a;
  --ok: #c99223;
  --low: #de7444;
  --crit: #cc3d52;
  --warn-bg: #fff1dc;
  --sad-bg: #f3ecf6;
  --joy: #3a936a;
  --shadow: 0 1px 2px rgb(80 30 40 / 6%), 0 6px 20px rgb(80 30 40 / 7%);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #eee2d8;
  --radius: 18px;
  --radius-s: 12px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1b1320;
    --bg-2: #24192b;
    --surface: #291e30;
    --surface-2: #32253a;
    --ink: #f7eaf1;
    --ink-2: #d9c4d1;
    --muted: #a99aa6;
    --line: #3e3046;
    --accent: #f08a72;
    --accent-hover: #f6a08b;
    --accent-ink: #2a1520;
    --accent-soft: #4a2c35;
    --focus: #9aa8ff;
    --good: #5cc290;
    --ok: #e0b24f;
    --low: #f0925f;
    --crit: #f06a7c;
    --warn-bg: #3b2a1c;
    --sad-bg: #2f2638;
    --joy: #5cc290;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
    --series-1: #3987e5;
    --series-2: #d95926;
    --grid: #3a2e41;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1320;
  --bg-2: #24192b;
  --surface: #291e30;
  --surface-2: #32253a;
  --ink: #f7eaf1;
  --ink-2: #d9c4d1;
  --muted: #a99aa6;
  --line: #3e3046;
  --accent: #f08a72;
  --accent-hover: #f6a08b;
  --accent-ink: #2a1520;
  --accent-soft: #4a2c35;
  --focus: #9aa8ff;
  --good: #5cc290;
  --ok: #e0b24f;
  --low: #f0925f;
  --crit: #f06a7c;
  --warn-bg: #3b2a1c;
  --sad-bg: #2f2638;
  --joy: #5cc290;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
  --series-1: #3987e5;
  --series-2: #d95926;
  --grid: #3a2e41;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse at top, var(--bg-2), var(--bg) 60%);
  background-attachment: fixed;
  color: var(--ink);
  font: 16px/1.5 var(--font);
  min-height: 100vh;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.05rem; display: flex; align-items: center; gap: .45rem; }
h3 { font-size: .95rem; color: var(--ink-2); margin-top: 1rem; }
p { margin: .4rem 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: .5rem 1rem; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.fineprint { color: var(--muted); font-size: .8rem; margin-top: .6rem; }
.hint { color: var(--ink-2); font-size: .9rem; margin: 0 .25rem 1rem; }

.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

.app { max-width: 780px; margin: 0 auto; padding: 0 16px 48px; position: relative; }
.utility { position: absolute; right: 16px; top: 10px; display: flex; gap: .35rem; z-index: 3; }
.icon-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { color: var(--accent); }
main:focus { outline: none; }

/* Tabs */
.tabs { position: sticky; top: 0; z-index: 2; margin: 0 -16px 1rem; padding: 10px 16px 8px; padding-right: 100px;
  background: linear-gradient(var(--bg) 75%, transparent); }
.tabs ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .3rem; overflow-x: auto; scrollbar-width: none; }
.tabs ul::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: .35rem; padding: .45rem .8rem; border-radius: 999px;
  text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .9rem; white-space: nowrap;
  border: 1px solid transparent;
}
.tab:hover { background: var(--surface-2); color: var(--ink); }
.tab.current { background: var(--accent); color: var(--accent-ink); }

/* Cards */
.card, .alert, .notice-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin-bottom: .9rem; box-shadow: var(--shadow);
}
.notice-card { margin-top: 4rem; text-align: center; }
.alert.tone-warn { background: var(--warn-bg); border-color: var(--low); }
.alert.tone-sad { background: var(--sad-bg); }
.alert.tone-warm { background: var(--surface-2); }
.alert h2 { font-size: 1.1rem; }
details.card > summary, details.more > summary, details.table-view > summary {
  cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: .45rem; list-style: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "›"; margin-left: auto; transition: transform .2s; color: var(--muted); }
details[open] > summary::after { transform: rotate(90deg); }
details.more { margin-top: .8rem; border-top: 1px dashed var(--line); padding-top: .7rem; }
details.more > summary { color: var(--accent); }
details.more[open] > summary { margin-bottom: .6rem; }
details.admin[open] > summary { margin-bottom: .6rem; }

/* Hero */
.hero { display: flex; gap: 1rem; align-items: center; margin: .2rem 0 1rem; }
.portrait {
  width: 128px; height: 128px; flex: none; border-radius: 40%;
  background: radial-gradient(circle at 50% 40%, var(--surface), var(--accent-soft));
  border: 1px solid var(--line); display: grid; place-items: center; box-shadow: var(--shadow);
}
.portrait .critter { width: 112px; height: 112px; }
.pet-name { font-size: 1.9rem; font-weight: 800; letter-spacing: -.01em; margin: 0; }
.pet-sub { color: var(--ink-2); margin: .1rem 0; text-transform: none; }
.pet-age { color: var(--muted); font-size: .9rem; margin: 0; }
.pet-mood { margin-top: .35rem; font-style: italic; color: var(--ink-2); }
.state-dead .portrait { filter: saturate(.55); }
@media (max-width: 420px) {
  .hero { gap: .75rem; }
  .portrait { width: 96px; height: 96px; }
  .portrait .critter { width: 84px; height: 84px; }
  .pet-name { font-size: 1.5rem; }
}

/* The critter */
.critter { overflow: visible; }
.critter .shadow { fill: rgb(60 20 40 / 12%); }
.critter { --fur: #f0b98a; --fur-2: #fbe3cc; --dark: #3a2232; --ear-in: #f6a7a0; }
.critter.sp-puppy { --fur: #e2a86e; --fur-2: #f8dfc1; }
.critter.sp-kitten { --fur: #b6a7c9; --fur-2: #ece4f4; }
.critter.sp-bunny { --fur: #efdcd1; --fur-2: #fff6f1; }
.critter.sp-fox { --fur: #ec8a4a; --fur-2: #fff1e4; }
.critter.sp-raccoon { --fur: #9d9aa3; --fur-2: #e7e5ea; }
.critter.sp-otter { --fur: #a77a56; --fur-2: #e9d3bd; }
.critter.sp-dragon { --fur: #79c2a2; --fur-2: #d6f1e3; }
.critter.sp-bird { --fur: #7cb6e8; --fur-2: #fff3c9; }
.critter .body, .critter .head, .critter .ear, .critter .tail-fill { fill: var(--fur); }
.critter .belly { fill: var(--fur-2); }
.critter .ear-in { fill: var(--ear-in); }
.critter .tail { fill: none; stroke: var(--fur); stroke-width: 9; stroke-linecap: round; }
.critter .mask { fill: #4b4752; opacity: .85; }
.critter .horn { fill: #f3e6b5; }
.critter .wing { fill: var(--fur-2); stroke: var(--fur); stroke-width: 2; }
.critter .crest { fill: #f2a65a; }
.critter .beak { fill: #f2a65a; }
.critter .eye { fill: var(--dark); }
.critter .glint { fill: #fff; }
.critter .eye-closed, .critter .mouth { fill: none; stroke: var(--dark); stroke-width: 2.4; stroke-linecap: round; }
.critter .nose { fill: var(--dark); }
.critter .blush { fill: #f58c97; opacity: .45; }
.critter .zzz text { fill: var(--muted); font: 700 14px var(--font); }
.critter .flower circle { fill: #f5b5c8; }
.critter .flower .flower-mid { fill: #f6d77a; }
.critter.sp-fox .ear-in { fill: #fff1e4; }
.critter.st-baby .body-wrap, .critter.st-child .body-wrap { transform: translate(15px, 26px) scale(.75); }
.critter.st-tween .body-wrap { transform: translate(9px, 16px) scale(.85); }
.critter .egg-shell { fill: #fbf1df; stroke: #ecd3ae; stroke-width: 2; }
.critter .egg-spot { fill: #f3c9a3; }
.critter .egg-shine { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; opacity: .8; }
.critter .breathe, .critter .egg { transform-box: fill-box; transform-origin: 50% 100%; }

@media (prefers-reduced-motion: no-preference) {
  .critter.cs-awake .breathe { animation: breathe 3.6s ease-in-out infinite; }
  .critter.cs-asleep .breathe { animation: breathe 6s ease-in-out infinite; }
  .critter.cs-egg .egg { animation: wobble 5s ease-in-out infinite; }
  .critter.cs-awake .eyes { animation: blink 6s infinite; transform-box: fill-box; transform-origin: center; }
  .critter .zzz text { animation: float 3s ease-in-out infinite; }
  .critter .zzz text + text { animation-delay: 1.2s; }
  .splash-egg .critter .egg { animation-duration: 1.6s; }
}
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.025, .975); } }
@keyframes wobble { 0%, 80%, 100% { transform: rotate(0); } 84% { transform: rotate(-6deg); } 88% { transform: rotate(5deg); } 92% { transform: rotate(-3deg); } 96% { transform: rotate(2deg); } }
@keyframes blink { 0%, 96%, 100% { transform: scaleY(1); } 98% { transform: scaleY(.1); } }
@keyframes float { 0% { opacity: 0; transform: translateY(4px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }

.splash { display: grid; place-items: center; padding-top: 22vh; text-align: center; }
.splash-egg .critter { width: 120px; height: 120px; }
.splash-text { color: var(--muted); }

/* Needs */
.needs { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.need { display: grid; grid-template-columns: 7.2rem 1fr 2.2rem; align-items: center; gap: .6rem; }
.need-label { display: flex; align-items: center; gap: .4rem; color: var(--ink-2); font-weight: 600; font-size: .92rem; }
.need-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; }
.bar { width: 100%; height: 12px; display: block; }
.bar .track { fill: var(--surface-2); }
.need.lvl-good .fill { fill: var(--good); }
.need.lvl-ok .fill { fill: var(--ok); }
.need.lvl-low .fill { fill: var(--low); }
.need.lvl-crit .fill { fill: var(--crit); }
.need.lvl-crit .need-label { color: var(--crit); }

/* Buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  border-radius: 999px; padding: .55rem 1rem; font: 600 .95rem var(--font); cursor: pointer;
  min-height: 40px; text-decoration: none; transition: transform .08s, background .15s;
}
.btn:hover { background: var(--accent-soft); color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.quiet { background: transparent; }
.btn.danger.armed { background: var(--crit); color: #fff; border-color: var(--crit); }
.btn[disabled], form.busy .btn { opacity: .6; cursor: progress; }
.act { display: inline-flex; flex-direction: column; gap: .25rem; margin: 0; }
.act.wide { display: flex; width: 100%; }
.act.wide .btn { align-self: flex-start; }
.act .note { color: var(--muted); font-size: .78rem; padding-left: .5rem; }
.acts { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.fields { display: grid; gap: .55rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: .5rem; }
.field { display: grid; gap: .2rem; font-size: .85rem; color: var(--ink-2); font-weight: 600; }
.field input, .field select {
  font: 1rem var(--font); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: .5rem .65rem; min-height: 40px; width: 100%;
}
.care-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.care-grid .act, .care-grid .btn { width: 100%; }
.care-grid .btn { flex-direction: column; padding: .8rem .5rem; border-radius: var(--radius-s); min-height: 72px; }
.care-grid .btn .i { width: 1.6em; height: 1.6em; color: var(--accent); }

/* Items */
.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .65rem 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item-main { display: grid; min-width: 0; flex: 1 1 12rem; }
.item-name { font-weight: 700; }
.qty { color: var(--muted); font-weight: 600; }
.item-meta { color: var(--muted); font-size: .83rem; }
.price { display: inline-flex; align-items: center; gap: .15rem; color: var(--ink-2); font-weight: 700; }
.item-acts { display: flex; flex-wrap: wrap; gap: .4rem; align-items: flex-end; }
.items.shop .act { flex-direction: row; align-items: flex-end; }
.items.shop .fields { display: flex; gap: .4rem; margin: 0; }
.items.shop .field { width: auto; }
.items.shop .field input { width: 4.5rem; }
.items.shop .field-label { font-size: .7rem; }
.items.shop .item-acts { gap: .35rem; }
.items.compact .item { padding: .45rem 0; }

/* Lists */
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { display: grid; grid-template-columns: 1fr auto; gap: 0 .75rem; padding: .45rem 0; border-top: 1px solid var(--line); }
.ledger li:first-child { border-top: 0; }
.ledger .amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.ledger .up .amt { color: var(--good); }
.ledger .when { grid-column: 1 / -1; color: var(--muted); font-size: .78rem; }
.people { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.people li { background: var(--surface-2); border-radius: 999px; padding: .25rem .75rem; }
.family { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.npc { display: grid; }
.npc-name { font-weight: 700; }
.npc-rel { color: var(--muted); font-size: .85rem; }
.npc-about { color: var(--ink-2); font-size: .9rem; }
.npc.gone { opacity: .7; }
.activities { list-style: none; margin: 0; padding: 0; }
.activity { padding: .6rem 0; border-top: 1px solid var(--line); }
.activity:first-child { border-top: 0; }
.disc { padding: .6rem 0; border-top: 1px solid var(--line); }
.disc:first-of-type { border-top: 0; }
.disc .reason { font-style: italic; color: var(--ink-2); }
.romance-row { padding: .5rem 0; border-top: 1px solid var(--line); }
.romance-row:first-of-type { border-top: 0; }
.optin { margin-top: .6rem; }

.wallets { display: flex; flex-wrap: wrap; gap: 1rem 2rem; }
.stat { display: grid; }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 600; }
.stat-value { font-size: 1.5rem; font-weight: 800; display: flex; align-items: center; gap: .3rem; font-variant-numeric: tabular-nums; margin: 0; }
.stat-value .i { color: var(--ok); }
.stat-row { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin: 0; }
.wallet { display: inline-flex; align-items: center; gap: .2rem; }

.you .pet-says { margin: .6rem 0; padding: .7rem 1rem; background: var(--accent-soft); border-radius: var(--radius-s) var(--radius-s) var(--radius-s) 4px; font-style: italic; }
.facts { margin: .4rem 0; padding-left: 1.2rem; }

.foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 1.5rem; }

/* Lives index */
.page-head { margin: .4rem 0 1rem; }
.page-head h1 { display: flex; gap: .5rem; align-items: center; }
.pet-cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; }
.pet-card { display: flex; gap: .8rem; align-items: center; padding: .8rem; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pet-card:hover { border-color: var(--accent); color: var(--ink); }
.pet-card .mini { width: 64px; height: 64px; flex: none; }
.pet-card .critter { width: 64px; height: 64px; }
.pet-card.state-dead .mini { filter: saturate(.5); }
.pc-text { display: grid; }
.pc-name { font-weight: 800; font-size: 1.1rem; }
.pc-sub, .pc-line { color: var(--muted); font-size: .85rem; }

/* Life page */
.two-col { display: grid; gap: 0 .9rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .two-col { grid-template-columns: 1fr 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { background: var(--accent-soft); color: var(--ink); padding: .2rem .7rem; border-radius: 999px; font-weight: 600; font-size: .88rem; }
.kv { margin: .5rem 0; display: grid; gap: .3rem; }
.kv div { display: grid; grid-template-columns: 7.5rem 1fr; gap: .5rem; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; }
.backstory { white-space: pre-line; color: var(--ink-2); }
.memorial-card { background: var(--sad-bg); text-align: center; }
.memorial-card h2 { justify-content: center; }
.epitaph { font-size: 1.25rem; font-style: italic; margin: .6rem 0; }
.eulogy { white-space: pre-line; text-align: left; margin: .8rem 0; line-height: 1.65; }
.memorial-card .act { margin-top: .5rem; }

.timeline { display: grid; gap: .6rem; }
.tl-day { position: relative; }
.tl-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: .4rem 0 .3rem; }
.tl-list { list-style: none; margin: 0; padding: 0 0 0 .2rem; border-left: 2px solid var(--line); }
.tl-entry { display: grid; grid-template-columns: 1.9rem 1fr; gap: 0 .5rem; padding: .3rem 0; position: relative; margin-left: -1.05rem; }
.tl-icon { width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); border: 2px solid var(--surface); }
.tl-entry.tone-joy .tl-icon { color: var(--joy); }
.tl-entry.tone-warn .tl-icon { color: var(--low); }
.tl-entry.tone-sad .tl-icon { color: var(--muted); }
.tl-text { align-self: center; }
.tl-time { grid-column: 2; color: var(--muted); font-size: .75rem; }
.more-btn { justify-self: center; }
.journal { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.journal .when { color: var(--muted); font-size: .8rem; margin-right: .4rem; }

/* Charts */
.chart-wrap { width: 100%; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .tick, .chart .axis-label { fill: var(--muted); font: 11px var(--font); }
.chart .direct { fill: var(--ink-2); font: 600 11px var(--font); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s1 { stroke: var(--series-1); }
.chart .line.s2 { stroke: var(--series-2); }
.chart .dot { stroke: var(--surface); stroke-width: 2; opacity: 0; }
.chart .dot.s1 { fill: var(--series-1); }
.chart .dot.s2 { fill: var(--series-2); }
.chart .hit:hover .dot { opacity: 1; }
.chart .target { fill: transparent; }
.chart .bar.s1 { fill: var(--series-1); }
.chart .hit:hover .bar { opacity: .8; }
.legend { list-style: none; margin: 0 0 .4rem; padding: 0; display: flex; gap: 1rem; font-size: .85rem; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: .35rem; }
.swatch { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.swatch.s1 { background: var(--series-1); }
.swatch.s2 { background: var(--series-2); }
.table-view { margin-top: .4rem; font-size: .85rem; }
.table-scroll { max-height: 240px; overflow: auto; margin-top: .4rem; }
.table-view table { border-collapse: collapse; width: 100%; }
.table-view th, .table-view td { text-align: left; padding: .25rem .5rem; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }

/* Games */
.game-lines { background: var(--surface-2); border-radius: var(--radius-s); padding: .6rem .8rem; margin: .5rem 0; }
.game-lines.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; white-space: pre; overflow-x: auto; line-height: 1.35; }
.game-status { font-weight: 700; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: min(92vw, 480px);
  background: var(--ink); color: var(--bg); padding: .7rem 1.1rem; border-radius: 14px; box-shadow: var(--shadow);
  font-weight: 600; z-index: 20;
}
.toast.bad { background: var(--crit); color: #fff; }
@media (prefers-reduced-motion: no-preference) {
  .toast:not([hidden]) { animation: pop .25s ease-out; }
  .view { animation: fade .2s ease-out; }
}
@keyframes pop { from { transform: translate(-50%, 10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes fade { from { opacity: .4; } to { opacity: 1; } }

@media (forced-colors: active) {
  .bar .fill, .chart .line, .chart .bar { forced-color-adjust: none; }
  .tab.current { outline: 2px solid CanvasText; }
}

/* Imported history */
.tl-entry.tone-chapter .tl-text { font-style: italic; color: var(--ink-2); line-height: 1.6; }
.tl-entry.tone-chapter .tl-icon { color: var(--accent); }
.lore { margin: 0; padding-left: 1.2rem; display: grid; gap: .5rem; }
.letter { margin: .6rem 0; padding: .8rem 1rem; background: var(--surface-2); border-radius: var(--radius-s); border-left: 3px solid var(--accent); }
.letter p { white-space: pre-line; margin: 0 0 .3rem; }
.final-mood { background: var(--sad-bg); }

/* Care finance: running bills on the House tab (DESIGN 17). */
.bills .bill { padding: 0.6rem 0; border-top: 1px solid var(--line, rgba(127,127,127,0.2)); }
.bills .bill:first-child { border-top: 0; }
.bills .bill.overdue { background: var(--warn-bg); border-radius: 0.5rem; padding: 0.6rem; }
.bills .warn { color: var(--low); font-weight: 600; margin: 0.3rem 0; }

/* Funeral words (DESIGN 20): eulogies and letters on the memorial. */
blockquote.eulogy { margin: .75rem 0; padding: .5rem .9rem; border-left: 3px solid currentColor; opacity: .95; }
blockquote.eulogy p { white-space: pre-line; margin: .25rem 0; }
blockquote.letter { font-style: italic; }
