:root {
  --ink: #171815;
  --paper: #eeeee3;
  --paper-deep: #deded0;
  --acid: #d7ff3f;
  --rust: #e45c3a;
  --muted: #686960;
  --line: #b8b9ac;
  --white: #fafaf3;
  --shadow: 7px 7px 0 var(--ink);
  color-scheme: light;
  font-family: "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }

html { background: var(--ink); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

button,
input { font: inherit; }

button { color: inherit; }

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--acid);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.paper-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.start-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 26px 16px;
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(23, 24, 21, .06) 50%, transparent 50.2%),
    var(--paper);
}

.start-card {
  position: relative;
  width: min(100%, 620px);
  border: 2px solid var(--ink);
  padding: clamp(24px, 6vw, 52px);
  background: var(--white);
  box-shadow: var(--shadow);
}

.classified {
  position: absolute;
  top: 0;
  left: 0;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--acid);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
}

.start-mark {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 54px;
  transform: rotate(7deg);
}

.eyebrow {
  margin: 35px 0 10px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .15em;
}

h1,
h2,
h3,
p { margin-top: 0; }

h1 {
  margin-bottom: 14px;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(4rem, 15vw, 7.4rem);
  font-weight: 900;
  line-height: .76;
  letter-spacing: -.035em;
}

.lede {
  max-width: 460px;
  margin-bottom: 28px;
  font-family: Georgia, serif;
  font-size: clamp(1rem, 3vw, 1.2rem);
  line-height: 1.45;
}

.name-label,
.section-kicker,
.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
}

.name-row {
  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 8px;
  margin-bottom: 20px;
}

.name-row input {
  width: 100%;
  min-width: 0;
  height: 52px;
  border: 2px solid var(--ink);
  border-radius: 0;
  padding: 0 14px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  text-transform: uppercase;
}

.icon-button,
.button,
.text-button,
.nav-button,
.ambition-button,
.choice-button,
.tab-button,
.compact-button {
  cursor: pointer;
  border-radius: 0;
}

.icon-button {
  border: 2px solid var(--ink);
  background: var(--acid);
  font-size: 1.5rem;
  font-weight: 800;
}

.ambition-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ambition-button {
  position: relative;
  min-height: 132px;
  border: 2px solid var(--ink);
  padding: 17px;
  background: var(--acid);
  text-align: left;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 100ms, box-shadow 100ms;
}

.ambition-button.destroy { background: var(--ink); color: var(--white); }
.ambition-button:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.ambition-button strong { display: block; margin: 22px 0 7px; font-family: Impact, sans-serif; font-size: 2rem; letter-spacing: .03em; }
.ambition-button small { display: block; max-width: 190px; line-height: 1.3; }
.ambition-number { position: absolute; top: 10px; right: 12px; font-size: .66rem; }

.text-button {
  border: 0;
  padding: 16px 0 0;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
  font-size: .76rem;
  font-weight: 700;
}

.text-button span { color: var(--muted); }

.game-shell { min-height: 100vh; background: var(--paper); }

.hud {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(420px, 2fr);
  border-bottom: 2px solid var(--ink);
  background: var(--ink);
  color: var(--white);
}

.identity {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid #45463f;
  padding: 14px 22px;
  text-transform: uppercase;
}

.identity span:first-child { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.identity span:last-child { margin-top: 3px; color: #a7a89f; font-size: .7rem; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); }
.metrics > div { min-width: 0; border-right: 1px solid #45463f; padding: 10px 14px; }
.metrics small { display: block; margin-bottom: 4px; color: #a7a89f; font-size: .6rem; letter-spacing: .08em; }
.metrics strong { display: block; overflow: hidden; color: var(--acid); font-size: clamp(.8rem, 1.6vw, 1.05rem); text-overflow: ellipsis; white-space: nowrap; }
.metrics > div:last-child strong { color: #ff8c70; }

.workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 65px);
}

.side-rail {
  position: sticky;
  top: 65px;
  display: flex;
  align-self: start;
  flex-direction: column;
  height: calc(100vh - 65px);
  border-right: 2px solid var(--ink);
  background: var(--paper-deep);
}

.rail-title {
  border-bottom: 2px solid var(--ink);
  padding: 19px 17px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
}

.nav-list { display: grid; }
.nav-button {
  display: grid;
  grid-template-columns: 27px 1fr auto;
  align-items: center;
  min-height: 54px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  background: transparent;
  font-size: .73rem;
  font-weight: 700;
  text-align: left;
}

.nav-button span { color: var(--muted); font-size: .6rem; }
.nav-button b { font-size: .62rem; }
.nav-button:hover,
.nav-button.active { background: var(--ink); color: var(--acid); }
.nav-button.active span { color: var(--white); }

.rail-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
  border-top: 2px solid var(--ink);
  padding: 16px;
  color: var(--muted);
  font-size: .64rem;
  font-weight: 700;
}

.view {
  width: min(100%, 920px);
  min-width: 0;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px);
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 30px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 15px;
}

.page-heading h2,
.modal h2 {
  margin: 0;
  font-family: Impact, sans-serif;
  font-size: clamp(2.5rem, 7vw, 4.6rem);
  font-weight: 900;
  line-height: .88;
  letter-spacing: .015em;
  text-transform: uppercase;
}

.page-heading p { max-width: 370px; margin: 0; color: var(--muted); font-family: Georgia, serif; font-size: .95rem; line-height: 1.35; }

.story-layout { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 22px; align-items: start; }
.event-card { border: 2px solid var(--ink); background: var(--white); box-shadow: var(--shadow); }
.event-meta { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 11px 14px; color: var(--muted); font-size: .64rem; font-weight: 700; letter-spacing: .08em; }
.event-body { padding: clamp(20px, 5vw, 36px); }
.event-body h2 { max-width: 610px; margin-bottom: 26px; font-family: Georgia, serif; font-size: clamp(1.55rem, 4vw, 2.35rem); font-weight: 400; line-height: 1.15; }
.choice-list { display: grid; gap: 10px; }

.choice-button,
.button,
.compact-button {
  min-height: 50px;
  border: 2px solid var(--ink);
  padding: 12px 15px;
  background: var(--paper);
  font-size: .76rem;
  font-weight: 700;
  text-align: left;
  transition: background 90ms, color 90ms, transform 90ms;
}

.choice-button { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.choice-button small { color: var(--muted); font-size: .65rem; font-weight: 400; }
.choice-button:hover:not(:disabled),
.button:hover:not(:disabled),
.compact-button:hover:not(:disabled) { background: var(--ink); color: var(--acid); transform: translateY(-1px); }
.choice-button:hover:not(:disabled) small { color: var(--white); }
.choice-button:disabled,
.button:disabled,
.compact-button:disabled { cursor: not-allowed; opacity: .43; }
.button.primary,
.compact-button.primary { background: var(--acid); }
.button.danger { background: var(--rust); color: var(--white); }

.action-panel { border-top: 6px solid var(--ink); padding-top: 12px; }
.action-panel h3 { margin-bottom: 6px; font-size: .8rem; letter-spacing: .08em; }
.action-panel > p { color: var(--muted); font-size: .7rem; line-height: 1.4; }
.quick-actions { display: grid; gap: 7px; }
.quick-actions .compact-button { display: flex; justify-content: space-between; min-height: 43px; border-width: 1px; padding: 9px 11px; font-size: .68rem; }
.quick-actions small { color: var(--muted); }

.notice {
  margin-bottom: 20px;
  border-left: 6px solid var(--acid);
  padding: 12px 15px;
  background: var(--ink);
  color: var(--white);
  font-size: .76rem;
  line-height: 1.45;
}

.notice.warning { border-color: var(--rust); }
.notice strong { color: var(--acid); }

.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.record-card { position: relative; border: 2px solid var(--ink); padding: 18px; background: var(--white); }
.record-card.tracked { box-shadow: inset 6px 0 0 var(--acid); }
.record-card.locked { background: var(--paper-deep); }
.record-card h3 { margin-bottom: 5px; font-size: 1rem; line-height: 1.15; text-transform: uppercase; }
.record-card .teaser { min-height: 34px; margin-bottom: 14px; color: var(--muted); font-family: Georgia, serif; font-size: .83rem; line-height: 1.35; }
.record-tag { display: inline-block; margin-bottom: 12px; padding: 4px 6px; background: var(--ink); color: var(--acid); font-size: .59rem; font-weight: 700; letter-spacing: .07em; }
.requirement-list { display: grid; gap: 6px; margin: 12px 0 16px; padding: 0; list-style: none; }
.requirement-list li { display: grid; grid-template-columns: 17px 1fr; gap: 6px; font-size: .69rem; line-height: 1.3; }
.requirement-list .met { color: #3d6418; }
.requirement-list .unmet { color: #8b3523; }
.card-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.compact-button { min-height: 40px; padding: 8px 10px; font-size: .66rem; }
.hint { margin: 12px 0 0; color: var(--muted); font-size: .65rem; line-height: 1.4; }

.subnav { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.tab-button { min-height: 38px; border: 1px solid var(--ink); padding: 8px 12px; background: transparent; font-size: .66rem; font-weight: 700; }
.tab-button.active { background: var(--ink); color: var(--acid); }
.section-title { margin: 30px 0 13px; border-bottom: 1px solid var(--ink); padding-bottom: 7px; font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; }
.section-title:first-child { margin-top: 0; }
.price { color: var(--muted); font-size: .68rem; font-weight: 700; }
.status-line { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 13px; color: var(--muted); font-size: .65rem; }
.status-dot::before { content: "●"; margin-right: 5px; }
.status-dot.ally::before { color: #5b8b21; }
.status-dot.acquaintance::before { color: #aa7919; }
.status-dot.unknown::before { color: var(--line); }
.asset-list { display: flex; flex-wrap: wrap; gap: 7px; }
.asset-pill { border: 1px solid var(--ink); padding: 7px 9px; background: var(--white); font-size: .65rem; }

.progress-track { height: 8px; margin: 12px 0 5px; background: var(--paper-deep); }
.progress-track span { display: block; height: 100%; background: var(--acid); border-right: 1px solid var(--ink); }
.income-banner { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 20px; border: 2px solid var(--ink); padding: 13px 15px; background: var(--acid); font-size: .75rem; font-weight: 700; }

.toast {
  position: fixed;
  top: 82px;
  left: 50%;
  z-index: 30;
  width: min(calc(100% - 32px), 570px);
  transform: translate(-50%, -18px);
  border: 2px solid var(--ink);
  padding: 12px 16px;
  background: var(--acid);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: .73rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms, transform 140ms;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.bottom-nav { display: none; }

.modal {
  width: min(calc(100% - 28px), 760px);
  max-height: calc(100vh - 40px);
  border: 2px solid var(--ink);
  border-radius: 0;
  padding: clamp(22px, 5vw, 42px);
  background: var(--white);
  box-shadow: 9px 9px 0 var(--acid);
  color: var(--ink);
}
.modal::backdrop { background: rgba(23, 24, 21, .86); }
.modal-close { position: absolute; top: 11px; right: 12px; width: 42px; height: 42px; cursor: pointer; border: 1px solid var(--ink); background: transparent; font-size: 1.6rem; }
.modal-intro { color: var(--muted); font-family: Georgia, serif; }
.gallery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 22px; }
.ending-tile { min-height: 100px; border: 1px solid var(--ink); padding: 13px; }
.ending-tile.locked { display: grid; place-items: center; background: var(--paper-deep); color: var(--muted); }
.ending-tile strong { display: block; margin-bottom: 6px; font-size: .75rem; }
.ending-tile p { margin: 0; color: var(--muted); font-family: Georgia, serif; font-size: .73rem; line-height: 1.3; }

.timing-bar { position: relative; height: 44px; margin: 24px 0; overflow: hidden; border: 2px solid var(--ink); background: var(--paper-deep); }
.timing-target { position: absolute; top: 0; bottom: 0; background: var(--acid); }
.timing-marker { position: absolute; top: -3px; bottom: -3px; width: 6px; margin-left: -3px; background: var(--rust); }
.clicker-counter { margin: 23px 0; font-family: Impact, sans-serif; font-size: 3.2rem; }
.modal-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 22px; }
.ending-stamp { display: inline-block; margin: 18px 0; border: 5px double var(--rust); padding: 8px 11px; color: var(--rust); font-size: .75rem; font-weight: 700; transform: rotate(-2deg); }
.run-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 22px 0; background: var(--ink); border: 1px solid var(--ink); }
.run-summary div { padding: 12px; background: var(--paper); }
.run-summary small { display: block; margin-bottom: 5px; color: var(--muted); font-size: .6rem; }
.run-summary strong { font-size: .76rem; }

@media (max-width: 800px) {
  .hud { grid-template-columns: 1fr; }
  .identity { flex-direction: row; justify-content: space-between; border-right: 0; border-bottom: 1px solid #45463f; padding: 9px 13px; }
  .identity span:last-child { margin: 0; }
  .metrics > div { padding: 8px 10px; }
  .workspace { display: block; min-height: calc(100vh - 104px); }
  .side-rail { display: none; }
  .view { padding: 24px 16px 102px; }
  .bottom-nav { position: fixed; inset: auto 0 0; z-index: 12; display: grid; grid-template-columns: repeat(5, 1fr); border-top: 2px solid var(--ink); background: var(--paper-deep); }
  .bottom-nav .nav-button { display: flex; min-width: 0; min-height: 60px; flex-direction: column; justify-content: center; gap: 4px; border: 0; border-right: 1px solid var(--line); padding: 5px 2px; font-size: .56rem; text-align: center; }
  .bottom-nav .nav-button span { font-size: .52rem; }
  .toast { top: 112px; }
}

@media (max-width: 650px) {
  .start-card { box-shadow: 4px 4px 0 var(--ink); }
  .start-mark { width: 44px; }
  .ambition-grid,
  .card-grid,
  .story-layout,
  .gallery-grid { grid-template-columns: 1fr; }
  .ambition-button { min-height: 112px; }
  .story-layout { gap: 28px; }
  .action-panel { border-top-width: 2px; }
  .page-heading { display: block; }
  .page-heading p { margin-top: 10px; }
  .event-card { box-shadow: 4px 4px 0 var(--ink); }
  .modal-actions { grid-template-columns: 1fr; }
  .run-summary { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
