:root { color-scheme: dark; --bg: #171716; --fg: #ecebe6; --muted: #a3a29b; --icon-filter: invert(1); }
.icon-img { filter: var(--icon-filter); }
html { background: var(--bg); }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 16px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--fg); background: var(--bg); }
#app { max-width: 40rem; margin: 0 auto; padding: 1rem; overflow-wrap: anywhere; }
#app.play { height: 100%; display: flex; flex-direction: column; gap: 0.75rem; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
button, input, select, textarea { font: inherit; min-height: 3rem; padding: 0.5rem 1rem; border: 2px solid var(--fg); border-radius: 0; background: var(--bg); color: var(--fg); }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
input { width: 100%; margin-bottom: 0.75rem; }
.wide { display: block; width: 100%; margin-bottom: 0.75rem; }
.muted { color: var(--muted); }
.error { border: 2px solid var(--fg); padding: 0.75rem; }
#app.menu { height: 100%; display: flex; flex-direction: column; gap: 0.75rem; }
.title { font-size: 2.75rem; text-align: center; margin: 2rem 0 1.5rem; letter-spacing: 0.04em; }
.saves { flex: 1; min-height: 0; overflow-y: auto; border: 2px solid var(--fg); padding: 0.5rem; }
.save { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.save-name { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; font-weight: bold; font-size: 1.2rem; text-decoration: underline dotted; text-underline-offset: 0.25em; }
.save-delete { flex: none; min-width: 6rem; }
.menu-foot { display: flex; gap: 0.5rem; }
.menu-foot button { flex: 1; }
.top { display: flex; gap: 0.5rem; }
.top .icon { width: 3rem; padding: 0; font-size: 1.5rem; flex: none; }
.top { align-items: flex-start; }
.who { flex: 1; min-width: 0; }
.top .money, .top .name { min-height: 0; padding: 0; border: 0; background: none; text-align: left; font-weight: bold; font-size: 1.25rem; text-decoration: underline dotted; text-underline-offset: 0.25em; }
.bars { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.bar-head { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 0.15rem; }
.bar-track { height: 1rem; border: 2px solid var(--fg); }
.bar-fill { height: 100%; width: 100%; background: var(--fg); }
.bar-track { position: relative; }
.bar-cap { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--fg); }
.skills { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.traits { margin-bottom: 1rem; }
.trait-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.trait-list p { margin: 0.15rem 0 0; }
.trait-list .icon-img { vertical-align: middle; margin-right: 0.4rem; }
.tabs { display: flex; gap: 0.5rem; }
.tabs button { flex: 1; padding: 0.5rem 0.25rem; }
.status { margin: 0.25rem 0 0; font-size: 0.9rem; color: var(--muted); }
.log { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 0.5rem 0.75rem; border: 2px solid var(--fg); list-style: none; }
.log li { margin-bottom: 1rem; }
.log-head { margin: 0 0 0.25rem; font-size: 0.8rem; color: var(--muted); }
.log-body { margin: 0; }
.log-body + .log-body { margin-top: 0.4rem; }
.bottom { display: flex; gap: 0.5rem; align-items: stretch; }
.bottom button { flex: 1; min-height: 4rem; padding: 0.5rem 0.25rem; font-size: 1.05rem; }
.bottom .advance { flex: 2; min-height: 5.5rem; font-size: 1.2rem; font-weight: bold; }
.big { align-self: center; padding: 1rem 2.5rem; min-height: 4rem; font-size: 1.4rem; font-weight: bold; }
.icon-img { image-rendering: pixelated; vertical-align: middle; flex: none; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
h1 .icon-img { margin-right: 0.75rem; }
.save-name, .top .name, .top .icon { justify-content: center; }
.bottom button { flex-direction: column; gap: 0.25rem; }
.tabs button { gap: 0.5rem; }
.menu-foot button { flex-direction: column; gap: 0.25rem; padding: 0.5rem 0.25rem; min-height: 4.5rem; }
.money-amount { font-weight: bold; }
.save-name { justify-content: flex-start; }
.wide { position: relative; }
.wide .icon-img { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); }

.activities { list-style: none; margin: 0 0 0.75rem; padding: 0; }
.activities li:last-child { margin-bottom: 0; }
.activities li { margin-bottom: 0.75rem; }
.action-btn { display: flex; flex-direction: column; height: 5.25rem; padding: 0.25rem 1rem; gap: 0.15rem; }
button.greyed { color: var(--muted); border-color: var(--muted); background: rgba(128, 128, 128, 0.18); }
.odds-note { font-size: 0.8rem; font-weight: normal; text-align: center; }
.grey-note { font-size: 0.8rem; font-weight: normal; text-align: center; }

.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 10; }
.modal { background: var(--bg); color: var(--fg); border: 2px solid var(--fg); width: min(100%, 24rem); aspect-ratio: 1 / 1; max-height: 100%; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.modal h2 { margin: 0; font-size: 1.25rem; }
.modal h2 .icon-img { margin-right: 0.5rem; }
.modal .modal-body { flex: 1; margin: 0; }
.modal .responses .wide:last-child { margin-bottom: 0; }

/* Wide screens: keep the mobile layout as a full-height column centered on the page, with no frame around it.
   #app scrolls inside the body and the event popup is pinned to the column, not the window. */
@media (min-width: 600px) {
  body { position: relative; width: 30rem; height: 100%; margin: 0 auto; overflow: hidden; }
  #app { height: 100%; overflow-y: auto; }
  .overlay { position: absolute; }
}
.dead-name { margin: 0; font-size: 1.25rem; }

.people { list-style: none; margin: 0 0 0.75rem; padding: 0; }
.people .person:last-child { margin-bottom: 0; }
.people .person { margin-bottom: 0.75rem; }
.person-name { min-height: 0; padding: 0; border: 0; background: none; text-align: left; justify-content: flex-start; font-weight: bold; text-decoration: underline dotted; text-underline-offset: 0.25em; }
.rel-group { height: auto; padding: 0.75rem 1rem; display: block; text-align: left; }
.rel-group .bar { width: 100%; }
.person-facts { margin-bottom: 1rem; }
/* Monospace fit: whole words only on buttons, side buttons sized to their label, room for the action icon. */
.tabs button, .bottom button { overflow-wrap: normal; }
.tabs button { font-size: 0.9rem; gap: 0.4rem; }
.bottom button { font-size: 0.8rem; min-width: 0; padding-inline: 0.15rem; }
.bottom .advance { flex: 1.3; font-size: 1.05rem; }
.action-btn { padding-inline: 3.25rem; }
/* Character screen heading (name, age and occupation, location). The name on the main screen never moves when tapped. */
.char-name { font-size: 1.25rem; margin: 0; }
.top .name:active { transform: none; }
.status { overflow-wrap: anywhere; }
.top .status { font-size: 0.8rem; }
.char-head { padding-left: 3.5rem; margin-bottom: 1rem; }
/* Activities and popup responses start from the left (owner), after the icon where there is one. */
.action-btn { align-items: flex-start; justify-content: center; text-align: left; padding-inline: 4rem 1rem; }
.action-btn .odds-note, .action-btn .grey-note { text-align: left; }
.modal .responses .wide { justify-content: flex-start; text-align: left; }

.confirm { display: flex; align-items: center; gap: 0.5rem; height: 4rem; margin-bottom: 0.75rem; padding: 0.25rem 0.5rem 0.25rem 4rem; border: 2px solid currentColor; }
.confirm-q { flex: 1; margin: 0; }
.confirm button { flex: none; width: 5rem; height: 100%; min-height: 0; margin: 0; padding: 0; }
/* Buttons off the main screen are smaller (owner). */
.wide { min-height: 2.5rem; padding-block: 0.25rem; }
.action-btn { height: 4rem; }
/* Every screen is a column; Back always sits at the bottom (owner). */
#app { display: flex; flex-direction: column; min-height: 100%; }
.back { margin-top: auto; flex: none; }
/* One gap everywhere (0.75rem): buttons inside a list carry no margin of their own, the list does the spacing. */
.activities .wide { margin-bottom: 0; }


/* Press feel: buttons dip down when pressed; text-link buttons nudge down 1px. */
button { transition: transform 80ms ease-out; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:active:not(:disabled) { transform: translateY(3px); transition-duration: 30ms; }
.save-name:active, .top .money:active, .top .name:active, .person-name:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}

/* Bottom buttons (owner 2026-11-09): Activities and Pursuits match the Relationships/Assets tab buttons (icon beside label, same height); Advance Year is a slightly bigger full-width row under them. */
.bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.bottom button { flex: none; display: flex; flex-direction: row; justify-content: center; align-items: center; gap: 0.4rem; min-width: 0; min-height: 3rem; font-size: 0.9rem; padding: 0.5rem 0.25rem; }
.bottom .advance { grid-column: 1 / -1; min-height: 3.75rem; font-size: 1.1rem; font-weight: bold; }

/* Icon sits beside the label, the pair centered, with a little more space between them (owner 2026-11-09). */
.tabs button:has(.icon-img), .bottom button:not(.advance) { gap: 0.75rem; }
