/* Layout: one reading column; form on top, notes below. Palette from Dominion's card frames:
   Victory green for actions, Treasure gold for the players' names, parchment-grey paper. */
:root {
  --paper: #f2f3ee;
  --panel: #ffffff;
  --ink: #1d2219;
  --muted: #586152;
  --rule: #d8dccf;
  --victory: #2f6a35;
  --on-victory: #ffffff;
  --treasure: #8a6100;
  --warn: #f6ecc9;
  --code: #e7eadf;
  --p0: #2f62a8;
  --p1: #b4462f;
  --p2: #6b4fa0;
  --p3: #1f7a6d;
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121510;
    --panel: #1b1f18;
    --ink: #edf0e7;
    --muted: #a7af9c;
    --rule: #343a2e;
    --victory: #8acd7f;
    --on-victory: #10140e;
    --treasure: #e6b94f;
    --warn: #3a3420;
    --code: #262b22;
    --p0: #7aa7e8;
    --p1: #ee8a6f;
    --p2: #b49be0;
    --p3: #5cc3b2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121510;
  --panel: #1b1f18;
  --ink: #edf0e7;
  --muted: #a7af9c;
  --rule: #343a2e;
  --victory: #8acd7f;
  --on-victory: #10140e;
  --treasure: #e6b94f;
  --warn: #3a3420;
  --code: #262b22;
  --p0: #7aa7e8;
  --p1: #ee8a6f;
  --p2: #b49be0;
  --p3: #5cc3b2;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--body);
}
/* every page: the same 1180px column as the navigation and the footer */
header, main { max-width: 1180px; margin: 0 auto; padding-inline: 16px; }
header { padding-block: 32px 8px; }
h1, article h1, article h2 { font-family: var(--display); font-weight: 700; letter-spacing: 0.02em; text-wrap: balance; }
header h1 { margin: 0 0 4px; font-size: 2rem; }
header p, .note { margin: 0 0 20px; color: var(--muted); max-width: 65ch; }
code { font-family: var(--mono); font-size: 0.9em; }
::placeholder { color: var(--muted); opacity: 1; }
a { color: var(--victory); }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.9em; }
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: 13px/1.45 var(--mono);
  resize: vertical;
}
textarea:focus-visible, button:focus-visible { outline: 2px solid var(--victory); outline-offset: 2px; }
fieldset { border: 1px solid var(--rule); border-radius: 6px; margin: 16px 0; padding: 10px 14px 14px; }
legend { font-weight: 600; padding: 0 6px; }
label.check { display: flex; gap: 8px; align-items: baseline; font-weight: 400; }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--muted); margin-bottom: 8px; }
.buttons, .toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
button {
  border: 1px solid var(--victory);
  background: var(--victory);
  color: var(--on-victory);
  padding: 8px 16px;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}
button.secondary { background: transparent; color: var(--victory); }
button:disabled { opacity: 0.6; cursor: progress; }
#output { margin-block: 32px 64px; }
.toolbar { margin-bottom: 12px; }
#source { color: var(--muted); margin-right: auto; }
.warning, #error { background: var(--warn); color: var(--ink); padding: 10px 14px; border-radius: 6px; }
#error { margin-block: 16px; }
article, #source-md {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 8px 24px 24px;
  overflow-x: auto;
  min-width: 0;
}
#source-md { white-space: pre-wrap; font: 13px/1.45 var(--mono); padding: 16px; margin: 0; }
article h1 { font-size: 1.6rem; }
article h2 { font-size: 1.2rem; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--rule); }
/* a wide table scrolls by itself instead of the whole article */
article table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 0.92em; font-variant-numeric: tabular-nums; }
article th, article td { border: 1px solid var(--rule); padding: 4px 10px; }
article code { background: var(--code); padding: 1px 5px; border-radius: 4px; font: 0.85em var(--mono); }
article ul { padding-left: 20px; }
article li { margin: 2px 0; }
article li > strong:first-child { color: var(--treasure); }
@media (max-width: 600px) {
  article { padding: 4px 12px 16px; }
}
@media (max-width: 800px) {
  header h1 { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

/* Kingdom viewer. Tiles carry their own card-frame colours (the same in both themes),
   with dark ink on light frames and light ink on Night cards. */
.kingdom { display: grid; gap: 10px; margin-block: 4px 18px; }
.piles { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.landscapes { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.tile {
  --ink: #1f1d18;
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-width: 0;
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  background: var(--f1);
  box-shadow: inset 0 -4px 0 var(--f2);
  border: 1px solid rgba(0, 0, 0, 0.25);
  font-size: 0.8rem;
  line-height: 1.25;
}
.tile.dark { --ink: #f3f0e8; }
.tile:hover, .tile:focus-visible { outline: 2px solid var(--victory); outline-offset: 1px; }
.tile .art {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.35);
}
.tile.landscape .art { aspect-ratio: 2 / 1; }
.tile .art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .set {
  position: absolute;
  left: 6px;
  bottom: 4px;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.7;
}
.tile .art img + .set { display: none; }
.tile .name {
  font-weight: 650;
  font-size: 0.8rem;
  padding: 5px 6px 2px;
  overflow-wrap: break-word;
  hyphens: auto;
}
.tile .foot { display: flex; gap: 6px; align-items: center; padding: 2px 6px 6px; min-width: 0; }
.tile .types { font-size: 0.68rem; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost { display: inline-flex; gap: 2px; flex: none; font-variant-numeric: tabular-nums; }
.cost > span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding-inline: 3px;
  font-weight: 700;
  font-size: 0.72rem;
  color: #1f1d18;
}
.coin { border-radius: 50%; background: #f2c83b; border: 1px solid #a07b10; }
.potion { border-radius: 50% 50% 45% 45%; background: #3f6fb8; border: 1px solid #2c4f86; color: #fff !important; }
.debt { clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); background: #c98b5a; }

/* Without art (hosted page): one-line chips, two per row on a phone. */
.kingdom:has(.chip) .piles, .kingdom:has(.chip) .landscapes { grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 6px; }
.tile.chip {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 8px 6px 10px;
  box-shadow: inset 5px 0 0 var(--f2);
}
.tile.chip .cost { min-width: 20px; }
.tile.chip .info { display: grid; min-width: 0; }
.tile.chip .name { padding: 0; font-size: 0.86rem; line-height: 1.2; }
.tile.chip .meta { font-size: 0.7rem; opacity: 0.78; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Site navigation and footer, the same on every page. A static copy of a page
   (scry site, cmd/buildsite) has body.static and hides the links to pages it lacks. */
.static .local-only { display: none !important; }
.top {
  display: flex;
  gap: 4px 18px;
  flex-wrap: wrap;
  align-items: baseline;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 16px 0;
}
.top a { color: var(--muted); text-decoration: none; }
.top a:hover, .top a[aria-current="page"] { color: var(--ink); }
.top .brand { font-family: var(--display); font-weight: 700; color: var(--ink); margin-right: auto; letter-spacing: 0.03em; }

/* Landing page */
.hero { max-width: 1180px; margin: 0 auto; padding: 48px 16px 24px; display: grid; gap: 28px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); align-items: center; }
.hero h1 { font-family: var(--display); font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.05; margin: 0 0 12px; }
.hero .lede { font-size: 1.15rem; color: var(--muted); max-width: 46ch; margin: 0 0 24px; }
.hero svg { width: 100%; height: auto; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; }
.cta a { text-decoration: none; padding: 10px 18px; border-radius: 6px; border: 1px solid var(--victory); font-weight: 600; }
.cta a.primary { background: var(--victory); color: var(--on-victory); }
.modules, .steps { max-width: 1180px; margin: 0 auto; padding: 8px 16px 24px; }
.modules h2, .steps h2 { font-family: var(--display); font-size: 1.35rem; margin: 24px 0 12px; }
.module-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.module { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 16px 18px 18px; }
.module h3 { margin: 0 0 2px; font-size: 1.05rem; }
.module .tag { font: 0.78rem var(--mono); color: var(--muted); }
.module p { margin: 10px 0 0; }
.module.soon { border-style: dashed; }
.steps ol { padding-left: 22px; max-width: 72ch; }
.steps li { margin: 8px 0; }
.steps code, .module code { font: 0.88em var(--mono); background: var(--code); padding: 1px 5px; border-radius: 4px; }
/* a bookmark to drag to the bookmarks bar (Scry game, Recent games), and a pulsing "waiting" dot */
.bookmark { display: inline-block; padding: 3px 12px; border-radius: 14px; background: var(--treasure); color: var(--paper); font-weight: 700; text-decoration: none; cursor: grab; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--victory); animation: pulse 1.4s ease-in-out infinite; flex: none; }
@keyframes pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }
.site-foot { max-width: 1180px; margin: 0 auto; padding: 24px 16px 48px; color: var(--muted); font-size: 0.9rem; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 28px; }
  .hero svg { max-width: 420px; }
}
