:root {
  color-scheme: light;
  font: 16px/1.45 system-ui, sans-serif;
  --ink: #102839;
  --muted: #38576d;
  --paper: #fff;
  --line: #cfe5f7;
  --nav: #104679;
  --accent: #d9f2ff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #092d50; color: var(--ink); }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .63; }
button:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #176ca6; outline-offset: 2px; }
p, h1, h2, h3 { margin: 0 0 .55rem; }
.game {
  width: min(100%, 440px);
  height: 100dvh;
  margin: auto;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: var(--paper);
}
.bar {
  min-height: 52px;
  padding: 4px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nav);
  color: #fff;
}
.brand { display: flex; gap: .55rem; align-items: center; letter-spacing: .16em; }
.brand span { color: var(--accent); font-size: 1.45rem; }
.menu-button { min-height: 44px; color: #fff; border: 0; background: none; padding: 0 .5rem; }
.identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: #e4f4ff;
  border-bottom: 1px solid var(--line);
}
.identity img { border-radius: 12px; object-fit: cover; }
.identity h1 { font-size: 1.05rem; margin: 0; }
.identity p, .balance small { display: block; font-size: .76rem; color: var(--muted); margin: 0; }
.balance { justify-self: end; text-align: right; font-variant-numeric: tabular-nums; }
main { overflow: auto; overscroll-behavior: contain; padding: 16px 14px; }
h2 { font-size: 1.32rem; line-height: 1.2; }
h3 { font-size: 1rem; }
.kicker { font-weight: 800; font-size: .7rem; letter-spacing: .13em; color: #275c85; }
.story { border-left: 3px solid #71b9ec; padding: 2px 0 3px 12px; }
#scene, #plan-note, #result { color: var(--muted); font-size: .88rem; }
#result:empty { display: none; }
#result { margin-top: .7rem; }
.actions { display: grid; gap: 7px; margin-top: .75rem; }
.choice, .activity {
  min-height: 44px;
  width: 100%;
  color: var(--ink);
  text-align: left;
  padding: 7px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .86rem;
  font-weight: 650;
}
.choice[aria-pressed="true"] { background: #dff2ff; border-color: #70b8ea; opacity: 1; }
.choice small, .activity small { display: block; font-size: .73rem; font-weight: 450; color: var(--muted); }
details { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 6px; }
summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-weight: 650; }
.summary-list { font-size: .82rem; margin: .5rem 0; padding-left: 1.25rem; }
.summary-list li { margin-bottom: .5rem; }
dl { margin: 0 0 12px; }
dl div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 8px 0; font-size: .85rem; }
dd { margin: 0; text-align: right; color: var(--muted); }
#budget { width: 100%; accent-color: #176ca6; }
.console { background: var(--nav); color: #fff; padding: 8px 12px max(5px, env(safe-area-inset-bottom)); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0 1px 8px; }
.stat { min-width: 0; }
.stat span { display: block; font-size: .64rem; white-space: nowrap; color: #102839; }
.stat strong { display: block; font-size: .86rem; font-variant-numeric: tabular-nums; }
.stat meter { width: 100%; height: 6px; display: block; margin-top: 3px; }
.stat meter::-webkit-meter-bar { background: #174766; border: 0; }
.stat meter::-webkit-meter-optimum-value { background: #fff; }
.primary { min-height: 47px; width: 100%; border: 0; border-radius: 10px; background: var(--accent); color: #102839; font-weight: 800; }
.console nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 5px; }
.console nav button { min-height: 45px; padding: 2px 0; border: 0; border-radius: 7px; color: #102839; background: none; font-size: .72rem; }
.console nav button span { display: block; font-size: 1rem; line-height: 1.05; }
.console nav [aria-current] { color: #102839; background: #c9edff; font-weight: 750; }
dialog { width: min(calc(100% - 28px), 388px); max-height: 85dvh; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); color: var(--ink); padding: 20px; }
dialog::backdrop { background: #072849bb; }
dialog form { display: grid; gap: 8px; margin-top: 12px; }
dialog label { display: grid; gap: 3px; font-size: .82rem; }
dialog select { min-height: 44px; padding: 4px 8px; }
#intro { text-align: center; }
@media (min-width: 700px) {
  .game { height: min(100dvh, 900px); }
}

.journal-button { color: inherit; border: 0; background: none; min-height: 44px; padding: 0; }
.console { padding-inline: 0; padding-top: 0; background: #1ab1fd; color: #102839; }
.console nav { grid-template-columns: 1fr 1fr 1.15fr 1fr 1fr; margin: 0; padding: 5px 7px; }
.console nav button { min-width: 0; min-height: 49px; }
.console nav button span:not([aria-hidden]) { font-size: inherit; }
.console nav .primary { background: var(--accent); color: #102839; font-size: .95rem; border-radius: 9px; }
.console nav .primary[hidden] { display: block !important; visibility: hidden; }
.stats { grid-template-columns: 1fr 1fr; gap: 8px 14px; padding: 9px 12px 5px; border-top: 1px solid #167db7; }
.stat { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 5px; }
.stat meter { grid-column: 1 / -1; }
.actions:empty, #plan-result:empty { display: none; }
#plan-result { margin-top: 10px; color: var(--muted); font-size: .85rem; }
.console nav [data-screen="connections"] { font-size: .61rem; }
.choice, .activity { border-radius: 15px; background: #f5fbff; border-bottom-width: 3px; }
.console nav button span[aria-hidden] { font-size: 1.46rem; margin-bottom: 4px; }
.console nav button { font-weight: 750; }
.console nav .primary { border-radius: 16px; border-bottom: 4px solid #9cd9f6; }
.stat meter { height: 9px; }
.stat meter::-webkit-meter-bar { background: #174766; border-radius: 7px; }
.stat meter::-webkit-meter-optimum-value { background: #fff; border-radius: 7px; }
#people meter { display: block; width: 78px; height: 9px; }
#people meter::-webkit-meter-optimum-value { background: #147cbd; }

.identity img, .console nav button span[aria-hidden], #assets summary span {
  filter: grayscale(1) sepia(1) hue-rotate(165deg) saturate(1.4);
}
.game { grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
#screen { grid-row: 4; }
.console { grid-row: 5; }
.guide { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 14px; background: #104679; color: white; }
.guide p { flex: 1; margin: 0; font-size: .83rem; font-weight: 700; }
.guide button { flex: 0 0 44px; min-height: 44px; border: 0; border-radius: 8px; background: #d9f2ff; color: #102839; font-size: 1.4rem; }
.guide-choices { outline: 2px solid #176ca6; outline-offset: 3px; border-radius: 12px; }
.guide-choices::before { content: "↓"; color: #104679; line-height: 1; font-size: 1.4rem; font-weight: 900; justify-self: center; animation: guide-point .8s ease-in-out infinite alternate; }
.guide-next { position: relative; outline: 2px solid #104679; outline-offset: 2px; }
.guide-next::before { content: "↓"; position: absolute; bottom: calc(100% + 5px); left: calc(50% - 15px); width: 30px; border-radius: 50%; font-size: 1.3rem; background: #104679; color: white; animation: guide-point .8s ease-in-out infinite alternate; pointer-events: none; }
@keyframes guide-point { from { transform: translateY(-3px); } to { transform: translateY(1px); } }
@media (prefers-reduced-motion: reduce) {
  .guide-choices::before, .guide-next::before { animation: none; }
}
.idle-arrow { position: fixed; z-index: 20; width: 30px; height: 30px; margin-left: -15px; border-radius: 50%; background: #104679; color: white; text-align: center; font: 800 22px/30px system-ui; box-shadow: 0 0 0 2px white; pointer-events: none; animation: guide-point .8s ease-in-out infinite alternate; }
.idle-arrow.below { rotate: 180deg; }
@media (prefers-reduced-motion: reduce) { .idle-arrow { animation: none; } }
#year-options { color: var(--muted); font-size: .85rem; }
