/* Corporate Chaos. One visual world: a trading terminal at night, with the paperwork on top.
   Layout idea: a single phone-width column; the ticker tape and the stock chart on top, the memo below. */
:root {
  color-scheme: dark;
  --deep: #0d1a20;       /* page */
  --panel: #152830;      /* tiles */
  --line: #2b444e;       /* borders on dark */
  --text: #e9f1ef;       /* text on dark */
  --mute: #93a9ae;       /* secondary text on dark */
  --tape: #ffb52e;       /* the ticker tape, money, focus */
  --up: #49d49b;
  --down: #ff6d5f;
  --memo: #f2f0e9;       /* letterhead paper */
  --manila: #ecdcae;     /* the dossier folder */
  --ink: #15232a;        /* text on paper */
  --ink-soft: #57696f;
  --stamp: #b3261e;      /* CONFIDENTIAL, bad news on paper */
  --good-ink: #16644a;
  --display: 'Big Shoulders Display', 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --body: 'IBM Plex Sans', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--deep);
  background-image: linear-gradient(180deg, #14303a 0, transparent 340px);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}
#app { max-width: 460px; margin: 0 auto; padding: 14px 16px 40px; display: flex; flex-direction: column; gap: 12px; }
h1, h2, h3, p, figure, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, summary:focus-visible { outline: 3px solid var(--tape); outline-offset: 2px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); }

/* ---- ticker tape ---- */
.tape { overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #091318; margin: 0 -16px; }
.tape .run { display: inline-flex; gap: 26px; padding: 6px 13px; white-space: nowrap; font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--tape); animation: tape 38s linear infinite; }
.tape b { font-weight: 600; color: var(--text); }
@keyframes tape { to { transform: translateX(-50%); } }

/* ---- stock chart ---- */
.chart { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #0a151a; }
.chart svg { display: block; width: 100%; height: auto; }

/* ---- title ---- */
.title { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.title h1 { font-family: var(--display); font-weight: 800; font-size: 56px; line-height: .88; letter-spacing: .01em; text-transform: uppercase; color: var(--text); }
.title h1 span { color: var(--tape); display: block; }
.title p { color: var(--mute); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.btn { display: block; width: 100%; min-height: 52px; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; text-align: center; }
.btn small { display: block; font-weight: 400; color: var(--mute); font-size: 13px; }
.btn.primary { background: var(--tape); color: #241803; border-color: var(--tape); }
.btn.primary small { color: #5e4410; }
.btn:active { transform: translateY(1px); }
.how { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.how h2 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--tape); margin-bottom: 8px; }
.how li { padding: 6px 0; border-top: 1px solid var(--line); font-size: 15px; color: var(--mute); }
.how li:first-child { border-top: 0; }
.how b { color: var(--text); }
.how.goal { border-color: var(--tape); }
.how.goal p { font-size: 16.5px; color: var(--text); }
.fine { font-size: 12.5px; color: var(--mute); }

/* ---- top bar, money and meters ---- */
.bar { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bar .time { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; letter-spacing: .02em; }
.bar .where { color: var(--mute); font-size: 13px; text-align: right; margin-left: auto; }
.helpbtn { flex: none; align-self: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--tape); font-weight: 700; font-size: 18px; }
.money { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.meters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.tile .lab { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .val { font-size: 19px; font-weight: 600; line-height: 1.2; }
.money .tile .val { font-size: 25px; }
.tile .sub { font-size: 12px; color: var(--mute); white-space: nowrap; }
.meters .tile { padding: 7px 8px; }
.meters .tile .lab { font-size: 10px; letter-spacing: .02em; }
.track { height: 5px; border-radius: 3px; background: #091318; margin-top: 5px; overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 3px; background: var(--up); transition: width .3s; }
.track i.warn { background: var(--tape); }
.track i.bad { background: var(--down); }
.row2 { display: flex; flex-direction: column; gap: 6px; }
.row2 > .tile { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pips { display: flex; gap: 5px; }
.pips i { width: 13px; height: 13px; border-radius: 2px; background: var(--tape); transform: rotate(45deg); margin: 2px; }
.pips i.off { background: transparent; border: 2px solid var(--line); }
.staff { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mgr { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 7px 7px; min-width: 0; }
.mgr b { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mgr.gone b { text-decoration: line-through; color: var(--mute); }
.mgr .track { margin-top: 4px; height: 4px; }
.caption { font-size: 12px; color: var(--mute); }

/* ---- news that lands from earlier choices ---- */
.flash { border: 1px solid var(--down); border-left-width: 5px; border-radius: 8px; padding: 9px 12px; background: #2a1917; display: flex; flex-direction: column; gap: 6px; }
.flash .k { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--down); }
.flash p { font-size: 15px; }

/* ---- the memo (challenge card) and the dossier (stranger card) ---- */
.slip { background: var(--memo); color: var(--ink); border-radius: 4px 4px 12px 12px; padding: 0 16px 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); display: flex; flex-direction: column; gap: 12px; }
.slip .head { display: flex; justify-content: space-between; gap: 10px; margin: 0 -16px; padding: 8px 16px; border-bottom: 2px solid var(--ink); border-top: 6px solid var(--tape); font-size: 12px; letter-spacing: .07em; text-transform: uppercase; font-weight: 700; }
.slip .head span + span { color: var(--ink-soft); white-space: nowrap; font-family: var(--mono); }
.slip h2 { font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1.02; text-wrap: balance; }
.slip p { font-size: 16.5px; }
.slip .you { font-size: 14px; color: var(--ink-soft); }
.slip.dossier { background: var(--manila); }
.slip.dossier .head { border-top-color: var(--stamp); }
.slip.dossier .head span:first-child { color: var(--stamp); }
.twist { border-left: 4px solid var(--stamp); padding-left: 10px; display: flex; flex-direction: column; gap: 6px; }
.twist p { font-size: 15.5px; }
.notice { display: flex; flex-direction: column; gap: 0; }
.notice .k { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--ink-soft); margin-bottom: 2px; }
.notice li { font-size: 15.5px; padding: 7px 0 7px 18px; border-top: 1px dashed #b9a875; position: relative; }
.notice li::before { content: ''; position: absolute; left: 2px; top: 15px; width: 7px; height: 7px; background: var(--ink); transform: rotate(45deg); }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { text-align: left; width: 100%; min-height: 52px; padding: 10px 12px; border-radius: 8px; border: 2px solid var(--ink); background: #fffefa; color: var(--ink); display: flex; flex-direction: column; gap: 2px; }
.opt .l { font-weight: 600; font-size: 16px; line-height: 1.25; }
.opt .m { font-size: 13px; color: var(--ink-soft); }
.opt .m b { color: var(--stamp); font-weight: 600; }
.opt:active { background: #e6e2d3; }
.opt[disabled] { opacity: .45; cursor: not-allowed; }
.opt.del { border-style: dashed; background: transparent; }
.opt.go { background: var(--ink); color: var(--memo); align-items: center; justify-content: center; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 4px; background: #d9efe3; color: var(--good-ink); border: 1px solid #9ccdb5; }
.chip.bad { background: #fbe0da; color: #8f241b; border-color: #e9a59b; }
.chip.flat { background: #e4e0d2; color: var(--ink); border-color: #c5c0ad; }
.flash .chip, .flash .chip.bad { background: transparent; }
.flash .chip { color: var(--up); border-color: var(--up); }
.flash .chip.bad { color: var(--down); border-color: var(--down); }
.badge { align-self: flex-start; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; background: var(--good-ink); color: #fff; }
.badge.lost { background: var(--stamp); }
.pace { border-top: 1px dashed var(--ink-soft); padding-top: 10px; font-size: 14px; font-family: var(--mono); }
.pace b { font-weight: 600; }
.pace .dn { color: #8f241b; } .pace .u { color: var(--good-ink); }
.facts li { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-top: 1px dashed #bdb8a4; font-size: 15px; }
.facts li:first-child { border-top: 0; }
.facts li span:first-child { color: var(--ink-soft); flex: none; }
.facts li span:last-child { font-weight: 600; text-align: right; }

/* ---- year-end report ---- */
.paper { background: var(--memo); color: var(--ink); border-radius: 4px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.paper .mast { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; border-bottom: 3px double var(--ink); padding-bottom: 6px; font-weight: 700; }
.paper h2 { font-family: Georgia, 'Times New Roman', serif; font-weight: 700; font-size: 25px; line-height: 1.12; text-wrap: balance; }
.stampRow { display: flex; justify-content: center; padding: 10px 0 6px; }
.stamp { max-width: 100%; padding: 6px 18px 8px; border-radius: 8px; border: 5px solid var(--stamp); outline: 2px solid var(--stamp); outline-offset: 3px; color: var(--stamp); text-align: center; font-family: var(--display); font-weight: 800; font-size: min(52px, calc((min(100vw, 460px) - 104px) / (var(--n, 10) * .66))); line-height: .95; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; transform: rotate(-5deg); animation: stamp .35s cubic-bezier(.2, 1.4, .4, 1) both; }
.stamp small { display: block; font-family: var(--mono); font-weight: 600; font-size: 11px; letter-spacing: .16em; line-height: 1.6; }
.stamp.good { border-color: var(--good-ink); outline-color: var(--good-ink); color: var(--good-ink); }
@keyframes stamp { from { transform: rotate(-5deg) scale(1.6); opacity: 0; } }
.worth { text-align: center; }
.worth .big { font-size: 21px; font-weight: 600; line-height: 1.2; }
.worth .sm { font-size: 14px; color: var(--ink-soft); }
.adj li { font-size: 14.5px; display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.adj li b { white-space: nowrap; }
.adj li b.upg { color: var(--good-ink); } .adj li b.dng { color: #8f241b; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.stats div { background: #e4e0d2; border-radius: 6px; padding: 6px 2px; min-width: 0; }
.stats b { display: block; font-size: 15px; font-family: var(--mono); font-weight: 600; }
.stats span { font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); }
.quote { font-size: 16.5px; border-left: 3px solid var(--tape); padding-left: 10px; font-weight: 600; }
.sect { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--ink-soft); border-top: 1px solid #bdb8a4; padding-top: 10px; }
.file li { padding: 8px 0; border-top: 1px dashed #bdb8a4; font-size: 14.5px; display: flex; flex-direction: column; gap: 2px; }
.file li:first-child { border-top: 0; }
.file .who { font-weight: 700; }
.file .tag { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--good-ink); }
.file .tag.spy { color: var(--stamp); }
.file .c { color: var(--ink-soft); font-size: 13.5px; }
.log li { display: grid; grid-template-columns: 40px 1fr auto; gap: 8px; font-size: 14px; padding: 5px 0; border-top: 1px dashed #bdb8a4; }
.log li:first-child { border-top: 0; }
.log .t { color: var(--ink-soft); font-family: var(--mono); font-size: 12.5px; padding-top: 1px; }
.log .c { color: var(--ink-soft); display: block; font-size: 13px; }
.log .d { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.log .d.neg { color: #8f241b; } .log .d.pos { color: var(--good-ink); }
textarea.share { width: 100%; min-height: 110px; border-radius: 10px; border: 1px solid var(--line); background: #091318; color: var(--text); font: inherit; font-size: 14px; padding: 10px; }

@media (max-width: 380px) {
  #app { padding-left: 16px; padding-right: 16px; }
  .title h1 { font-size: 46px; }
  .money .tile .val { font-size: 21px; }
  .meters { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .tape .run { animation: none; }
  .stamp { animation: none; }
}

/* ---- how to play ---- */
.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(5, 12, 15, .85); overflow-y: auto; padding: 16px; }
.sheet { max-width: 460px; margin: 0 auto; background: var(--memo); color: var(--ink); border-radius: 10px; border-top: 6px solid var(--tape); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.sheetTop { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sheet h2 { font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1.05; text-wrap: balance; }
.sheet p { font-size: 15.5px; }
.sheet .x { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); background: transparent; color: var(--ink); font-size: 24px; line-height: 1; }
.credits { border-top: 1px solid #bdb8a4; padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.credits .k { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--ink-soft); }
.credits li { display: flex; justify-content: space-between; gap: 14px; padding: 3px 0; font-size: 15px; }
.credits li span { color: var(--ink-soft); }
.credits li b { font-weight: 600; text-align: right; }
