:root {
  --night: #15100d;
  --night-2: #241715;
  --paper: #f2e4c5;
  --paper-2: #e4cda5;
  --ink: #241a15;
  --muted: #75685c;
  --red: #be4938;
  --red-bright: #e4644e;
  --gold: #d4ad5d;
  --gold-pale: #f1d991;
  --jade: #4d8875;
  --blue: #7f91b6;
  --line: rgba(82, 58, 38, .2);
  --dark-line: rgba(235, 207, 151, .18);
  --white: #fff8e9;
  --shadow: 0 24px 70px rgba(0,0,0,.31);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  color: var(--paper);
  background:
    radial-gradient(circle at 70% 0, rgba(190,73,56,.2), transparent 31%),
    radial-gradient(circle at 5% 78%, rgba(77,136,117,.13), transparent 28%),
    repeating-linear-gradient(90deg, rgba(255,244,213,.018) 0 1px, transparent 1px 32px),
    var(--night);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.ash-field { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ash {
  position: absolute; top: -20px; width: 3px; height: 8px; border-radius: 50%;
  background: rgba(241,217,145,.32); filter: blur(.4px);
  animation: ashFall linear infinite;
}
@keyframes ashFall {
  to { transform: translate3d(var(--drift), 108vh, 0) rotate(220deg); opacity: 0; }
}

.topbar {
  position: sticky; z-index: 30; top: 0;
  min-height: 62px; padding: 8px clamp(12px, 3vw, 30px);
  display: flex; align-items: center; gap: 16px;
  border-bottom: 1px solid var(--dark-line);
  background: rgba(21,16,13,.9); backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-seal {
  width: 34px; height: 42px; display: grid; place-items: center;
  border: 2px solid var(--red-bright); color: var(--red-bright);
  font: 900 17px/1 "STKaiti", "KaiTi", serif;
  box-shadow: inset 0 0 12px rgba(228,100,78,.14);
}
.brand div { min-width: 0; }
.brand b { display: block; font: 900 20px/1.1 "STKaiti", "KaiTi", serif; letter-spacing: .04em; white-space: nowrap; }
.brand small { display: block; margin-top: 3px; color: #8f8070; font: 700 7px/1 "Menlo", monospace; letter-spacing: .12em; }
.top-status { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.top-status span { padding: 7px 8px; border: 1px solid var(--dark-line); border-radius: 6px; white-space: nowrap; }
.top-status b { color: var(--gold-pale); font: 800 11px/1 "Menlo", monospace; }
.top-status button {
  height: 31px; padding: 0 9px; border: 1px solid var(--dark-line); border-radius: 6px;
  color: #cfbea8; background: transparent; cursor: pointer;
}
.top-status button:hover { color: var(--gold-pale); border-color: rgba(212,173,93,.45); }
#soundBtn { width: 31px; padding: 0; }

.day-ribbon {
  display: grid; grid-template-columns: auto minmax(80px, 230px) auto;
  align-items: center; gap: 11px;
  max-width: 1450px; margin: 0 auto; padding: 10px clamp(14px, 3vw, 30px) 0;
  color: #cdbda7; font: 800 9px/1 "Menlo", monospace;
}
.day-ribbon span { color: var(--gold-pale); letter-spacing: .08em; }
.day-ribbon i { height: 3px; border-radius: 2px; overflow: hidden; background: rgba(255,255,255,.08); }
.day-ribbon i b { display: block; width: 25%; height: 100%; background: linear-gradient(90deg,var(--red),var(--gold)); transition: width .3s; }
.day-ribbon small { color: #756a5e; font-size: 8px; }

.game-shell {
  position: relative; z-index: 1;
  width: min(1450px, 100%); margin: 0 auto; padding: 12px clamp(12px,3vw,30px) 45px;
  display: grid; grid-template-columns: minmax(260px, .72fr) minmax(530px, 1.5fr) minmax(260px, .68fr);
  gap: 12px; align-items: start;
}
.system-column, .court-column, .chronicle { min-width: 0; }
.system-column { display: grid; gap: 10px; position: sticky; top: 74px; }
.system-card, .mission-card, .court-board, .action-panel, .chronicle {
  border-radius: 16px; box-shadow: var(--shadow);
}
.system-card {
  position: relative; overflow: hidden; min-height: 325px; padding: 16px;
  color: #dff4ea;
  border: 1px solid rgba(108,206,178,.27);
  background:
    radial-gradient(circle at 50% 29%, rgba(80,194,167,.16), transparent 34%),
    repeating-linear-gradient(0deg, rgba(90,213,187,.035) 0 1px, transparent 1px 11px),
    #071716;
}
.system-card::after {
  content: ""; position: absolute; inset: 7px; border: 1px solid rgba(111,222,190,.07); border-radius: 11px; pointer-events: none;
}
.system-wash {
  position: absolute; width: 180px; height: 180px; right: -70px; top: -80px;
  border-radius: 50%; border: 1px solid rgba(112,225,192,.12);
  box-shadow: 0 0 70px rgba(74,199,167,.12);
}
.system-head { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; }
.system-head span { display: block; color: #64c9aa; font: 800 7px/1 "Menlo", monospace; letter-spacing: .14em; }
.system-head b { display: block; margin-top: 6px; font: 900 23px/1 "STKaiti", "KaiTi", serif; color: #d9f5e8; }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; background: #57d0ad; box-shadow: 0 0 0 4px rgba(87,208,173,.1),0 0 14px #57d0ad; animation: blink 2.3s infinite; }
@keyframes blink { 50% { opacity: .38; } }
.system-eye {
  position: relative; width: 132px; height: 56px; margin: 24px auto 11px;
  border: 1px solid rgba(94,220,184,.4); border-radius: 50%;
  transform: rotate(-2deg);
  box-shadow: inset 0 0 22px rgba(70,215,176,.08),0 0 28px rgba(70,215,176,.06);
}
.system-eye::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 35px; height: 35px;
  transform: translate(-50%,-50%) rotate(45deg); border: 1px solid rgba(97,222,184,.45);
}
.system-eye span {
  position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; border-radius: 50%;
  transform: translate(-50%,-50%); background: #91ffe1; box-shadow: 0 0 18px #50d5ad;
  animation: eyePulse 2.8s ease-in-out infinite;
}
.system-eye i {
  position: absolute; inset: -7px 21px; border-top: 1px solid rgba(98,220,184,.14);
  border-bottom: 1px solid rgba(98,220,184,.08); border-radius: 50%;
}
@keyframes eyePulse { 50% { width: 14px; height: 14px; opacity: .72; } }
.system-card.glitch .system-eye { animation: glitchEye .25s steps(2,end) 2; }
@keyframes glitchEye { 50% { transform: translateX(5px) rotate(2deg); filter: hue-rotate(80deg); } }
.system-copy {
  position: relative; z-index: 1; min-height: 48px; margin: 0; text-align: center;
  color: #a7c7ba; font: 700 10px/1.65 "STKaiti", "KaiTi", serif;
}
.trust-label { position: relative; z-index: 1; display: flex; justify-content: space-between; margin-top: 16px; color: #6c9a89; font-size: 8px; }
.trust-label b { color: #8edcbe; font: 800 10px/1 "Menlo", monospace; }
.trust-bar { position: relative; z-index: 1; height: 5px; margin-top: 6px; border-radius: 3px; overflow: hidden; background: rgba(255,255,255,.08); }
.trust-bar i { display: block; height: 100%; width: 50%; background: linear-gradient(90deg,#3e8d75,#72e2be); transition: width .3s; }
.system-errors { position: relative; z-index: 1; margin-top: 10px; color: rgba(216,83,69,.32); font: 700 6px/1 "Menlo", monospace; text-align: center; letter-spacing: .12em; }
.system-card.glitch .system-errors { color: rgba(255,113,93,.8); animation: glitchText .18s steps(2,end) infinite; }
@keyframes glitchText { 50% { transform: translateX(3px); opacity: .45; } }

.mission-card {
  padding: 15px; color: var(--ink); background:
    linear-gradient(135deg, rgba(190,73,56,.08), transparent 45%),
    var(--paper);
}
.mission-kicker { display: flex; justify-content: space-between; gap: 8px; }
.mission-kicker span { color: var(--red); font: 800 7px/1 "Menlo", monospace; letter-spacing: .1em; }
.mission-kicker b { color: var(--muted); font-size: 8px; }
.mission-card h2 { margin: 11px 0 5px; font: 900 25px/1.05 "STKaiti", "KaiTi", serif; }
.mission-card > p { margin: 0; color: #67594f; font-size: 9px; line-height: 1.65; }
.assignment-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 5px;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid rgba(142,92,48,.22);
  background: rgba(142,92,48,.055);
}
.assignment-strip span { min-width: 0; padding-left: 6px; border-left: 2px solid rgba(142,92,48,.4); }
.assignment-strip small { display: block; color: #8f7764; font-size: 7.5px; }
.assignment-strip b { display: block; margin-top: 2px; color: #4c3c32; font-size: 8.5px; line-height: 1.4; }
.assignment-strip span:first-child { grid-column: 1/-1; }
.assignment-strip span:first-child b { font-size: 11px; }
.mission-card blockquote {
  margin: 10px 0; padding: 8px 10px; color: #376e5e;
  border-left: 3px solid var(--jade); background: rgba(77,136,117,.07);
  font: 700 9px/1.55 "STKaiti", "KaiTi", serif;
}
.mission-choices { display: grid; gap: 6px; }
.mission-choice {
  width: 100%; padding: 8px 9px; text-align: left;
  border: 1px solid rgba(75,51,33,.18); border-radius: 7px;
  color: var(--ink); background: rgba(255,255,255,.42); cursor: pointer;
}
.mission-choice:hover { border-color: var(--red); background: rgba(190,73,56,.055); }
.mission-choice b { display: block; font-size: 10px; }
.mission-choice span { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; line-height: 1.35; }
.mission-done {
  display: none; padding: 10px; border: 1px dashed rgba(77,136,117,.34);
  color: #48796b; background: rgba(77,136,117,.05); font-size: 9px; line-height: 1.5;
}
.mission-card.resolved .mission-choices,
.mission-card.resolved blockquote { display: none; }
.mission-card.resolved .mission-done { display: block; }

.stats-strip {
  display: grid; grid-template-columns: repeat(5, minmax(0,1fr)) auto; gap: 6px;
}
.stat-card {
  position: relative; min-height: 66px; padding: 9px;
  overflow: hidden; color: var(--ink); border: 1px solid var(--line);
  border-radius: 9px; background: rgba(242,228,197,.94);
}
.stat-card::after { content: ""; position: absolute; right: -13px; top: -20px; width: 45px; height: 45px; border: 1px solid var(--line); border-radius: 50%; }
.stat-card span { display: block; color: var(--muted); font-size: 7px; }
.stat-card b { display: block; margin-top: 5px; font: 900 17px/1 "Menlo", monospace; }
.stat-card i { position: absolute; left: 9px; right: 9px; bottom: 8px; height: 3px; border-radius: 2px; overflow: hidden; background: rgba(47,33,24,.09); }
.stat-card i em { display: block; height: 100%; border-radius: inherit; transition: width .3s; }
.stat-card.favor em { background: var(--red); }
.stat-card.suspicion em { background: #a99b50; }
.stat-card.allies em { background: var(--jade); }
.stat-card.evidence em { background: var(--blue); }
.stat-card.defiance em { background: #785d83; }
.stat-card.silver { min-width: 70px; background: #201915; color: var(--gold-pale); border-color: rgba(212,173,93,.28); }
.stat-card.silver span, .stat-card.silver small { color: #93816d; }
.stat-card.silver b { color: var(--gold-pale); }
.stat-card.silver small { position: absolute; left: 28px; bottom: 13px; font-size: 7px; }

.court-board {
  margin-top: 8px; padding: 14px;
  color: var(--ink); background:
    radial-gradient(circle at 50% 50%, rgba(212,173,93,.1), transparent 42%),
    linear-gradient(135deg, rgba(255,255,255,.42), transparent 55%),
    var(--paper);
}
.court-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.eyebrow { margin: 0 0 5px; color: var(--red); font: 800 7px/1 "Menlo", monospace; letter-spacing: .13em; }
.court-head h1 { margin: 0; font: 900 clamp(26px, 4vw, 43px)/1 "STKaiti", "KaiTi", serif; }
.court-head > span { color: var(--muted); font-size: 8px; }
.palace-map {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px;
}
.palace-map::before {
  content: "内"; position: absolute; left: 50%; top: 50%; z-index: 0;
  transform: translate(-50%,-50%); color: rgba(60,42,28,.045);
  font: 900 120px/1 "STKaiti", serif; pointer-events: none;
}
.room-card {
  position: relative; min-height: 118px; padding: 12px; overflow: hidden;
  border: 1.5px solid rgba(54,37,25,.25); border-radius: 10px;
  color: var(--ink); background: rgba(255,250,239,.64);
  text-align: left; cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s;
}
.room-card::after {
  content: ""; position: absolute; right: -26px; bottom: -40px; width: 112px; height: 112px;
  border: 1px solid color-mix(in srgb, var(--room-color) 30%, transparent);
  border-radius: 50%;
}
.room-card:hover { transform: translateY(-2px); border-color: var(--room-color); }
.room-card.active { border-color: var(--room-color); background: rgba(255,252,245,.95); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--room-color) 18%, transparent); }
.room-seal {
  position: absolute; right: 10px; top: 9px; width: 31px; height: 31px;
  display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--room-color) 62%, transparent);
  color: var(--room-color); font: 900 13px/1 "STKaiti", serif; transform: rotate(3deg);
}
.room-card b { display: block; font: 900 22px/1 "STKaiti", "KaiTi", serif; }
.room-card p { max-width: 75%; margin: 8px 0 0; color: var(--muted); font-size: 8px; line-height: 1.45; }
.room-count { position: absolute; left: 12px; bottom: 10px; color: var(--room-color); font: 800 7px/1 "Menlo", monospace; }

.action-panel {
  margin-top: 8px; padding: 14px; color: var(--ink);
  border: 1px solid var(--line); background: rgba(242,228,197,.94);
}
.action-head { display: flex; justify-content: space-between; gap: 15px; align-items: flex-end; }
.action-head h2 { margin: 0; font: 900 25px/1 "STKaiti", "KaiTi", serif; }
.action-head > p { max-width: 300px; margin: 0; color: var(--muted); font-size: 8px; line-height: 1.5; text-align: right; }
.action-list { display: grid; gap: 6px; margin-top: 10px; }
.action-btn {
  width: 100%; padding: 10px 11px; display: grid; grid-template-columns: 1fr auto; gap: 7px 12px;
  text-align: left; border: 1px solid rgba(63,43,29,.17); border-radius: 8px;
  color: var(--ink); background: rgba(255,255,255,.36); cursor: pointer;
}
.action-btn:hover:not(:disabled) { border-color: var(--red); background: rgba(190,73,56,.045); }
.action-btn b { font-size: 11px; }
.action-btn p { margin: 3px 0 0; color: var(--muted); font-size: 8px; line-height: 1.45; }
.action-btn .cost { align-self: center; color: var(--red); font: 800 8px/1 "Menlo", monospace; }
.action-btn .effects { display: flex; gap: 4px; flex-wrap: wrap; grid-column: 1/-1; }
.effect-chip { padding: 3px 5px; border-radius: 3px; color: #49615a; background: rgba(77,136,117,.08); font: 700 7px/1 "Menlo", monospace; }
.effect-chip.bad { color: #9d4d41; background: rgba(190,73,56,.08); }
.action-btn:disabled { opacity: .5; cursor: not-allowed; }
.action-btn:disabled:hover { border-color: rgba(63,43,29,.17); background: rgba(255,255,255,.36); }
.lock-note { grid-column: 1/-1; color: var(--red); font-size: 7px; }
.action-empty { padding: 20px 10px; color: var(--muted); text-align: center; font-size: 10px; }

.end-day {
  width: 100%; margin-top: 8px; padding: 13px 16px; display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 11px; border: 1px solid rgba(212,173,93,.38); border-radius: 10px;
  color: var(--gold-pale); background: linear-gradient(135deg,#311c18,#201512); cursor: pointer;
}
.end-day span { font: 900 17px/1 "STKaiti", serif; }
.end-day b { color: #a9937c; font-size: 8px; font-weight: 500; }
.end-day i { font-style: normal; }
.end-day:disabled { opacity: .45; cursor: not-allowed; }

.chronicle {
  position: sticky; top: 74px; overflow: hidden;
  color: var(--ink); border: 1px solid rgba(239,208,147,.16);
  background: rgba(242,228,197,.96);
}
.chronicle-head { padding: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.chronicle-head span { display: block; color: var(--red); font: 800 7px/1 "Menlo", monospace; letter-spacing: .12em; }
.chronicle-head b { display: block; margin-top: 5px; font: 900 20px/1 "STKaiti", serif; }
.chronicle-head button { border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: transparent; padding: 6px 7px; font-size: 8px; cursor: pointer; }
.chronicle-head button b { display: inline; margin-left: 3px; color: var(--red); font: 800 8px/1 "Menlo", monospace; }
.log-list { height: min(58vh, 510px); overflow-y: auto; padding: 10px 14px; }
.log-entry { padding: 8px 0; border-bottom: 1px dotted rgba(66,45,29,.16); }
.log-entry:first-child { animation: logIn .25s ease; }
@keyframes logIn { from { opacity: 0; transform: translateY(-5px); } }
.log-entry small { color: #a18f7d; font: 700 7px/1 "Menlo", monospace; }
.log-entry p { margin: 4px 0 0; color: #5e5148; font-size: 11px; line-height: 1.55; }
.log-entry.system p { color: #3c7664; font-family: "STKaiti", serif; font-weight: 700; }
.log-entry.mission p { color: #98483b; }
.log-entry.ending p { color: #a87524; font-weight: 800; }
.origin-mark { margin: 10px; padding: 11px; border: 1px dashed rgba(74,51,33,.2); border-radius: 7px; }
.origin-mark span { color: var(--muted); font-size: 7px; }
.origin-mark b { display: block; margin-top: 4px; font: 900 16px/1 "STKaiti", serif; }
.origin-mark p { margin: 6px 0 0; color: var(--muted); font-size: 8px; line-height: 1.45; }

.overlay {
  position: fixed; inset: 0; z-index: 80; display: none; place-items: center;
  padding: 16px; background: rgba(8,5,4,.83); backdrop-filter: blur(9px);
}
.overlay.show { display: grid; }
.intro-card, .result-card, .final-card, .ending-card, .drawer-card, .help-card, .confirm-card {
  width: min(760px,100%); max-height: 92vh; overflow-y: auto;
  padding: clamp(20px,4vw,38px); border: 1px solid rgba(235,207,151,.19); border-radius: 18px;
  color: var(--ink); background:
    radial-gradient(circle at 100% 0, rgba(190,73,56,.12), transparent 34%),
    var(--paper);
  box-shadow: 0 35px 110px rgba(0,0,0,.57);
}
.intro-eyebrow { color: var(--red); font: 800 8px/1 "Menlo", monospace; letter-spacing: .15em; }
.intro-card h2, .result-card h2, .final-card h2, .ending-card h2, .drawer-card h2, .help-card h2, .confirm-card h2 {
  margin: 11px 0 0; font: 900 clamp(31px,5vw,54px)/1.04 "STKaiti", "KaiTi", serif;
}
.intro-copy { margin: 13px 0 17px; color: #6c5d51; font: 700 11px/1.75 "STKaiti", serif; }
.origin-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
.origin-card {
  position: relative; min-height: 155px; padding: 13px; text-align: left;
  border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: rgba(255,255,255,.32);
  cursor: pointer;
}
.origin-card:hover, .origin-card.active { border-color: var(--red); background: rgba(190,73,56,.055); }
.origin-card.active { box-shadow: inset 0 0 0 1px var(--red); }
.origin-card > span { position: absolute; right: 9px; top: 8px; color: rgba(190,73,56,.5); font: 900 22px/1 "STKaiti", serif; }
.origin-card b { display: block; font: 900 19px/1 "STKaiti", serif; }
.origin-card p { margin: 11px 0 0; color: var(--muted); font-size: 8px; line-height: 1.6; }
.origin-card em { display: block; margin-top: 9px; color: #9b6658; font-size: 8px; line-height: 1.45; font-style: normal; }
.name-field { display: grid; gap: 6px; margin-top: 13px; color: var(--muted); font-size: 8px; }
.name-field input {
  height: 43px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px;
  color: var(--ink); background: rgba(255,255,255,.5); font-size: 15px; text-align: center;
}
.primary, .secondary, .destructive {
  border: 0; border-radius: 7px; cursor: pointer;
}
.primary { padding: 13px 17px; color: var(--white); background: linear-gradient(135deg,var(--red),#8e2e24); font-weight: 900; }
.primary:hover { filter: brightness(1.07); }
.secondary { padding: 11px 15px; color: var(--ink); border: 1px solid var(--line); background: rgba(255,255,255,.38); font-weight: 800; }
.destructive { padding: 12px 16px; color: #fff6ec; background: #9e372b; font-weight: 900; }
.intro-card > .primary { width: 100%; margin-top: 10px; }
.safe-copy { margin: 9px 0 0; color: #a08d77; font-size: 7px; text-align: center; }

.result-card { width: min(590px,100%); text-align: center; }
.result-mark {
  width: 54px; height: 54px; margin: 0 auto 13px; display: grid; place-items: center;
  border: 2px solid var(--red); border-radius: 50%; color: var(--red);
  font: 900 20px/1 "STKaiti", serif;
}
.result-card h2 { font-size: clamp(29px,5vw,43px); }
.result-copy { margin: 14px auto 0; max-width: 500px; color: #6d5d50; font-size: 13px; line-height: 1.75; white-space: pre-line; }
.result-card blockquote { margin: 14px 0; padding: 10px 12px; color: #396f61; border-left: 3px solid var(--jade); background: rgba(77,136,117,.06); font: 700 12px/1.6 "STKaiti", serif; text-align: left; }
.result-card .primary { width: 100%; margin-top: 8px; }
.effect-chips { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; margin: 12px 0; }
.effect-chip { padding: 4px 6px; border-radius: 4px; font: 800 8px/1 "Menlo", monospace; }
.effect-chip.good { color: #3c715f; background: #d9eadf; }
.effect-chip.bad { color: #9e4034; background: #f0d9d2; }
.effect-chip.neutral { color: #796951; background: #e7dcc8; }

.final-card { width: min(760px,100%); }
.final-card > p:not(.eyebrow) { color: var(--muted); font-size: 10px; line-height: 1.65; }
.final-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 17px; }
.final-choice {
  min-height: 100px; padding: 13px; text-align: left;
  color: var(--ink); border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.34);
  cursor: pointer;
}
.final-choice:hover { border-color: var(--red); background: rgba(190,73,56,.055); }
.final-choice b { display: block; font: 900 19px/1 "STKaiti", serif; }
.final-choice span { display: block; margin-top: 7px; color: var(--muted); font-size: 8px; line-height: 1.5; }

.ending-card { width: min(660px,100%); text-align: center; }
.ending-card[data-tone="gold"] { background: linear-gradient(160deg,#f4e5bc,#e4ca92); }
.ending-card[data-tone="red"] { background: linear-gradient(160deg,#f1d9c6,#dfb79f); }
.ending-card[data-tone="blue"] { background: linear-gradient(160deg,#e4e4d8,#c8d3d3); }
.ending-card[data-tone="green"] { background: linear-gradient(160deg,#e4e5ca,#cbd9c0); }
.ending-card[data-tone="gray"] { background: linear-gradient(160deg,#ded8cb,#c8c0b3); }
.ending-card[data-tone="ink"] { background: linear-gradient(160deg,#eee0c8,#d3c0a7); }
.ending-card h2 { font-size: clamp(34px,6vw,58px); color: #7d342a; }
.ending-subtitle { margin: 10px 0 0; color: #655548; font: 700 13px/1.65 "STKaiti", serif; }
.ending-copy { margin: 17px auto; max-width: 560px; color: #5e5045; font-size: 12px; line-height: 1.8; }
.ending-stats { display: flex; justify-content: center; gap: 5px; flex-wrap: wrap; margin: 15px 0; }
.ending-stats span { padding: 5px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 8px; }
.ending-actions { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 6px; }
.ending-actions button { width: 100%; }

.drawer-card { width: min(700px,100%); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.close {
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%;
  color: var(--ink); background: transparent; font-size: 20px; cursor: pointer;
}
.memory-list, .gallery-grid { display: grid; gap: 7px; margin-top: 15px; }
.memory-entry, .gallery-entry { padding: 11px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.3); }
.memory-entry b, .gallery-entry b { display: block; font: 900 18px/1 "STKaiti", serif; }
.memory-entry p, .gallery-entry p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.memory-entry.causal-note { border-color: rgba(190,73,56,.35); background: rgba(190,73,56,.06); }
.memory-entry.causal-note p { font-size: 10px; }
.memory-entry.case-preview { border-color: rgba(77,136,117,.3); background: rgba(77,136,117,.055); }
.memory-entry.case-preview p:last-child { color: #8c6047; }
.gallery-grid { grid-template-columns: 1fr 1fr; }
.gallery-entry.locked { opacity: .42; border-style: dashed; }
.gallery-entry.locked b { color: var(--muted); }

.help-card { width: min(580px,100%); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 16px 0; }
.help-grid div { padding: 11px; border: 1px solid var(--line); border-radius: 7px; }
.help-grid b { font: 900 15px/1.1 "STKaiti", serif; }
.help-grid span { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.help-card .primary { width: 100%; }
.confirm-card { width: min(430px,100%); text-align: center; }
.confirm-card p:not(.eyebrow) { color: var(--muted); font-size: 11px; line-height: 1.6; }
.confirm-card button { width: 100%; margin-top: 8px; }

.toast {
  position: fixed; z-index: 100; left: 50%; bottom: max(18px,env(safe-area-inset-bottom));
  transform: translate(-50%, 12px); max-width: calc(100% - 30px);
  padding: 10px 15px; border: 1px solid rgba(235,207,151,.22); border-radius: 8px;
  color: var(--paper); background: rgba(21,16,13,.96); box-shadow: 0 16px 50px rgba(0,0,0,.4);
  font-size: 9px; opacity: 0; pointer-events: none; transition: .18s;
}
.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 1120px) {
  .game-shell { grid-template-columns: minmax(250px,.7fr) minmax(480px,1.3fr); }
  .chronicle { grid-column: 1/-1; position: static; }
  .chronicle .log-list { height: 220px; }
}
@media (max-width: 820px) {
  .topbar { min-height: 52px; padding: 6px 10px; gap: 8px; }
  .brand-seal { width: 29px; height: 36px; font-size: 14px; }
  .brand b { font-size: 17px; }
  .brand small { display: none; }
  .top-status span { padding: 6px 6px; font-size: 8px; }
  .game-shell { grid-template-columns: 1fr; padding: 8px; gap: 8px; }
  .system-column { position: static; grid-template-columns: 1fr 1fr; }
  .system-card, .mission-card { min-height: 0; }
  .system-card { min-height: 310px; }
  .chronicle { display: block; }
  .log-list { height: 210px; }
  .day-ribbon { padding: 8px 12px 0; }
}
@media (max-width: 620px) {
  .top-status span:first-of-type { display: none; }
  .top-status button { padding: 0 7px; font-size: 8px; }
  .day-ribbon { grid-template-columns: auto 1fr; }
  .day-ribbon small { display: none; }
  .system-column { grid-template-columns: 1fr; }
  .system-card { min-height: 280px; }
  .system-eye { margin-top: 18px; }
  .stats-strip { grid-template-columns: repeat(3,1fr); }
  .stat-card { min-height: 58px; }
  .stat-card.silver { min-width: 0; }
  .palace-map { gap: 6px; }
  .room-card { min-height: 108px; padding: 10px; }
  .room-card b { font-size: 19px; }
  .room-card p { font-size: 7px; }
  .action-head { display: block; }
  .action-head > p { margin-top: 6px; text-align: left; }
  .action-btn { padding: 9px; }
  .origin-grid, .final-choices, .gallery-grid, .help-grid { grid-template-columns: 1fr; }
  .origin-card { min-height: 116px; }
  .intro-card, .result-card, .final-card, .ending-card, .drawer-card, .help-card, .confirm-card {
    padding: 19px; border-radius: 14px;
  }
  .ending-actions { grid-template-columns: 1fr; }
  .chronicle-head { padding: 11px; }
  .log-list { padding: 8px 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Single-screen action desk */
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
body { min-height: 100dvh; }
button, input { touch-action: manipulation; }
button { user-select: none; -webkit-user-select: none; }

.app-frame {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  height: 100dvh;
  margin: 0 auto;
  padding:
    max(6px, env(safe-area-inset-top))
    clamp(7px, 2vw, 18px)
    max(6px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 7px;
}
.app-frame > * { min-width: 0; max-width: 100%; }

.topbar {
  position: relative;
  top: auto;
  z-index: 3;
  min-height: 48px;
  padding: 5px 7px;
  gap: 8px;
  border: 1px solid rgba(235,207,151,.16);
  border-radius: 11px;
  background: rgba(21,16,13,.82);
  box-shadow: 0 10px 28px rgba(0,0,0,.2);
}
.brand { gap: 8px; flex: 0 1 auto; }
.brand-seal { width: 28px; height: 34px; font-size: 13px; }
.brand b { font-size: clamp(15px, 4.5vw, 19px); }
.brand small { margin-top: 2px; font-size: 6px; }
.day-meter {
  min-width: 0;
  margin-left: auto;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 2px 7px;
  text-align: right;
}
.day-meter > span {
  color: var(--gold-pale);
  font: 800 8px/1 "Menlo", monospace;
  white-space: nowrap;
}
.day-meter > small {
  color: #8f8070;
  font-size: 7px;
  white-space: nowrap;
}
.day-meter > small b { color: #d9c6a9; font: 800 9px/1 "Menlo", monospace; }
.day-meter > i {
  grid-column: 1/-1;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255,255,255,.08);
}
.day-meter > i em {
  display: block;
  width: 25%;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold));
  transition: width .25s;
}
.top-actions { display: flex; gap: 4px; }
.top-actions button {
  width: 29px;
  height: 29px;
  padding: 0;
  border: 1px solid var(--dark-line);
  border-radius: 7px;
  color: #cfbea8;
  background: rgba(255,255,255,.025);
  font: 800 13px/1 "Menlo", monospace;
  cursor: pointer;
}

.game-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
}
.system-column, .court-column, .chronicle, .day-ribbon { display: none; }

.system-brief {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(108,206,178,.28);
  border-radius: 12px;
  color: #dff4ea;
  background:
    radial-gradient(circle at 8% 50%, rgba(80,194,167,.18), transparent 25%),
    repeating-linear-gradient(0deg, rgba(90,213,187,.025) 0 1px, transparent 1px 9px),
    #071716;
  box-shadow: 0 11px 30px rgba(0,0,0,.23);
}
.system-brief.glitch { animation: briefGlitch .22s steps(2,end) 2; }
@keyframes briefGlitch { 50% { transform: translateX(2px); filter: hue-rotate(35deg); } }
.mission-summary {
  width: 100%;
  min-height: 63px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) 53px 10px;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
}
.system-orb {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(94,220,184,.4);
  border-radius: 50%;
  box-shadow: inset 0 0 16px rgba(70,215,176,.08), 0 0 18px rgba(70,215,176,.07);
}
.system-orb::before, .system-orb::after {
  content: "";
  position: absolute;
  width: 25px;
  height: 12px;
  border-top: 1px solid rgba(97,222,184,.45);
  border-bottom: 1px solid rgba(97,222,184,.2);
  border-radius: 50%;
}
.system-orb::after { transform: rotate(90deg); opacity: .45; }
.system-orb i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #91ffe1;
  box-shadow: 0 0 14px #50d5ad;
  animation: eyePulse 2.8s ease-in-out infinite;
}
.mission-summary-copy { min-width: 0; display: grid; gap: 2px; }
.mission-summary-copy small {
  overflow: hidden;
  color: #63b99f;
  font: 800 7px/1.2 "Menlo", monospace;
  letter-spacing: .07em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mission-summary-copy b {
  overflow: hidden;
  color: #e3f8ee;
  font: 900 clamp(16px, 4.5vw, 21px)/1.15 "STKaiti", "KaiTi", serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mission-summary-copy em {
  overflow: hidden;
  color: #86aa9c;
  font-size: 7px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trust-mini { display: grid; gap: 2px; text-align: right; }
.trust-mini small { color: #6f9b8b; font-size: 7px; }
.trust-mini > b { color: #9ee9cc; font: 900 15px/1 "Menlo", monospace; }
.trust-mini > i {
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255,255,255,.08);
}
.trust-mini > i em {
  display: block;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg,#3e8d75,#72e2be);
  transition: width .25s;
}
.mission-chevron { color: #67bba1; font-size: 22px; line-height: 1; }

.stats-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 4px;
}
.stat-card {
  min-width: 0;
  min-height: 47px;
  padding: 6px 6px 7px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
}
.stat-card::after { display: none; }
.stat-card span { font-size: 7px; }
.stat-card b { margin-top: 4px; font-size: clamp(13px,4vw,17px); }
.stat-card i { left: 6px; right: 6px; bottom: 5px; height: 2px; }
.stat-card.silver { min-width: 0; }
.stat-card.silver small { left: calc(100% - 15px); bottom: 9px; font-size: 6px; }

.play-table {
  position: relative;
  min-height: 0;
  display: grid;
  grid-auto-rows: auto;
  align-content: start;
  gap: 5px;
}
.play-table::after {
  content: "局";
  position: absolute;
  right: 2%;
  bottom: 1%;
  z-index: 0;
  color: rgba(241,217,145,.025);
  font: 900 clamp(110px,34vw,210px)/.8 "STKaiti", "KaiTi", serif;
  pointer-events: none;
}
.play-head, .palace-map, .action-panel { position: relative; z-index: 1; }
.play-head {
  min-height: 35px;
  padding: 0 3px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}
.play-head .eyebrow { margin-bottom: 2px; color: #c56a58; font-size: 6px; }
.play-head h1 {
  margin: 0;
  color: var(--paper);
  font: 900 clamp(18px,5vw,24px)/1 "STKaiti", "KaiTi", serif;
}
.play-head > small {
  max-width: 45%;
  overflow: hidden;
  color: #77695d;
  font: 700 7px/1.2 "Menlo", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pressure-banner {
  position: relative;
  z-index: 1;
  padding: 7px 9px;
  border: 1px solid rgba(177,126,44,.34);
  border-radius: 8px;
  color: #765b35;
  background: rgba(212,173,93,.09);
}
.pressure-banner[hidden] { display: none; }
.pressure-banner[data-level="danger"] {
  color: #8d3e34;
  border-color: rgba(190,73,56,.38);
  background: rgba(190,73,56,.075);
}
.pressure-banner > span {
  display: block;
  font: 900 9px/1.2 "STKaiti", "KaiTi", serif;
}
.pressure-banner > div { display: grid; gap: 2px; margin-top: 3px; }
.pressure-banner p { margin: 0; font-size: 8px; line-height: 1.42; }

.palace-map {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 4px;
}
.palace-map::before { display: none; }
.room-card {
  min-width: 0;
  min-height: 46px;
  padding: 5px 5px;
  display: grid;
  grid-template-columns: 22px minmax(0,1fr);
  align-items: center;
  gap: 4px;
  border-width: 1px;
  border-radius: 8px;
  background: rgba(242,228,197,.88);
  box-shadow: none;
}
.room-card::after { display: none; }
.room-card:hover { transform: none; }
.room-seal {
  position: static;
  width: 22px;
  height: 26px;
  display: grid;
  border-width: 1px;
  font-size: 11px;
  transform: none;
}
.room-card b {
  display: block;
  overflow: hidden;
  font-size: clamp(13px,3.8vw,17px);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-card p { display: none; }
.room-count {
  position: static;
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 6px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-copy { min-width: 0; }

.action-panel {
  flex: none;
  min-height: 0;
  margin: 0;
  padding: 7px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 11px;
}
.action-head {
  min-height: 35px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.action-head .eyebrow { margin-bottom: 1px; font-size: 6px; }
.action-head h2 { font-size: clamp(18px,5vw,24px); line-height: 1; }
.action-head #roomSubtitle {
  max-width: 100%;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 7px;
  line-height: 1.2;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.action-tip {
  flex: none;
  padding: 3px 5px;
  border: 1px solid rgba(89,62,40,.13);
  border-radius: 4px;
  color: #8c7460;
  font-size: 6px;
  white-space: nowrap;
}
.action-list {
  min-height: 0;
  flex: none;
  margin-top: 5px;
  display: grid;
  align-content: stretch;
  grid-template-rows: repeat(3, minmax(58px, 70px));
  gap: 4px;
}
.action-btn {
  min-height: 0;
  padding: 7px 8px;
  grid-template-columns: minmax(0,1fr) auto;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 3px 8px;
  border-radius: 7px;
  background: rgba(255,255,255,.43);
}
.action-btn > div { min-width: 0; }
.action-btn b {
  display: block;
  overflow: hidden;
  font-size: clamp(11px,3.4vw,14px);
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.action-btn p {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 6.5px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.action-btn .cost { align-self: start; font-size: 7px; white-space: nowrap; }
.action-btn .effects {
  min-width: 0;
  grid-column: 1/-1;
  display: flex;
  gap: 3px;
  overflow: hidden;
  flex-wrap: nowrap;
}
.effect-chip {
  flex: none;
  padding: 2px 4px;
  font-size: 6px;
  white-space: nowrap;
}
.lock-note { overflow: hidden; font-size: 6px; text-overflow: ellipsis; white-space: nowrap; }
.action-empty {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 10px;
  font-size: 9px;
}
.action-btn.action-done {
  opacity: .46;
  border-style: dashed;
  cursor: default;
}
.action-btn.action-done .cost { color: var(--muted); }

.bottom-dock {
  min-height: 51px;
  display: grid;
  grid-template-columns: minmax(0,.75fr) minmax(0,.9fr) minmax(0,1.75fr);
  gap: 5px;
}
.dock-button {
  min-width: 0;
  padding: 5px;
  display: grid;
  grid-template-columns: 26px minmax(0,1fr);
  place-items: center;
  gap: 5px;
  border: 1px solid var(--dark-line);
  border-radius: 9px;
  color: #c9b99f;
  background: rgba(242,228,197,.08);
  cursor: pointer;
}
.dock-button > span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(212,173,93,.25);
  border-radius: 50%;
  color: var(--gold-pale);
  font: 900 12px/1 "STKaiti", serif;
}
.dock-button b {
  min-width: 0;
  overflow: hidden;
  font-size: clamp(8px,2.4vw,10px);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dock-button b em {
  color: var(--red-bright);
  font: 800 8px/1 "Menlo", monospace;
  font-style: normal;
}
.end-day {
  min-height: 51px;
  height: 100%;
  margin: 0;
  padding: 6px 9px;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 7px;
  border-radius: 9px;
}
.end-day span { font-size: clamp(15px,4.2vw,18px); }
.end-day b {
  overflow: hidden;
  font-size: 7px;
  line-height: 1.25;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.end-day i { font-size: 16px; }

.overlay {
  padding:
    max(9px, env(safe-area-inset-top))
    max(9px, env(safe-area-inset-right))
    max(9px, env(safe-area-inset-bottom))
    max(9px, env(safe-area-inset-left));
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.intro-card, .result-card, .final-card, .ending-card, .drawer-card, .help-card, .confirm-card {
  max-height: calc(100dvh - max(18px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.intro-card { width: min(520px,100%); padding: 20px; }
.prologue-card {
  width: min(620px,100%);
  padding: clamp(16px,4vw,24px);
}
.prologue-card h2 {
  margin-top: 7px;
  font-size: clamp(29px,7.6vw,46px);
  line-height: 1.02;
}
.prologue-card .intro-copy {
  margin: 8px 0;
  color: #5f5045;
  font-size: 9.5px;
  line-height: 1.58;
}
.prologue-beats {
  display: grid;
  gap: 5px;
  margin: 9px 0;
}
.story-beat {
  display: grid;
  grid-template-columns: 35px minmax(0,1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid rgba(77,54,35,.16);
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(190,73,56,.055), transparent 58%),
    rgba(255,255,255,.28);
}
.story-beat > span {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(190,73,56,.36);
  border-radius: 50%;
  color: var(--red);
  font: 900 8px/1 "STKaiti", "KaiTi", serif;
}
.story-beat b { display: block; font: 900 12px/1.2 "STKaiti", "KaiTi", serif; }
.story-beat p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.42;
}
.system-whisper {
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  align-items: center;
  gap: 9px;
  margin: 8px 0;
  padding: 7px 9px;
  border: 1px solid rgba(77,136,117,.22);
  border-radius: 7px;
  color: #dff4ea;
  background:
    repeating-linear-gradient(0deg, rgba(90,213,187,.025) 0 1px, transparent 1px 8px),
    #102622;
}
.system-whisper span {
  padding: 3px 5px;
  border: 1px solid rgba(112,225,192,.28);
  border-radius: 4px;
  color: #8edcbe;
  font: 800 7px/1 "Menlo", monospace;
  letter-spacing: .08em;
}
.system-whisper p {
  margin: 0;
  color: #b8d8cb;
  font: 700 9px/1.45 "STKaiti", "KaiTi", serif;
}
.origin-grid { grid-template-columns: 1fr; }
.origin-card {
  min-height: 0;
  padding: 11px 12px 11px 58px;
  display: block;
}
.origin-card > span {
  left: 13px;
  right: auto;
  top: 50%;
  width: 34px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(190,73,56,.45);
  transform: translateY(-50%);
  font-size: 17px;
}
.origin-card b { font-size: 20px; }
.origin-card p { margin-top: 5px; font-size: 8px; line-height: 1.45; }
.origin-card em { margin-top: 5px; font-size: 8px; }
.identity-dossier {
  padding-top: 9px;
  padding-bottom: 9px;
  border-color: rgba(190,73,56,.42);
  background: rgba(190,73,56,.035);
}
.identity-dossier b { font-size: 17px; }
.identity-dossier p { margin-top: 3px; color: #8e6c5c; font-size: 7px; }
.identity-dossier em { margin-top: 3px; color: #5e756b; font-size: 7px; }
.intro-stakes {
  margin: 7px 0 0;
  padding: 6px 8px;
  border-left: 2px solid var(--gold);
  color: #725d45;
  background: rgba(212,173,93,.07);
  font: 700 8px/1.55 "STKaiti", "KaiTi", serif;
}
.name-field { margin-top: 10px; }
.name-field input { height: 38px; font-size: 14px; }
.intro-card > .primary { margin-top: 8px; padding: 11px 15px; }
.safe-copy { margin-top: 6px; }

.modal-mission {
  width: min(570px,100%);
  max-height: calc(100dvh - 20px);
  margin: auto;
  padding: 17px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  border-radius: 14px;
}
.mission-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.mission-modal-head .mission-kicker { flex: 1; }
.modal-mission .system-copy {
  min-height: 0;
  margin: 9px 0 0;
  padding: 7px 9px;
  color: #376e5e;
  border-left: 2px solid var(--jade);
  background: rgba(77,136,117,.07);
  text-align: left;
  font-size: 9px;
  line-height: 1.45;
}
.modal-mission h2 { margin-top: 12px; font-size: clamp(27px,8vw,38px); }
.modal-mission > p:not(.system-copy) { margin: 5px 0 0; font-size: 10px; line-height: 1.55; }
.modal-mission blockquote { margin: 9px 0; padding: 7px 9px; font-size: 9px; }
.mission-choices { gap: 5px; }
.mission-choice { padding: 8px 9px; }
.mission-choice b { font-size: 11px; }
.mission-choice span { margin-top: 2px; font-size: 8px; }

.trace-card { width: min(620px,100%); display: flex; flex-direction: column; }
.trace-card .origin-mark { margin: 10px 0 0; }
.trace-card .log-list {
  min-height: 120px;
  height: auto;
  max-height: none;
  flex: 1;
  padding: 5px 0 0;
  overflow-y: auto;
}

@media (max-width: 620px) {
  .app-frame { gap: 5px; }
  .brand { min-width: 0; }
  .brand div { min-width: 0; }
  .brand b {
    max-width: 45vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand small { display: block; max-width: 45vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .day-meter > span { display: none; }
  .day-meter { grid-template-columns: auto; gap: 3px; }
  .day-meter > i { width: 76px; }
  .game-shell { gap: 5px; }
  .mission-summary { grid-template-columns: 38px minmax(0,1fr) 46px 8px; gap: 6px; padding: 6px; }
  .system-orb { width: 34px; height: 34px; }
  .trust-mini > b { font-size: 13px; }
  .stat-card { padding: 5px 4px 6px; }
  .stat-card b { font-size: 14px; }
  .stat-card.silver small { display: none; }
  .room-card { grid-template-columns: 20px minmax(0,1fr); padding: 4px; gap: 3px; }
  .room-seal { width: 20px; height: 24px; font-size: 10px; }
  .room-card b { font-size: 12px; }
  .room-count { font-size: 5.5px; }
  .action-tip { display: none; }
  .action-head #roomSubtitle { max-width: calc(100vw - 34px); }
  .action-btn { padding: 6px 7px; }
  .action-btn b { font-size: 11px; }
  .effect-chip { font-size: 5.5px; }
  .bottom-dock { min-height: 47px; }
  .dock-button { grid-template-columns: 23px minmax(0,1fr); padding: 4px; gap: 3px; }
  .dock-button > span { width: 23px; height: 23px; font-size: 11px; }
  .dock-button b { font-size: 8px; }
  .end-day { min-height: 47px; padding: 5px 6px; gap: 5px; }
  .end-day span { font-size: 15px; }
  .end-day b { font-size: 6.5px; }
}

@media (max-height: 700px) {
  .app-frame { gap: 4px; }
  .topbar { min-height: 43px; }
  .brand-seal { width: 25px; height: 30px; }
  .brand b { font-size: 15px; }
  .brand small { display: none; }
  .mission-summary { min-height: 54px; }
  .system-orb { width: 31px; height: 31px; }
  .mission-summary-copy small, .mission-summary-copy em { display: none; }
  .stat-card { min-height: 41px; }
  .stat-card span { font-size: 6px; }
  .stat-card b { font-size: 13px; }
  .play-head { min-height: 29px; }
  .room-card { min-height: 40px; }
  .action-head { min-height: 30px; }
  .action-head #roomSubtitle { display: none; }
  .action-btn b { font-size: 10px; }
  .bottom-dock, .end-day { min-height: 43px; }
  .bottom-dock { min-height: 43px; }
}

/* v0.2 readability, growth, saves and causal replay */
.game-shell {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}

.growth-card {
  min-height: 56px;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: 38px auto minmax(0,1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 3px 8px;
  border: 1px solid rgba(212,173,93,.28);
  border-radius: 10px;
  color: var(--paper);
  text-align: left;
  background:
    linear-gradient(100deg, rgba(190,73,56,.16), transparent 52%),
    rgba(33,22,18,.92);
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
  cursor: pointer;
}
.growth-seal {
  grid-row: 1/3;
  width: 36px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(228,100,78,.62);
  color: var(--red-bright);
  font: 900 18px/1 "STKaiti", "KaiTi", serif;
}
.growth-title { grid-column: 2; grid-row: 1; display: grid; gap: 1px; }
.growth-title small { color: #a58c70; font-size: 9px; }
.growth-title b { color: var(--gold-pale); font: 900 18px/1 "STKaiti", "KaiTi", serif; }
.growth-attrs {
  grid-column: 2/4;
  grid-row: 2;
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
}
.growth-attrs span {
  color: #a99782;
  font-size: 9.5px;
  white-space: nowrap;
}
.growth-attrs b { margin-left: 2px; color: #f0d7a4; font: 900 15px/1 "Menlo", monospace; }
.growth-progress {
  grid-column: 3;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(50px,1fr) auto;
  align-items: center;
  gap: 7px;
}
.growth-progress i {
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255,255,255,.1);
}
.growth-progress i em {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg,var(--red),var(--gold));
  transition: width .25s;
}
.growth-progress small { color: #9a8166; font-size: 8.5px; white-space: nowrap; }

.stat-card { min-height: 50px; }
.stat-card span { font-size: 9px; font-weight: 700; }
.stat-card b { font-size: clamp(15px,4vw,18px); }
.mission-summary-copy small { font-size: 8.5px; }
.mission-summary-copy b { font-size: clamp(18px,5vw,23px); }
.mission-summary-copy em { font-size: 8.5px; }
.trust-mini small { font-size: 8.5px; }
.trust-mini > b { font-size: 16px; }

.play-head .eyebrow { font-size: 7.5px; }
.play-head h1 { font-size: clamp(20px,5.4vw,26px); }
.play-head > small { font-size: 9px; }
.room-card b { font-size: clamp(14px,4vw,18px); }
.room-count { font-size: 7.5px; }
.action-head .eyebrow { font-size: 7.5px; }
.action-head h2 { font-size: clamp(20px,5.4vw,26px); }
.action-head #roomSubtitle { font-size: 9px; }
.action-tip { font-size: 8px; }
.action-list { grid-template-rows: repeat(3, minmax(72px, 86px)); }
.action-btn { padding: 7px 8px; gap: 3px 7px; }
.action-btn b { font-size: clamp(13.5px,3.9vw,16px); }
.action-btn p { font-size: 9.5px; }
.action-btn .cost { font-size: 8.5px; }
.action-btn .effects { flex-wrap: wrap; gap: 3px; }
.effect-chip { padding: 3px 4.5px; font-size: 8.5px; }
.effect-chip.growth {
  color: #3f6d5e;
  background: rgba(77,136,117,.14);
  box-shadow: inset 0 0 0 1px rgba(77,136,117,.12);
}
.lock-note { font-size: 8.5px; }

.bottom-dock {
  grid-template-columns: repeat(3, 50px) minmax(0, 1fr);
  min-height: 53px;
}
.dock-button {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 3px;
}
.dock-button > span { width: 24px; height: 24px; font-size: 12px; }
.dock-button b { max-width: 100%; font-size: 8px; }
.dock-button b em { font-size: 7.5px; }
.end-day { min-height: 53px; padding: 6px 8px; }
.end-day span { font-size: 17px; }
.end-day b { font-size: 8px; }

.mission-choice { padding: 9px 10px; }
.mission-choice b { font-size: 13px; }
.mission-choice > span { margin-top: 2px; font-size: 10px; line-height: 1.4; }
.mission-choice-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 6px;
}
.mission-choice-effects .effect-chip { font-size: 9px; }
.modal-mission .system-copy { font-size: 11px; }
.modal-mission > p:not(.system-copy) { font-size: 11.5px; }
.modal-mission blockquote { font-size: 11px; }

.growth-sheet { width: min(640px,100%); }
.rank-banner {
  display: grid;
  grid-template-columns: 54px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 11px;
  border: 1px solid rgba(190,73,56,.3);
  border-radius: 9px;
  background: rgba(190,73,56,.055);
}
.rank-banner > span {
  width: 48px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 2px solid var(--red);
  color: var(--red);
  font: 900 22px/1 "STKaiti", serif;
}
.rank-banner small { color: var(--muted); font-size: 10px; }
.rank-banner b { display: block; font: 900 24px/1.1 "STKaiti", serif; }
.rank-banner p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.rank-banner strong { color: var(--red); font-size: 11px; white-space: nowrap; }
.rank-banner strong em { font: 900 20px/1 "Menlo", monospace; font-style: normal; }
.office-charter {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 6px;
  margin-top: 10px;
  padding: 9px;
  border: 1px solid rgba(198,155,77,.2);
  background: rgba(198,155,77,.04);
}
.office-charter div { min-width: 0; padding: 6px 7px; border-left: 2px solid rgba(198,155,77,.5); }
.office-charter small { display: block; color: var(--muted); font-size: 9px; }
.office-charter b { display: block; margin-top: 3px; font-size: 10.5px; line-height: 1.4; }
.growth-breakdown {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 7px;
  margin-top: 10px;
}
.growth-breakdown article {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.28);
}
.growth-breakdown span { color: var(--muted); font-size: 10px; }
.growth-breakdown b { display: block; margin-top: 3px; font: 900 23px/1 "Menlo", monospace; }
.growth-breakdown p { margin: 6px 0 0; color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.rank-ladder { display: grid; gap: 5px; margin-top: 12px; }
.rank-ladder > div {
  display: grid;
  grid-template-columns: 30px 58px minmax(0,1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px dashed rgba(72,50,34,.18);
  border-radius: 7px;
  color: #8b7968;
}
.rank-ladder > div.passed { border-style: solid; background: rgba(77,136,117,.055); }
.rank-ladder > div.current { border: 1px solid var(--red); color: var(--ink); background: rgba(190,73,56,.06); }
.rank-ladder span { font: 900 14px/1 "STKaiti", serif; text-align: center; }
.rank-ladder b { font-size: 11px; }
.rank-ladder small { font-size: 9.5px; line-height: 1.35; }

.save-drawer { width: min(680px,100%); }
.save-intro { margin: 11px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.save-slots { display: grid; gap: 7px; margin-top: 12px; }
.save-slot {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.28);
}
.save-slot.empty { border-style: dashed; opacity: .78; }
.slot-number {
  width: 34px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(190,73,56,.4);
  color: var(--red);
  font: 900 16px/1 "Menlo", monospace;
}
.slot-copy { min-width: 0; }
.slot-copy small { color: var(--red); font: 800 8px/1 "Menlo", monospace; }
.slot-copy b { display: block; margin-top: 3px; font: 900 17px/1.1 "STKaiti", serif; }
.slot-copy p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.slot-copy em { display: block; margin-top: 3px; overflow: hidden; color: #8b7866; font-size: 8.5px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.slot-actions { display: grid; gap: 3px; }
.slot-actions button {
  min-width: 50px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: rgba(255,255,255,.42);
  font-size: 9px;
  cursor: pointer;
}
.slot-actions button:disabled { opacity: .35; cursor: not-allowed; }
.slot-actions .slot-delete { color: #985044; }

.ending-reason {
  max-width: 590px;
  margin: 0 auto 11px;
  padding: 8px 10px;
  color: #6b5745;
  border-left: 2px solid var(--red);
  background: rgba(190,73,56,.06);
  font-size: 11px;
  line-height: 1.55;
  text-align: left;
}
.ending-causal {
  max-width: 590px;
  margin: 0 auto 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.23);
  text-align: left;
}
.ending-causal summary {
  padding: 8px 10px;
  color: #765b42;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.ending-causal ol { display: grid; gap: 5px; margin: 0; padding: 0 10px 9px 29px; }
.ending-causal li { color: var(--muted); font-size: 9px; }
.ending-causal li small { display: block; color: var(--red); font: 800 7.5px/1 "Menlo", monospace; }
.ending-causal li b { display: block; margin-top: 2px; color: var(--ink); font-size: 10px; }
.ending-causal li span { display: block; margin-top: 1px; }
.ending-actions-used { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 10px 10px; }
.ending-actions-used > span { width: 100%; color: #8a7664; font-size: 8.5px; }
.ending-actions-used em { padding: 3px 5px; border-radius: 4px; color: #466b60; background: rgba(77,136,117,.08); font-size: 8px; font-style: normal; }

.prologue-card .intro-copy { font-size: 10.5px; }
.story-beat b { font-size: 13px; }
.story-beat p { font-size: 9.5px; }
.system-whisper p { font-size: 10px; }
.origin-card b { font-size: 20px; }
.origin-card p { font-size: 9px; }
.origin-card em { font-size: 9px; }
.intro-stakes { font-size: 9.5px; }
.name-field { font-size: 10px; }

@media (max-width: 620px) {
  .game-shell { gap: 4px; }
  .growth-card { min-height: 53px; grid-template-columns: 34px auto minmax(0,1fr); gap: 2px 6px; padding: 5px 6px; }
  .growth-seal { width: 32px; height: 36px; font-size: 16px; }
  .growth-title small { font-size: 8px; }
  .growth-title b { font-size: 16px; }
  .growth-attrs { gap: 4px; }
  .growth-attrs span { font-size: 8.5px; }
  .growth-attrs b { font-size: 13px; }
  .growth-progress small { font-size: 7.5px; }
  .stat-card { min-height: 47px; padding: 5px 4px 6px; }
  .stat-card span { font-size: 8px; }
  .stat-card b { font-size: 15px; }
  .room-card b { font-size: 13px; }
  .room-count { font-size: 6.5px; }
  .action-list { grid-template-rows: repeat(3, minmax(70px, 84px)); }
  .action-btn b { font-size: 13px; }
  .action-btn p { font-size: 9px; }
  .effect-chip { font-size: 8px; }
  .bottom-dock { grid-template-columns: repeat(3, 48px) minmax(0,1fr); min-height: 50px; }
  .dock-button > span { width: 22px; height: 22px; font-size: 11px; }
  .dock-button b { font-size: 7.5px; }
  .end-day { min-height: 50px; }
  .end-day b { font-size: 7.5px; }
  .office-charter { grid-template-columns: 1fr; }
  .growth-breakdown { grid-template-columns: 1fr; }
  .save-slot { grid-template-columns: 32px minmax(0,1fr); }
  .slot-number { width: 30px; height: 36px; }
  .slot-actions { grid-column: 1/-1; grid-template-columns: repeat(3,1fr); }
  .slot-actions button { width: 100%; }
  .rank-banner { grid-template-columns: 44px minmax(0,1fr); }
  .rank-banner > span { width: 40px; height: 45px; }
  .rank-banner strong { grid-column: 2; }
}

@media (max-height: 720px) {
  .growth-card { min-height: 47px; }
  .growth-progress small { display: none; }
  .growth-progress { grid-template-columns: 1fr; }
  .action-list { grid-template-rows: repeat(3, minmax(58px, 68px)); }
  .action-btn p { display: none; }
  .effect-chip { font-size: 7.5px; }
  .mission-summary-copy em { display: none; }
}

/* v0.3 romance */
.bottom-dock {
  grid-template-columns: repeat(4, 45px) minmax(0, 1fr);
  gap: 4px;
}
.dock-button.has-event {
  border-color: rgba(228,100,78,.58);
  box-shadow: 0 0 18px rgba(228,100,78,.12);
}
.dock-button.has-event > span {
  color: var(--red-bright);
  border-color: rgba(228,100,78,.55);
}

.romance-drawer { width: min(720px,100%); }
.romance-daily {
  margin-top: 11px;
  padding: 8px 10px;
  border: 1px solid rgba(77,136,117,.2);
  border-radius: 7px;
  color: #466f62;
  background: rgba(77,136,117,.06);
  font-size: 10.5px;
  line-height: 1.45;
}
.romance-list { display: grid; gap: 8px; margin-top: 10px; }
.romance-card {
  position: relative;
  overflow: hidden;
  padding: 11px;
  border: 1px solid color-mix(in srgb, var(--romance-color) 38%, transparent);
  border-radius: 9px;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--romance-color) 10%, transparent), transparent 38%),
    rgba(255,255,255,.27);
}
.romance-card.threat-warning { box-shadow: inset 3px 0 0 rgba(177,126,44,.55); }
.romance-card.threat-danger { box-shadow: inset 3px 0 0 rgba(173,53,42,.72); }
.romance-card header {
  display: grid;
  grid-template-columns: 40px minmax(0,1fr) auto;
  align-items: center;
  gap: 9px;
}
.romance-seal {
  width: 38px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--romance-color);
  color: var(--romance-color);
  font: 900 17px/1 "STKaiti", "KaiTi", serif;
}
.romance-card header small { color: var(--muted); font-size: 9px; }
.romance-card h3 { margin: 2px 0 0; font: 900 22px/1 "STKaiti", "KaiTi", serif; }
.romance-card header > strong {
  padding: 4px 6px;
  border: 1px solid color-mix(in srgb, var(--romance-color) 35%, transparent);
  border-radius: 5px;
  color: var(--romance-color);
  font-size: 9px;
}
.romance-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.romance-bars label {
  display: grid;
  grid-template-columns: auto minmax(30px,1fr) auto;
  align-items: center;
  gap: 5px;
  color: #76584e;
  font-size: 9px;
}
.romance-bars label i { height: 5px; overflow: hidden; border-radius: 3px; background: rgba(40,25,20,.09); }
.romance-bars label i em { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#c4503e,#e7785f); }
.romance-bars label b { color: var(--red); font: 900 11px/1 "Menlo", monospace; }
.romance-bars .danger span { color: #876744; }
.romance-bars .danger i em { background: linear-gradient(90deg,#9d793c,#d1a43e); }
.romance-bars .danger b { color: #9b7130; }
.romance-card.threat-danger .romance-bars .danger i em { background: linear-gradient(90deg,#9d342b,#df654e); }
.romance-card.threat-danger .romance-bars .danger b { color: #a43c31; }
.romance-summary { margin: 8px 0 0; color: #5d5047; font-size: 10.5px; line-height: 1.5; }
.romance-reality {
  margin: 7px 0 0;
  padding: 6px 8px;
  border-left: 2px solid rgba(126,96,61,.4);
  color: #806b59;
  background: rgba(95,67,42,.045);
  font-size: 9.5px;
  line-height: 1.45;
}
.romance-reality b { margin-right: 6px; color: #6c5442; }
.romance-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  margin-top: 8px;
}
.romance-card-foot > span { color: #887464; font-size: 9px; }
.romance-card-foot button,
.romance-event-choices button {
  border: 1px solid rgba(190,73,56,.25);
  border-radius: 6px;
  color: #8d392f;
  background: rgba(255,255,255,.42);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.romance-card-foot button { padding: 7px 9px; white-space: nowrap; }
.romance-card-foot button:disabled { opacity: .42; cursor: not-allowed; }
.romance-empty {
  padding: 24px 16px;
  border: 1px dashed rgba(80,55,35,.2);
  border-radius: 9px;
  text-align: center;
}
.romance-empty b { font: 900 22px/1.2 "STKaiti", serif; }
.romance-empty p { margin: 8px auto 0; max-width: 390px; color: var(--muted); font-size: 10px; line-height: 1.55; }

.romance-event-card {
  width: min(590px,100%);
  max-height: calc(100dvh - 20px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--romance-color) 40%, transparent);
  border-radius: 15px;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--romance-color) 15%, transparent), transparent 38%),
    var(--paper);
  box-shadow: 0 35px 110px rgba(0,0,0,.57);
}
.romance-event-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.romance-event-card h2 { margin: 7px 0 0; font: 900 clamp(27px,8vw,40px)/1.04 "STKaiti", serif; }
.romance-event-intro { margin: 11px 0 0; color: #615247; font-size: 12px; line-height: 1.65; }
.romance-event-status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.romance-event-status > span {
  padding: 5px 7px;
  border: 1px solid rgba(190,73,56,.2);
  border-radius: 5px;
  color: #8f4f43;
  background: rgba(255,255,255,.3);
  font-size: 9px;
}
.romance-event-status > span b { font: 900 13px/1 "Menlo", monospace; }
.romance-event-status p { width: 100%; margin: 0; color: #7a6858; font-size: 9.5px; line-height: 1.45; }
.romance-event-status .romance-risk-note {
  padding: 5px 7px;
  color: #953f35;
  border-left: 2px solid rgba(190,73,56,.48);
  background: rgba(190,73,56,.06);
}
.romance-event-choices { display: grid; gap: 6px; margin-top: 11px; }
.romance-event-choices button { width: 100%; padding: 10px; text-align: left; }
.romance-event-choices button:hover { border-color: var(--romance-color); background: rgba(255,255,255,.58); }
.romance-event-choices button > b { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.romance-event-choices button > b em {
  padding: 2px 4px;
  color: #fff8e9;
  background: var(--red);
  font-size: 8px;
  font-style: normal;
}
.romance-event-choices button > span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.romance-choice-effects { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }

.romance-ending {
  max-width: 590px;
  margin: 0 auto 11px;
  padding: 10px;
  border: 1px solid rgba(77,136,117,.22);
  border-radius: 8px;
  background: rgba(255,255,255,.25);
  text-align: left;
}
.romance-ending > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.romance-ending > div span {
  padding: 3px 6px;
  border-radius: 4px;
  color: #3d6f60;
  background: rgba(77,136,117,.1);
  font-size: 9px;
  font-weight: 800;
}
.romance-ending[data-type="虐恋"] > div span { color: #9f3e32; background: rgba(190,73,56,.11); }
.romance-ending[data-type="苦情"] > div span { color: #88662d; background: rgba(180,139,59,.12); }
.romance-ending[data-type="独美"] > div span { color: #5f6574; background: rgba(93,105,130,.1); }
.romance-ending > div small { color: #917b68; font-size: 8.5px; }
.romance-ending h3 { margin: 7px 0 0; color: #762f27; font: 900 24px/1.1 "STKaiti", serif; }
.romance-ending > p { margin: 7px 0 0; color: #5f5046; font-size: 11px; line-height: 1.6; }
.romance-ending-metrics { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.romance-ending-metrics span { padding: 3px 5px; border-radius: 4px; color: #496b61; background: rgba(77,136,117,.09); font-size: 8.5px; }
.romance-ending blockquote { margin: 7px 0 0; color: #816f5d; font-size: 9.5px; line-height: 1.45; }

.truth-reveal {
  max-width: 590px;
  margin: 0 auto 11px;
  padding: 10px;
  border: 1px solid rgba(112,91,57,.25);
  border-radius: 8px;
  background: rgba(255,255,255,.24);
  text-align: left;
}
.truth-reveal[hidden] { display: none; }
.truth-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.truth-head b { color: #6d4b32; font: 900 18px/1 "STKaiti", serif; }
.truth-head span { padding: 3px 6px; border: 1px solid rgba(112,91,57,.25); border-radius: 4px; color: #806841; font-size: 8.5px; }
.truth-reveal[data-level="full"] .truth-head span { color: #356d5d; border-color: rgba(77,136,117,.4); }
.truth-public { margin: 7px 0 0; padding: 6px 8px; color: #735943; background: rgba(212,173,93,.07); font-size: 9.5px; line-height: 1.45; }
.truth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.truth-grid > div { padding: 8px; border: 1px dashed rgba(84,61,39,.2); border-radius: 6px; }
.truth-grid h4 { margin: 0 0 5px; color: #76563f; font-size: 10px; }
.truth-grid ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.truth-grid li { color: #746253; font-size: 8.5px; line-height: 1.4; }
.truth-grid li b { display: block; color: #4d3b2e; font-size: 9.5px; }
.truth-grid li span { display: block; margin-top: 2px; }

@media (max-width: 620px) {
  .bottom-dock { grid-template-columns: repeat(4, 43px) minmax(0,1fr); gap: 3px; }
  .romance-card { padding: 9px; }
  .romance-card header { grid-template-columns: 34px minmax(0,1fr) auto; gap: 6px; }
  .romance-seal { width: 32px; height: 37px; font-size: 15px; }
  .romance-card h3 { font-size: 19px; }
  .romance-card-foot { align-items: flex-end; }
  .romance-card-foot > span { max-width: 58%; line-height: 1.35; }
  .romance-event-card { padding: 15px; }
  .truth-grid { grid-template-columns: 1fr; }
  .copy-actions { grid-template-columns: 1fr; }
}

/* v0.4 repeatable actions and world pressure */
.action-list {
  grid-template-rows: none;
  grid-auto-rows: minmax(68px, auto);
  align-content: start;
  max-height: min(38dvh, 330px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}
.action-btn.repeatable {
  border-left: 2px solid rgba(77,136,117,.45);
}
.action-btn.romance-hook {
  border-left: 2px solid rgba(202,83,73,.52);
  background: linear-gradient(90deg, rgba(202,83,73,.05), rgba(255,255,255,.4));
}
.action-btn {
  align-content: start;
  grid-auto-rows: auto;
}
.action-btn .effects {
  align-items: flex-start;
  overflow: visible;
  flex-wrap: wrap;
}
.effect-chip {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  overflow: visible;
  line-height: 1.25;
}
.repeat-note {
  grid-column: 1/-1;
  color: #58776c;
  font-size: 7.5px;
  line-height: 1.25;
}
.action-history-note {
  padding: 7px 8px;
  border: 1px dashed rgba(75,55,38,.16);
  border-radius: 6px;
  color: #8b7866;
  background: rgba(255,255,255,.18);
  font-size: 8px;
  line-height: 1.45;
  text-align: center;
}

@media (max-width: 620px) {
  .action-list { max-height: min(38dvh, 310px); }
  .pressure-banner { padding: 6px 8px; }
  .pressure-banner > span { font-size: 8.5px; }
  .pressure-banner p { font-size: 7.5px; }
}

@media (max-height: 720px) {
  .action-list { max-height: min(34dvh, 245px); }
}

/* v0.5 favor ledger */
.stat-card.allies {
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.stat-card.allies:hover {
  border-color: rgba(77,136,117,.55);
}
.favor-badge {
  position: absolute;
  right: 5px;
  top: 5px;
  min-width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  padding: 0 3px;
  border-radius: 8px;
  color: #f8edda;
  background: var(--jade);
  font: 800 8px/1 "Menlo", monospace;
}
.stat-card.allies.has-favors .favor-badge {
  box-shadow: 0 0 10px rgba(77,136,117,.35);
}

.favor-drawer { width: min(690px,100%); }
.favor-intro {
  margin: 11px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(77,136,117,.2);
  border-radius: 7px;
  color: #4e6f64;
  background: rgba(77,136,117,.055);
  font-size: 10px;
  line-height: 1.5;
}
.favor-list { display: grid; gap: 8px; margin-top: 10px; }
.favor-card {
  padding: 10px;
  border: 1px solid rgba(77,136,117,.25);
  border-radius: 8px;
  background: rgba(255,255,255,.27);
}
.favor-card header {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
}
.favor-seal {
  width: 36px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(77,136,117,.55);
  color: var(--jade);
  font: 900 17px/1 "STKaiti", "KaiTi", serif;
}
.favor-card header small { color: #7d6b5b; font-size: 9px; }
.favor-card h3 { margin: 2px 0 0; font: 900 19px/1.1 "STKaiti", serif; }
.favor-card header > strong {
  padding: 3px 5px;
  border-radius: 4px;
  color: #376b5c;
  background: rgba(77,136,117,.09);
  font-size: 8.5px;
}
.favor-card.status-expired,
.favor-card.status-lost,
.favor-card.status-used,
.favor-card.status-cashed { opacity: .67; }
.favor-source { margin: 7px 0 0; color: #8b6a55; font-size: 9px; line-height: 1.4; }
.favor-description { margin: 4px 0 0; color: #5f5147; font-size: 10.5px; line-height: 1.5; }
.favor-risk { margin: 6px 0 0; padding: 5px 7px; border-left: 2px solid rgba(177,126,44,.42); color: #7d6648; background: rgba(212,173,93,.06); font-size: 9px; line-height: 1.42; }
.favor-risk b { margin-right: 6px; color: #725735; font-size: 9px; }
.favor-meta { display: flex; flex-wrap: wrap; gap: 5px 10px; margin-top: 6px; color: #887666; font-size: 8.5px; }
.favor-effects { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 7px; }
.favor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 8px; }
.favor-actions button {
  padding: 7px;
  border: 1px solid rgba(77,136,117,.28);
  border-radius: 6px;
  color: #356c5c;
  background: rgba(255,255,255,.42);
  font-size: 9.5px;
  font-weight: 800;
  cursor: pointer;
}
.favor-actions button.cash {
  color: #8d4d3f;
  border-color: rgba(190,73,56,.22);
}
.favor-actions button:disabled { opacity: .38; cursor: not-allowed; }
.favor-empty {
  padding: 24px 16px;
  border: 1px dashed rgba(77,136,117,.24);
  border-radius: 8px;
  text-align: center;
}
.favor-empty b { font: 900 21px/1.2 "STKaiti", serif; }
.favor-empty p { margin: 7px auto 0; max-width: 390px; color: var(--muted); font-size: 10px; line-height: 1.5; }

@media (max-width: 620px) {
  .favor-card header { grid-template-columns: 32px minmax(0,1fr) auto; gap: 6px; }
  .favor-seal { width: 30px; height: 35px; font-size: 15px; }
  .favor-card h3 { font-size: 17px; }
}

/* v0.6 copy fallback */
.copy-card {
  width: min(620px,100%);
  padding: clamp(18px,4vw,28px);
  border: 1px solid rgba(235,207,151,.2);
  border-radius: 15px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 35px 110px rgba(0,0,0,.57);
}
.copy-card h2 { margin: 8px 0 0; font: 900 clamp(27px,7vw,40px)/1.05 "STKaiti", serif; }
.copy-card > p:not(.eyebrow) { margin: 9px 0 0; color: #67594f; font-size: 11px; line-height: 1.55; }
.copy-card textarea {
  width: 100%;
  min-height: 190px;
  margin-top: 11px;
  padding: 10px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(255,255,255,.55);
  font-size: 12px;
  line-height: 1.6;
}
.copy-actions { display: grid; grid-template-columns: 1fr 1.2fr 1fr .7fr; gap: 5px; margin-top: 9px; }
.copy-actions button { width: 100%; }

@media (max-width: 620px) {
  .copy-actions { grid-template-columns: 1fr 1fr; }
}

/* v0.7 causal feedback */
.world-status {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 10px;
}
.world-status > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 5px;
  color: #ad9d8c;
  background: rgba(255,255,255,.025);
  font-size: 8.5px;
  line-height: 1.35;
}
.world-status b {
  color: #d8c39c;
  font: 800 8px/1 "Menlo", monospace;
}
.world-status .world-identity {
  color: #d4ad5d;
  border-color: rgba(212,173,93,.28);
}
.world-status .world-person.good { color: #84b8a0; }
.world-status .world-person.danger { color: #d47b68; }
.world-status .world-person.neutral { color: #b9aa96; }
.ending-epilogue {
  max-width: 590px;
  margin: 0 auto 10px;
  padding: 8px 10px;
  color: #665445;
  border-left: 2px solid rgba(77,136,117,.55);
  background: rgba(77,136,117,.07);
  font-size: 10px;
  line-height: 1.65;
  text-align: left;
}
.ending-reflection {
  max-width: 590px;
  margin: 0 auto 11px;
  padding: 8px 10px;
  border: 1px solid rgba(190,73,56,.18);
  border-radius: 7px;
  background: rgba(190,73,56,.045);
  text-align: left;
}
.ending-reflection > b {
  color: #7c3c31;
  font: 900 10px/1.2 "STKaiti", serif;
}
.ending-reflection ul {
  display: grid;
  gap: 3px;
  margin: 6px 0 0;
  padding-left: 17px;
}
.ending-reflection li {
  color: #6e5948;
  font-size: 9.5px;
  line-height: 1.5;
}
.resource-loops {
  border: 1px dashed rgba(82,58,38,.22);
  border-radius: 7px;
  background: rgba(255,255,255,.24);
}
.resource-loops summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  color: #705d4d;
  font-size: 9.5px;
  font-weight: 800;
  cursor: pointer;
}
.resource-loops summary span {
  color: #9b8873;
  font: 700 8px/1 "Menlo", monospace;
}
.resource-loops > p {
  margin: 0 10px 7px;
  color: #988674;
  font-size: 8.5px;
  line-height: 1.45;
}
.resource-loop-list {
  display: grid;
  gap: 5px;
  padding: 0 7px 7px;
}
@media (max-width: 620px) {
  .world-status { gap: 3px; }
  .world-status > span { padding: 4px 5px; font-size: 7.5px; }
  .world-status b { font-size: 7px; }
}

.banquet-card {
  width: min(780px, calc(100vw - 28px));
  max-height: min(88vh, 880px);
  overflow: auto;
  padding: 24px;
  border: 1px solid rgba(244, 211, 156, .58);
  border-radius: 14px;
  background:
    radial-gradient(circle at 82% 8%, rgba(180, 72, 45, .22), transparent 30%),
    linear-gradient(145deg, #1b1718 0%, #241b1a 55%, #30211b 100%);
  box-shadow: 0 26px 90px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 236, 198, .06);
  color: #f0dfc7;
}
.banquet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.banquet-head .eyebrow { color: #d98962; }
.banquet-head > span {
  color: #b9a58d;
  font: 700 9px/1.2 "Menlo", monospace;
  letter-spacing: .08em;
}
.banquet-card h2 {
  margin: 8px 0 10px;
  color: #fff0d8;
  font: 850 clamp(26px, 4.8vw, 44px)/1.05 "Songti SC", "STSong", serif;
  letter-spacing: -.04em;
}
.banquet-intro {
  max-width: 64ch;
  margin: 0 0 15px;
  color: #d8c3a9;
  font-size: 13px;
  line-height: 1.75;
}
.banquet-card blockquote {
  margin: 0 0 14px;
  padding: 11px 14px;
  border-left: 2px solid #d18758;
  background: rgba(255, 244, 220, .06);
  color: #f0d1a6;
  font-size: 12px;
  line-height: 1.65;
}
.banquet-presence {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.banquet-presence-chip {
  padding: 5px 8px;
  border: 1px solid rgba(235, 210, 174, .18);
  border-radius: 999px;
  background: rgba(255, 247, 227, .045);
  color: #cbb69e;
  font-size: 9px;
}
.banquet-presence-chip b {
  margin-right: 5px;
  color: #f0d1a6;
}
.banquet-presence-chip.good { border-color: rgba(130, 186, 152, .36); }
.banquet-presence-chip.danger { border-color: rgba(210, 116, 92, .42); color: #dda18f; }
.banquet-choices {
  display: grid;
  gap: 8px;
}
.banquet-choices button {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(239, 214, 177, .2);
  border-radius: 9px;
  background: rgba(255, 249, 232, .06);
  color: #f3e4cf;
  text-align: left;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.banquet-choices button:hover {
  transform: translateY(-1px);
  border-color: rgba(239, 186, 119, .6);
  background: rgba(255, 249, 232, .1);
}
.banquet-choices button b { font-size: 13px; }
.banquet-choices button > span {
  color: #cdb398;
  font-size: 10px;
  line-height: 1.5;
}
.banquet-choice-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.banquet-choice-effects .effect-chip {
  background: rgba(255,255,255,.08);
  color: #e4caa8;
}
@media (max-width: 620px) {
  .banquet-card {
    width: calc(100vw - 16px);
    max-height: 92vh;
    padding: 17px 14px;
    border-radius: 11px;
  }
  .banquet-intro { font-size: 12px; }
  .banquet-card blockquote { font-size: 11px; }
  .banquet-choices button { padding: 11px 12px; }
  .banquet-choices button b { font-size: 12px; }
}

/* 0.9: the strip shows only what a player watches; the rest folds away. */
.stats-strip { grid-template-columns: repeat(4, minmax(0,1fr)); }
.stats-strip .stat-extra { display: none; }
.stats-strip.open .stat-extra { display: block; }
.stat-toggle { cursor: pointer; text-align: left; font: inherit; color: inherit; }
.stat-toggle b { font-size: 13px; }
.tone-tag {
  display: inline-block; min-width: 18px; padding: 2px 6px; border-radius: 3px;
  border: 1px solid currentColor; color: #9b6a3a; font: 800 11px/1.2 serif; text-align: center;
}

/* 0.9.0 fix: the action desk scrolls as one column. The list used to have its
   own max-height inside a clipped panel, so when the space above it grew
   (stats expanded, status chips wrapping, short mobile viewports) its bottom
   was cut off with nothing left to swipe. */
.play-table {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding-bottom: 6px;
}
.play-table > * { flex: none; }
.play-table > .action-panel { flex: 1 0 auto; overflow: visible; }
.action-list { max-height: none; overflow: visible; flex: none; }
.action-list > .action-history-note { align-self: start; }

/* 0.9.2: life lines are the autosave; finished lines can be reviewed or replayed. */
.save-slot.active { border-color: rgba(190,73,56,.55); box-shadow: inset 3px 0 0 rgba(190,73,56,.55); }
.save-slot.ended .slot-copy b { color: #7a3d31; }
.slot-replay {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding-top: 6px; border-top: 1px dashed rgba(82,58,38,.18);
}
.slot-replay span { margin-right: 2px; color: var(--muted); font-size: 9px; }
.slot-replay button {
  padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px;
  color: var(--ink); background: rgba(255,255,255,.42); font-size: 9.5px; cursor: pointer;
}
.slot-actions .slot-copy-to { color: #5e5444; }
.gallery-review {
  margin-top: 8px; padding: 6px 8px; border: 1px solid rgba(190,73,56,.35); border-radius: 5px;
  color: var(--red); background: rgba(255,255,255,.4); font-size: 10px; cursor: pointer;
}
.ending-card { position: relative; }
.ending-review-close { position: sticky; top: 0; float: right; z-index: 2; }
.ending-review-close[hidden] { display: none; }
.ending-review-close { background: #f4e8cf; box-shadow: 0 2px 8px rgba(0,0,0,.18); }

/* 0.9.2 layout pass: phone first. What the player acts on (the action list)
   comes up first; the post, the people and the extra counters fold into
   one-liners. Everything below overrides the older layers above. */
.toast {
  bottom: calc(max(6px, env(safe-area-inset-bottom)) + 66px);
  padding: 9px 14px;
  font-size: 12px;
}

/* Post line under the top bar (was a three-row card). */
.role-line {
  position: relative;
  min-height: 28px;
  padding: 4px 9px 5px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) 8px;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  border: 1px solid rgba(212,173,93,.24);
  border-radius: 8px;
  color: #b9a58a;
  text-align: left;
  background: linear-gradient(100deg, rgba(190,73,56,.14), transparent 55%), rgba(33,22,18,.9);
  cursor: pointer;
}
.role-seal {
  width: 17px; height: 19px; display: grid; place-items: center;
  border: 1px solid rgba(228,100,78,.6); color: var(--red-bright);
  font: 900 11px/1 "STKaiti", "KaiTi", serif;
}
.role-text { min-width: 0; display: flex; align-items: baseline; gap: 6px; overflow: hidden; white-space: nowrap; }
.role-office { flex: none; color: var(--gold-pale); font-size: 12px; font-weight: 800; }
.role-office #roleOffice::after { content: "·"; margin: 0 1px; color: #8a7a62; }
.role-office b { font-weight: 800; }
.role-text em { min-width: 0; overflow: hidden; color: #a8957c; font-size: 11px; font-style: normal; text-overflow: ellipsis; }
.role-chevron { color: #b69a64; font-size: 17px; line-height: 1; }
.role-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255,255,255,.07); }
.role-bar i { display: block; width: 0; height: 100%; background: linear-gradient(90deg,var(--red),var(--gold)); transition: width .25s; }
.role-line.flash {
  border-color: var(--gold); color: #f6e7c1;
  background: linear-gradient(100deg, rgba(212,173,93,.34), rgba(190,73,56,.12) 70%), rgba(48,33,22,.96);
  animation: roleFlash 1.1s ease-in-out 4;
}
.role-line.flash .role-text em { color: #f1d991; }
@keyframes roleFlash { 50% { box-shadow: 0 0 0 3px rgba(212,173,93,.35); } }

/* Mission card: loud while it waits for an answer, one line once answered. */
.mission-summary { min-height: 56px; }
.mission-summary.resolved {
  min-height: 32px; padding: 3px 10px;
  grid-template-columns: minmax(0,1fr) auto 8px; gap: 8px;
}
.mission-summary.resolved .system-orb,
.mission-summary.resolved .mission-summary-copy small,
.mission-summary.resolved .trust-mini > i { display: none; }
.mission-summary.resolved .mission-summary-copy { display: flex; align-items: baseline; gap: 8px; overflow: hidden; }
.mission-summary.resolved .mission-summary-copy b { flex: none; max-width: 64%; font-size: 14px; line-height: 1.2; }
.mission-summary.resolved .mission-summary-copy b::before { content: "✓ "; color: #72e2be; font-family: sans-serif; font-size: 12px; }
.mission-summary.resolved .mission-summary-copy em { display: block; min-width: 0; font-size: 11px; }
.mission-summary.resolved .trust-mini { display: flex; align-items: baseline; gap: 4px; }
.mission-summary.resolved .trust-mini small { font-size: 10px; }
.mission-summary.resolved .trust-mini > b { font-size: 13px; }
.mission-summary.resolved .mission-chevron { font-size: 17px; }
.system-brief:has(.mission-summary.resolved) { border-radius: 8px; box-shadow: none; }

/* Counters: label and value on one row, bars underneath. */
.stats-strip { gap: 4px; }
.stats-strip .stat-card {
  min-height: 34px; padding: 4px 8px 8px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 4px;
}
.stats-strip .stat-card span { display: inline; font-size: 11px; font-weight: 700; }
.stats-strip .stat-card b { display: inline; margin: 0; font-size: 15px; }
.stats-strip .stat-card i { left: 8px; right: 8px; bottom: 4px; height: 2px; }
.stats-strip .stat-toggle { align-items: center; gap: 3px; }
.stats-strip .stat-toggle b { font-size: 15px; }
.stat-toggle u {
  flex: none; width: 6px; height: 6px; margin: -3px 1px 0 0;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  opacity: .6; transform: rotate(45deg); transition: transform .15s;
}
.stat-toggle[aria-expanded="true"] u { margin-top: 3px; transform: rotate(-135deg); }
.stats-strip .stat-card.stat-extra { display: none; }
.stats-strip.open .stat-card.stat-extra { display: flex; grid-column: span 2; }
.stats-strip .stat-toggle { color: var(--ink); }
.stats-strip .stat-card.allies { align-items: center; padding-right: 26px; }
.stats-strip .favor-badge { top: 50%; right: 6px; transform: translateY(-50%); }

/* People: one scrollable row of chips; tap one for its full line. */
.world-status {
  flex-wrap: nowrap; gap: 5px; margin: 0; padding: 1px 0 2px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch;
}
.world-status::-webkit-scrollbar { display: none; }
.world-status .world-person {
  flex: none; max-width: 190px; padding: 5px 9px 5px 8px;
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid rgba(255,255,255,.12); border-radius: 999px;
  background: rgba(255,255,255,.04); font-family: inherit; font-size: 11px; line-height: 1.2; cursor: pointer;
}
.world-status .world-person i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.world-status .world-person b { flex: none; color: #e6d5b4; font: 800 11px/1.2 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }
.world-status .world-person span { min-width: 0; max-width: 8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.world-status .world-person.selected { border-color: var(--gold); background: rgba(212,173,93,.14); }
.world-detail {
  margin: 0; padding: 7px 10px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px;
  color: #b9aa96; background: rgba(255,255,255,.04); font-size: 12px; line-height: 1.5; cursor: pointer;
}
.world-detail[hidden] { display: none; }
.world-detail b { margin-right: 8px; color: #e6d5b4; }
.world-detail[data-tone="good"] { color: #84b8a0; }
.world-detail[data-tone="danger"] { color: #d47b68; }
.growth-plan { margin-top: 8px; }

/* Action desk head: title and tags share a line; decorative codes go. */
.play-head { min-height: 26px; align-items: baseline; }
.play-head > small { max-width: 58%; font-size: 10.5px; }
.action-list { grid-template-rows: none; grid-auto-rows: auto; }
.action-btn { min-height: 56px; }

@media (max-width: 620px) {
  .play-head .eyebrow, .action-head .eyebrow { display: none; }
  .play-head h1 { font-size: 20px; }
  .action-head { min-height: 0; align-items: baseline; justify-content: flex-start; }
  .action-head > div { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
  .action-head h2 { flex: none; font-size: 20px; }
  .action-head #roomSubtitle { display: block; max-width: none; margin: 0; font-size: 11px; }
  .action-btn p { display: block; font-size: 11px; }
  .action-btn b { font-size: 15px; }
  .action-btn .cost { font-size: 10px; }
  .room-count { font-size: 9px; }
  .room-card { min-height: 42px; }
  .game-shell { gap: 5px; }
  .play-table { gap: 5px; }
}
@media (max-height: 700px) {
  .mission-summary.resolved .mission-summary-copy em { display: block; }
  .stats-strip .stat-card { min-height: 32px; }
  .action-btn p { display: none; }
}

/* Life lines: one clear primary, a quiet secondary, a small delete in the corner. */
.save-slot {
  position: relative;
  grid-template-columns: 34px minmax(0,1fr);
  align-items: start; gap: 7px 10px; padding: 10px;
}
.slot-number { width: 30px; height: 36px; }
.slot-copy { padding-right: 56px; }
.slot-copy small { font-size: 9px; }
.slot-copy p { font-size: 11px; }
.save-slot .slot-delete {
  position: absolute; top: 6px; right: 6px; z-index: 1; width: auto; min-width: 0;
  padding: 6px 8px; border: 0; border-radius: 6px;
  color: #a08a7e; background: transparent; font-size: 11px; cursor: pointer;
}
.save-slot .slot-delete.confirming { color: #fff4e6; background: #a8473a; font-weight: 800; }
.slot-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.slot-actions button { width: auto; min-width: 0; }
.slot-actions .slot-primary {
  flex: 1; padding: 10px; border: 0; border-radius: 8px;
  color: #fff6e6; background: var(--red); font-size: 14px; font-weight: 800; letter-spacing: .04em;
}
.save-slot.ended .slot-actions .slot-primary { background: #7a3d31; }
.slot-actions .slot-secondary {
  flex: none; padding: 8px 6px; border: 0; background: transparent;
  color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px;
}
.slot-actions .slot-secondary.solo {
  flex: 1; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.42);
  color: var(--ink); text-decoration: none; font-size: 13px;
}
.slot-replay { padding-top: 7px; }
.slot-replay span { font-size: 10.5px; }
@media (max-width: 620px) {
  .slot-actions { grid-template-columns: none; }
}
@media (max-width: 620px) {
  .brand b { max-width: none; font-size: 15px; letter-spacing: .02em; }
}

/* ---- UI art (public/art). Pictures overlay the old text/seal; if one fails to
   load, game.mjs removes the <img> and the text style below shows as before. ---- */
img.art {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; object-fit: cover; border-radius: inherit;
  user-select: none; -webkit-user-drag: none; pointer-events: none;
}
.room-seal, .role-seal, .rank-banner > span, .rank-ladder span, .slot-number,
.luan-avatar, .room-banner, .system-orb { position: relative; }
.room-seal, .role-seal, .rank-banner > span, .slot-number { overflow: hidden; }

/* Palace tabs: 4-up on a phone, icon + name. */
.room-card { grid-template-columns: 28px minmax(0,1fr); gap: 5px; padding: 4px 5px; }
.room-seal { right: auto; top: auto; width: 28px; height: 28px; border-radius: 6px; transform: none; }
.room-seal.has-art { border-color: color-mix(in srgb, var(--room-color) 55%, transparent); box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.room-card.active .room-seal.has-art { box-shadow: 0 0 0 2px var(--room-color); }
@media (min-width: 621px) {
  .room-card { grid-template-columns: 38px minmax(0,1fr); min-height: 54px; }
  .room-seal { width: 38px; height: 38px; }
}

/* Room banner: ~5:1 strip after the action-panel title. Hidden until loaded. */
.room-banner { display: none; }
.room-banner.has-art {
  display: block; height: 72px; margin: 6px 0 2px; overflow: hidden;
  border-radius: 8px; border: 1px solid rgba(60,40,28,.35);
  background: #19120f;
}
.room-banner.has-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(20,14,12,.0) 45%, rgba(20,14,12,.5));
}
@media (min-width: 621px) { .room-banner.has-art { height: 104px; } }
@media (max-height: 700px) { .room-banner.has-art { height: 48px; } }

/* Rank seal (resume stamp). */
.role-seal.has-art { width: 24px; height: 24px; border-radius: 5px; border-color: rgba(228,100,78,.5); }
.role-seal.has-art { margin: -3px 0; }
.rank-banner > span.has-art { border-radius: 8px; border-width: 1px; }
.rank-ladder span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; overflow: hidden; }
.rank-ladder > div { grid-template-columns: 30px 58px minmax(0,1fr); }

/* Life-line card thumb (5:6). Number becomes a corner chip once the art is in. */
.save-slot { grid-template-columns: 46px minmax(0,1fr); }
.slot-number { width: 46px; height: 55px; border-radius: 6px; }
.slot-number.has-art { border-color: rgba(190,73,56,.55); }
.slot-number.has-art .num {
  position: absolute; left: 0; bottom: 0; z-index: 1; min-width: 15px; padding: 2px 4px 1px;
  color: #fff3dc; font: 900 10px/1 "Menlo", monospace; text-align: center;
  border-top-right-radius: 5px; background: rgba(25,16,12,.78);
}

/* Luantai avatar: round, 1:1, falls back to the old pulse / a 鸾 seal. */
.luan-avatar {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center; overflow: hidden;
  border-radius: 50%; border: 1px solid rgba(94,220,184,.5);
  color: #8edcbe; background: #102622; font: 900 15px/1 "STKaiti", "KaiTi", serif;
  box-shadow: 0 0 12px rgba(70,215,176,.18);
}
.luan-avatar.has-art b { visibility: hidden; }
.luan-slot { display: block; }
.luan-say { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 8px; align-items: start; margin-top: 9px; }
.luan-say .system-copy { margin: 0; }
.luan-say .luan-avatar { width: 38px; height: 38px; }
.result-card blockquote:has(.luan-avatar), .banquet-card blockquote:has(.luan-avatar) {
  display: flex; align-items: flex-start; gap: 10px;
}
.result-card blockquote .luan-avatar, .banquet-card blockquote .luan-avatar { width: 40px; height: 40px; margin-top: 1px; }
.luan-text { min-width: 0; flex: 1; }

/* Mission summary: the pulse orb becomes Luantai's face. */
.system-orb.has-art { overflow: hidden; border-color: rgba(94,220,184,.55); box-shadow: 0 0 14px rgba(70,215,176,.2); }
.system-orb.has-art::before, .system-orb.has-art::after, .system-orb.has-art > i { display: none; }

/* Origin picker (new run): three selectable cards above the prologue. */
.origin-pick-title { margin: 12px 0 7px; color: #8e6c5c; font: 800 10px/1 "Menlo", "STKaiti", serif; letter-spacing: .12em; }
.origin-grid { gap: 6px; margin-bottom: 4px; }
.origin-grid .origin-card { width: 100%; font: inherit; cursor: pointer; padding-top: 10px; padding-bottom: 10px; }
.origin-grid .origin-card b { font-size: 17px; }
.origin-grid .origin-card p { margin-top: 4px; color: #6c5d51; font-size: 9px; line-height: 1.5; }
.origin-grid .origin-card em { margin-top: 5px; color: #9b4a3b; font-size: 9px; line-height: 1.5; }
.origin-grid .origin-card:not(.active) { opacity: .86; }
.origin-grid .origin-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.system-whisper[hidden] { display: none; }

/* Non-Luantai romance speakers: plain "name: quote", no avatar. */
.result-card blockquote.npc-quote { display: block; color: #5a4636; border-left-color: var(--gold); background: rgba(212,173,93,.08); }
.npc-quote .npc-name { font-weight: 900; color: var(--red); }
.npc-quote .npc-name::after { content: "："; }
.origin-grid + h2 { margin-top: 18px; }

/* v0.9.5 结局页三块折叠 + 行动区折叠行 */
.ending-fold { max-width: 590px; margin: 0 auto 8px; text-align: left; }
.ending-fold > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 34px; cursor: pointer; list-style: none;
  color: #6d4b32; font: 900 15px/1.2 "STKaiti", serif;
}
.ending-fold > summary::-webkit-details-marker { display: none; }
.ending-fold > summary::after { content: "展开"; color: #9b8873; font: 700 9px/1 "Menlo", monospace; }
.ending-fold[open] > summary::after { content: "收起"; }
.ending-fold > summary span { margin-left: auto; margin-right: 8px; color: #806841; font: 700 10px/1.2 sans-serif; }
.ending-body-fold { border: 0; padding: 0; background: none; text-align: center; }
.ending-body-fold > summary { justify-content: center; padding-bottom: 4px; border-bottom: 1px solid rgba(112,91,57,.2); margin-bottom: 8px; }
.ending-body-fold > summary::after { display: none; }
.ending-body-fold .ending-reflection { margin-left: auto; margin-right: auto; }
.romance-ending.ending-fold, .truth-reveal.ending-fold { padding: 4px 10px; }
.romance-ending.ending-fold[open], .truth-reveal.ending-fold[open] { padding-bottom: 10px; }
.ending-fold > summary.truth-head b { font: 900 15px/1.2 "STKaiti", serif; }
.ending-fold { overflow-wrap: anywhere; }
.locked-actions > summary { color: #8a7a6a; }
.locked-actions .action-btn { opacity: .72; }
.origin-card.locked { opacity: .55; cursor: default; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.origin-card.locked:hover { border-color: inherit; background: inherit; }
.origin-card.locked em { color: #8a7a6a; }
.ending-causal .ending-stats { padding: 0 10px 8px; justify-content: flex-start; }
.origin-locked-note { margin: 4px 2px 0; color: #8a7a6a; font-size: 12px; line-height: 1.5; text-align: center; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
