:root {
  color-scheme: light;
  --paper: #fcfaf7;
  --page: #ffffff;
  --ink: #322a2a;
  --secondary: #6e6464;
  --primary: #bc3956;
  --primary-hover: #a42d48;
  --accent-ink: #a3314c;
  --blush: #fbeced;
  --rule: #e4ddda;
  --editorial: 'Songti SC', 'STSong', 'Noto Serif CJK SC', 'Noto Serif SC', 'SimSun', serif;
  --sans:
    -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei',
    'Noto Sans CJK SC', sans-serif;
  --display:
    ui-rounded, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui,
    sans-serif;
}
* {
  box-sizing: border-box;
}
html {
  min-height: 100%;
  scroll-padding: 16px;
}
body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
button,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
select {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(205, 55, 87, 0.13);
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
a {
  color: inherit;
  text-decoration: none;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent-ink);
  outline-offset: 4px;
}
button {
  border: 0;
  background: none;
}
button:disabled {
  opacity: 0.7;
}
h1,
h2,
h3,
p,
figure,
ol,
dl,
dd,
blockquote {
  margin: 0;
}
h1,
h2,
h3 {
  font-family: var(--display);
  text-wrap: balance;
}
h1:focus,
main:focus {
  outline: none;
}
.sr-only,
.skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  padding: 8px 16px;
  z-index: 10;
  background: var(--page);
}
.icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.site-header {
  border-bottom: 1px solid var(--rule);
}
.header-inner,
main,
.footer {
  width: min(1180px, calc(100% - 112px));
  margin-inline: auto;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}
.brand img {
  width: 40px;
  height: 40px;
}
.brand span {
  font-family: var(--display);
  font-weight: 750;
  font-size: 22px;
  line-height: 1.12;
  letter-spacing: 0.012em;
}
nav {
  display: flex;
  align-items: center;
  gap: 11px;
}
nav a {
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--secondary);
  padding: 7px 19px;
  border-radius: 999px;
}
nav a[aria-current='page'] {
  color: var(--ink);
  font-weight: 700;
}
.site-header nav a {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 44px;
}
.site-header nav a[aria-current='page']::after {
  position: absolute;
  content: '';
  width: 20px;
  height: 3px;
  border-radius: 99px;
  background: var(--primary);
  bottom: 2px;
}
nav a:hover,
.back:hover,
.text-action:hover {
  color: var(--primary-hover);
}
main {
  flex: 1;
  min-width: 0;
}
.wait-page {
  padding: 90px 0;
}
.section-tag,
.tiny-tag {
  color: var(--secondary);
  font-size: 12px;
  letter-spacing: 0.055em;
  font-weight: 600;
}
.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.short-rule {
  width: 17px;
  height: 3px;
  border-radius: 10px;
  background: var(--primary);
}
h1 {
  letter-spacing: -0.035em;
  font-size: clamp(36px, 4vw, 58px);
  font-weight: 600;
  line-height: 1.28;
}
.cover-actions,
.end-actions {
  display: flex;
  align-items: center;
  gap: 19px;
  flex-wrap: wrap;
}
.primary,
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  line-height: 1.3;
  gap: 12px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.015em;
  padding: 15px 22px;
  min-height: 46px;
}
.primary {
  background: var(--primary);
  color: var(--page);
  border: 1px solid var(--primary);
}
.primary:hover {
  background: var(--primary-hover);
}
.secondary {
  background: var(--page);
  border: 1px solid #dfcdd3;
  color: var(--primary);
}
.secondary:hover {
  background: var(--blush);
}
.era {
  display: inline-flex;
  align-items: center;
  color: var(--secondary);
  gap: 7px;
  min-height: 44px;
  padding: 6px 4px;
  font-size: 14px;
  border-radius: 9px;
}
.era:hover {
  color: var(--accent-ink);
  background: var(--blush);
}
.world-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0;
}
.world-option {
  display: flex;
  align-items: center;
  min-height: 47px;
  gap: 8px;
  padding: 8px 11px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid #dfcdd3;
  border-radius: 11px;
  cursor: pointer;
}
.world-option:has(:checked) {
  color: var(--accent-ink);
  border-color: var(--primary);
  background: var(--blush);
}
.world-option:has(:focus-visible) {
  outline: 3px solid var(--accent-ink);
  outline-offset: 2px;
}
.world-option input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  flex: none;
  margin: 0;
}
.world-year:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 14px;
  font-size: 14px;
}
.world-year select {
  flex: 1;
  max-width: 100%;
  min-height: 44px;
  font-size: 16px;
  border: 1px solid #cbbfc5;
  border-radius: 9px;
  background: var(--page);
  padding: 5px 8px;
}
.world-hint {
  margin: 13px 0 17px;
  color: var(--secondary);
  font-size: 14px;
}
.world-confirm {
  width: 100%;
}
.rebirth-confirm {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rebirth-confirm .primary {
  flex: 1;
}
.rebirth-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 6px;
  border-radius: 8px;
  color: var(--accent-ink);
  font-size: 14px;
}
.rebirth-link:hover {
  background: var(--blush);
}
.chapter .rebirth-link {
  margin-top: 8px;
}
.archived-place {
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
}
.archived-event {
  margin: 25px 0 8px;
  font-size: 18px;
}
.resume-note {
  font-size: 12px;
  color: var(--secondary);
  margin-top: 12px;
}
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 19px 0 24px;
  border-top: 1px solid var(--rule);
  font-size: 11px;
  color: var(--secondary);
  letter-spacing: 0.05em;
  margin-top: 16px;
}
.footer-title {
  display: flex;
  align-items: center;
  gap: 9px;
}
.footer i {
  height: 10px;
  width: 1px;
  background: var(--rule);
}
.footer #mode::before {
  content: none;
}
.chapter-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 68px;
}
.back,
.text-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--secondary);
  min-height: 34px;
}
.reader-tools {
  max-width: 1050px;
  margin-inline: auto;
}
.pace-tools,
.pace-toggle,
.pace-skip,
.pace-waiting,
.pace-rate {
  display: flex;
  align-items: center;
}
.pace-tools {
  gap: 6px;
  color: var(--secondary);
  font-size: 13px;
}
.pace-toggle,
.pace-skip,
.pace-rate select {
  min-height: 44px;
  border-radius: 10px;
  font-weight: 600;
}
.pace-toggle,
.pace-skip {
  gap: 5px;
  padding: 0 10px;
}
.pace-skip {
  color: var(--accent-ink);
}
.pace-skip[aria-pressed="true"],
.pace-skip:hover,
.pace-toggle:hover,
.pace-rate select:hover {
  background: var(--blush);
}
.pace-rate {
  position: relative;
}
.pace-rate select {
  width: 65px;
  appearance: none;
  padding: 0 19px 0 10px;
  color: var(--ink);
  background: transparent;
  border: none;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.pace-rate > .icon {
  position: absolute;
  right: 8px;
  pointer-events: none;
}
.pace-waiting {
  gap: 6px;
  padding: 0 8px;
  color: var(--accent-ink);
}
.spread {
  display: grid;
  grid-template-columns: minmax(208px, 0.61fr) minmax(0, 1.5fr);
  gap: clamp(26px, 6.5vw, 100px);
  align-items: start;
  padding-bottom: 42px;
  max-width: 1050px;
  margin-inline: auto;
}
.dossier {
  padding: 24px;
  border-block: 1px solid var(--rule);
}
.portrait-plate {
  position: relative;
  overflow: hidden;
  background: #f5efeb;
  border: 1px solid var(--rule);
  border-radius: 50%;
  width: 116px;
  height: 116px;
  margin-inline: auto;
  isolation: isolate;
}
.portrait-wrap {
  height: 100%;
  display: grid;
  place-items: end center;
}
.portrait-wrap > svg,
.portrait-wrap > img {
  display: block;
  height: 100%;
  width: 100%;
  object-fit: contain;
}
.portrait-caption,
.portrait-edit {
  position: absolute;
  bottom: 9px;
  line-height: 1;
  background: #ffffffeb;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.portrait-caption {
  left: 11px;
  letter-spacing: 0.12em;
  padding: 6px;
  font-family: var(--display);
  font-size: 11px;
}
.portrait-edit {
  right: 10px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
}
.identity {
  padding-top: 16px;
}
@media (min-width: 761px) {
  .identity { text-align: center; }
  .identity .origin { justify-content: center; }
  .dossier:has(.face-redraw, .portrait-edit) .portrait-plate {
    width: 148px;
    height: 148px;
    border-radius: 16px;
  }
}
.tiny-tag {
  font-size: 11px;
  letter-spacing: 0.11em;
}
.identity h2 {
  font-size: 31px;
  line-height: 1.2;
  margin: 5px 0 6px;
}
.origin {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--secondary);
}
.facts {
  border-top: 1px solid var(--rule);
  margin: 14px 0 6px;
  padding-top: 8px;
  font-size: 13px;
}
.facts div,
.detail-list div {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 3px 0;
}
.facts dt,
.detail-list dt {
  color: var(--secondary);
  flex-shrink: 0;
}
.facts dd,
.detail-list dd {
  text-align: right;
}
.text-action {
  color: var(--accent-ink);
  padding: 3px 0;
}
.chapter {
  min-width: 0;
  padding-top: 8px;
  overflow-wrap: anywhere;
}
.chapter-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.page-date,
.ending-years {
  font-family: var(--display);
  font-variant-numeric: tabular-nums;
  color: var(--secondary);
}
.page-date {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  font-size: 14px;
}
.page-date strong {
  display: inline-block;
  position: relative;
  padding: 3px 10px;
  color: var(--accent-ink);
  background: var(--blush);
  border-radius: 8px 8px 8px 2px;
  font-weight: 600;
}
.page-date strong::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 100%;
  border-top: 4px solid var(--blush);
  border-right: 4px solid transparent;
}
.page-date span {
  font-size: 0.92em;
}
.chapter h1 {
  font-size: clamp(31px, 3.4vw, 51px);
  font-family: var(--editorial);
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: 0;
  margin: 20px 0 12px;
}
.scene-text,
.tributes blockquote,
.timeline p,
.dialog-lead {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.85;
  color: #423c3a;
}
.choices {
  display: grid;
  gap: 0;
  margin: 24px 0 12px;
  border-block: 1px solid var(--rule);
}
.spoken-choice {
  width: fit-content;
  max-width: min(100%, 34em);
  position: relative;
  padding: 10px 16px;
  border-radius: 12px 12px 12px 2px;
  background: var(--blush);
  color: var(--ink);
}
.spoken-choice::after {
  position: absolute;
  content: '';
  left: 8px;
  top: 100%;
  border-top: 6px solid var(--blush);
  border-right: 6px solid transparent;
}
.choice {
  width: 100%;
  display: flex;
  align-items: center;
  text-align: left;
  gap: 12px;
  padding: 16px 8px;
  background: transparent;
  border: 0;
  border-radius: 0;
  min-height: 60px;
  line-height: 1.55;
  font-size: 15px;
}
.choice + .choice { border-top: 1px solid var(--rule); }
.choice:focus-visible { outline-offset: -2px; }
.choice .icon {
  margin-left: auto;
  color: #756b75;
}
.choice-copy {
  min-width: 0;
  font-weight: 600;
}
.choice-copy small {
  display: block;
  margin-top: 2px;
  font: 400 13px/1.45 var(--sans);
  color: var(--secondary);
}
.choice-bullet {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border-radius: 50%;
  border: 1.5px solid #ac9a99;
  color: var(--primary);
}
@media (hover: hover) {
  .choice:hover { background: var(--blush); }
  .choice:hover .choice-bullet { border-color: var(--primary); }
}
.birth-income {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px 15px;
  margin-top: 18px;
}
.birth-income dt,
.recent-beats li > span,
.beat-status {
  font-size: 13px;
  color: var(--secondary);
}
.birth-income dd {
  color: var(--ink);
  font: 650 19px var(--display);
  font-variant-numeric: tabular-nums;
}
.beat-clock {
  margin-top: 22px;
}
.beat-track {
  height: 3px;
  background: #efe1e5;
  overflow: hidden;
  border-radius: 8px;
}
.beat-track > span {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left;
  transform: scaleX(0);
  background: #ca637b;
}
.beat-status:not(:empty) {
  margin-top: 7px;
}
.recent-beats {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}
.recent-head,
.recent-beats li {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.recent-head {
  align-items: center;
  justify-content: space-between;
}
.recent-head .text-action {
  font-size: 12px;
}
.recent-beats ol {
  list-style: none;
  padding: 0;
}
.recent-beats li {
  margin-top: 4px;
  font-size: 14px;
  color: var(--secondary);
}
.recent-beats li > span {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.ending-years {
  font-size: 24px;
  margin: 6px 0 12px;
}
.ending-years span {
  font: 13px var(--sans);
  margin-left: 12px;
}
.tribute-title {
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: 21px;
  margin: 23px 0 9px;
  color: var(--accent-ink);
}
.tributes {
  display: grid;
  gap: 16px;
}
.tributes blockquote {
  font-size: 16px;
  padding: 12px 16px;
  border: 1px solid var(--rule);
  border-radius: 12px 12px 12px 2px;
  background: var(--page);
}
.tributes figcaption {
  font-size: 12px;
  color: var(--secondary);
  margin-top: 4px;
}
.end-actions {
  margin-top: 22px;
}
.archive-page {
  max-width: 850px;
  margin: 48px auto 70px;
}
.archive-head h1 {
  margin: 10px 0 27px;
  font-size: 43px;
  font-family: var(--editorial);
}
.empty-state {
  text-align: center;
  background: var(--page);
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 62px 20px;
}
.empty-state > span {
  display: grid;
  margin: 0 auto 14px;
  place-items: center;
  background: var(--blush);
  color: var(--primary);
  width: 63px;
  height: 63px;
  border-radius: 24px;
}
.empty-state h2 {
  font-size: 24px;
}
.empty-state p {
  font-size: 14px;
  margin: 6px 0 24px;
  color: var(--secondary);
}
.archive-list {
  border-block: 1px solid var(--rule);
}
.archive-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 19px 8px;
}
.archive-item + .archive-item {
  border-top: 1px solid var(--rule);
}
.archive-item:hover {
  background: #fff2f4;
}
.archive-mark {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  height: 48px;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: #f0f5f8;
}
.archive-mark:has([data-portrait-sex='female']) { background: #fbf0f2; }
.archive-mark .life-portrait { width: 100%; height: 100%; }
.archive-person {
  min-width: 0;
}
.archive-person strong {
  display: block;
  font-family: var(--display);
  font-size: 23px;
}
.archive-person small,
.archive-age small {
  display: block;
  color: var(--secondary);
  font-size: 12px;
}
.archive-age {
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}
dialog {
  position: fixed;
  margin: auto;
  width: min(480px, calc(100% - 32px));
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: var(--page);
  color: var(--ink);
  padding: 32px;
  max-height: 85svh;
  overflow: auto;
  overscroll-behavior: contain;
  box-shadow: 0 12px 48px #322a2a1c;
}
dialog::backdrop {
  background: #322a2a53;
}
dialog h2 {
  font-size: 27px;
  margin: 5px 24px 13px 0;
  line-height: 1.4;
}
.close {
  position: absolute;
  right: 12px;
  top: 13px;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.close:hover {
  background: var(--blush);
}
.dialog-lead {
  font-size: 16px;
  margin: 5px 0 14px;
}
.field-hint {
  color: var(--secondary);
  font-size: 12px;
}
.dialog-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 6px;
}
textarea {
  width: 100%;
  border: 1px solid #cbbfc5;
  border-radius: 9px;
  resize: vertical;
  background: var(--page);
  padding: 11px 13px;
  min-height: 100px;
  font-size: 16px;
}
textarea::placeholder {
  color: #736a72;
}
.form-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin: 13px 0 0;
}
.form-foot small {
  color: var(--secondary);
}
.idea-page {
  width: min(620px, 100%);
  margin: 40px auto 64px;
}
.idea-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--rule);
}
.idea-head h1 { font-size: 34px; }
.idea-back { min-height: 44px; white-space: nowrap; padding: 6px 0 6px 8px; }
.idea-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
#redirect-form label { font-weight: 600; }
#direction-input {
  display: block;
  min-height: 72px;
  height: 9em;
  line-height: 1.6;
  font-size: 17px;
  caret-color: var(--accent-ink);
}
#direction-limit { white-space: nowrap; }
#redirect-form .form-foot { margin-top: 20px; }
#redirect-form .form-foot small { font-size: 13px; }
.direction-progress {
  margin: 14px 0 0;
  padding: 9px 12px;
  border-inline-start: 2px solid var(--primary);
  background: var(--blush);
  color: var(--accent-ink);
  font-size: 14px;
}
.actions-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding-inline: 10px;
  color: var(--accent-ink);
  font-weight: 600;
  border-radius: 9px;
}
.actions-entry:hover { background: var(--blush); }
.actions-page { width: min(660px, 100%); margin: 40px auto 64px; }
.actions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.actions-head h1 { font: 600 34px/1.3 var(--editorial); }
.actions-head .back { min-height: 44px; padding-inline: 8px 0; }
.action-balances {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin: 14px 0 20px;
  font-variant-numeric: tabular-nums;
}
.action-balances div { display: flex; align-items: baseline; gap: 7px; }
.action-balances dt { font-size: 13px; color: var(--secondary); }
.action-balances dd { font-weight: 600; }
.action-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--rule); }
.action-tabs button {
  min-height: 44px;
  padding: 5px 2px;
  color: var(--secondary);
  border-bottom: 2px solid transparent;
}
.action-tabs [aria-selected="true"] { color: var(--accent-ink); font-weight: 650; border-color: currentColor; }
.life-action { border-bottom: 1px solid var(--rule); }
.life-action summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 14px 0;
  cursor: pointer;
  list-style: none;
}
.life-action summary::-webkit-details-marker { display: none; }
.life-action summary:focus-visible,
.actions-page [role="tabpanel"]:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.life-action summary > .icon { color: var(--secondary); }
.life-action[open] summary > .icon { transform: rotate(180deg); }
.action-name strong { display: block; font-weight: 650; font-size: 16px; }
.action-name small,
.action-option small { display: block; color: var(--secondary); line-height: 1.55; font-size: 13px; }
.action-status { color: var(--secondary); font-size: 12px; max-width: 14em; text-align: end; overflow-wrap: anywhere; }
.action-status.is-active { color: var(--accent-ink); font-weight: 600; }
.action-body { padding: 0 0 18px; }
.action-description { margin-bottom: 8px; font-size: 14px; }
.action-facts { font-size: 14px; line-height: 1.65; }
.action-facts > div { display: grid; grid-template-columns: 2.5em minmax(0, 1fr); gap: 9px; margin-bottom: 4px; }
.action-facts dt, .action-empty { color: var(--secondary); }
.action-form fieldset {
  min-inline-size: 0;
  margin: 14px 0 0;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 0 12px 4px;
  background: var(--page);
}
.action-form legend { font-size: 13px; padding-inline: 4px; color: var(--secondary); }
.action-option { display: flex; align-items: start; gap: 9px; min-height: 44px; padding: 9px 2px; cursor: pointer; }
.action-option + .action-option { border-top: 1px solid var(--rule); }
.action-option input { flex: none; margin: 5px 0 0; accent-color: var(--accent-ink); }
.action-option strong { display: block; font-size: 14px; font-weight: 600; }
.action-option.unavailable { color: var(--secondary); cursor: default; }
.action-reason, .action-option .action-reason { color: var(--accent-ink); font-size: 13px; margin-top: 4px; }
.action-form .primary { margin-top: 12px; padding: 8px 19px; min-height: 44px; }
.action-form .primary:disabled { background: #eee8e6; color: var(--secondary); opacity: 1; }
.action-feedback {
  margin: 12px 0;
  padding: 10px 13px;
  border-left: 2px solid #71876b;
  background: #f0f4ed;
  font-size: 14px;
}
.action-feedback.is-error { border-color: var(--primary); background: var(--blush); }
.action-empty { padding-block: 24px; }
.error {
  color: #a12441;
  font-size: 13px;
  line-height: 1.65;
  margin-top: 8px;
}
.error:empty {
  display: none;
}
.page-error {
  position: sticky;
  bottom: 8px;
  background: #fff0ef;
  border: 1px solid #efbac5;
  border-radius: 9px;
  padding: 10px 16px;
  z-index: 2;
}
.detail-list {
  font-size: 14px;
  margin: 8px 0;
}
.data-references { margin-top: 16px; color: var(--secondary); font-size: 13px; }
.data-references summary { padding-block: 10px; cursor: pointer; }
.data-references p { margin: 5px 0 12px; }
.data-references a { color: var(--accent-ink); text-decoration: underline; }
.detail-list div {
  border-bottom: 1px solid var(--rule);
  padding: 7px 0;
}
.life-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  max-width: 1050px;
  margin: 0 auto;
  padding-block: 12px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.life-stats > div {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
}
.life-stats > div + div { border-inline-start: 1px solid var(--rule); }
.life-stats.with-savings { grid-template-columns: minmax(max-content, 1.6fr) repeat(4, minmax(0, 1fr)); }
.life-stats .current-savings {
  background: var(--blush);
  border-radius: 8px;
  padding: 3px 10px;
}
.life-stats .current-savings + div { border-inline-start: 0; }
.life-stats .current-savings dt, .life-stats .current-savings dd { color: var(--accent-ink); }
.life-stats .current-savings dd { white-space: nowrap; }
.life-stats dt { color: var(--secondary); font-size: 13px; }
.life-stats dd {
  display: flex;
  align-items: baseline;
  gap: 3px;
  position: relative;
  font: 600 25px/1.15 var(--display);
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.stat-change { color: var(--accent-ink); font: 600 11px/1 var(--sans); }
dialog .life-stats { background: transparent; }
.reader-actions, .impact-line { display: flex; align-items: center; gap: 12px; }
.write-anytime {
  color: var(--accent-ink);
  background: var(--blush);
  border-radius: 10px;
  min-height: 44px;
  padding: 6px 13px;
  font-weight: 600;
}
.write-anytime small { font-size: 12px; margin-inline-start: 4px; }
.write-anytime:enabled:hover { background: #ffe3ea; }
.write-anytime:disabled { color: var(--secondary); background: #f2edef; }
.impact-line {
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-block: 5px 1px;
  color: var(--accent-ink);
  font: 500 12px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
}
.impact-line span { white-space: nowrap; }
.timeline .impact-line { margin-block: 2px 10px; }
@media (max-width: 760px), (max-height: 500px) and (max-width: 960px) and (pointer: coarse) {
  .life-stats { padding: 8px 0; }
  .life-stats > div { flex-direction: column; align-items: center; gap: 1px; }
  .life-stats dt { font-size: 12px; }
  .life-stats dd { font-size: 20px; }
  .life-stats .current-savings { padding: 2px 6px; }
  .life-stats .current-savings dd { font-size: clamp(14px, 4.5vw, 20px); }
  .life-stats dd .stat-change { position: absolute; top: 1px; left: calc(100% + 2px); }
  main > .life-stats { position: sticky; top: 0; z-index: 3; }
}
.timeline {
  list-style: none;
  padding: 3px 0;
}
.timeline li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  column-gap: 16px;
}
.time-age {
  position: relative;
  padding: 12px 16px 12px 0;
  border-right: 1px solid var(--rule);
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.time-age::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 21px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--page);
  border: 1px solid #a99b97;
}
.timeline li:first-child .time-age::after { background: var(--primary); border-color: var(--primary); }
.timeline li > div + div { padding: 10px 0 16px; }
.time-age small {
  display: block;
  font-weight: 400;
  font-size: 11px;
}
.timeline h3 {
  font-size: 17px;
}
.timeline p {
  font-size: 14px;
  line-height: 1.8;
}
.tattoo-preview {
  margin: 8px auto;
  height: 200px;
  background: #ffebe6;
  border-radius: 12px;
  display: grid;
  place-items: center;
}
.tattoo-preview svg,
.tattoo-preview img {
  height: 100%;
  max-width: 100%;
  object-fit: contain;
}
.motifs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 13px 0;
}
.motifs button {
  border-radius: 7px;
  padding: 6px 12px;
  border: 1px solid var(--rule);
  font-size: 13px;
}
.motifs button[aria-pressed='true'] {
  background: var(--blush);
  border-color: #d97992;
}
@media (max-width: 900px) {
  .header-inner,
  main,
  .footer {
    width: calc(100% - 60px);
  }
  .spread {
    gap: 30px;
  }
  .chapter {
    padding-top: 2px;
  }
}
.mobile-only {
  display: none;
}
@media (max-width: 760px),
  (max-height: 500px) and (max-width: 960px) and (pointer: coarse) {
  :root {
    --gutter-start: max(18px, env(safe-area-inset-left));
    --gutter-end: max(18px, env(safe-area-inset-right));
  }
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: block;
  }
  .header-inner,
  main,
  .footer {
    width: auto;
    margin-inline: var(--gutter-start) var(--gutter-end);
  }
  .header-inner {
    min-height: 58px;
  }
  .brand {
    gap: 8px;
  }
  .brand span {
    font-size: 18px;
    letter-spacing: -0.035em;
  }
  .brand img {
    width: 31px;
    height: 31px;
  }
  .site-header nav {
    gap: 2px;
  }
  .site-header nav a {
    font-size: 13px;
    min-height: 44px;
    padding: 6px 9px;
  }
  .site-header nav a[aria-current='page']::after {
    bottom: 4px;
  }
  .section-tag {
    font-size: 12px;
  }
  .primary,
  .secondary {
    min-height: 46px;
    padding: 12px 20px;
  }
  .footer {
    padding: 15px 0 18px;
    margin-top: 12px;
  }
  body:has(.mobile-dock) {
    padding-bottom: calc(75px + env(safe-area-inset-bottom));
    scroll-padding-bottom: calc(75px + env(safe-area-inset-bottom));
  }
  html:has(.mobile-dock) {
    scroll-padding-bottom: calc(75px + env(safe-area-inset-bottom));
  }
  .chapter-tools {
    min-height: 40px;
  }
  .spread {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px 0 20px;
  }
  .dossier {
    display: flex;
    padding: 0;
    width: 100%;
    align-items: center;
    gap: 10px;
    min-height: 53px;
    border: none;
    border-radius: 0;
    background: none;
    overflow: visible;
  }
  .dossier .portrait-plate {
    flex: 0 0 47px;
    width: 47px;
    height: 47px;
    border: 1px solid #f3dce2;
    border-radius: 50%;
    margin: 0;
  }
  .dossier .portrait-plate::before {
    content: none;
  }
  .dossier .portrait-wrap {
    min-height: 0;
    height: 100%;
  }
  .dossier .portrait-wrap > svg,
  .dossier .portrait-wrap > img {
    height: 100%;
    width: 100%;
  }
  .dossier .identity {
    padding: 0;
    flex: 1;
    min-width: 0;
  }
  .identity h2 {
    font-size: 18px;
    margin: 0 0 1px;
    line-height: 1.35;
  }
  .identity .origin {
    font-size: 12px;
  }
  .identity .tiny-tag,
  .identity .facts,
  .identity > .text-action {
    display: none;
  }
  .reader-tools {
    justify-content: flex-end;
    min-height: 44px;
  }
  main:has(> .reader-tools) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-content: start;
    column-gap: 8px;
    padding: 12px 0 24px;
  }
  main:has(> .reader-tools) > .life-spread { display: contents; }
  main:has(> .reader-tools) > .life-stats { grid-area: 1 / 1 / 2 / -1; margin-bottom: 9px; }
  main:has(> .reader-tools) .dossier { grid-area: 2 / 1; }
  main:has(> .reader-tools) > .reader-tools { grid-area: 2 / 2; align-self: center; }
  main:has(> .reader-tools) .chapter {
    grid-column: 1 / -1;
    padding-top: 16px;
    margin-top: 12px;
    border-top: 1px solid var(--rule);
  }
  main:has(> .reader-tools) > .page-error { grid-column: 1 / -1; }
  .pace-toggle span { display: none; }
  .pace-toggle, .pace-skip { min-width: 44px; justify-content: center; padding: 0 4px; }
  .pace-skip { gap: 2px; }
  .pace-rate select { width: 48px; padding-left: 4px; }
  .pace-rate > .icon { right: 2px; }
  .pace-waiting { padding: 0 4px; font-size: 12px; color: var(--secondary); }
  .dossier .identity { overflow-wrap: anywhere; }
  .dossier .origin .icon { display: none; }
  .dossier .identity h2 { font-weight: 600; }
  .life-spread .chapter-top .section-tag { letter-spacing: 0; }
  .chapter-top .page-date { gap: 8px; }
  .chapter-top .section-tag { font-weight: 500; }
  .pace-tools {
    gap: 3px;
  }
  .portrait-open {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    width: 100%;
    height: 100%;
    padding: 0;
  }
  .portrait-plate:has(.portrait-open:focus-visible) {
    outline: 2px solid var(--accent-ink);
    outline-offset: 2px;
  }
  .profile-hero.mobile-only {
    border-radius: 16px;
    background: #f6f2ee;
    display: grid;
    position: relative;
    place-items: center;
    margin: 8px 0 14px;
    overflow: hidden;
  }
  .profile-portrait {
    height: clamp(112px, 23dvh, 175px);
    width: 100%;
    text-align: center;
  }
  .profile-portrait > svg,
  .profile-portrait > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
  .mobile-profile-action {
    position: absolute;
    right: 5px;
    bottom: 4px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 44px;
    padding: 5px 10px;
    background: #ffffffee;
    color: var(--accent-ink);
    font-size: 13px;
    font-weight: 600;
  }
  .chapter {
    width: 100%;
    padding: 0;
  }
  .chapter-top {
    gap: 8px;
  }
  .page-date {
    font-size: 13px;
  }
  .chapter h1 {
    font-size: clamp(26px, 7.3vw, 34px);
    margin: 12px 0 8px;
  }
  .scene-text {
    font-size: 16px;
    line-height: 1.75;
  }
  .choices {
    margin: 20px 0 0;
  }
  .choice {
    font-size: 15px;
    min-height: 48px;
    padding: 12px 4px;
    gap: 12px;
  }
  .recent-beats {
    margin-top: 20px;
  }
  .beat-clock {
    margin-top: 17px;
  }
  .mobile-dock {
    position: fixed;
    z-index: 4;
    inset: auto 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    border-top: 1px solid var(--rule);
    background: #fffffffa;
    padding: 7px max(13px, env(safe-area-inset-right))
      calc(7px + env(safe-area-inset-bottom))
      max(13px, env(safe-area-inset-left));
  }
  .dock-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    min-height: 46px;
    padding: 6px;
    flex: 1 1 0;
    font-size: 13px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--secondary);
    border-radius: 999px;
  }
  .dock-item:not(.dock-direction):hover {
    background: var(--blush);
    color: var(--accent-ink);
  }
  .dock-direction {
    flex: 1.85 1 0;
    background: var(--primary);
    color: white;
  }
  .dock-direction:disabled {
    opacity: 1;
    background: #f3eef0;
    color: #71666c;
  }
  .dock-caption {
    font-size: 11px;
    line-height: 1.25;
    font-weight: 500;
    white-space: nowrap;
  }
  body:has(dialog[open]) {
    overflow: hidden;
  }
  dialog {
    inset: auto 0 var(--mobile-keyboard-inset, 0px);
    margin: 0 auto;
    width: min(100%, 600px);
    max-width: 100%;
    padding: 23px max(20px, env(safe-area-inset-right))
      calc(18px + env(safe-area-inset-bottom))
      max(20px, env(safe-area-inset-left));
    max-height: min(
      88dvh,
      calc(var(--mobile-sheet-height, 100dvh) - 8px),
      760px
    );
    border-radius: 23px 23px 0 0;
    scroll-padding-block: 22px;
    overscroll-behavior: contain;
  }
  dialog::before {
    content: '';
    width: 33px;
    height: 4px;
    background: #e0d5d9;
    position: absolute;
    top: 8px;
    left: calc(50% - 16px);
    border-radius: 99px;
  }
  dialog .close {
    top: 8px;
    right: 9px;
    width: 44px;
    height: 44px;
    background: var(--page);
  }
  dialog h2 {
    font-size: 23px;
    margin-right: 37px;
  }
  body:is(.writing-idea, .arranging-actions) .site-header,
  body:is(.writing-idea, .arranging-actions) .footer { display: none; }
  body:is(.writing-idea, .arranging-actions) main { padding: 0; }
  .actions-page { margin: 0 auto; padding-block: calc(9px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-bottom)); }
  .actions-head h1 { font-size: 29px; }
  .action-balances { margin: 8px 0 10px; gap: 2px 18px; }
  .action-tabs { gap: 18px; }
  .life-action summary { gap: 6px; padding: 12px 0; }
  .action-status { max-width: 8em; }
  .mobile-dock:has([data-action="actions"]) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(84px, 1.4fr);
    gap: 4px;
  }
  .mobile-dock:has([data-action="actions"]) .dock-direction {
    flex-direction: column;
    gap: 1px;
    padding-inline: 3px;
  }
  .idea-page {
    margin-block: 0;
    padding-top: calc(8px + env(safe-area-inset-top));
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
  .idea-head { padding-bottom: 10px; margin-bottom: 14px; gap: 12px; }
  .idea-head h1 { font-size: 28px; }
  .idea-back { font-size: 14px; }
  #direction-input { height: clamp(84px, 28dvh, 180px); }
  #direction-input:focus { outline-offset: 0; }
  #redirect-form .form-foot { flex-wrap: nowrap; gap: 12px; margin-top: 16px; }
  #redirect-form .primary { min-height: 44px; padding: 10px 14px; white-space: nowrap; }
  .form-foot {
    flex-wrap: wrap;
  }
  .form-foot > .primary {
    margin-left: auto;
  }
  .detail-list dd {
    overflow-wrap: anywhere;
  }
  .back,
  .text-action,
  .motifs button {
    min-height: 44px;
  }
  .archive-page {
    margin: 24px auto 48px;
  }
  .archive-head h1 {
    font-size: 32px;
  }
  .archive-item {
    padding: 14px 2px;
    gap: 10px;
  }
  .archive-person strong {
    font-size: 19px;
  }
  .empty-state {
    padding: 34px 12px;
  }
  .empty-state h2 {
    font-size: 20px;
  }
  .ending-years {
    font-size: 20px;
  }
  .tributes blockquote {
    font-size: 15px;
    line-height: 1.8;
  }
}
@media (max-height: 360px) and (max-width: 960px) {
  .idea-page { margin-top: 0; padding-top: calc(4px + env(safe-area-inset-top)); }
  .idea-head { padding-bottom: 4px; margin-bottom: 8px; }
  .idea-head h1 { font-size: 25px; }
  .idea-label { margin-bottom: 5px; }
  #direction-input { min-height: 48px; height: clamp(48px, 30dvh, 92px); }
}
@media (max-width: 355px) {
  :root {
    --gutter-start: max(14px, env(safe-area-inset-left));
    --gutter-end: max(14px, env(safe-area-inset-right));
  }
  .site-header nav a {
    padding-inline: 7px;
  }
  .dock-item {
    gap: 4px;
    font-size: 12px;
  }
  .dock-caption {
    font-size: 10px;
  }
}
.face-redraw {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  padding: 3px 9px;
  border: 1px solid #e9d6db;
  border-radius: 8px;
  background: #ffffffef;
  color: var(--primary);
  font-size: 11px;
}
.face-redraw:hover {
  background: var(--page);
}

/* Abstract defaults share the same quiet framing at every viewport size. */
.portrait-plate:has([data-portrait-source="default"]),
.profile-hero:has([data-portrait-source="default"]) {
  --avatar-surface: #f1f7fa;
  --avatar-rule: #dce9f0;
  background: var(--avatar-surface);
  border-color: var(--avatar-rule);
}
.portrait-plate:has([data-portrait-source="default"][data-portrait-sex="female"]),
.profile-hero:has([data-portrait-source="default"][data-portrait-sex="female"]) {
  --avatar-surface: #fcf3f5;
  --avatar-rule: #f0dfe5;
}
.portrait-plate:has([data-portrait-source="default"])::before {
  content: none;
}
.portrait-wrap:has(> [data-portrait-source="default"]) {
  place-items: center;
}
.portrait-wrap > [data-portrait-source="default"],
.profile-portrait > [data-portrait-source="default"] {
  display: block;
  object-fit: contain;
  object-position: center;
  transform: none;
}
