:root {
  color-scheme: light;
  --ink: #121722;
  --muted: #657184;
  --paper: #eee8dc;
  --surface: #fffdf7;
  --line: #d9cebd;
  --navy: #101827;
  --navy-2: #1a2639;
  --green: #2f7a57;
  --gold: #f0b13e;
  --blue: #257da8;
  --red: #b5483e;
  --cream: #fbf6eb;
  --shadow: 0 18px 44px rgba(18, 23, 34, 0.18);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at 12% 0%, rgba(240, 177, 62, 0.34), transparent 24rem),
    linear-gradient(135deg, #172033 0 28%, #f4efe4 28% 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
[role="tab"]:focus-visible {
  outline: 3px solid rgba(37, 125, 168, 0.35);
  outline-offset: 2px;
}

.app-shell {
  width: min(1640px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 0 28px;
}

.topbar,
.game-layout,
.command-center,
.lower-grid {
  margin-bottom: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(16, 24, 39, 0.95);
  box-shadow: 0 18px 50px rgba(7, 11, 18, 0.28);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--gold), #d96e35);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.16), 0 8px 20px rgba(0, 0, 0, 0.18);
}

.topbar h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.65rem, 1.2rem + 1.2vw, 2.35rem);
  line-height: 1;
  letter-spacing: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.98rem;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.topbar-link {
  position: relative;
  flex: 0 1 270px;
  min-height: 44px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 16px;
  border: 1px solid #fff0b7;
  border-radius: 7px;
  background: linear-gradient(180deg, #ffe28a 0%, #d5a23e 100%);
  color: #1e1914;
  font-size: 0.92rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62), inset 0 -3px 0 rgba(81, 52, 10, 0.18), 0 10px 22px rgba(0, 0, 0, 0.24);
  transform: translateY(0);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.topbar-link::before {
  position: absolute;
  inset: -4px;
  z-index: -1;
  border-radius: 10px;
  background: rgba(216, 183, 106, 0.22);
  content: "";
}

.topbar-link-kicker {
  color: #5f3712;
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.topbar-link strong {
  line-height: 1.05;
}

.topbar-link:hover,
.topbar-link:focus-visible {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -3px 0 rgba(81, 52, 10, 0.16), 0 13px 28px rgba(0, 0, 0, 0.3);
  filter: saturate(1.08);
  transform: translateY(-1px);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.icon-button,
.secondary-action,
.primary-action,
.tab,
.decision-button,
.social-button {
  border-radius: var(--radius);
  min-height: 42px;
  font-weight: 800;
  transition: transform 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

.icon-button {
  width: 42px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.icon-button.danger {
  background: var(--red);
}

.primary-action {
  padding: 0 18px;
  background: linear-gradient(180deg, #3c956b, var(--green));
  color: #fff;
  box-shadow: 0 8px 18px rgba(47, 122, 87, 0.25);
}

.sim-controls {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.speed-row {
  display: flex;
  gap: 6px;
}

.speed-button {
  min-width: 42px;
  min-height: 30px;
  border-radius: 6px;
  color: var(--ink);
  background: #e7dece;
  font-weight: 900;
}

.speed-button.active {
  color: #111827;
  background: var(--gold);
}

.secondary-action {
  padding: 0 14px;
  color: var(--ink);
  background: #e7dece;
}

.tab {
  position: relative;
  padding: 0 14px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tab.active {
  color: #111827;
  background: var(--gold);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 14px;
}

.scene-panel,
.dashboard,
.command-center,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.96);
  box-shadow: var(--shadow);
}

.scene-panel {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  padding: 10px;
  border: 0;
  background: #101724;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  background: #9fc4d1;
  image-rendering: auto;
}

.ticker {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 20px;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(15, 23, 39, 0.92);
  color: #fff;
  font-size: 0.94rem;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: linear-gradient(180deg, #fffdf7, #f2ece1);
}

.demand-box,
.management-box {
  padding: 12px;
  border: 1px solid #ded2bf;
  border-radius: var(--radius);
  background: #fffaf0;
}

.panel-head.compact {
  margin-bottom: 8px;
}

.bar-stack {
  display: grid;
  gap: 9px;
}

.bar-row {
  display: grid;
  grid-template-columns: 70px 1fr 58px;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 900;
}

.bar-track {
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(16, 24, 39, 0.1);
}

.bar-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 220ms ease;
}

#capacityBar {
  background: var(--green);
}

#kitInventoryBar {
  background: #c49536;
}

.badge.good {
  background: #dceee3;
  color: #1f6848;
}

.badge.danger {
  background: #f7d8d3;
  color: #9c3028;
}

.manager-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.panel-button {
  position: relative;
  min-height: 38px;
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  font-weight: 900;
}

.panel-button.has-alert::after,
.tab.has-alert::after {
  content: "";
  position: absolute;
  top: -5px;
  right: -5px;
  width: 13px;
  height: 13px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #d83b31;
  box-shadow: 0 0 0 2px rgba(216, 59, 49, 0.22), 0 5px 10px rgba(5, 8, 14, 0.26);
}

.panel-button.active {
  background: var(--gold);
  color: #111827;
}

.month-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#dateLabel {
  display: block;
  font-size: 1.3rem;
}

.day-label {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.stat-tile {
  min-height: 90px;
  padding: 10px;
  border: 1px solid #ded2bf;
  border-radius: var(--radius);
  background: #fffaf0;
}

.stat-tile small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.stat-tile strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(1.1rem, 0.9rem + 0.4vw, 1.45rem);
  line-height: 1.05;
}

.stat-tile span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.goal-box {
  padding: 12px;
  border: 1px solid #c7decf;
  border-radius: var(--radius);
  background: #edf5f0;
}

.goal-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.goal-progress {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(47, 122, 87, 0.18);
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 220ms ease;
}

.check-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.check-list .done {
  color: var(--green);
  font-weight: 900;
}

.command-center {
  padding: 14px;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 39, 0.95);
}

.research-bank {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.research-bank span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-weight: 900;
  font-size: 0.8rem;
}

.tech-tree {
  overflow: auto;
  padding-bottom: 8px;
}

.tech-columns {
  display: grid;
  grid-template-columns: repeat(6, minmax(260px, 1fr));
  gap: 12px;
  min-width: 1680px;
  align-items: start;
}

.tech-era-column {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 100%;
  padding: 10px;
  border: 1px solid #ded2bf;
  border-radius: var(--radius);
  background: rgba(234, 223, 201, 0.42);
}

.tech-era-column h4 {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0;
  min-height: 36px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  font-size: 0.9rem;
}

.tech-era-nodes {
  display: grid;
  gap: 10px;
}

.tech-node {
  display: flex;
  flex-direction: column;
  min-height: 235px;
  padding: 12px;
  border: 1px solid #ded2bf;
  border-radius: var(--radius);
  background: #fffaf0;
  box-shadow: 0 8px 20px rgba(18, 23, 34, 0.12);
}

.tech-node.ready {
  border-color: rgba(47, 122, 87, 0.48);
  box-shadow: inset 0 0 0 2px rgba(47, 122, 87, 0.12);
}

.tech-node.unlocked {
  background: #edf5f0;
  border-color: #c7decf;
}

.tech-node.locked {
  opacity: 0.82;
}

.tech-node .lane {
  width: fit-content;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eadfc9;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
}

.tech-node h3 {
  margin: 8px 0 0;
  font-size: 0.98rem;
}

.tech-node p {
  flex: 1;
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.32;
}

.tech-node button {
  width: 100%;
  min-height: 40px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #213247, #111827);
  color: #fff;
  font-weight: 900;
}

.tech-node .action-meta {
  margin-bottom: 8px;
}

.tech-node .pill {
  min-height: 22px;
  font-size: 0.69rem;
}

.tech-node button {
  min-height: 38px;
  font-size: 0.78rem;
}

.tech-node.unlocked button {
  background: var(--green);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.action-card {
  display: flex;
  flex-direction: column;
  min-height: 178px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fffdf7, #efe8dc);
  box-shadow: 0 10px 26px rgba(5, 8, 14, 0.16);
}

.action-card h3 {
  margin: 0;
  font-size: 1.02rem;
}

.action-card p {
  flex: 1;
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #172033;
  background: #eadfc9;
  font-size: 0.75rem;
  font-weight: 900;
}

.action-card button {
  width: 100%;
  min-height: 40px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #213247, #111827);
  color: #fff;
  font-weight: 900;
}

.lower-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1.25fr;
  gap: 14px;
}

.panel {
  min-height: 230px;
  padding: 14px;
  background: linear-gradient(180deg, #fffdf7, #f2ede3);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel h2 {
  margin: 0;
  font-size: 1.1rem;
}

.advantage-list {
  display: grid;
  gap: 10px;
}

.advantage-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: start;
}

.advantage-item.locked {
  opacity: 0.48;
}

.advantage-item.active .advantage-icon {
  background: #dceee3;
  color: var(--green);
}

.advantage-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: #e9f0f3;
  color: var(--blue);
  font-weight: 900;
}

.advantage-item strong,
.advantage-item span {
  display: block;
}

.advantage-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.small-copy {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.finance-window {
  padding: 8px;
  border: 2px solid #4f4a42;
  border-radius: 8px;
  background: #8d8275;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 14px 28px rgba(22, 18, 14, 0.18);
}

.finance-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 7px;
}

.finance-tab {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 32px;
  border: 1px solid #5b554c;
  border-radius: 6px 6px 0 0;
  background: #c7b9a5;
  color: #251f19;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.finance-tab.active {
  background: #eee0c5;
}

.balance-sheet {
  overflow: hidden;
  border: 1px solid #4c463e;
  border-radius: 4px;
  background: #302b26;
}

.balance-sheet table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.82rem;
  line-height: 1.1;
}

.balance-sheet th,
.balance-sheet td {
  padding: 7px 9px;
  border-right: 1px solid #62584d;
  border-bottom: 1px solid #62584d;
  text-align: right;
  white-space: nowrap;
}

.balance-sheet thead th {
  background: #3c352e;
  color: #eee5d6;
  font-weight: 900;
}

.balance-sheet th:first-child {
  width: 34%;
  text-align: left;
}

.balance-sheet tbody th {
  background: #9c9082;
  color: #201b16;
  font-weight: 800;
  white-space: normal;
}

.balance-sheet tbody td {
  background: #2d2824;
  color: #e8dfd2;
}

.balance-sheet td.positive {
  color: #dff7cf;
}

.balance-sheet td.negative {
  color: #f4d0c8;
}

.balance-sheet td.zero {
  color: #998f83;
}

.balance-sheet tfoot th,
.balance-sheet tfoot td {
  border-bottom: 0;
  background: #776b5f;
  color: #fff2db;
  font-weight: 900;
}

.finance-footer {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 10px;
  margin-top: 8px;
  padding: 9px;
  border: 1px solid #5f584f;
  border-radius: 4px;
  background: #b1a392;
}

.loan-panel {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.loan-row {
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) 110px auto;
  gap: 8px;
  align-items: center;
}

.loan-control {
  color: #2b251e;
  font-weight: 900;
  font-size: 0.8rem;
}

.loan-panel input[type="range"] {
  width: 100%;
}

.loan-panel input[type="number"] {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid #6f6558;
  border-radius: 4px;
  background: #f5ead8;
  color: #241f19;
  font-weight: 900;
}

.finance-summary {
  margin: 0;
  color: #312a22;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.balance-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  align-content: start;
}

.balance-totals div {
  display: grid;
  gap: 2px;
  padding: 7px;
  border: 1px solid #6c6257;
  border-radius: 4px;
  background: #e3d5bf;
}

.balance-totals span {
  color: #625548;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.balance-totals strong {
  color: #1e1914;
  font-size: 1rem;
}

.balance-totals button {
  grid-column: 1 / -1;
}

.social-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.social-button {
  min-width: 0;
  padding: 0 8px;
  background: #e7dece;
  color: var(--ink);
  font-size: 0.86rem;
}

.social-button.active {
  background: var(--blue);
  color: #fff;
}

.status-line {
  min-height: 24px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.event-log {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 220px;
  margin: 0;
  padding: 0 4px 0 22px;
  overflow: auto;
}

.event-log li {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.event-log strong {
  color: var(--ink);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 51, 0.62);
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: min(680px, 100%);
  padding: 20px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.panel-modal-card {
  width: min(1320px, 96vw);
  max-height: min(86vh, 900px);
  overflow: auto;
}

.panel-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-modal-head h2 {
  margin: 9px 0 6px;
}

.panel-modal-head p {
  margin: 0;
  max-width: 820px;
}

.panel-view {
  display: none;
}

.panel-view.active {
  display: block;
}

.panel-view h3 {
  margin: 0;
}

.modal-stage {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: center;
}

#decisionSprite {
  width: 180px;
  height: 160px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #e9eef4;
}

.modal-backdrop[data-tone="positive"] .modal-card {
  box-shadow: 0 24px 80px rgba(47, 122, 87, 0.35);
}

.modal-backdrop[data-tone="negative"] .modal-card {
  box-shadow: 0 24px 80px rgba(181, 72, 62, 0.35);
}

.modal-card h2 {
  margin: 12px 0 8px;
}

.modal-card p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.45;
}

.decision-options {
  display: grid;
  gap: 8px;
}

.decision-button {
  display: grid;
  gap: 4px;
  min-height: 54px;
  padding: 10px 12px;
  text-align: left;
  color: #fff;
  background: var(--navy-2);
}

.decision-button.external-link {
  background: #2f7a57;
}

.decision-button small {
  color: rgba(255, 255, 255, 0.78);
}

@media (max-width: 1180px) {
  .game-layout,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .action-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 18px, 1500px);
    padding-top: 10px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar,
  .brand-lockup,
  .month-card {
    flex-direction: column;
  }

  .topbar-link,
  .topbar-actions {
    width: 100%;
  }

  .icon-button {
    flex: 1;
  }

  .scene-panel {
    min-height: unset;
    padding: 6px;
  }

  .ticker {
    position: static;
    border-radius: 0 0 6px 6px;
  }

  .dashboard,
  .command-center,
  .panel {
    padding: 10px;
  }

  .stats-grid,
  .action-grid,
  .finance-footer,
  .social-row {
    grid-template-columns: 1fr;
  }

  .loan-row,
  .balance-totals {
    grid-template-columns: 1fr;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .modal-stage {
    grid-template-columns: 1fr;
  }

  #decisionSprite {
    width: 100%;
  }
}

/* Single-screen game surface overrides */
html,
body {
  height: 100%;
  overflow: hidden;
}

.app-shell {
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr) 18px;
  gap: 8px;
  height: 100vh;
  min-height: 0;
  padding: 8px 0;
}

.topbar,
.game-layout,
.command-center,
.lower-grid {
  margin-bottom: 0;
}

.topbar {
  min-height: 0;
  padding: 8px 10px;
}

.topbar-link {
  flex-basis: 230px;
  min-height: 40px;
  padding: 5px 12px;
  font-size: 0.78rem;
}

.topbar-link-kicker {
  font-size: 0.54rem;
}

.brand-mark {
  width: 38px;
  height: 38px;
}

.topbar h1 {
  font-size: 1.35rem;
}

.topbar p {
  margin-top: 3px;
  font-size: 0.8rem;
}

.icon-button {
  width: 38px;
  min-height: 38px;
}

.game-layout {
  grid-template-columns: minmax(0, 1fr) clamp(280px, 24vw, 330px);
  gap: 8px;
  height: 100%;
  min-height: 0;
}

.scene-panel {
  display: grid;
  grid-template-rows: auto auto 32px;
  align-content: start;
  gap: 8px;
  height: 100%;
  min-height: 0;
  padding: 8px;
}

canvas {
  width: 100%;
  height: auto;
  max-height: calc(100vh - 342px);
  align-self: start;
}

.scene-management {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: min(520px, calc(100% - 24px));
}

.scene-management .panel-button {
  min-height: 34px;
  padding: 0 10px;
  box-shadow: 0 8px 18px rgba(5, 8, 14, 0.22);
}

.command-center {
  position: static;
  z-index: 3;
  max-height: none;
  overflow: hidden;
  padding: 8px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(15, 23, 39, 0.94);
}

.tabs {
  gap: 6px;
  margin-bottom: 8px;
}

.tab {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.action-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.action-card {
  min-height: 132px;
  padding: 9px;
}

.action-card h3 {
  font-size: 0.88rem;
}

.action-card p {
  display: -webkit-box;
  min-height: 34px;
  margin: 5px 0 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.action-meta {
  gap: 4px;
  margin-bottom: 8px;
}

.action-card .pill {
  min-height: 19px;
  font-size: 0.62rem;
}

.action-card button {
  min-height: 32px;
  font-size: 0.74rem;
}

.ticker {
  position: static;
  min-height: 32px;
  padding: 6px 9px;
  font-size: 0.76rem;
}

.dashboard {
  gap: 6px;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.month-card {
  gap: 8px;
  padding-bottom: 6px;
}

.primary-action {
  min-height: 34px;
  padding: 0 12px;
}

.sim-controls {
  gap: 5px;
}

.speed-button {
  min-width: 34px;
  min-height: 24px;
  font-size: 0.72rem;
}

#dateLabel {
  font-size: 0.96rem;
}

.day-label {
  font-size: 0.72rem;
}

.stats-grid {
  gap: 5px;
}

.stat-tile {
  min-height: 55px;
  padding: 6px;
}

.stat-tile small {
  font-size: 0.65rem;
}

.stat-tile strong {
  margin-top: 2px;
  font-size: 0.95rem;
}

.stat-tile span {
  margin-top: 1px;
  font-size: 0.62rem;
}

.demand-box,
.goal-box {
  padding: 7px;
}

.panel-head.compact {
  margin-bottom: 5px;
}

.bar-stack {
  gap: 5px;
}

.bar-row {
  grid-template-columns: 54px 1fr 48px;
  gap: 5px;
  font-size: 0.68rem;
}

.bar-track {
  height: 9px;
}

.status-line {
  min-height: 0;
  margin-top: 6px;
  font-size: 0.68rem;
  line-height: 1.25;
}

.goal-progress {
  grid-template-columns: 34px 1fr;
  gap: 6px;
  margin: 5px 0;
  font-size: 0.72rem;
}

.meter {
  height: 7px;
}

.check-list {
  gap: 2px;
}

.check-list li {
  grid-template-columns: 20px 1fr;
  gap: 5px;
  font-size: 0.62rem;
  line-height: 1.15;
}

.management-box {
  display: none;
}

@media (max-width: 980px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 260px;
  }

  .action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
