@charset "UTF-8";
:root {
  color-scheme: dark;
  --bg: #0b141b;
  --panel: #12212b;
  --panel2: #172a35;
  --ink: #f0ede4;
  --muted: #acb9bd;
  --line: #ffffff19;
  --gold: #e5b76a;
  --gold-soft: #e5b76a18;
  --good: #96d9b4;
  --bad: #ffaba0;
  --radius: 14px;
  font:
    16px/1.5 Arial,
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
[hidden] {
  display: none !important;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button,
input,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  color: var(--ink);
}
button {
  min-height: 44px;
  padding: 10px 15px;
  touch-action: manipulation;
  transition:
    background 0.18s,
    border-color 0.18s,
    transform 0.18s;
}
button:hover {
  border-color: #e5b76a88;
  background: #233947;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
input {
  min-width: 0;
  min-height: 48px;
  padding: 10px 12px;
}
input::placeholder {
  color: #809399;
}
a {
  color: inherit;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h2 {
  font-size: 1.2rem;
}
h3 {
  font-size: 1rem;
}
.wrap {
  width: min(1320px, calc(100% - 64px));
  margin-inline: auto;
}
.topbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.home {
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
}
.home:first-letter {
  color: var(--gold);
}
.edition {
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  color: var(--gold);
  padding-left: 22px;
  border-left: 1px solid var(--line);
}
nav {
  display: flex;
  gap: 7px;
  margin-left: auto;
}
nav button {
  background: transparent;
  font-size: 0.85rem;
  color: var(--muted);
  border-color: transparent;
}
.welcome {
  position: relative;
  isolation: isolate;
  min-height: 620px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #10222c;
}
.welcome-art {
  position: absolute;
  z-index: -2;
  inset: 0;
  background:
    linear-gradient(90deg, #0e1b24 6%, #0e1b2499 43%, #0e1b2400 75%),
    url("kingdom.webp") center right/cover;
}
.welcome::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(0deg, #0b1726cc, transparent 40%);
}
.welcome-copy {
  padding: 64px 48px 88px;
  max-width: 670px;
}
.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--gold);
  font-weight: 700;
}
h1 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.7rem, 5vw, 4.4rem);
  letter-spacing: -0.035em;
  line-height: 1.12;
  margin-top: 23px;
}
h1 span {
  display: block;
  font:
    400 1.25rem/1.5 Georgia,
    serif;
  letter-spacing: 0;
  color: #e4d8bd;
  margin-top: 17px;
}
.intro {
  font-family: Georgia, serif;
  font-size: 1.35rem;
  line-height: 1.5;
  max-width: 360px;
  margin-top: 29px;
}
.premise {
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 420px;
  margin-top: 13px;
  line-height: 1.65;
}
.start-form {
  margin-top: 28px;
}
.start-form label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.start-form label span {
  font-size: 0.7rem;
  letter-spacing: 0;
  color: var(--muted);
  font-weight: 400;
  margin-left: 8px;
}
.launch-row {
  display: flex;
  gap: 9px;
}
.launch-row input {
  width: 185px;
  background: #0b172bd9;
}
.primary {
  background: var(--gold);
  color: #192029;
  border-color: var(--gold);
  font-weight: 700;
}
.primary:hover {
  background: #f2c986;
  color: #13202a;
}
.primary span {
  margin-left: 10px;
}
.error {
  color: var(--bad);
  font-size: 0.85rem;
  line-height: 1.5;
}
.error:not(:empty) {
  margin-top: 9px;
}
.starting-resources {
  display: flex;
  gap: 24px;
  margin-top: 23px;
  font-size: 0.8rem;
  color: var(--muted);
}
.starting-resources strong {
  color: var(--ink);
  font-weight: 500;
}
.hero-caption {
  position: absolute;
  bottom: 20px;
  right: 28px;
  left: 28px;
  display: flex;
  justify-content: space-between;
  color: #c4cac8;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
}
.hero-caption span:last-child {
  letter-spacing: 0;
}
.welcome-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  padding: 36px 4px;
}
.welcome-bottom h2 {
  font:
    400 1.4rem Georgia,
    serif;
  margin-top: 8px;
}
.welcome-bottom p:not(.eyebrow) {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 13px;
  max-width: 460px;
  line-height: 1.7;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.text-button {
  color: var(--gold);
  background: transparent;
  border-color: transparent;
  padding: 5px 0;
  font-size: 0.85rem;
  text-align: left;
}
.text-button:hover {
  background: transparent;
  border-color: transparent;
  color: #ffdfa9;
}
.welcome-ranking {
  padding-left: 32px;
  border-left: 1px solid var(--line);
}
.footer {
  padding-block: 25px 30px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: #789099;
  font-size: 0.75rem;
}
.footer span span {
  padding-inline: 8px;
}
@media (max-width: 760px) {
  .wrap {
    width: calc(100% - 32px);
  }
  .topbar {
    min-height: 70px;
    gap: 14px;
    flex-wrap: wrap;
    padding-block: 12px;
  }
  .edition {
    padding-left: 14px;
    font-size: 0.62rem;
  }
  nav {
    gap: 0;
  }
  nav button {
    padding: 7px 9px;
    font-size: 0.8rem;
  }
  .welcome {
    min-height: 680px;
  }
  .welcome-copy {
    padding: 38px 25px 75px;
    max-width: 540px;
  }
  .welcome-art {
    background-position: center;
    background-image:
      linear-gradient(90deg, #0e1b24ef, #0e1b2466), url("kingdom.webp");
  }
  .welcome-bottom {
    gap: 25px;
    grid-template-columns: 1fr;
    padding: 28px 4px;
  }
  .welcome-ranking {
    padding: 22px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .footer {
    flex-direction: column;
    gap: 4px;
  }
  .intro {
    margin-top: 24px;
  }
  .hero-caption {
    right: 20px;
    left: 20px;
  }
  .hero-caption span:last-child {
    display: none;
  }
}
@media (max-width: 480px) {
  .topbar nav {
    width: 100%;
    justify-content: space-between;
    margin: 0;
  }
  .topbar {
    gap: 7px;
  }
  .edition {
    margin-left: auto;
  }
  .welcome-copy {
    padding: 31px 22px 73px;
  }
  .eyebrow {
    font-size: 0.62rem;
    line-height: 1.7;
  }
  h1 {
    font-size: 2.5rem;
  }
  h1 span {
    font-size: 1.05rem;
  }
  .intro {
    font-size: 1.2rem;
  }
  .launch-row {
    flex-direction: column;
  }
  .launch-row input {
    width: 100%;
    font-size: 1rem;
  }
  .launch-row button {
    min-height: 50px;
  }
  .starting-resources {
    gap: 15px;
    font-size: 0.75rem;
  }
  .welcome {
    min-height: 690px;
  }
  .section-heading {
    align-items: flex-start;
  }
  .welcome-bottom h2 {
    font-size: 1.25rem;
  }
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.reign-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 25px;
}
.reign-heading h1 {
  font:
    400 2.2rem/1.2 Georgia,
    serif;
  letter-spacing: -0.02em;
  margin: 7px 0 0;
}
.year-track {
  display: flex;
  gap: 7px;
}
.year-track span {
  width: 27px;
  height: 27px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 0.7rem;
  color: #778d96;
}
.year-track .complete {
  background: var(--gold);
  color: #15232d;
  border-color: var(--gold);
}
.year-track .current {
  border-color: var(--gold);
  color: var(--gold);
}
.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  align-items: start;
  gap: 24px;
  padding-bottom: 32px;
}
.kingdom-column {
  min-width: 0;
}
.kingdom-view {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  height: 415px;
  isolation: isolate;
}
.kingdom-view > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 65% center;
  z-index: -2;
}
.kingdom-view::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #0a151df5, transparent 62%);
  z-index: -1;
}
.kingdom-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px;
}
.kingdom-caption .eyebrow {
  text-shadow: 0 1px 5px #000;
}
.health {
  padding: 6px 10px;
  border-radius: 5px;
  background: #0b1b23e8;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid #ffffff25;
}
.good {
  color: var(--good);
}
.warning {
  color: var(--gold);
}
.danger {
  color: var(--bad);
}
.resources {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 30px 25px 27px;
  gap: 17px;
}
.resources > div + div {
  border-left: 1px solid #ffffff22;
  padding-left: 24px;
}
.resources span {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  color: #c9d2d0;
  white-space: nowrap;
}
.resources span small {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0;
  color: #9eafb3;
}
.resources strong {
  font:
    400 clamp(1.8rem, 3.3vw, 3rem) / 1.3 Georgia,
    serif;
  display: block;
  margin-block: 6px;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.resources > div > small {
  font-size: 0.73rem;
  color: var(--muted);
  display: block;
}
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.chronicle {
  padding: 27px;
  margin-top: 22px;
}
.chronicle h2 {
  font:
    400 1.45rem/1.4 Georgia,
    serif;
  margin-top: 7px;
}
.subtle {
  color: var(--muted);
  font-size: 0.85rem;
}
.advisor {
  font-size: 0.95rem;
  line-height: 1.75;
  color: #d0d9d9;
  margin-top: 20px;
}
.advisor + .subtle {
  margin-top: 12px;
  line-height: 1.7;
}
.reign-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  justify-content: space-between;
  padding: 15px 5px 0;
}
.council {
  overflow: hidden;
  padding: 25px;
}
.council h2 {
  font:
    400 1.6rem Georgia,
    serif;
  margin-top: 5px;
}
.council-heading {
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}
.seal {
  display: grid;
  place-items: center;
  border: 1px solid #e5b76a55;
  color: var(--gold);
  font:
    1.5rem Georgia,
    serif;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}
fieldset {
  margin: 0;
  padding: 19px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
legend {
  float: left;
  width: 100%;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 13px;
  padding: 0;
}
legend span {
  color: var(--gold);
  font-size: 0.7rem;
  padding-right: 9px;
  font-weight: 400;
}
.market-line,
.field-heading {
  clear: both;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  font-size: 0.8rem;
  margin-bottom: 9px;
  color: var(--muted);
}
.market-line strong {
  font-weight: 400;
  color: var(--gold);
}
.trade-controls {
  display: flex;
  gap: 8px;
}
.trade-controls select {
  max-width: 42%;
  padding: 8px;
  min-height: 46px;
  font-size: 0.9rem;
}
.number-control {
  display: flex;
  min-width: 0;
  flex: 1;
  background: #0d1b24;
  border: 1px solid #40515b;
  border-radius: 7px;
  overflow: hidden;
}
.number-control input {
  border: 0;
  border-radius: 0;
  width: 100%;
  padding: 5px;
  text-align: center;
  background: transparent;
  font-size: 1.05rem;
  min-height: 44px;
  appearance: textfield;
  -moz-appearance: textfield;
}
.number-control input::-webkit-inner-spin-button,
.number-control input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.number-control button {
  min-width: 42px;
  padding: 6px;
  border: 0;
  border-radius: 0;
  background: #1a2e39;
  font-size: 1.2rem;
  color: var(--muted);
}
.number-control:focus-within {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.number-control input:focus-visible {
  outline: 0;
}
.field-note {
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted);
  margin-top: 8px;
}
.field-heading .text-button {
  min-height: 0;
  padding: 0;
  font-size: 0.8rem;
}
.rations {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}
.rations button {
  flex: 1;
  padding: 5px 6px;
  font-size: 0.9rem;
  min-height: 44px;
  background: #172934;
}
.rations span {
  font-size: 0.65rem;
  display: block;
  color: var(--muted);
}
.rations button[aria-pressed="true"] {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
}
.budget {
  margin-top: 19px;
  padding: 14px;
  background: #0c1b24;
  border-radius: 8px;
}
.budget > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 7px;
}
.budget strong {
  color: var(--ink);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.budget .budget-total {
  border-top: 1px solid var(--line);
  padding-top: 9px;
  margin-top: 9px;
  color: var(--ink);
  font-size: 0.9rem;
}
.budget-total strong {
  color: var(--gold);
}
.budget p {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 8px;
}
.risk-warning {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--gold);
}
.risk-warning:not(:empty) {
  margin-top: 12px;
  padding-left: 10px;
  border-left: 2px solid var(--gold);
}
.end-year {
  width: 100%;
  margin-top: 17px;
  min-height: 50px;
  font-size: 0.9rem;
}
.commit-note {
  text-align: center;
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 9px;
}
.event {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.event:last-child {
  border: 0;
}
.event h3 {
  font-size: 0.9rem;
  margin-bottom: 3px;
}
.event p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}
.harvest-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 20px 0 7px;
}
.harvest-summary > div {
  padding: 13px;
  background: #0c1b2488;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.harvest-summary span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}
.harvest-summary strong {
  display: block;
  font-size: 1.1rem;
  margin-top: 4px;
  font-weight: 500;
}
.chronicle details {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 16px;
}
.chronicle summary {
  cursor: pointer;
  font-size: 0.85rem;
  min-height: 44px;
}
.chronicle summary span {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin: 4px 0 0 15px;
}
.history-row {
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.history-row h3 {
  font-size: 0.85rem;
  color: var(--gold);
}
.history-row p {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.7;
  margin-top: 4px;
}
dialog {
  max-width: 560px;
  width: calc(100% - 32px);
  max-height: calc(100dvh - 40px);
  color: var(--ink);
  border: 1px solid #52606a;
  border-radius: 16px;
  background: #10202b;
  padding: 0;
  box-shadow: 0 25px 100px #0009;
}
dialog::backdrop {
  background: #03090dd9;
  backdrop-filter: blur(5px);
}
.dialog-inner {
  padding: 30px;
}
dialog h2 {
  font:
    400 2rem/1.3 Georgia,
    serif;
  margin-top: 8px;
}
.close-button {
  font-size: 1.6rem;
  padding: 2px;
  min-width: 44px;
  align-self: flex-start;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
#report-subtitle {
  margin-top: 8px;
}
.report-numbers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 25px 0 7px;
}
.report-numbers > div {
  background: #1b303b;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  padding: 17px 7px;
}
.report-numbers strong {
  display: block;
  font:
    1.7rem Georgia,
    serif;
  margin-block: 7px;
}
.report-numbers span {
  font-size: 0.7rem;
  color: var(--muted);
  display: block;
}
.report-numbers small {
  font-size: 0.75rem;
}
.rank-tabs {
  display: flex;
  gap: 8px;
  margin: 24px 0 15px;
}
.rank-tabs button {
  flex: 1;
  font-size: 0.85rem;
}
.rank-tabs [aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-soft);
}
.rank-list {
  list-style: none;
  padding: 0;
  margin: 17px 0;
}
.rank-list li {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 13px 0;
}
.rank-list .position {
  color: var(--gold);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.rank-list .rank-name {
  display: block;
  font-size: 0.95rem;
}
.rank-list small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}
.rank-list .rank-score {
  text-align: right;
  font-size: 1.05rem;
}
.rank-list .your-round {
  background: #e5b76a0b;
}
.empty-state {
  padding: 28px 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.8;
}
.help-intro {
  margin-top: 19px;
  line-height: 1.7;
  color: var(--muted);
  font-size: 0.95rem;
}
.rule {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.rule strong {
  font-weight: 500;
  color: var(--gold);
  font-size: 0.95rem;
}
.rule p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--muted);
  margin-top: 6px;
}
.music-settings {
  margin-top: 25px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.music-settings label {
  font-size: 0.9rem;
}
.music-settings input {
  width: 100%;
  accent-color: var(--gold);
  padding: 0;
  min-height: 44px;
}
.final-score {
  display: block;
  font:
    5rem/1 Georgia,
    serif;
  letter-spacing: -0.04em;
  color: var(--gold);
  margin: 30px 0 8px;
}
#finished-panel {
  padding-top: 27px;
}
#finished-panel h2 {
  font-size: 2rem;
  margin-top: 12px;
}
#finished-copy {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 15px;
  line-height: 1.7;
}
.final-stats {
  display: flex;
  justify-content: space-between;
  margin: 24px 0;
  padding-block: 20px;
  border-block: 1px solid var(--line);
}
.final-stats strong {
  display: block;
  font-size: 1.1rem;
  font-weight: 500;
}
.final-stats span {
  color: var(--muted);
  font-size: 0.75rem;
}
.result-links {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.result-links button {
  font-size: 0.8rem;
  flex: 1;
}
.result-links .text-button {
  flex-basis: 100%;
  text-align: center;
}
@media (hover: hover) and (pointer: fine) {
  .primary:hover {
    transform: translateY(-1px);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .welcome-copy {
    animation: reveal 0.65s ease both;
  }
  .kingdom-view > img {
    animation: kingdom-drift 32s ease-in-out infinite alternate;
  }
  .dialog-inner {
    animation: reveal 0.25s ease both;
  }
  .resources strong {
    transition: color 0.25s;
  }
  @keyframes reveal {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  @keyframes kingdom-drift {
    from {
      transform: scale(1);
    }
    to {
      transform: scale(1.055);
    }
  }
}
@media (max-width: 1100px) {
  .wrap {
    width: calc(100% - 40px);
  }
  .play-layout {
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 18px;
  }
  .council {
    padding: 21px;
  }
  .resources {
    padding-inline: 18px;
    gap: 12px;
  }
  .resources > div + div {
    padding-left: 16px;
  }
  .chronicle {
    padding: 23px;
  }
  .kingdom-view {
    height: 365px;
  }
  .resources > div > small {
    font-size: 0.67rem;
  }
  .welcome-copy {
    max-width: 615px;
  }
  .welcome-art {
    background-image:
      linear-gradient(90deg, #0e1b24f5 2%, #0e1b24aa 47%, #0e1b2400 90%),
      url("kingdom.webp");
  }
}
@media (max-width: 850px) {
  .play-layout {
    grid-template-columns: 1fr;
  }
  .kingdom-view {
    height: 330px;
  }
  .council {
    padding: 26px;
  }
  .kingdom-column {
    display: contents;
  }
  .kingdom-view {
    order: 0;
  }
  .council {
    order: 1;
  }
  .chronicle {
    order: 2;
    margin-top: 0;
  }
  .reign-bottom {
    order: 3;
  }
  .resources strong {
    font-size: 2.4rem;
  }
  .resources > div > small {
    font-size: 0.75rem;
  }
  .year-track {
    gap: 5px;
  }
  .year-track span {
    width: 23px;
    height: 23px;
  }
  .reign-heading h1 {
    font-size: 1.9rem;
  }
  .play-layout {
    gap: 18px;
  }
  .trade-controls select {
    min-width: 150px;
  }
  .welcome-copy {
    max-width: 590px;
  }
  .welcome-art {
    background-image:
      linear-gradient(90deg, #0e1b24f5, #0e1b2488), url("kingdom.webp");
  }
}
@media (max-width: 550px) {
  .wrap {
    width: calc(100% - 28px);
  }
  .reign-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 17px;
    padding: 13px 0 20px;
  }
  .reign-heading h1 {
    font-size: 1.9rem;
  }
  .year-track {
    width: 100%;
    justify-content: space-between;
  }
  .year-track span {
    width: 24px;
    height: 24px;
  }
  .kingdom-view {
    height: 300px;
  }
  .kingdom-caption {
    padding: 18px;
  }
  .resources {
    padding: 20px 15px;
    gap: 10px;
  }
  .resources > div + div {
    padding-left: 12px;
  }
  .resources strong {
    font-size: 2rem;
  }
  .resources span {
    font-size: 0.57rem;
    letter-spacing: 0.1em;
  }
  .resources span small {
    font-size: 0.62rem;
  }
  .resources > div > small {
    font-size: 0.65rem;
  }
  .council {
    padding: 22px;
  }
  .council h2 {
    font-size: 1.5rem;
  }
  .chronicle {
    padding: 22px;
  }
  .reign-bottom {
    gap: 5px;
    padding-top: 0;
  }
  .reign-bottom button {
    font-size: 0.7rem;
  }
  .trade-controls select {
    min-width: 0;
    max-width: 45%;
    font-size: 1rem;
  }
  .market-line {
    font-size: 0.75rem;
  }
  .field-heading {
    font-size: 0.85rem;
  }
  .field-note {
    font-size: 0.75rem;
  }
  .number-control input {
    font-size: 1rem;
  }
  .report-numbers {
    gap: 6px;
  }
  .report-numbers strong {
    font-size: 1.45rem;
  }
  .dialog-inner {
    padding: 23px;
  }
  .dialog-inner h2 {
    font-size: 1.7rem;
  }
  .report-numbers small {
    font-size: 0.65rem;
  }
  .hero-caption {
    left: 22px;
  }
  .resources > div > small {
    line-height: 1.5;
  }
  .intro {
    max-width: 300px;
  }
  .premise {
    font-size: 0.9rem;
  }
  .welcome {
    min-height: 710px;
  }
  .starting-resources {
    flex-wrap: wrap;
    gap: 10px 17px;
  }
  .seal {
    width: 40px;
    height: 40px;
  }
  .budget > div {
    font-size: 0.85rem;
  }
  .end-year {
    font-size: 0.85rem;
  }
  .year-track {
    gap: 3px;
  }
}
@media (max-width: 359px) {
  h1 {
    font-size: 2.12rem;
  }
  .welcome-copy {
    padding-inline: 18px;
  }
  .resources strong {
    font-size: 1.7rem;
  }
  .council {
    padding: 18px;
  }
  .market-line {
    flex-wrap: wrap;
  }
  .number-control button {
    min-width: 38px;
  }
  .reign-bottom {
    justify-content: flex-start;
    gap: 15px;
  }
  .report-numbers strong {
    font-size: 1.2rem;
  }
}
/* The settlement is a playable 3D view; its resources stay in normal flow. */
.kingdom-view.living-kingdom {
  height: auto;
  background: #10232e;
}
.living-kingdom::after {
  display: none;
}
.world-shell {
  position: relative;
  height: 440px;
  overflow: hidden;
  background: #183847;
  isolation: isolate;
}
.world-shell canvas,
.world-fallback {
  display: block;
  width: 100%;
  height: 100%;
}
.world-shell canvas {
  touch-action: pan-y;
  cursor: grab;
  outline-offset: -4px;
}
.world-shell canvas:active {
  cursor: grabbing;
}
.world-shell canvas[hidden] {
  display: none;
}
.world-fallback {
  position: absolute;
  inset: 0;
  object-fit: cover;
  object-position: 65% center;
  z-index: -1;
}
.world-ready .world-fallback {
  visibility: hidden;
}
.world-heading {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px;
  pointer-events: none;
  background: linear-gradient(#0b202dba, transparent);
}
.world-heading .eyebrow {
  color: #f2deb4;
  margin-bottom: 6px;
}
#world-status {
  color: #d5e0e2;
  font-size: 0.72rem;
  line-height: 1.5;
  text-shadow: 0 1px 5px #0b202d;
}
#motion-toggle,
.world-controls button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border: 1px solid #b3d6dc45;
  background: #102a36e8;
  color: #f6ebd3;
  border-radius: 9px;
  font:
    1.4rem/1 system-ui,
    sans-serif;
  pointer-events: auto;
}
#motion-toggle {
  font-size: 1rem;
}
.world-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid #b3d6dc26;
  border-radius: 14px;
  background: #10253288;
}
.world-controls button:hover,
#motion-toggle:hover {
  background: #254c5c;
  border-color: var(--gold);
}
.living-kingdom .kingdom-caption {
  padding: 14px 22px 0;
}
#world-instructions {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
}
.living-kingdom .resources {
  position: static;
  padding-top: 18px;
}
#replay-year {
  width: 100%;
  margin: 8px 0 16px;
  min-height: 44px;
}
#replay-year:disabled {
  opacity: 0.5;
  cursor: default;
}
.cinema-dialog {
  max-width: 1080px;
  width: calc(100% - 36px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border-color: #6d8a8c;
}
.cinema-dialog::backdrop {
  background: #020b11ed;
}
.cinema-header {
  padding: 17px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cinema-header .eyebrow {
  font-size: 0.6rem;
}
.cinema-header h2 {
  margin-top: 3px;
  font-size: 1.7rem;
}
#skip-year {
  min-height: 44px;
  flex-shrink: 0;
  padding: 9px 14px;
  font-size: 0.78rem;
}
#cinema-stage .world-shell {
  height: clamp(200px, calc(100dvh - 310px), 600px);
}
.cinematic .world-heading,
.cinematic .world-controls {
  display: none;
}
.cinematic canvas {
  cursor: default;
}
.cinema-ledger {
  display: flex;
  justify-content: center;
  gap: clamp(28px, 7vw, 90px);
  padding: 14px 20px 0;
  border-top: 1px solid var(--line);
}
.cinema-ledger > div {
  display: grid;
  gap: 3px;
  text-align: center;
}
.cinema-ledger span {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.cinema-ledger strong {
  font:
    1.7rem/1.2 Georgia,
    serif;
  font-variant-numeric: tabular-nums;
  color: #f7e6c5;
}
.cinema-caption {
  text-align: center;
  padding: 15px 24px 20px;
  min-height: 96px;
}
.cinema-caption h3 {
  font:
    1.4rem/1.3 Georgia,
    serif;
  color: var(--gold);
  margin: 0 0 6px;
}
.cinema-caption p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0;
}
.cinema-caption[data-kind="arrivals"] h3 {
  color: var(--good);
}
.cinema-caption[data-kind="starvation"] h3,
.cinema-caption[data-kind="plague"] h3 {
  color: #e4b5b0;
}
.cinema-progress {
  height: 3px;
  background: #2c4651;
}
#cinema-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold);
}
@media (max-width: 1100px) and (min-width: 851px) {
  .world-shell {
    height: 390px;
  }
}
@media (max-width: 550px) {
  .world-shell {
    height: 330px;
  }
  .world-heading {
    padding: 16px;
  }
  .world-heading .eyebrow {
    font-size: 0.6rem;
  }
  #world-status {
    font-size: 0.63rem;
  }
  .living-kingdom .kingdom-caption {
    padding: 12px 15px 0;
    align-items: flex-start;
  }
  #world-instructions {
    max-width: 175px;
    font-size: 0.64rem;
  }
  .living-kingdom .resources {
    padding-top: 16px;
  }
  .health {
    white-space: nowrap;
    font-size: 0.7rem;
  }
  .cinema-dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 12px;
  }
  .cinema-header {
    padding: 13px 15px;
  }
  .cinema-header h2 {
    font-size: 1.24rem;
  }
  .cinema-header .eyebrow {
    font-size: 0.48rem;
  }
  #skip-year {
    padding: 8px 10px;
    font-size: 0.65rem;
  }
  #cinema-stage .world-shell {
    height: clamp(200px, calc(100dvh - 285px), 480px);
  }
  .cinema-ledger strong {
    font-size: 1.4rem;
  }
  .cinema-caption {
    padding: 13px 15px 18px;
    min-height: 100px;
  }
  .cinema-caption h3 {
    font-size: 1.2rem;
  }
  .cinema-caption p {
    font-size: 0.74rem;
  }
}
@media (max-height: 550px) and (min-width: 551px) {
  .cinema-header {
    padding: 9px 20px;
  }
  .cinema-header h2 {
    font-size: 1.25rem;
  }
  #cinema-stage .world-shell {
    height: max(160px, calc(100dvh - 222px));
  }
  .cinema-ledger {
    padding-top: 8px;
  }
  .cinema-ledger strong {
    font-size: 1.2rem;
  }
  .cinema-caption {
    padding: 8px 16px 12px;
    min-height: 60px;
  }
  .cinema-caption h3 {
    font-size: 1.1rem;
    margin-bottom: 3px;
  }
  .cinema-caption p {
    font-size: 0.7rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
