:root {
  color-scheme: dark;
  --bg: #071014;
  --panel: #101b21;
  --panel-2: #14242b;
  --line: rgba(156, 189, 197, 0.18);
  --text: #eff8f7;
  --muted: #8fa7a8;
  --blue: #3ba7ff;
  --green: #25c48f;
  --gold: #f4b84a;
  --red: #f05f57;
  --coal: #f17845;
  --wind: #22c4aa;
  --solar: #f6c84b;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  min-height: 100vh;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    radial-gradient(circle at 12% 8%, rgba(59, 167, 255, 0.16), transparent 28%),
    linear-gradient(145deg, #071014 0%, #0a1719 46%, #071014 100%);
  background-size: 32px 32px, 32px 32px, auto, auto;
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 82px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 27, 33, 0.84);
  box-shadow: var(--shadow);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(59, 167, 255, 0.42);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(59, 167, 255, 0.22), rgba(37, 196, 143, 0.14));
}

.brand-mark span {
  width: 23px;
  height: 31px;
  clip-path: polygon(48% 0, 88% 0, 61% 41%, 100% 41%, 35% 100%, 49% 55%, 15% 55%);
  background: linear-gradient(180deg, #f6d36a, #24c5aa);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

.year-strip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.year-strip > div {
  min-width: 128px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.year-strip strong {
  font-size: 16px;
}

.primary-action,
.secondary-action,
.guide-action {
  height: 56px;
  padding: 0 22px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-action {
  border: 0;
  color: #061014;
  background: linear-gradient(135deg, #f4c35c, #28d4a1);
}

.secondary-action {
  border: 1px solid rgba(244, 184, 74, 0.38);
  color: var(--gold);
  background: rgba(244, 184, 74, 0.08);
}

.secondary-action:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.guide-action {
  border: 1px solid rgba(59, 167, 255, 0.45);
  color: #ccecff;
  background: rgba(59, 167, 255, 0.1);
}

.guide-action:hover,
.secondary-action:hover:not(:disabled) {
  background: rgba(59, 167, 255, 0.16);
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.rule-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 13px 16px;
  border: 1px solid rgba(37, 196, 143, 0.36);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(37, 196, 143, 0.12), rgba(59, 167, 255, 0.08));
  box-shadow: var(--shadow);
}

.rule-banner strong {
  flex: 0 0 auto;
  color: var(--green);
}

.rule-banner span {
  color: #d9e8e8;
  font-size: 14px;
  line-height: 1.45;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.metric-card,
.map-panel,
.side-panel > article,
.finance-panel,
.log-panel,
.rank-panel,
.asset-ledger-panel,
.review-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(20, 36, 43, 0.92), rgba(13, 24, 29, 0.95));
  box-shadow: var(--shadow);
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  padding: 18px;
}

.metric-card::after {
  position: absolute;
  right: 14px;
  bottom: -12px;
  width: 76px;
  height: 76px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.12;
  content: "";
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.metric-card.cash { color: var(--gold); }
.metric-card.profit { color: var(--green); }
.metric-card.debt { color: var(--red); }
.metric-card.capacity { color: var(--blue); }
.metric-card.score { color: #bfa0ff; }

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.map-panel {
  min-height: 560px;
  padding: 18px;
  background:
    radial-gradient(circle at 16% 20%, rgba(37, 196, 143, 0.12), transparent 26%),
    linear-gradient(180deg, rgba(20, 36, 43, 0.92), rgba(13, 24, 29, 0.95));
}

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

.panel-title.compact {
  margin-bottom: 14px;
}

.legend {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
}

.dot.coal { background: var(--coal); }
.dot.wind { background: var(--wind); }
.dot.solar { background: var(--solar); }

.land-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(158px, auto);
  gap: 12px;
  padding: 8px;
  border: 1px solid rgba(59, 167, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(30deg, rgba(255, 255, 255, 0.025) 12%, transparent 12.5%, transparent 87%, rgba(255, 255, 255, 0.025) 87.5%),
    rgba(0, 0, 0, 0.12);
}

.land-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(143, 167, 168, 0.22);
  border-radius: 8px;
  color: var(--text);
  text-align: left;
  background:
    radial-gradient(circle at 86% 16%, rgba(244, 184, 74, 0.13), transparent 18%),
    linear-gradient(135deg, rgba(59, 167, 255, 0.08), transparent 56%),
    rgba(255, 255, 255, 0.035);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.land-card::before {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 38%);
  content: "";
}

.land-card::after {
  position: absolute;
  right: -20px;
  bottom: -22px;
  width: 88px;
  height: 88px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transform: rotate(30deg);
  content: "";
}

.land-card > * {
  position: relative;
  z-index: 1;
}

.land-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 167, 255, 0.55);
  background:
    linear-gradient(135deg, rgba(59, 167, 255, 0.18), transparent 58%),
    rgba(255, 255, 255, 0.06);
}

.land-card.occupied {
  border-color: rgba(37, 196, 143, 0.5);
}

.land-id {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold);
  font-weight: 900;
}

.land-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
}

.land-card small {
  color: var(--blue);
  font-weight: 800;
}

.land-card p {
  min-height: 38px;
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.asset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 25px;
}

.asset-chips span,
.asset-chips em {
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.asset-chips em {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.055);
}

.asset-chips .coal { color: #2b1008; background: var(--coal); }
.asset-chips .wind { color: #06221f; background: var(--wind); }
.asset-chips .solar { color: #2b2105; background: var(--solar); }

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.event-card,
.action-card,
.rules-card {
  padding: 18px;
}

.event-card {
  min-height: 210px;
  border-color: rgba(244, 184, 74, 0.35);
  background:
    linear-gradient(145deg, rgba(244, 184, 74, 0.14), rgba(20, 36, 43, 0.94) 62%),
    var(--panel);
}

.event-card::before {
  display: block;
  width: 100%;
  height: 5px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), transparent);
  content: "";
}

.event-card h2 {
  margin-bottom: 12px;
  font-size: 24px;
}

.event-card p:not(.eyebrow) {
  color: #d8e7e3;
  line-height: 1.62;
}

.event-impact {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(244, 184, 74, 0.35);
  border-radius: 8px;
  color: var(--gold);
  background: rgba(244, 184, 74, 0.08);
  font-weight: 800;
}

.play-hint {
  margin-bottom: 14px;
  padding: 11px 12px;
  border: 1px solid rgba(59, 167, 255, 0.35);
  border-radius: 8px;
  background: rgba(59, 167, 255, 0.08);
}

.play-hint strong,
.play-hint span {
  display: block;
}

.play-hint strong {
  margin-bottom: 4px;
  color: var(--blue);
}

.play-hint span {
  color: #d7e8e8;
  font-size: 13px;
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #0b171c;
}

.field-hint {
  display: block;
  margin-top: 7px;
  color: #b9cbcb;
  font-size: 12px;
  line-height: 1.42;
}

.asset-actions,
.quick-actions {
  display: grid;
  gap: 10px;
}

.resource-controls {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.resource-controls label {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.resource-controls span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.resource-controls input {
  width: 100%;
  height: 38px;
  border: 1px solid rgba(59, 167, 255, 0.28);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: rgba(2, 8, 10, 0.48);
  font-weight: 800;
}

.resource-controls select {
  height: 38px;
  border-color: rgba(59, 167, 255, 0.28);
  background: rgba(2, 8, 10, 0.48);
}

.resource-controls small {
  color: #b9cbcb;
  font-size: 12px;
  line-height: 1.35;
}

.asset-btn,
.quick-actions button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.asset-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 13px;
  text-align: left;
}

.asset-btn span {
  font-weight: 900;
}

.asset-btn small {
  color: var(--muted);
  font-size: 12px;
}

.asset-btn.coal { border-color: rgba(241, 120, 69, 0.35); }
.asset-btn.wind { border-color: rgba(34, 196, 170, 0.35); }
.asset-btn.solar { border-color: rgba(246, 200, 75, 0.35); }

.asset-btn:hover,
.quick-actions button:hover {
  border-color: rgba(59, 167, 255, 0.6);
  background: rgba(59, 167, 255, 0.08);
}

.quick-actions {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
}

.quick-actions button {
  min-height: 44px;
  font-size: 13px;
  font-weight: 800;
}

.bottom-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.25fr 0.85fr;
  gap: 16px;
}

.finance-panel,
.log-panel,
.rank-panel,
.asset-ledger-panel,
.review-panel {
  min-height: 250px;
  padding: 18px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 16px;
}

.risk-stack {
  display: grid;
  gap: 10px;
}

.risk-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

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

.risk-item strong {
  margin-bottom: 5px;
}

.risk-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.risk-item.ok { border-color: rgba(37, 196, 143, 0.38); }
.risk-item.warn { border-color: rgba(244, 184, 74, 0.42); }
.risk-item.high { border-color: rgba(240, 95, 87, 0.48); }

.log-list {
  display: grid;
  gap: 8px;
  max-height: 174px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.log-list li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #d9e8e8;
  background: rgba(255, 255, 255, 0.035);
  font-size: 13px;
  line-height: 1.42;
}

.rank-list {
  display: grid;
  gap: 9px;
}

.rank-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.rank-row.active {
  border-color: rgba(244, 184, 74, 0.55);
  background: rgba(244, 184, 74, 0.09);
}

.rank-row span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: #081316;
  background: var(--gold);
  font-weight: 900;
}

.rank-row strong {
  font-size: 13px;
}

.rank-row em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

.asset-ledger,
.review-grid {
  display: grid;
  gap: 10px;
}

.ledger-row {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.ledger-row small {
  grid-column: 2 / 4;
  color: var(--muted);
  line-height: 1.42;
}

.ledger-row em {
  color: var(--blue);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.ledger-type {
  display: grid;
  place-items: center;
  min-height: 30px;
  border-radius: 8px;
  color: #071014;
  font-size: 12px;
  font-weight: 900;
}

.ledger-type.coal { background: var(--coal); }
.ledger-type.wind { background: var(--wind); }
.ledger-type.solar { background: var(--solar); }

.empty-state {
  padding: 18px;
  border: 1px dashed rgba(156, 189, 197, 0.28);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  line-height: 1.55;
}

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

.review-metrics div {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.review-metrics span,
.review-metrics strong {
  display: block;
}

.review-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.review-metrics strong {
  margin-top: 6px;
  font-size: 18px;
}

.review-metrics .positive strong {
  color: var(--green);
}

.review-metrics .negative strong {
  color: var(--red);
}

.asset-breakdown {
  display: grid;
  gap: 7px;
}

.asset-breakdown p {
  margin: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #d8e7e3;
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  line-height: 1.45;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(2, 8, 10, 0.72);
  backdrop-filter: blur(10px);
}

.modal-backdrop.open {
  display: grid;
}

.rules-modal {
  width: min(920px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  border: 1px solid rgba(59, 167, 255, 0.28);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 0%, rgba(59, 167, 255, 0.18), transparent 30%),
    linear-gradient(180deg, #122129, #0c171c);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
}

.rules-modal-head,
.rules-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.rules-modal-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.rules-modal-foot span {
  color: #d8e7e3;
  line-height: 1.5;
}

.icon-close {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  font-size: 28px;
  line-height: 1;
}

.rules-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 20px;
}

.rules-modal-grid article {
  min-height: 136px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.rules-modal-grid strong {
  display: block;
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 15px;
}

.rules-modal-grid p {
  margin: 0;
  color: #d8e7e3;
  font-size: 14px;
  line-height: 1.65;
}

.primary-action.small {
  height: 42px;
  padding: 0 16px;
}

.rules-card {
  border-color: rgba(37, 196, 143, 0.28);
}

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

.rules-list li {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.rules-list strong {
  color: var(--green);
  font-size: 13px;
}

.rules-list span {
  color: #d8e7e3;
  font-size: 13px;
  line-height: 1.42;
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .app-shell {
    padding: 12px;
  }

  .topbar,
  .year-strip,
  .panel-title,
  .rule-banner,
  .rules-modal-head,
  .rules-modal-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-row,
  .main-grid,
  .bottom-grid,
  .land-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .metric-row {
    order: 2;
  }

  .main-grid {
    order: 1;
  }

  .bottom-grid {
    order: 3;
  }

  .side-panel {
    order: 1;
  }

  .map-panel {
    order: 2;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

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

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

  .modal-backdrop {
    padding: 12px;
  }
}
