/*
 * The town at night.
 *
 * Dark on purpose: the canvas is the page's subject and a light chrome around a
 * dark isometric board makes the board read as a widget embedded in a document.
 * Everything else here is deliberately quiet so that the only saturated colours
 * on screen are the ones carrying meaning — the selection ring, the worker dot,
 * and the arrears red.
 */

:root {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: #dfe6e3;
  background: #10161a;
  color-scheme: dark;
}
* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% -10%, #1d2a33 0, #10161a 55%, #0b0f12 100%);
}

main { width: min(1240px, calc(100% - 32px)); margin: 36px auto 64px; }

.eyebrow { letter-spacing: .2em; font-size: .7rem; font-weight: 800; color: #7f9aa5; margin: 0; }
h1 { margin: .2rem 0 .4rem; font-size: clamp(2rem, 5vw, 3.6rem); line-height: .98; }
.lede { max-width: 68ch; color: #91a5ad; margin: 0 0 22px; }

/* -- status bar -- */
.statusbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.pill {
  padding: 6px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700;
  background: #1b262d; border: 1px solid #2c3b45; color: #a9bcc4;
}
.pill--live { color: #7fd6a2; border-color: #2f5c43; }
.pill--down { color: #e79a9a; border-color: #663c3c; }
.message { font-size: .86rem; color: #8fa3ab; }

/* -- layout -- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }

.stage {
  background: #131c22; border: 1px solid #24333c; border-radius: 16px; padding: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
canvas { width: 100%; height: auto; display: block; border-radius: 10px; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .76rem; color: #8398a1; margin: 12px 4px 2px; }
.key { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.key--available { background: #2f4858; }
.key--owned { background: #3d5a53; }
.key--site { background: #5a5030; }
.key--building { background: #4a5a3d; }
.key--lien { background: #5e3a3a; }

/* -- side panel -- */
.side { position: sticky; top: 18px; display: grid; gap: 12px; }
.tabs { display: flex; gap: 6px; }
.tab {
  flex: 1; padding: 9px 8px; border-radius: 9px; border: 1px solid #2c3b45;
  background: #182228; color: #91a5ad; font: inherit; font-weight: 700; cursor: pointer;
}
.tab.is-active { background: #22323b; color: #e6efe9; border-color: #3d5665; }

.panel {
  background: #131c22; border: 1px solid #24333c; border-radius: 14px; padding: 16px;
  min-height: 200px; max-height: 52vh; overflow: auto;
}
.is-hidden { display: none; }
.panel h2 { margin: .25rem 0 .8rem; font-size: 1.3rem; }
.hint { color: #78909a; font-size: .9rem; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 16px; font-size: .88rem; }
.facts dt { color: #7f959e; }
.facts dd { margin: 0; font-weight: 600; }

.buy { width: 100%; padding: 10px; border-radius: 9px; border: 1px solid #3f7d5c; background: #245c40; color: #e9f6ee; font: inherit; font-weight: 700; cursor: pointer; }
.buy:disabled { opacity: .38; cursor: not-allowed; }

.link { background: none; border: 0; padding: 0; color: #8fc6e0; font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
.link:hover { text-decoration: underline; }

.roster { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.roster li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: baseline; }
.roster .sub { grid-column: 1 / -1; font-size: .78rem; color: #74898f; }
.tag { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #d7b96a; border: 1px solid #5a4a22; padding: 1px 6px; border-radius: 999px; }

/* Story lines are indented by kind so a decision and its outcome read as one
   thought, exactly as they do in `npm run narrate`. */
.story { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: .87rem; line-height: 1.45; }
.story li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline; }
.story-outcome, .story-memory { padding-left: 14px; color: #93a7ae; }
.story-goal { color: #c9b87a; }
.story-decision { color: #e2ebe6; }
.story-world { color: #a9bcc4; }
.tick { font-size: .72rem; color: #6d848c; white-space: nowrap; }
.repeat { font-size: .72rem; color: #6d848c; }

/* -- controls -- */
.controls {
  display: flex; align-items: end; gap: 12px; flex-wrap: wrap;
  background: #131c22; border: 1px solid #24333c; border-radius: 14px; padding: 14px;
}
label { display: grid; gap: 5px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #86a0a9; }
select, .controls button { padding: 9px 11px; border-radius: 9px; border: 1px solid #354853; background: #1b262d; color: #dfe6e3; font: inherit; }
.controls button { cursor: pointer; font-weight: 700; }
a { color: #8fc6e0; font-weight: 700; }

/* -- feed -- */
.feed { margin-top: 22px; background: #131c22; border: 1px solid #24333c; border-radius: 16px; padding: 16px 20px; }
.feed h2 { margin: 0 0 10px; font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; color: #7f9aa5; }
.feed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 240px; overflow: auto; font-size: .86rem; color: #a9bcc4; }
.feed-list li { padding-bottom: 6px; border-bottom: 1px solid #1d282f; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; }
}

/* -- account --------------------------------------------------------------
 *
 * The account bar sits between the header and the world, because that is what
 * it is: a strip about you, above a town that belongs to everybody. It is not
 * a screen and it never covers the canvas — signing in adds a panel, it does
 * not replace the view (ARCHITECTURE.md §17).
 */
.account { margin: 0 0 16px; }
.account__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.account__hint { font-size: .84rem; color: #8fa3ab; margin-right: auto; }
.account__who { font-size: .86rem; color: #a9bcc4; margin-right: auto; }
.account__who strong { color: #dfe6e3; font-weight: 650; }
.account__title { font-size: 1rem; margin: 0 0 4px; }
.account__rule { font-size: .76rem; color: #7f9aa5; margin: 0; }
.account__error { font-size: .82rem; color: #e79a9a; margin: 0; min-height: 1.1em; }
/* What came back from a redirect — success or refusal, so not error-coloured. */
.account__notice { font-size: .82rem; color: #a9bcc4; margin: 8px 0 0; }

.account__form {
  display: flex; flex-direction: column; gap: 10px;
  max-width: 380px; padding: 16px;
  background: #131c22; border: 1px solid #24333c; border-radius: 12px;
}

.field { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; color: #8fa3ab; }
.field input {
  font: inherit; font-size: .9rem; color: #dfe6e3;
  padding: 8px 10px; border-radius: 8px;
  background: #0e1519; border: 1px solid #2c3b45;
}
.field input:focus-visible { outline: 2px solid #4f9c7a; outline-offset: 1px; border-color: #4f9c7a; }

.btn {
  font: inherit; font-size: .82rem; font-weight: 650; cursor: pointer;
  padding: 7px 14px; border-radius: 8px;
  background: #2f5c43; border: 1px solid #3e7a58; color: #dff2e7;
}
.btn:hover { background: #376b4e; }
.btn--ghost { background: #1b262d; border-color: #2c3b45; color: #a9bcc4; }
.btn--ghost:hover { background: #223038; }
.btn--danger { background: #3a2226; border-color: #663c3c; color: #e79a9a; }
.btn--danger:hover { background: #47292e; }
.btn:focus-visible { outline: 2px solid #7fd6a2; outline-offset: 2px; }
/* An anchor styled as a button, so it needs the parts a button gets for free. */
.btn--google {
  background: #1b262d; border-color: #3e5b6b; color: #dbe7ee;
  text-decoration: none; display: inline-flex; align-items: center; line-height: 1.35;
}
.btn--google:hover { background: #223642; }

/* -- my agents -- */
.mine-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mine {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: #162026; border: 1px solid #24333c;
}
.mine__status { display: block; font-size: .74rem; color: #7f9aa5; }

/*
 * The shown-once panel. Deliberately the loudest thing in the sidebar: this is
 * the one place in the client where a player closing the page at the wrong
 * moment costs them their agent's credential.
 */
.token {
  margin: 0 0 14px; padding: 14px;
  border-radius: 10px;
  background: #1a2a22; border: 1px solid #3e7a58;
}
.token__title { margin: 0 0 8px; font-size: .8rem; font-weight: 700; color: #7fd6a2; }
.token__value {
  display: block; word-break: break-all; user-select: all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem;
  padding: 8px 10px; border-radius: 8px; color: #dff2e7;
  background: #0e1519; border: 1px solid #2c3b45;
}
.token__warn { margin: 8px 0 0; font-size: .76rem; line-height: 1.45; color: #a9bcc4; }
.token__warn em { color: #dff2e7; font-style: normal; font-weight: 650; }

.hint--tight { margin: 4px 0 10px; font-size: .74rem; line-height: 1.4; }
