:root {
  --bg-deep: #183a31;
  --bg-mid: #2e6653;
  --paper: #f7f1e3;
  --paper-soft: #efe4ca;
  --foam: #edf7f2;
  --leaf: #6e9a57;
  --forest: #345d3d;
  --water: #3e8395;
  --water-soft: #a9d3da;
  --sun: #efc37a;
  --clay: #a66a53;
  --money: #e6f3cc;
  --env: #d9f0e8;
  --trust: #dce9f6;
  --text-dark: #1e342d;
  --text-soft: #f6f0e5;
  --shadow: 0 20px 55px rgba(17, 45, 37, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text-dark);
  background:
    radial-gradient(circle at top left, rgba(239, 195, 122, 0.28), transparent 24%),
    radial-gradient(circle at right 12% top 14%, rgba(169, 211, 218, 0.28), transparent 18%),
    linear-gradient(160deg, #f5efdf 0%, #d9ebda 48%, #c2ddd4 100%);
}

button {
  font: inherit;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.app-shell::before,
.app-shell::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.42;
}

.app-shell::before {
  width: 24rem;
  height: 24rem;
  top: -8rem;
  right: -6rem;
  background: radial-gradient(circle, rgba(62, 131, 149, 0.46), transparent 66%);
}

.app-shell::after {
  width: 18rem;
  height: 18rem;
  left: -5rem;
  bottom: -4rem;
  background: radial-gradient(circle, rgba(110, 154, 87, 0.42), transparent 65%);
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 1.5rem;
}

.screen.active {
  display: block;
  animation: screen-fade-in 0.28s ease-out;
}

.home-screen,
.start-screen,
.rounds-screen,
.rules-screen,
.end-screen {
  display: none;
  align-items: center;
  justify-content: center;
}

.home-screen.active,
.start-screen.active,
.rounds-screen.active,
.rules-screen.active,
.end-screen.active {
  display: flex;
}

.eyebrow {
  margin: 0 0 0.5rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--forest);
}

.build-stamp {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(30, 52, 45, 0.72);
}

.step-indicator {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(52, 93, 61, 0.74);
}

.lead,
.education-copy {
  line-height: 1.72;
  font-size: 1.02rem;
}

.lead {
  margin-bottom: 0.85rem;
}

h1,
h2,
h3,
h4 {
  margin-top: 0;
  font-family: Georgia, "Palatino Linotype", serif;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4.3rem);
  line-height: 1.05;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  margin-bottom: 0.75rem;
}

.home-card,
.start-card,
.end-card {
  width: min(820px, 100%);
  padding: 3rem;
  border-radius: 30px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(247, 241, 227, 0.92)),
    repeating-linear-gradient(
      -45deg,
      rgba(110, 154, 87, 0.04),
      rgba(110, 154, 87, 0.04) 10px,
      transparent 10px,
      transparent 20px
    );
  box-shadow: var(--shadow);
  border: 2px solid rgba(52, 93, 61, 0.12);
}

.home-card {
  width: min(760px, 100%);
  text-align: center;
  padding: 3.3rem 3rem;
}

.start-card {
  text-align: left;
}

.setup-card {
  width: min(860px, 100%);
}

.rounds-card {
  width: min(760px, 100%);
}

.rules-card {
  width: min(900px, 100%);
}

.home-subtitle {
  margin: -0.1rem 0 0.95rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--forest);
}

.home-lead {
  max-width: 42rem;
  margin: 0 auto 1.7rem;
  text-align: center;
}

.home-actions,
.end-actions {
  display: flex;
  justify-content: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.rules-summary-grid,
.rules-layout {
  display: grid;
  gap: 1rem;
}

.rules-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1.3rem 0 1rem;
}

.rules-summary-card,
.rules-info-card,
.rules-reminder {
  padding: 1rem 1.05rem;
  border-radius: 20px;
  border: 1px solid rgba(52, 93, 61, 0.12);
  background: rgba(255, 255, 255, 0.76);
}

.summary-label {
  display: block;
  margin-bottom: 0.32rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(30, 62, 46, 0.68);
}

.rules-summary-card strong {
  font-size: 1.05rem;
  color: var(--forest);
}

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

.rules-info-card h3,
.rules-reminder h3 {
  margin-bottom: 0.65rem;
  color: var(--forest);
}

.rules-list {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.55rem;
  line-height: 1.55;
}

.rules-mode-meta p,
.rules-reminder p {
  margin: 0.45rem 0 0;
  line-height: 1.58;
}

.info-card {
  width: min(640px, 100%);
  text-align: left;
}

.ending-verdict {
  display: inline-flex;
  align-items: center;
  margin: 0 0 0.75rem;
  padding: 0.42rem 0.78rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.verdict-win {
  background: rgba(56, 133, 85, 0.14);
  color: #1f6a40;
}

.verdict-mixed {
  background: rgba(196, 146, 45, 0.16);
  color: #8d6410;
}

.verdict-loss {
  background: rgba(168, 77, 72, 0.15);
  color: #8f3d38;
}

.performance-summary {
  margin: 0.9rem 0 0;
  color: rgba(24, 57, 42, 0.82);
  line-height: 1.6;
}

.round-picker {
  margin: 1.4rem auto 1.5rem;
  padding: 1.2rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(52, 93, 61, 0.12);
}

.setup-block {
  margin-top: 1.35rem;
}

.picker-label {
  margin: 0 0 0.9rem;
  font-weight: 800;
}

.round-options,
.start-highlights,
.end-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.start-highlights {
  justify-content: flex-start;
}

.token-picker-block {
  margin-top: 1.2rem;
  padding: 1rem 1.05rem;
  border-radius: 22px;
  border: 1px solid rgba(52, 93, 61, 0.12);
  background: rgba(255, 255, 255, 0.68);
}

.mode-picker-block {
  margin-top: 1.2rem;
  padding: 1rem 1.05rem;
  border-radius: 22px;
  border: 1px solid rgba(52, 93, 61, 0.12);
  background: rgba(247, 250, 245, 0.8);
}

.mode-picker-heading {
  margin-bottom: 0.9rem;
}

.mode-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.mode-option {
  display: grid;
  gap: 0.35rem;
  width: 100%;
  text-align: left;
  padding: 1.05rem 1rem;
  border-radius: 20px;
  border: 1px solid rgba(52, 93, 61, 0.14);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 18px rgba(33, 77, 58, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.round-option span {
  display: inline-block;
  margin-top: 0.28rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: rgba(30, 52, 45, 0.72);
}

.setup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.setup-card .start-guide,
.setup-card .token-picker-block {
  display: none;
}

.mode-option strong {
  color: var(--forest);
  font-size: 1rem;
}

.mode-option span {
  font-size: 0.88rem;
  line-height: 1.45;
  color: rgba(25, 58, 42, 0.8);
}

.mode-option:hover,
.mode-option:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(33, 77, 58, 0.1);
  border-color: rgba(53, 113, 84, 0.26);
}

.mode-option.selected {
  background: linear-gradient(135deg, rgba(233, 247, 237, 0.98), rgba(233, 243, 248, 0.98));
  border-color: rgba(53, 113, 84, 0.34);
  box-shadow: 0 14px 28px rgba(37, 90, 69, 0.14);
}

.mode-detail-card {
  margin-top: 0.9rem;
  padding: 1rem 1.05rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(52, 93, 61, 0.1);
}

.mode-detail-card h3 {
  margin: 0.15rem 0 0.35rem;
  color: var(--forest);
}

.mode-detail-card p {
  margin: 0;
  line-height: 1.55;
}

.mode-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.mode-detail-grid div {
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  background: rgba(244, 249, 242, 0.84);
}

.mode-detail-grid span {
  display: block;
  margin-bottom: 0.28rem;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(30, 62, 46, 0.68);
}

.mode-detail-grid strong {
  font-size: 0.9rem;
  line-height: 1.45;
  color: rgba(25, 58, 42, 0.88);
}

.token-picker-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.token-picker-note,
.selected-token-label {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: rgba(25, 58, 42, 0.78);
}

.selected-token-label strong {
  color: var(--forest);
}

.token-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.token-option {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 20px;
  border: 1px solid rgba(52, 93, 61, 0.14);
  background: rgba(248, 251, 245, 0.92);
  box-shadow: 0 8px 18px rgba(33, 77, 58, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.token-option:hover,
.token-option:focus-visible {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 12px 24px rgba(33, 77, 58, 0.12);
  border-color: rgba(53, 113, 84, 0.32);
}

.token-option.selected {
  border-color: rgba(53, 113, 84, 0.4);
  background: linear-gradient(135deg, rgba(237, 248, 236, 0.98), rgba(231, 245, 248, 0.98));
  box-shadow: 0 14px 28px rgba(37, 90, 69, 0.18);
  transform: translateY(-1px) scale(1.02);
}

.token-icon {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 1.35rem;
  box-shadow: inset 0 0 0 1px rgba(52, 93, 61, 0.08);
}

.token-name {
  font-weight: 700;
  color: var(--forest);
}

.round-option,
.start-highlights span,
.turn-pill,
.space-badge {
  border-radius: 999px;
  padding: 0.65rem 1rem;
  border: 1px solid rgba(52, 93, 61, 0.14);
  background: rgba(255, 255, 255, 0.78);
}

.round-option {
  min-width: 170px;
  min-height: 96px;
  border-radius: 24px;
  padding: 1rem 1.1rem;
  font-size: 1rem;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(28, 70, 54, 0.08);
}

.round-option.selected {
  background: linear-gradient(135deg, rgba(52, 93, 61, 0.95), rgba(62, 131, 149, 0.95));
  color: white;
}

.round-option.selected span {
  color: rgba(255, 255, 255, 0.86);
}

.start-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 1.6rem 0 1.75rem;
}

.start-guide-card {
  padding: 1rem 1.05rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(52, 93, 61, 0.12);
}

.start-guide-card h3 {
  margin-bottom: 0.55rem;
  font-size: 1.02rem;
  color: var(--forest);
}

.start-guide-card p {
  margin: 0 0 0.55rem;
  line-height: 1.55;
  font-size: 0.92rem;
}

.start-guide-card p:last-child {
  margin-bottom: 0;
}

.primary-button {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.3rem;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--forest), var(--water));
  box-shadow: 0 14px 28px rgba(24, 67, 55, 0.22);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.secondary-button {
  border: 1px solid rgba(52, 93, 61, 0.18);
  border-radius: 999px;
  padding: 0.74rem 1.15rem;
  font-weight: 700;
  color: var(--forest);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 18px rgba(28, 70, 54, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.primary-button:hover:not(:disabled),
.decision-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.primary-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 0.45rem;
}

.header-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 0.75rem;
}

.game-layout {
  display: grid;
  gap: 0.5rem;
}

.panel,
.board-panel {
  padding: 1rem;
  border-radius: 24px;
  background: rgba(249, 244, 234, 0.82);
  border: 1px solid rgba(52, 93, 61, 0.12);
  box-shadow: var(--shadow);
}

.board-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
  width: min(100%, 1080px);
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem;
  border-radius: 22px;
  background: rgba(120, 160, 120, 0.08);
  border: 2px solid rgba(120, 160, 120, 0.25);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  min-height: clamp(360px, 72vh, 860px);
}

.panel {
  margin-bottom: 1rem;
}

.gameplay-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 20px;
  background: rgba(249, 244, 234, 0.68);
  margin-bottom: 0;
}

.hud-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.hud-stats {
  flex: 1 1 460px;
}

.hud-actions {
  flex: 1 1 430px;
  justify-content: flex-end;
}

.hud-pill {
  display: grid;
  gap: 0.12rem;
  min-width: 102px;
  padding: 0.48rem 0.68rem;
  border-radius: 15px;
  border: 1px solid rgba(30, 52, 45, 0.08);
}

.hud-pill span {
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.2;
}

.hud-pill strong {
  font-size: 1rem;
  white-space: nowrap;
}

.hud-condition {
  display: block;
  font-size: 0.62rem;
  line-height: 1.25;
  font-weight: 700;
  color: rgba(30, 52, 45, 0.68);
}

.hud-pill.money {
  background: var(--money);
}

.hud-pill.environment {
  background: var(--env);
}

.hud-pill.trust {
  background: var(--trust);
}

.hud-pill.meta {
  min-width: 78px;
  background: rgba(255, 255, 255, 0.62);
}

.stat-list {
  display: grid;
  gap: 0.8rem;
}

.stat-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(30, 52, 45, 0.08);
}

.stat-card strong {
  font-size: 1.55rem;
}

.stat-card.money {
  background: var(--money);
}

.stat-card.environment {
  background: var(--env);
}

.stat-card.trust {
  background: var(--trust);
}

.dice-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(239, 195, 122, 0.2), rgba(62, 131, 149, 0.15));
}

.hud-dice {
  min-width: 195px;
  margin-bottom: 0;
  padding: 0.42rem 0.58rem;
  border-radius: 15px;
}

.dice-label {
  font-family: "Segoe Print", "Bradley Hand", cursive;
  font-size: 0.92rem;
}

.dice-caption {
  margin: 0.18rem 0 0;
  font-size: 0.66rem;
  line-height: 1.28;
  color: rgba(30, 52, 45, 0.72);
}

.dice-face {
  position: relative;
  flex: 0 0 auto;
  width: 3.2rem;
  height: 3.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  border: 2px solid rgba(52, 93, 61, 0.18);
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.96), rgba(237, 247, 242, 0.9) 42%, rgba(169, 211, 218, 0.9) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.65),
    0 12px 22px rgba(24, 67, 55, 0.16);
  color: var(--forest);
  font-family: Georgia, "Palatino Linotype", serif;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
}

.dice-face::before {
  content: "";
  position: absolute;
  inset: 0.28rem;
  border-radius: 10px;
  border: 1px dashed rgba(52, 93, 61, 0.14);
}

.dice-face.dice-idle {
  color: rgba(30, 52, 45, 0.5);
}

.dice-face.dice-pop {
  animation: dice-pop 0.24s ease-out;
}

@keyframes dice-pop {
  0% {
    transform: scale(0.9) rotate(-6deg);
  }

  65% {
    transform: scale(1.05) rotate(3deg);
  }

  100% {
    transform: scale(1) rotate(0deg);
  }
}

.status-text {
  min-height: 0;
  margin-top: 0.15rem;
  line-height: 1.5;
  margin-bottom: 0;
  font-size: 0.95rem;
  color: rgba(30, 52, 45, 0.82);
}

.hud-status-text {
  margin: 0 0 0.05rem;
  padding: 0 0.25rem;
  font-size: 0.82rem;
}

.finance-alert {
  margin: 0 0 0.15rem;
  padding: 0.7rem 0.9rem;
  border-radius: 16px;
  font-size: 0.84rem;
  line-height: 1.5;
  border: 1px solid rgba(52, 93, 61, 0.12);
}

.finance-stable {
  background: rgba(236, 247, 240, 0.82);
  color: #26573e;
}

.finance-caution {
  background: rgba(255, 245, 217, 0.92);
  color: #7b5b0a;
  border-color: rgba(184, 142, 31, 0.2);
}

.finance-critical {
  background: rgba(255, 233, 215, 0.92);
  color: #944a17;
  border-color: rgba(193, 108, 39, 0.22);
}

.finance-debt {
  background: rgba(255, 224, 224, 0.95);
  color: #973a3a;
  border-color: rgba(169, 74, 74, 0.24);
}

.finance-crash {
  background: rgba(109, 35, 35, 0.95);
  color: #fff0f0;
  border-color: rgba(90, 24, 24, 0.32);
}

.stat-feedback-layer {
  position: fixed;
  top: 5.2rem;
  right: 1.2rem;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  pointer-events: none;
}

.stat-feedback-bubble {
  min-width: 148px;
  padding: 0.72rem 0.95rem;
  border-radius: 16px;
  color: white;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 16px 28px rgba(17, 45, 37, 0.16);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: transform 0.32s ease, opacity 0.32s ease;
}

.stat-feedback-bubble.leaving {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: stat-fade-out 1.45s ease forwards;
}

.stat-feedback-bubble.money {
  background: linear-gradient(135deg, #1c7b4d, #2f9e65);
}

.stat-feedback-bubble.environment {
  background: linear-gradient(135deg, #2f7a4b, #58a46f);
}

.stat-feedback-bubble.trust {
  background: linear-gradient(135deg, #2d6d87, #4c9dba);
}

.stat-feedback-bubble.negative.money,
.stat-feedback-bubble.negative.environment,
.stat-feedback-bubble.negative.trust {
  background: linear-gradient(135deg, #8c4a3b, #bb6458);
}

.hud-roll-button {
  min-width: 108px;
  padding: 0.62rem 1rem;
  white-space: nowrap;
  box-shadow: 0 10px 22px rgba(24, 67, 55, 0.18);
}

.board {
  position: relative;
  width: min(100%, 72vh, 860px);
  max-width: 100%;
  max-height: 72vh;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  min-height: 0;
}

.space {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 92px;
  min-height: 92px;
  padding: 0.5rem;
  box-sizing: border-box;
  border-radius: 18px;
  border: 2px solid rgba(52, 93, 61, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(239, 228, 202, 0.96));
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  min-height: 0;
  overflow: hidden;
  touch-action: manipulation;
}

.space:hover {
  transform: rotate(-0.6deg) translateY(-2px);
}

.space.corner {
  border-radius: 28px;
  border-width: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.space.top,
.space.bottom {
  align-items: flex-start;
}

.space.left,
.space.right {
  padding: 0.55rem 0.5rem;
}

.space.left .space-name,
.space.right .space-name {
  font-size: 0.72rem;
  line-height: 1.08;
}

.space.left .space-badge,
.space.right .space-badge,
.space.left .space-index,
.space.right .space-index {
  font-size: 0.58rem;
}

.space-name {
  font-weight: 600;
  line-height: 1.08;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  text-align: left;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: keep-all;
}

.space-index {
  font-size: 0.72rem;
  opacity: 0.7;
}

.space-badge {
  max-width: 100%;
  padding: 0.35rem 0.55rem;
  font-size: 0.68rem;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.space[data-band="coast"] {
  background: linear-gradient(180deg, rgba(236, 248, 241, 0.98), rgba(169, 211, 218, 0.78));
}

.space[data-band="forest"] {
  background: linear-gradient(180deg, rgba(238, 247, 232, 0.98), rgba(110, 154, 87, 0.36));
}

.space[data-band="village"] {
  background: linear-gradient(180deg, rgba(248, 242, 233, 0.98), rgba(166, 106, 83, 0.2));
}

.space[data-band="wetland"] {
  background: linear-gradient(180deg, rgba(239, 248, 233, 0.98), rgba(141, 177, 104, 0.32));
}

.space.current {
  box-shadow: 0 0 0 4px rgba(62, 131, 149, 0.2);
}

.space[data-tile-type="start"] {
  border-color: rgba(230, 184, 0, 0.6);
}

.space[data-tile-type="community"] {
  border-color: rgba(59, 130, 246, 0.45);
}

.space[data-tile-type="environment"] {
  border-color: rgba(34, 197, 94, 0.45);
}

.space[data-tile-type="crisis"],
.space[data-tile-type="goToCrisis"] {
  border-color: rgba(239, 68, 68, 0.48);
}

.tile-effect-float {
  position: absolute;
  top: -0.72rem;
  left: 50%;
  z-index: 5;
  padding: 0.28rem 0.52rem;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  box-shadow: var(--shadow);
  font-size: var(--text-xs);
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%);
  animation: tile-effect-rise 1.05s ease-out forwards;
}

.tile-effect-start {
  color: #e6b800;
  border-color: rgba(230, 184, 0, 0.42);
}

.tile-effect-community {
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.36);
}

.tile-effect-environment {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.36);
}

.tile-effect-crisis,
.tile-effect-goToCrisis {
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.36);
}

.tile-flash-start {
  animation: tile-glow-start 0.9s ease-out;
}

.tile-flash-community {
  animation: tile-pulse-community 0.9s ease-out;
}

.tile-flash-environment {
  animation: tile-pulse-environment 0.9s ease-out;
}

.tile-flash-crisis {
  animation: tile-warning-shake 0.75s ease-out;
}

.tile-flash-goToCrisis {
  animation: tile-teleport-flash 0.7s ease-out;
}

.board-center {
  position: absolute;
  left: 21%;
  top: 21%;
  width: 58%;
  height: 58%;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 1rem;
  text-align: left;
  border-radius: 34px;
  background:
    radial-gradient(circle at top, rgba(237, 247, 242, 0.96), rgba(247, 241, 227, 0.88) 60%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(239, 228, 202, 0.58));
  border: 2px dashed rgba(52, 93, 61, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.board-center::before,
.board-center::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.34;
}

.board-center::before {
  width: 9rem;
  height: 9rem;
  top: 8%;
  right: 8%;
  background: radial-gradient(circle, rgba(169, 211, 218, 0.55), transparent 68%);
}

.board-center::after {
  width: 10rem;
  height: 10rem;
  left: 4%;
  bottom: 6%;
  background: radial-gradient(circle, rgba(110, 154, 87, 0.42), transparent 70%);
}

.board-center h3 {
  margin: 0;
  font-size: clamp(1.2rem, 1.8vw, 1.9rem);
}

.board-center p {
  position: relative;
  z-index: 1;
  margin: 0;
  line-height: 1.45;
}

.center-insert {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.7rem;
  width: 100%;
  height: 100%;
}

.center-branding {
  padding: 0.9rem 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(52, 93, 61, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.center-kicker {
  margin-bottom: 0.25rem;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--forest);
}

.center-purpose {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: rgba(30, 52, 45, 0.86);
}

.center-sections {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  min-height: 0;
}

.center-sections.compact {
  grid-template-columns: 1fr;
}

.status-layout {
  align-content: start;
}

.insert-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  padding: 0.8rem 0.85rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(52, 93, 61, 0.12);
}

.compact-card {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.7rem 0.8rem;
}

.status-card {
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  min-height: 0;
}

.status-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--water);
}

.status-card h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: var(--forest);
}

.mini-stats-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  text-align: center;
}

.mini-stat {
  padding: 0.45rem 0.25rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(52, 93, 61, 0.08);
}

.mini-stat span {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(30, 52, 45, 0.7);
}

.mini-stat strong {
  display: block;
  margin-top: 0.18rem;
  font-size: 1rem;
  color: var(--forest);
}

.insert-card p {
  font-size: 0.72rem;
  line-height: 1.42;
  color: rgba(30, 52, 45, 0.92);
}

.board-tooltip {
  position: absolute;
  z-index: 8;
  width: min(260px, calc(100% - 2rem));
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(28, 54, 46, 0.95);
  color: var(--text-soft);
  box-shadow: 0 18px 30px rgba(17, 45, 37, 0.22);
  border: 1px solid rgba(169, 211, 218, 0.24);
  pointer-events: none;
  transform: translate(-50%, -110%);
}

.board-tooltip.hidden {
  display: none;
}

.board-tooltip.below {
  transform: translate(-50%, 12%);
}

.board-tooltip.touch-visible {
  z-index: 12;
}

.board-tooltip strong {
  display: block;
  margin-bottom: 0.35rem;
  font-family: Georgia, "Palatino Linotype", serif;
}

.board-tooltip p {
  margin: 0;
  line-height: 1.5;
  font-size: 0.92rem;
}

.player-token {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.92);
  background: radial-gradient(circle at 35% 35%, #fffaf0, #f2ddb6 62%, #d2b886 100%);
  box-shadow: 0 8px 18px rgba(111, 87, 41, 0.28);
  font-size: 1rem;
  line-height: 1;
  z-index: 2;
}

.character-sprite,
.token-sprite {
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
  color: transparent;
  overflow: hidden;
}

.character-sprite {
  display: block;
  width: 5rem;
  height: 5.4rem;
  justify-self: center;
  font-size: 0;
}

.token-icon.character-sprite {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 3rem;
  background-color: transparent;
  box-shadow: none;
}

.selected-character-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  max-width: 100%;
  line-height: 1.1;
  vertical-align: middle;
}

.selected-character-sprite {
  flex: 0 0 auto;
  width: 2.35rem;
  height: 2.7rem;
}

.player-token.token-sprite {
  top: 0.26rem;
  right: 0.26rem;
  width: 1.85rem;
  height: 2.1rem;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  box-shadow: 0 10px 16px rgba(17, 24, 39, 0.2);
  font-size: 0;
}

.token-moving {
  animation: token-step-pop 0.22s ease-out;
}

.character-sprite-boy,
.token-sprite-boy {
  background-image: url("assets/character-tokens/boy.png");
}

.character-sprite-girl,
.token-sprite-girl {
  background-image: url("assets/character-tokens/girl.png");
}

.character-sprite-cat,
.token-sprite-cat {
  background-image: url("assets/character-tokens/cat.png");
}

.character-sprite-dog,
.token-sprite-dog {
  background-image: url("assets/character-tokens/dog.png");
}

.character-sprite-car,
.token-sprite-car {
  background-image: url("assets/character-tokens/car.png");
}

.character-sprite-tree,
.token-sprite-tree {
  background-image: url("assets/character-tokens/tree.png");
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(17, 45, 37, 0.55);
  backdrop-filter: blur(4px);
}

.card-modal {
  background:
    radial-gradient(circle at center, rgba(8, 20, 17, 0.18), rgba(8, 20, 17, 0.84)),
    rgba(11, 23, 19, 0.78);
  backdrop-filter: blur(7px);
  animation: modal-fade-in 0.2s ease-out;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(900px, 100%);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 1.7rem;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(249, 244, 234, 0.98), rgba(237, 247, 242, 0.98));
  border: 2px solid rgba(52, 93, 61, 0.12);
  box-shadow: var(--shadow);
}

.decision-card {
  width: min(760px, 100%);
  padding: 1.9rem;
  border-radius: 26px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.995), rgba(246, 252, 247, 0.995)),
    radial-gradient(circle at top right, rgba(239, 195, 122, 0.11), transparent 32%),
    radial-gradient(circle at top left, rgba(169, 211, 218, 0.12), transparent 28%);
  border: 1px solid rgba(255, 255, 255, 0.52);
  box-shadow: 0 32px 64px rgba(10, 24, 19, 0.3);
  transform: translateY(18px);
  opacity: 0;
}

.decision-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), transparent 22%),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.22), transparent 40%);
  opacity: 0.9;
}

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

.decision-card.ready {
  animation: decision-card-enter 0.34s ease-out forwards;
}

.decision-card.resolved {
  animation: decision-card-settle 0.26s ease-out forwards;
}

.decision-card.closing {
  animation: decision-card-exit 0.18s ease-in forwards;
}

.decision-card-header {
  margin-bottom: 0.8rem;
}

.decision-card-header .eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.62rem;
  border-radius: 999px;
  background: rgba(62, 131, 149, 0.1);
  color: var(--water);
  letter-spacing: 0.12em;
}

.decision-card-header h3 {
  margin: 0;
  font-size: clamp(1.7rem, 2.1vw, 2.15rem);
  line-height: 1.08;
  max-width: 18ch;
}

.year-card {
  width: min(760px, 100%);
  text-align: center;
}

.loan-card {
  width: min(760px, 100%);
}

.investment-card {
  text-align: left;
}

.year-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
  margin: 1.4rem 0 1.2rem;
}

.year-stats div,
.year-insights {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 18px;
}

.year-stats div {
  min-width: 160px;
  padding: 1rem;
}

.year-stats strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.6rem;
}

.year-planning-notes {
  margin-top: 1rem;
  text-align: left;
}

.year-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.1rem;
  flex-wrap: wrap;
}

.year-insights {
  display: grid;
  gap: 0.3rem;
  margin: 1rem 0 1.1rem;
  padding: 0.9rem 1rem;
  text-align: left;
}

.year-insights p {
  margin: 0;
}

.card-description {
  margin: 0 0 1.15rem;
  max-width: 58ch;
  line-height: 1.72;
  font-size: 1.02rem;
  color: rgba(27, 52, 41, 0.84);
}

.card-tone {
  margin: -0.15rem 0 1.05rem;
  padding-left: 0.9rem;
  border-left: 3px solid rgba(62, 131, 149, 0.34);
  color: rgba(28, 54, 46, 0.78);
  font-size: 0.92rem;
  line-height: 1.55;
  font-style: italic;
}

.card-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.05rem;
  align-items: stretch;
}

.decision-button {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 248px;
  padding: 1.08rem 1.05rem 1rem;
  border-radius: 20px;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, filter 0.2s ease, background 0.2s ease;
}

.decision-button:hover:not(:disabled),
.decision-button:focus-visible:not(:disabled) {
  transform: translateY(-3px) scale(1.012);
  box-shadow: 0 18px 32px rgba(17, 45, 37, 0.16);
}

.decision-button:active:not(:disabled) {
  transform: translateY(0) scale(0.99);
}

.decision-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.decision-button-positive {
  background: linear-gradient(180deg, rgba(237, 250, 239, 0.98), rgba(225, 246, 230, 0.98));
  border-color: rgba(60, 138, 86, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.decision-button-risky {
  background: linear-gradient(180deg, rgba(254, 241, 238, 0.98), rgba(250, 229, 223, 0.98));
  border-color: rgba(172, 77, 65, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.decision-button::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  border-radius: 20px 0 0 20px;
  background: rgba(255, 255, 255, 0.36);
}

.decision-button-positive::before {
  background: linear-gradient(180deg, #2d8f58, #6cb17f);
}

.decision-button-risky::before {
  background: linear-gradient(180deg, #c56a45, #d69168);
}

.decision-option-label {
  display: inline-block;
  margin-bottom: 0.45rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(37, 70, 56, 0.72);
}

.decision-option-copy {
  margin: 0.45rem 0 0.9rem;
  color: rgba(30, 52, 45, 0.72);
  line-height: 1.48;
  font-size: 0.9rem;
}

.decision-option-title {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 1.12rem;
  line-height: 1.32;
  color: var(--forest);
}

.effect-list {
  display: grid;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.25rem;
}

.effect-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.48rem 0.65rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.effect-item-label {
  font-size: 0.84rem;
  color: rgba(30, 52, 45, 0.8);
}

.effect-value {
  font-weight: 800;
  font-size: 0.92rem;
}

.effect-value.positive {
  color: #1f7a3f;
}

.effect-value.negative {
  color: #b14b3f;
}

.card-feedback {
  margin: 0 0 1rem;
  padding: 1rem 1rem 0.95rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(236, 246, 239, 0.98), rgba(225, 241, 230, 0.98));
  border: 1px solid rgba(60, 138, 86, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 10px 22px rgba(35, 86, 60, 0.08);
  animation: feedback-fade-in 0.18s ease-out;
}

.card-feedback.hidden {
  display: none;
}

.card-feedback-title {
  margin: 0 0 0.3rem;
  font-weight: 800;
  color: var(--forest);
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

.card-feedback-copy {
  margin: 0;
  color: rgba(30, 52, 45, 0.86);
  line-height: 1.55;
}

.card-feedback-deltas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.delta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.delta-chip.positive {
  background: rgba(74, 155, 93, 0.14);
  color: #23653d;
}

.delta-chip.negative {
  background: rgba(191, 94, 74, 0.14);
  color: #9a4738;
}

.education-copy {
  margin-top: 0.75rem;
  text-align: left;
  padding: 1rem 1.15rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
}

.end-stats {
  margin: 1.8rem 0;
}

.end-stats div {
  min-width: 140px;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
}

.end-stats strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.6rem;
}

.end-breakdown {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.end-breakdown div {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(52, 93, 61, 0.12);
  background: rgba(255, 255, 255, 0.64);
}

.end-breakdown span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(30, 62, 46, 0.68);
}

.end-breakdown strong {
  display: block;
  margin-top: 0.32rem;
  font-size: 1rem;
  color: var(--forest);
}

.end-planning-summary {
  margin: -0.2rem 0 1.4rem;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  text-align: left;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(52, 93, 61, 0.12);
}

.end-planning-summary p {
  margin: 0.3rem 0;
  line-height: 1.55;
}

@keyframes stat-fade-out {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  70% {
    opacity: 1;
    transform: translateY(-8px) scale(1.01);
  }

  100% {
    opacity: 0;
    transform: translateY(-22px) scale(0.96);
  }
}

@keyframes decision-card-enter {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modal-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes screen-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes decision-card-settle {
  0% {
    transform: translateY(0) scale(1);
  }

  55% {
    transform: translateY(-2px) scale(1.01);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes decision-card-exit {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}

@keyframes feedback-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reflection-line {
  margin: 0 0 1.8rem;
  font-weight: 800;
  color: var(--forest);
}

@media (max-width: 980px) {
  .game-layout {
    gap: 0.55rem;
  }

  .game-header {
    align-items: start;
  }

  .gameplay-hud {
    align-items: stretch;
    padding: 0.65rem 0.7rem;
  }

  .hud-stats,
  .hud-actions {
    flex-basis: 100%;
    justify-content: flex-start;
  }

  .board-panel {
    min-height: min(72vh, 760px);
  }
}

@media (max-width: 760px) {
  .screen {
    padding: 1rem;
  }

  .start-card,
  .home-card,
  .end-card,
  .modal-card {
    padding: 1.3rem;
  }

  .card-choices {
    grid-template-columns: 1fr;
  }

  .round-options,
  .start-highlights,
  .end-stats,
  .end-breakdown,
  .header-pills {
    gap: 0.55rem;
  }

  .round-option,
  .primary-button,
  .decision-button,
  .secondary-button {
    min-height: 48px;
  }

  .primary-button,
  .round-option {
    width: 100%;
  }

  .primary-button.hud-roll-button {
    width: auto;
  }

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

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

  .token-picker-heading {
    flex-direction: column;
    align-items: start;
    margin-bottom: 0.8rem;
  }

  .mode-detail-grid {
    grid-template-columns: 1fr;
  }

  .start-guide {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .setup-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .home-actions,
  .end-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .rules-summary-grid,
  .rules-layout {
    grid-template-columns: 1fr;
  }

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

  .start-guide-card {
    padding: 0.85rem 0.9rem;
    border-radius: 18px;
  }

  .start-guide-card h3 {
    font-size: 0.92rem;
  }

  .start-guide-card p {
    font-size: 0.84rem;
    line-height: 1.46;
  }

  .header-pills {
    justify-content: start;
  }

  .turn-pill {
    padding: 0.6rem 0.9rem;
  }

  .panel,
  .board-panel {
    padding: 0.85rem;
    border-radius: 20px;
  }

  .status-text {
    min-height: 0;
  }

  .gameplay-hud {
    padding: 0.62rem 0.68rem;
    gap: 0.55rem;
  }

  .hud-group {
    gap: 0.42rem;
  }

  .hud-pill {
    min-width: 104px;
    padding: 0.52rem 0.62rem;
  }

  .hud-pill span {
    font-size: 0.58rem;
  }

  .hud-pill strong {
    font-size: 0.94rem;
  }

  .hud-dice {
    min-width: 180px;
  }

  .hud-roll-button {
    min-width: 100px;
    padding: 0.58rem 0.9rem;
  }

  .space {
    padding: 0.45rem;
    border-radius: 16px;
  }

  .dice-display {
    align-items: center;
    padding: 0.82rem 0.88rem;
  }

  .dice-face {
    width: 3.7rem;
    height: 3.7rem;
    font-size: 1.55rem;
  }

  .board-panel {
    min-height: min(64vh, 620px);
  }

  .board {
    width: min(100%, 64vh, 760px);
    max-height: 64vh;
  }

  .space-name {
    font-size: 0.7rem;
  }

  .space.left .space-name,
  .space.right .space-name {
    font-size: 0.62rem;
  }

  .space-badge,
  .space-index {
    font-size: 0.62rem;
  }

  .board-center {
    left: 22%;
    top: 22%;
    width: 56%;
    height: 56%;
    padding: 0.85rem;
    border-radius: 24px;
  }

  .board-center h3 {
    font-size: 1.02rem;
  }

  .board-center p {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .center-insert {
    gap: 0.55rem;
  }

  .center-branding {
    padding: 0.65rem 0.75rem;
    border-radius: 18px;
  }

  .center-kicker {
    font-size: 0.55rem;
  }

  .center-purpose {
    margin-top: 0.3rem;
    font-size: 0.64rem;
    line-height: 1.32;
  }

  .center-sections {
    grid-template-columns: 1fr;
    gap: 0.45rem;
    overflow: hidden;
  }

  .insert-card {
    padding: 0.52rem 0.6rem;
    gap: 0.28rem;
    border-radius: 14px;
  }

  .insert-card p {
    font-size: 0.59rem;
    line-height: 1.26;
  }

  .status-kicker {
    font-size: 0.52rem;
  }

  .status-card h4 {
    font-size: 0.76rem;
  }

  .mini-stat {
    padding: 0.36rem 0.2rem;
  }

  .mini-stat span {
    font-size: 0.5rem;
  }

  .mini-stat strong {
    font-size: 0.82rem;
  }

  .board-tooltip {
    width: min(240px, calc(100% - 1rem));
    padding: 0.75rem 0.85rem;
  }

  .board-tooltip.touch-visible {
    transform: translate(-50%, 0);
  }

  .board-tooltip.touch-visible.below {
    transform: translate(-50%, 8%);
  }

  .player-token {
    top: 0.28rem;
    right: 0.28rem;
    width: 1.28rem;
    height: 1.28rem;
    font-size: 0.8rem;
  }

  .modal {
    padding: 0.7rem;
  }

  .stat-feedback-layer {
    top: auto;
    right: 0.7rem;
    bottom: 0.9rem;
    left: 0.7rem;
  }

  .stat-feedback-bubble {
    min-width: 0;
    width: 100%;
  }

  .modal-card {
    max-height: calc(100vh - 1.4rem);
    border-radius: 22px;
  }

  .decision-card {
    padding: 1.2rem;
  }

  .card-description {
    font-size: 0.96rem;
    line-height: 1.58;
  }

  .card-tone {
    margin-bottom: 0.95rem;
    padding-left: 0.75rem;
    font-size: 0.88rem;
  }

  .decision-card-header .eyebrow {
    margin-bottom: 0.55rem;
    font-size: 0.68rem;
  }

  .decision-card-header h3 {
    max-width: none;
    font-size: 1.55rem;
  }

  .decision-button {
    min-height: 0;
    padding: 0.95rem 0.95rem 0.9rem;
  }

  .decision-option-title {
    font-size: 1rem;
  }

  .decision-option-copy {
    font-size: 0.88rem;
    margin-bottom: 0.8rem;
  }

  .card-feedback {
    padding: 0.85rem 0.9rem;
  }

  .year-stats div,
  .end-stats div,
  .end-breakdown div {
    min-width: 120px;
    flex: 1 1 120px;
  }

  .effect-item {
    gap: 0.6rem;
    font-size: 0.92rem;
  }
}

@media (max-width: 560px) {
  .decision-card {
    padding: 1rem;
    border-radius: 22px;
  }

  .card-description {
    margin-bottom: 0.95rem;
    font-size: 0.93rem;
  }

  .card-tone {
    font-size: 0.84rem;
    line-height: 1.5;
  }

  .card-choices {
    gap: 0.8rem;
  }

  .decision-button {
    padding: 0.9rem 0.88rem 0.86rem;
    border-radius: 18px;
  }

  .effect-item {
    padding: 0.44rem 0.56rem;
  }

  .delta-chip {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .screen {
    padding: 0.8rem;
  }

  .game-header {
    margin-bottom: 1rem;
  }

  .hud-pill {
    min-width: 96px;
  }

  .hud-dice {
    min-width: 100%;
  }

  .hud-roll-button {
    width: auto;
  }

  .dice-face {
    width: 2.9rem;
    height: 2.9rem;
    font-size: 1.3rem;
  }

  .board-panel {
    min-height: min(58vh, 520px);
  }

  .board {
    width: min(100%, 58vh, 680px);
    max-height: 58vh;
  }

  .space-name {
    font-size: 0.66rem;
  }

  .space.left .space-name,
  .space.right .space-name {
    font-size: 0.58rem;
  }

  .space-badge,
  .space-index {
    font-size: 0.56rem;
    padding: 0.35rem 0.55rem;
  }

  .board-center {
    padding: 0.7rem;
  }

  .board-center p {
    font-size: 0.68rem;
  }

  .center-branding {
    padding: 0.55rem 0.62rem;
  }

  .center-kicker {
    font-size: 0.5rem;
  }

  .center-purpose {
    font-size: 0.58rem;
  }

  .insert-card {
    padding: 0.45rem 0.52rem;
  }

  .insert-card p {
    font-size: 0.54rem;
    line-height: 1.22;
  }

  .start-guide-card p {
    font-size: 0.78rem;
  }

  .mode-picker {
    grid-template-columns: 1fr;
  }

  .status-card h4 {
    font-size: 0.7rem;
  }

  .mini-stats-card {
    gap: 0.3rem;
  }

  .mini-stat span {
    font-size: 0.46rem;
  }

  .mini-stat strong {
    font-size: 0.76rem;
  }

  .card-description,
  .lead,
  .education-copy {
    font-size: 0.95rem;
    line-height: 1.6;
  }
}

/* V2 mobile-first setup and simplified color language */
:root {
  --bg-deep: #0f172a;
  --bg-mid: #1e293b;
  --paper: #1e293b;
  --paper-soft: #273449;
  --foam: #334155;
  --leaf: #4caf50;
  --forest: #f1f5f9;
  --water: #4a90e2;
  --water-soft: #79aef0;
  --sun: #f4c542;
  --clay: #475569;
  --money: #f4c542;
  --env: #4caf50;
  --trust: #4a90e2;
  --text-dark: #f1f5f9;
  --text-soft: #f1f5f9;
  --shadow: 0 20px 55px rgba(2, 6, 23, 0.46);
}

body {
  background:
    radial-gradient(circle at top left, rgba(244, 197, 66, 0.14), transparent 22%),
    radial-gradient(circle at right 12% top 14%, rgba(74, 144, 226, 0.14), transparent 18%),
    linear-gradient(160deg, #0f172a 0%, #162033 52%, #111827 100%);
  color: var(--text-dark);
}

.eyebrow,
.build-stamp,
.step-indicator,
.summary-label,
.token-picker-note,
.selected-token-label,
.status-kicker,
.mode-detail-grid span,
.mini-stat span,
.hud-pill span,
.hud-condition,
.dice-caption,
.card-tone,
.effect-item-label,
.education-copy,
.lead,
.status-text,
.performance-summary,
.rules-list,
.rules-mode-meta p,
.rules-reminder p,
.insert-card p {
  color: rgba(241, 245, 249, 0.82);
}

.home-card,
.start-card,
.end-card,
.modal-card,
.panel,
.board-panel,
.rules-summary-card,
.rules-info-card,
.rules-reminder,
.round-picker,
.mode-picker-block,
.mode-detail-card,
.year-stats div,
.year-insights,
.end-stats div,
.end-breakdown div,
.end-planning-summary,
.education-copy,
.insert-card,
.center-branding,
.mini-stat,
.effect-item {
  background: rgba(30, 41, 59, 0.94);
  border-color: rgba(241, 245, 249, 0.08);
  color: var(--text-soft);
}

.home-card,
.start-card,
.end-card {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(30, 41, 59, 0.94));
}

.home-subtitle,
.mode-option strong,
.mode-detail-card h3,
.rules-summary-card strong,
.rules-info-card h3,
.rules-reminder h3,
.decision-option-title,
.card-feedback-title,
.status-card h4,
.mini-stat strong,
.insert-card h4,
.board-center h3 {
  color: var(--text-soft);
}

.primary-button {
  background: linear-gradient(135deg, #f4c542, #f8d56a);
  color: #0f172a;
  box-shadow: 0 14px 28px rgba(244, 197, 66, 0.2);
}

.secondary-button {
  background: rgba(51, 65, 85, 0.96);
  color: var(--text-soft);
  border-color: rgba(241, 245, 249, 0.12);
}

.mode-option,
.round-option,
.character-option {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(241, 245, 249, 0.08);
  color: var(--text-soft);
}

.mode-option.selected,
.round-option.selected,
.character-option.selected {
  border-color: rgba(244, 197, 66, 0.48);
  background: linear-gradient(135deg, rgba(74, 144, 226, 0.18), rgba(76, 175, 80, 0.14));
  box-shadow: 0 14px 28px rgba(2, 6, 23, 0.3);
}

.round-option {
  min-width: 170px;
  min-height: 96px;
  border-radius: 24px;
  padding: 1rem 1.1rem;
  font-size: 1rem;
  font-weight: 800;
}

.round-option span,
.mode-option span,
.character-copy {
  color: rgba(241, 245, 249, 0.78);
}

.round-option.selected span {
  color: rgba(241, 245, 249, 0.92);
}

.simple-mode-toggle {
  display: grid;
  gap: 0.18rem;
  justify-items: start;
  max-width: 26rem;
  margin: 1.1rem auto 0;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(241, 245, 249, 0.08);
}

.simple-mode-toggle input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
}

.simple-mode-toggle span {
  font-weight: 800;
  color: var(--text-soft);
}

.simple-mode-toggle small {
  color: rgba(241, 245, 249, 0.74);
  line-height: 1.45;
}

.character-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.character-option {
  display: grid;
  gap: 0.32rem;
  text-align: left;
  padding: 1rem;
  border-radius: 20px;
  min-height: 152px;
}

.character-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.character-title {
  font-size: 1.08rem;
  color: var(--text-soft);
}

.character-bonus-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 0.18rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(244, 197, 66, 0.14);
  color: #f8d56a;
  font-size: 0.76rem;
  font-weight: 800;
}

.single-grid {
  grid-template-columns: 1fr;
}

.ready-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.ready-stat {
  padding: 0.85rem 0.7rem;
  border-radius: 16px;
  border: 1px solid rgba(241, 245, 249, 0.08);
  background: rgba(15, 23, 42, 0.82);
}

.ready-stat span {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.76rem;
  font-weight: 800;
}

.ready-stat strong {
  font-size: 1.15rem;
}

.money,
.ready-stat.money,
.effect-value.money,
.delta-chip.money,
.character-bonus-chip.money {
  color: #f8d56a;
}

.environment,
.ready-stat.environment,
.effect-value.environment,
.delta-chip.environment {
  color: #7be47f;
}

.trust,
.ready-stat.trust,
.effect-value.trust,
.delta-chip.trust {
  color: #7fb5f0;
}

.hud-pill.money {
  background: rgba(244, 197, 66, 0.15);
}

.hud-pill.environment {
  background: rgba(76, 175, 80, 0.15);
}

.hud-pill.trust {
  background: rgba(74, 144, 226, 0.15);
}

.hud-pill.meta,
.hud-dice {
  background: rgba(51, 65, 85, 0.92);
}

.dice-face {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(51, 65, 85, 0.92));
  color: #f8d56a;
  border-color: rgba(244, 197, 66, 0.28);
}

.finance-stable {
  background: rgba(74, 144, 226, 0.14);
  color: #d7e8fb;
}

.finance-caution {
  background: rgba(244, 197, 66, 0.14);
  color: #fde9a4;
}

.finance-critical,
.finance-debt,
.finance-crash {
  background: rgba(159, 71, 56, 0.22);
  color: #ffd2ca;
}

.effect-value.positive {
  color: inherit;
  filter: brightness(1.1);
}

.effect-value.negative {
  color: inherit;
  filter: saturate(0.8) brightness(0.88);
}

.effect-list .effect-item:nth-child(1) .effect-value,
.card-feedback-deltas .delta-chip:nth-child(1) {
  color: #f8d56a;
}

.effect-list .effect-item:nth-child(2) .effect-value,
.card-feedback-deltas .delta-chip:nth-child(2) {
  color: #7be47f;
}

.effect-list .effect-item:nth-child(3) .effect-value,
.card-feedback-deltas .delta-chip:nth-child(3) {
  color: #7fb5f0;
}

.decision-button-positive,
.decision-button-risky,
.card-feedback {
  background: rgba(30, 41, 59, 0.98);
  border-color: rgba(241, 245, 249, 0.08);
}

.decision-button-positive::before {
  background: linear-gradient(180deg, #4caf50, #7be47f);
}

.decision-button-risky::before {
  background: linear-gradient(180deg, #f4c542, #dba62f);
}

.player-token {
  background: linear-gradient(180deg, rgba(244, 197, 66, 0.98), rgba(248, 213, 106, 0.9));
  color: #0f172a;
  border-color: rgba(241, 245, 249, 0.92);
}

@media (max-width: 760px) {
  .character-picker,
  .ready-stat-grid {
    grid-template-columns: 1fr;
  }

  .simple-mode-toggle {
    margin-top: 0.95rem;
  }
}

/* ===== V2.0.3 UI/UX accessibility refresh ===== */
body[data-theme="light"] {
  --ui-bg: #f8fafc;
  --ui-card: #ffffff;
  --ui-card-soft: #f8fafc;
  --ui-text: #0f172a;
  --ui-text-soft: #334155;
  --ui-text-muted: #64748b;
  --ui-border: #e2e8f0;
  --ui-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --ui-overlay: rgba(15, 23, 42, 0.44);
  --bg-main: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-soft: #f1f5f9;
  --border: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --button-primary: #3b82f6;
  --button-secondary: #ffffff;
  --money-color: #e6b800;
  --environment-color: #22c55e;
  --trust-color: #3b82f6;
  --font-ui: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-md: 18px;
  --text-lg: 20px;
  --text-xl: 24px;
  --text-2xl: 28px;
  --text-3xl: 36px;
  --text-4xl: 48px;
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-pill: 999px;
}

body[data-theme="dark"] {
  --ui-bg: #0f172a;
  --ui-card: #1e293b;
  --ui-card-soft: #273449;
  --ui-text: #f1f5f9;
  --ui-text-soft: #e2e8f0;
  --ui-text-muted: #cbd5e1;
  --ui-border: #334155;
  --ui-shadow: 0 14px 36px rgba(2, 6, 23, 0.36);
  --ui-overlay: rgba(2, 6, 23, 0.68);
  --bg-main: #0f172a;
  --bg-elevated: #1e293b;
  --bg-soft: #273449;
  --border: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #e2e8f0;
  --text-muted: #cbd5e1;
  --button-primary: #3b82f6;
  --button-secondary: #273449;
  --money-color: #e6b800;
  --environment-color: #22c55e;
  --trust-color: #3b82f6;
  --font-ui: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-md: 18px;
  --text-lg: 20px;
  --text-xl: 24px;
  --text-2xl: 28px;
  --text-3xl: 36px;
  --text-4xl: 48px;
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-pill: 999px;
}

body {
  background: var(--ui-bg);
  color: var(--ui-text);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

/* Design system utility layer */
.bg-main {
  background: var(--bg-main) !important;
}

.bg-elevated {
  background: var(--bg-elevated) !important;
}

.bg-soft {
  background: var(--bg-soft) !important;
}

.border-default {
  border: 1px solid var(--border) !important;
}

.surface-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--ui-shadow);
}

.surface-soft {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.touch-target {
  min-height: 48px;
}

.text-display {
  font-size: clamp(var(--text-2xl), 6vw, var(--text-4xl));
  line-height: var(--leading-tight);
  font-weight: var(--font-weight-extrabold);
}

.text-screen-title {
  font-size: clamp(var(--text-xl), 4vw, var(--text-3xl));
  line-height: var(--leading-tight);
  font-weight: var(--font-weight-bold);
}

.text-section-title {
  font-size: var(--text-xl);
  line-height: var(--leading-snug);
  font-weight: var(--font-weight-bold);
}

.text-card-title {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  font-weight: var(--font-weight-bold);
}

.text-body {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  font-weight: var(--font-weight-regular);
}

.text-supporting {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  font-weight: var(--font-weight-medium);
}

.text-label {
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.04em;
}

.text-stat {
  font-size: var(--text-xl);
  line-height: var(--leading-tight);
  font-weight: var(--font-weight-extrabold);
}

.text-button {
  font-size: var(--text-base);
  line-height: var(--leading-snug);
  font-weight: var(--font-weight-semibold);
}

.text-primary {
  color: var(--text-primary) !important;
}

.text-secondary {
  color: var(--text-secondary) !important;
}

.text-muted {
  color: var(--text-muted) !important;
}

.stat-money {
  color: var(--money-color) !important;
}

.stat-environment {
  color: var(--environment-color) !important;
}

.stat-trust {
  color: var(--trust-color) !important;
}

.severity-secondary {
  color: var(--text-secondary) !important;
}

.severity-warning {
  color: #b45309 !important;
}

.severity-danger {
  color: #b91c1c !important;
}

.severity-positive {
  color: #166534 !important;
}

.app-shell::before,
.app-shell::after {
  display: none;
}

.screen {
  padding: var(--space-4);
}

.home-screen,
.start-screen,
.character-screen,
.rounds-screen,
.rules-screen,
.end-screen {
  align-items: center;
  justify-content: center;
}

.character-screen.active {
  display: flex;
}

.home-card,
.start-card,
.end-card,
.modal-card,
.panel,
.board-panel,
.rules-summary-card,
.rules-info-card,
.rules-reminder,
.mode-detail-card,
.round-picker,
.mode-picker-block,
.year-card,
.loan-card,
.investment-card {
  background: var(--ui-card);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
  box-shadow: var(--ui-shadow);
}

.home-card,
.start-card,
.end-card {
  padding: var(--space-6);
  border-radius: var(--radius-xl);
}

.eyebrow,
.step-indicator,
.summary-label,
.decision-option-label,
.status-kicker,
.center-kicker,
.dice-label {
  color: var(--ui-text-muted);
}

.build-stamp,
.lead,
.education-copy,
.token-picker-note,
.selected-token-label,
.decision-option-copy,
.card-tone,
.performance-summary,
.center-purpose,
.mode-option span,
.mode-detail-card p,
.mode-detail-grid strong,
.rules-reminder p,
.dice-caption {
  color: var(--ui-text-soft);
}

h1,
h2,
h3,
h4,
.home-subtitle,
.character-title,
.mode-option strong,
.decision-option-title,
.rules-summary-card strong,
.rules-info-card h3,
.rules-reminder h3,
.mode-detail-card h3,
.ready-stat strong,
.picker-label,
.settings-section h4,
.settings-header h3,
.settings-toggle span,
.settings-range span,
.settings-select span,
.secondary-button,
.round-option,
.build-stamp {
  color: var(--ui-text);
}

.summary-label,
.decision-option-label,
.status-kicker,
.center-kicker,
.dice-label,
.effect-item-label,
.simple-mode-toggle small,
.settings-note,
.token-picker-note,
.selected-token-label {
  color: var(--ui-text-muted);
}

.primary-button,
.secondary-button,
.round-option,
.settings-choice,
.decision-button,
.mode-option,
.character-option {
  min-height: 48px;
  font-size: var(--text-base);
  line-height: var(--leading-snug);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-pill);
}

.primary-button {
  background: #e6b800;
  color: #0f172a;
  border: 1px solid rgba(230, 184, 0, 0.68);
  box-shadow: 0 10px 24px rgba(230, 184, 0, 0.18);
}

.secondary-button {
  background: var(--ui-card-soft);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
}

.primary-button:hover,
.primary-button:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible,
.round-option:hover,
.round-option:focus-visible,
.settings-choice:hover,
.settings-choice:focus-visible,
.mode-option:hover,
.mode-option:focus-visible,
.character-option:hover,
.character-option:focus-visible,
.decision-button:hover,
.decision-button:focus-visible {
  transform: scale(1.02);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.home-card,
.start-card,
.rules-card,
.rounds-card {
  width: min(720px, 100%);
}

.home-card h1,
.start-card h1 {
  font-size: clamp(var(--text-2xl), 6vw, var(--text-4xl));
  line-height: var(--leading-tight);
  font-weight: var(--font-weight-extrabold);
}

.lead,
.education-copy,
.rules-list li,
.rules-reminder p,
.settings-note,
.decision-option-copy,
.card-description,
.card-tone {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

.home-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.simple-mode-toggle,
.settings-toggle,
.settings-range,
.settings-select {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--ui-border);
  background: var(--ui-card-soft);
  color: var(--ui-text);
}

.simple-mode-toggle small,
.settings-note {
  color: var(--ui-text-muted);
}

.settings-card {
  width: min(680px, 96vw);
  border-radius: var(--radius-xl);
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.settings-section + .settings-section {
  margin-top: var(--space-4);
}

.settings-choice-row,
.settings-grid {
  display: grid;
  gap: var(--space-3);
}

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

.settings-choice {
  background: var(--ui-card-soft);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.settings-choice.selected {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.settings-select select,
.settings-range input {
  width: 100%;
}

.settings-select select {
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ui-border);
  background: var(--ui-card);
  color: var(--ui-text);
  padding: var(--space-3) var(--space-4);
}

button,
label,
input,
select,
option {
  color: inherit;
}

.primary-button {
  color: #0f172a;
}

.setup-actions .primary-button {
  color: #ffffff;
}

.mode-picker,
.character-picker,
.round-options {
  grid-template-columns: 1fr;
}

.mode-option,
.character-option,
.round-option {
  background: var(--ui-card-soft);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
  box-shadow: none;
}

.mode-option.selected,
.character-option.selected,
.round-option.selected {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.character-icon {
  font-size: 2rem;
}

.character-bonus-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--ui-text);
}

.game-header {
  display: none;
}

.gameplay-hud {
  background: var(--ui-card);
  border: 1px solid var(--ui-border);
  padding: var(--space-3);
  gap: var(--space-3);
}

.hud-pill {
  background: var(--ui-card-soft);
  border: 1px solid var(--ui-border);
}

.hud-pill.money strong,
.ready-stat.money strong,
.effect-value.money,
.end-stats div:nth-child(2) strong {
  color: #e6b800;
}

.hud-pill.environment strong,
.ready-stat.environment strong,
.effect-value.environment,
.end-stats div:nth-child(3) strong {
  color: #22c55e;
}

.hud-pill.trust strong,
.ready-stat.trust strong,
.effect-value.trust,
.end-stats div:nth-child(4) strong {
  color: #3b82f6;
}

.hud-pill.debt strong,
#debt-stat,
#year-debt {
  color: #b45309;
}

#year-interest {
  color: #b45309;
}

.finance-alert {
  background: var(--ui-card-soft);
  color: var(--ui-text);
  border-color: var(--ui-border);
}

.finance-alert.finance-caution {
  border-left: 4px solid #e6b800;
}

.finance-alert.finance-balanced {
  border-left: 4px solid #3b82f6;
}

.finance-alert.finance-risky {
  border-left: 4px solid #f59e0b;
}

.finance-alert.finance-critical,
.finance-alert.finance-debt,
.finance-alert.finance-collapse {
  border-left: 4px solid #ef4444;
}

.loan-card .year-insights {
  margin: 0 0 var(--space-4);
}

.modal {
  background: var(--ui-overlay);
  backdrop-filter: blur(6px);
}

.card-modal {
  align-items: end;
}

.decision-card {
  width: min(640px, 95vw);
  max-width: 95vw;
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transform: translateY(24px);
  transition: transform 0.24s ease, opacity 0.24s ease, box-shadow 0.24s ease;
}

.decision-card.ready,
.decision-card.resolved {
  transform: translateY(0);
}

.decision-card.closing {
  transform: translateY(16px);
  opacity: 0;
}

.decision-card h3,
#card-title {
  font-size: clamp(var(--text-lg), 4vw, var(--text-xl));
  line-height: var(--leading-tight);
  color: var(--ui-text);
}

.card-description {
  margin: 0 0 var(--space-3);
  color: var(--ui-text);
}

.card-tone {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--ui-card-soft);
  border: 1px solid var(--ui-border);
}

.card-choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.decision-button {
  display: grid;
  gap: var(--space-2);
  align-items: start;
  text-align: left;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--ui-card-soft);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.decision-button::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
}

.decision-button-positive::before {
  background: #22c55e;
}

.decision-button-risky::before {
  background: #f59e0b;
}

.decision-option-title {
  font-size: var(--text-md);
  line-height: var(--leading-snug);
  font-weight: var(--font-weight-bold);
  color: var(--ui-text);
}

.effect-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.effect-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--ui-card);
  border: 1px solid var(--ui-border);
}

.effect-item-label {
  font-size: var(--text-sm);
  color: var(--ui-text-soft);
}

.effect-value {
  font-weight: 800;
}

.card-feedback {
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--ui-card-soft);
  border: 1px solid var(--ui-border);
}

.card-feedback-title,
.card-feedback-copy {
  color: var(--ui-text);
}

.stat-feedback-layer {
  top: auto;
  right: 0.8rem;
  left: 0.8rem;
  bottom: 0.9rem;
}

.stat-feedback-bubble {
  background: var(--ui-card);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
  box-shadow: var(--ui-shadow);
}

.stat-feedback-bubble.money {
  border-left: 5px solid #e6b800;
}

.stat-feedback-bubble.environment {
  border-left: 5px solid #22c55e;
}

.stat-feedback-bubble.trust {
  border-left: 5px solid #3b82f6;
}

.stat-feedback-bubble.negative {
  border-right: 5px solid #ef4444;
}

.board-panel {
  padding: var(--space-3);
  max-width: 1040px;
  margin: 0 auto;
}

.board-tooltip {
  background: var(--ui-card);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
  box-shadow: var(--ui-shadow);
}

@media (min-width: 760px) {
  .home-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

@media (max-width: 759px) {
  .screen {
    padding: var(--space-3);
  }

  .home-card,
  .start-card,
  .end-card,
  .decision-card,
  .settings-card {
    padding: var(--space-4);
  }

  .settings-choice-row,
  .ready-stat-grid,
  .rules-summary-grid,
  .rules-layout,
  .home-actions,
  .setup-actions {
    grid-template-columns: 1fr;
  }

  .setup-actions {
    display: grid;
  }
}

/* Mode selection polish */
.start-screen .setup-card {
  gap: 1.15rem;
}

.start-screen .lead {
  margin-bottom: 1rem;
}

.mode-picker-block {
  padding: 1.2rem;
  gap: 1rem;
}

.mode-picker-heading {
  margin-bottom: 1rem;
}

.mode-picker {
  gap: 0.9rem;
}

.mode-option {
  position: relative;
  padding: 1.1rem 1rem 1rem 1.1rem;
  border-width: 1px;
  border-left-width: 6px;
  border-left-color: var(--ui-border);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.mode-option strong {
  font-size: 1.02rem;
  color: var(--ui-text);
}

.mode-option span {
  color: var(--ui-text-soft);
}

.mode-option[data-mode-tone="guided"] {
  border-left-color: #3b82f6;
}

.mode-option[data-mode-tone="wealth"] {
  border-left-color: #e6b800;
}

.mode-option[data-mode-tone="conservation"] {
  border-left-color: #22c55e;
}

.mode-option[data-mode-tone="community"] {
  border-left-color: #3b82f6;
}

.mode-option[data-mode-tone="survival"] {
  border-left-color: #ef4444;
}

.mode-option[data-mode-tone="sandbox"] {
  border-left-color: #94a3b8;
}

.mode-option[data-mode-tone="education"] {
  border-left-color: #8b5cf6;
}

.mode-option.selected {
  background: #dbeafe;
  border: 2px solid #3b82f6;
  transform: scale(1.02);
  box-shadow: 0 14px 28px rgba(59, 130, 246, 0.18);
}

body[data-theme="dark"] .mode-option.selected {
  background: rgba(59, 130, 246, 0.22);
}

.mode-option.selected strong,
.mode-option.selected span {
  color: #0f172a;
}

body[data-theme="dark"] .mode-option.selected strong,
body[data-theme="dark"] .mode-option.selected span {
  color: #f8fbff;
}

.mode-detail-card {
  margin-top: 1.1rem;
  padding: 1.15rem;
  background: #ffffff;
  border: 1px solid #dbe4f0;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.mode-detail-card h3,
.mode-detail-card p,
.mode-detail-grid strong,
.mode-detail-grid span {
  color: #0f172a;
}

.mode-detail-grid {
  gap: 0.9rem;
  margin-top: 1rem;
}

.mode-detail-grid div {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0.95rem;
}

body[data-theme="dark"] .mode-detail-card {
  background: #ffffff;
  border-color: #dbe4f0;
}

body[data-theme="dark"] .lead,
body[data-theme="dark"] .education-copy,
body[data-theme="dark"] .character-copy,
body[data-theme="dark"] #character-description,
body[data-theme="dark"] #mode-description,
body[data-theme="dark"] #rules-mode-goal,
body[data-theme="dark"] #rules-mode-win,
body[data-theme="dark"] #rules-mode-lose,
body[data-theme="dark"] .mode-option span,
body[data-theme="dark"] .mode-detail-card p,
body[data-theme="dark"] .mode-detail-grid strong,
body[data-theme="dark"] .decision-option-copy,
body[data-theme="dark"] .card-tone,
body[data-theme="dark"] .performance-summary,
body[data-theme="dark"] .dice-caption {
  color: #e2e8f0;
}

body[data-theme="dark"] .summary-label,
body[data-theme="dark"] .decision-option-label,
body[data-theme="dark"] .status-kicker,
body[data-theme="dark"] .center-kicker,
body[data-theme="dark"] .dice-label,
body[data-theme="dark"] .effect-item-label,
body[data-theme="dark"] .simple-mode-toggle small,
body[data-theme="dark"] .settings-note,
body[data-theme="dark"] .token-picker-note,
body[data-theme="dark"] .selected-token-label,
body[data-theme="dark"] .build-stamp,
body[data-theme="dark"] .step-indicator,
body[data-theme="dark"] .eyebrow {
  color: #cbd5e1;
}

.setup-actions {
  margin-top: 1.7rem;
}

.setup-actions .primary-button {
  background: #3b82f6;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.22);
}

.setup-actions .secondary-button {
  background: transparent;
  color: var(--ui-text);
  border: 1.5px solid var(--ui-border);
  box-shadow: none;
}

.setup-actions .secondary-button:hover,
.setup-actions .secondary-button:focus-visible {
  background: var(--ui-card-soft);
}

@media (min-width: 760px) {
  .mode-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Final text contrast overrides */
.text-primary {
  color: #0f172a !important;
}

.text-secondary {
  color: #334155 !important;
}

.text-muted {
  color: #64748b !important;
}

body[data-theme="light"] .eyebrow,
body[data-theme="light"] .build-stamp,
body[data-theme="light"] .step-indicator,
body[data-theme="light"] .summary-label,
body[data-theme="light"] .picker-label,
body[data-theme="light"] .settings-section h4,
body[data-theme="light"] .settings-header h3,
body[data-theme="light"] .home-subtitle,
body[data-theme="light"] .character-title,
body[data-theme="light"] .mode-option strong,
body[data-theme="light"] .decision-option-title,
body[data-theme="light"] .rules-summary-card strong,
body[data-theme="light"] .rules-info-card h3,
body[data-theme="light"] .rules-reminder h3,
body[data-theme="light"] .secondary-button,
body[data-theme="light"] .round-option,
body[data-theme="light"] .simple-mode-toggle span,
body[data-theme="light"] .settings-toggle span,
body[data-theme="light"] .settings-range span,
body[data-theme="light"] .settings-select span,
body[data-theme="light"] label,
body[data-theme="light"] h1,
body[data-theme="light"] h2,
body[data-theme="light"] h3,
body[data-theme="light"] h4 {
  color: #0f172a !important;
  font-weight: 600;
}

body[data-theme="light"] .lead,
body[data-theme="light"] .education-copy,
body[data-theme="light"] .character-copy,
body[data-theme="light"] #character-description,
body[data-theme="light"] #mode-description,
body[data-theme="light"] #rules-mode-goal,
body[data-theme="light"] #rules-mode-win,
body[data-theme="light"] #rules-mode-lose,
body[data-theme="light"] .mode-option span,
body[data-theme="light"] .mode-detail-card p,
body[data-theme="light"] .mode-detail-grid strong,
body[data-theme="light"] .decision-option-copy,
body[data-theme="light"] .card-description,
body[data-theme="light"] .card-tone,
body[data-theme="light"] .performance-summary,
body[data-theme="light"] .token-picker-note,
body[data-theme="light"] .selected-token-label {
  color: #334155 !important;
}

body[data-theme="light"] .simple-mode-toggle small,
body[data-theme="light"] .settings-note,
body[data-theme="light"] .decision-option-label,
body[data-theme="light"] .status-kicker,
body[data-theme="light"] .center-kicker,
body[data-theme="light"] .dice-label,
body[data-theme="light"] .effect-item-label {
  color: #64748b !important;
}

.simple-mode-toggle,
.settings-toggle,
.settings-range,
.settings-select,
.mode-option,
.character-option,
.rules-summary-card,
.rules-info-card,
.mode-detail-card,
.round-option,
.secondary-button {
  opacity: 1 !important;
}

/* Full text hierarchy map */
body[data-theme="light"] .text-primary,
body[data-theme="light"] h1,
body[data-theme="light"] h2,
body[data-theme="light"] h3,
body[data-theme="light"] h4,
body[data-theme="light"] .home-subtitle,
body[data-theme="light"] .picker-label,
body[data-theme="light"] .mode-option strong,
body[data-theme="light"] .character-title,
body[data-theme="light"] .round-option,
body[data-theme="light"] .round-option span,
body[data-theme="light"] .rules-summary-card span,
body[data-theme="light"] .rules-summary-card strong,
body[data-theme="light"] .rules-info-card h3,
body[data-theme="light"] .rules-reminder h3,
body[data-theme="light"] .ready-stat span,
body[data-theme="light"] .ready-stat strong,
body[data-theme="light"] .hud-pill span,
body[data-theme="light"] .hud-pill strong,
body[data-theme="light"] .dice-face,
body[data-theme="light"] .primary-button,
body[data-theme="light"] .secondary-button,
body[data-theme="light"] .settings-toggle span,
body[data-theme="light"] .settings-range span,
body[data-theme="light"] .settings-select span,
body[data-theme="light"] .settings-choice,
body[data-theme="light"] .hud-roll-button,
body[data-theme="light"] .year-stats span,
body[data-theme="light"] .year-stats strong,
body[data-theme="light"] .year-insights strong,
body[data-theme="light"] .end-stats span,
body[data-theme="light"] .end-stats strong,
body[data-theme="light"] .end-breakdown span,
body[data-theme="light"] .end-breakdown strong,
body[data-theme="light"] .end-planning-summary strong,
body[data-theme="light"] .decision-option-title,
body[data-theme="light"] #card-title,
body[data-theme="light"] #loan-title,
body[data-theme="light"] #investment-title,
body[data-theme="light"] label {
  color: #0f172a !important;
}

body[data-theme="light"] .text-secondary,
body[data-theme="light"] .lead,
body[data-theme="light"] .education-copy,
body[data-theme="light"] .mode-option span,
body[data-theme="light"] .character-copy,
body[data-theme="light"] #character-description,
body[data-theme="light"] #mode-description,
body[data-theme="light"] #rules-mode-goal,
body[data-theme="light"] #rules-mode-win,
body[data-theme="light"] #rules-mode-lose,
body[data-theme="light"] .rules-list li,
body[data-theme="light"] .rules-reminder p,
body[data-theme="light"] .rules-mode-meta p,
body[data-theme="light"] .hud-condition,
body[data-theme="light"] .hud-status-text,
body[data-theme="light"] .finance-alert,
body[data-theme="light"] .dice-caption,
body[data-theme="light"] .card-description,
body[data-theme="light"] .card-tone,
body[data-theme="light"] .decision-option-copy,
body[data-theme="light"] .effect-item-label,
body[data-theme="light"] .year-summary,
body[data-theme="light"] #year-summary,
body[data-theme="light"] .year-insights p,
body[data-theme="light"] .performance-summary,
body[data-theme="light"] #strategy-summary,
body[data-theme="light"] #education-summary,
body[data-theme="light"] .settings-note,
body[data-theme="light"] .token-picker-note,
body[data-theme="light"] .selected-token-label,
body[data-theme="light"] #tooltip-description,
body[data-theme="light"] #loan-description,
body[data-theme="light"] #investment-description {
  color: #334155 !important;
}

body[data-theme="light"] .text-muted,
body[data-theme="light"] .eyebrow,
body[data-theme="light"] .build-stamp,
body[data-theme="light"] .step-indicator,
body[data-theme="light"] .summary-label,
body[data-theme="light"] .status-kicker,
body[data-theme="light"] .center-kicker,
body[data-theme="light"] .decision-option-label,
body[data-theme="light"] .dice-label,
body[data-theme="light"] .simple-mode-toggle small,
body[data-theme="light"] .settings-section .eyebrow,
body[data-theme="light"] #modal-place {
  color: #64748b !important;
}

body[data-theme="dark"] .text-primary,
body[data-theme="dark"] h1,
body[data-theme="dark"] h2,
body[data-theme="dark"] h3,
body[data-theme="dark"] h4,
body[data-theme="dark"] .home-subtitle,
body[data-theme="dark"] .picker-label,
body[data-theme="dark"] .mode-option strong,
body[data-theme="dark"] .character-title,
body[data-theme="dark"] .round-option,
body[data-theme="dark"] .round-option span,
body[data-theme="dark"] .rules-summary-card span,
body[data-theme="dark"] .rules-summary-card strong,
body[data-theme="dark"] .rules-info-card h3,
body[data-theme="dark"] .rules-reminder h3,
body[data-theme="dark"] .ready-stat span,
body[data-theme="dark"] .ready-stat strong,
body[data-theme="dark"] .hud-pill span,
body[data-theme="dark"] .hud-pill strong,
body[data-theme="dark"] .dice-face,
body[data-theme="dark"] .primary-button,
body[data-theme="dark"] .secondary-button,
body[data-theme="dark"] .settings-toggle span,
body[data-theme="dark"] .settings-range span,
body[data-theme="dark"] .settings-select span,
body[data-theme="dark"] .settings-choice,
body[data-theme="dark"] .hud-roll-button,
body[data-theme="dark"] .year-stats span,
body[data-theme="dark"] .year-stats strong,
body[data-theme="dark"] .year-insights strong,
body[data-theme="dark"] .end-stats span,
body[data-theme="dark"] .end-stats strong,
body[data-theme="dark"] .end-breakdown span,
body[data-theme="dark"] .end-breakdown strong,
body[data-theme="dark"] .end-planning-summary strong,
body[data-theme="dark"] .decision-option-title,
body[data-theme="dark"] #card-title,
body[data-theme="dark"] #loan-title,
body[data-theme="dark"] #investment-title,
body[data-theme="dark"] label {
  color: #f1f5f9 !important;
}

body[data-theme="dark"] .text-secondary,
body[data-theme="dark"] .lead,
body[data-theme="dark"] .education-copy,
body[data-theme="dark"] .mode-option span,
body[data-theme="dark"] .character-copy,
body[data-theme="dark"] #character-description,
body[data-theme="dark"] #mode-description,
body[data-theme="dark"] #rules-mode-goal,
body[data-theme="dark"] #rules-mode-win,
body[data-theme="dark"] #rules-mode-lose,
body[data-theme="dark"] .rules-list li,
body[data-theme="dark"] .rules-reminder p,
body[data-theme="dark"] .rules-mode-meta p,
body[data-theme="dark"] .hud-condition,
body[data-theme="dark"] .hud-status-text,
body[data-theme="dark"] .finance-alert,
body[data-theme="dark"] .dice-caption,
body[data-theme="dark"] .card-description,
body[data-theme="dark"] .card-tone,
body[data-theme="dark"] .decision-option-copy,
body[data-theme="dark"] .effect-item-label,
body[data-theme="dark"] #year-summary,
body[data-theme="dark"] .year-insights p,
body[data-theme="dark"] .performance-summary,
body[data-theme="dark"] #strategy-summary,
body[data-theme="dark"] #education-summary,
body[data-theme="dark"] .settings-note,
body[data-theme="dark"] .token-picker-note,
body[data-theme="dark"] .selected-token-label,
body[data-theme="dark"] #tooltip-description,
body[data-theme="dark"] #loan-description,
body[data-theme="dark"] #investment-description {
  color: #e2e8f0 !important;
}

.step-indicator,
.eyebrow,
.build-stamp,
.summary-label,
.status-kicker,
.center-kicker,
.decision-option-label,
.dice-label {
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  font-weight: var(--font-weight-semibold);
}

.picker-label,
.settings-section h4,
.settings-header h3,
.rules-summary-card strong,
.rules-info-card h3,
.rules-reminder h3,
.mode-detail-card h3,
.character-title,
.mode-option strong {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  font-weight: var(--font-weight-bold);
}

.hud-pill span,
.ready-stat span,
.end-stats span,
.end-breakdown span,
.year-stats span {
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  font-weight: var(--font-weight-semibold);
}

.hud-pill strong,
.ready-stat strong,
.year-stats strong,
.end-stats strong,
.end-breakdown strong,
#money-stat,
#environment-stat,
#trust-stat,
#year-counter,
#turn-counter {
  font-size: var(--text-xl);
  line-height: var(--leading-tight);
  font-weight: var(--font-weight-extrabold);
}

.hud-condition,
.hud-status-text,
.finance-alert,
.card-description,
.card-tone,
.decision-option-copy,
.settings-note,
.token-picker-note,
.selected-token-label,
.mode-option span,
.character-copy,
.lead,
.education-copy {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

body[data-theme="dark"] .text-muted,
body[data-theme="dark"] .eyebrow,
body[data-theme="dark"] .build-stamp,
body[data-theme="dark"] .step-indicator,
body[data-theme="dark"] .summary-label,
body[data-theme="dark"] .status-kicker,
body[data-theme="dark"] .center-kicker,
body[data-theme="dark"] .decision-option-label,
body[data-theme="dark"] .dice-label,
body[data-theme="dark"] .simple-mode-toggle small,
body[data-theme="dark"] .settings-section .eyebrow,
body[data-theme="dark"] #modal-place {
  color: #cbd5e1 !important;
}

/* Board light-surface consistency */
body[data-theme="light"] .board-panel,
body[data-theme="light"] .board-center,
body[data-theme="light"] .center-insert,
body[data-theme="light"] .center-branding,
body[data-theme="light"] .insert-card,
body[data-theme="light"] .status-card,
body[data-theme="light"] .mini-stats-card,
body[data-theme="light"] .mini-stat {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06) !important;
}

body[data-theme="light"] .board-center {
  background: #f8fafc !important;
}

body[data-theme="light"] .center-branding,
body[data-theme="light"] .insert-card,
body[data-theme="light"] .mini-stat {
  background: #f1f5f9 !important;
}

body[data-theme="light"] .board-center h3,
body[data-theme="light"] .status-card h4,
body[data-theme="light"] .insert-card h4,
body[data-theme="light"] .mini-stat strong,
body[data-theme="light"] #center-message-title,
body[data-theme="light"] #center-money-mini,
body[data-theme="light"] #center-environment-mini,
body[data-theme="light"] #center-trust-mini {
  color: #0f172a !important;
}

body[data-theme="light"] .board-center p,
body[data-theme="light"] .insert-card p,
body[data-theme="light"] .center-purpose,
body[data-theme="light"] #center-message-body,
body[data-theme="light"] .mini-stat span {
  color: #334155 !important;
}

/* Gameplay HUD light-theme consistency */
body[data-theme="light"] .gameplay-hud,
body[data-theme="light"] .top-hud,
body[data-theme="light"] .turn-bar,
body[data-theme="light"] .last-roll-panel,
body[data-theme="light"] .year-turn-panel,
body[data-theme="light"] .hud-group,
body[data-theme="light"] .hud-actions,
body[data-theme="light"] .hud-dice,
body[data-theme="light"] .dice-display {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06) !important;
}

body[data-theme="light"] .gameplay-hud .hud-pill,
body[data-theme="light"] .gameplay-hud .meta,
body[data-theme="light"] .year-turn-panel .hud-pill,
body[data-theme="light"] .last-roll-panel .hud-pill {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
}

body[data-theme="light"] .gameplay-hud .label,
body[data-theme="light"] .top-hud .label,
body[data-theme="light"] .turn-bar .label,
body[data-theme="light"] .last-roll-panel .label,
body[data-theme="light"] .year-turn-panel .label,
body[data-theme="light"] .hud-pill span,
body[data-theme="light"] .dice-label {
  color: var(--text-primary) !important;
}

body[data-theme="light"] .gameplay-hud .value,
body[data-theme="light"] .top-hud .value,
body[data-theme="light"] .turn-bar .value,
body[data-theme="light"] .last-roll-panel .value,
body[data-theme="light"] .year-turn-panel .value,
body[data-theme="light"] .hud-pill strong,
body[data-theme="light"] #year-counter,
body[data-theme="light"] #turn-counter,
body[data-theme="light"] #dice-result {
  color: var(--text-primary) !important;
}

body[data-theme="light"] .gameplay-hud .help,
body[data-theme="light"] .top-hud .help,
body[data-theme="light"] .turn-bar .help,
body[data-theme="light"] .last-roll-panel .help,
body[data-theme="light"] .year-turn-panel .help,
body[data-theme="light"] .dice-caption,
body[data-theme="light"] .hud-condition {
  color: var(--text-secondary) !important;
}

body[data-theme="light"] .dice-preview,
body[data-theme="light"] .last-roll-dice,
body[data-theme="light"] .roll-preview-box,
body[data-theme="light"] .dice-face,
body[data-theme="light"] .hud-dice .dice-face {
  background: var(--bg-soft) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
}

body[data-theme="light"] .rules-info-card,
body[data-theme="light"] .rules-summary-card,
body[data-theme="light"] .ready-stat,
body[data-theme="light"] .year-card,
body[data-theme="light"] .year-stats > div,
body[data-theme="light"] .year-insights,
body[data-theme="light"] .year-planning-notes {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06) !important;
}

body[data-theme="light"] .ready-stat,
body[data-theme="light"] .year-stats > div,
body[data-theme="light"] .year-insights,
body[data-theme="light"] .year-planning-notes {
  background: var(--bg-soft) !important;
}

body[data-theme="light"] .ready-stat span,
body[data-theme="light"] .year-stats span,
body[data-theme="light"] .year-insights p,
body[data-theme="light"] .year-event-note,
body[data-theme="light"] .year-reflection {
  color: var(--text-secondary) !important;
}

body[data-theme="light"] .ready-stat strong,
body[data-theme="light"] .year-stats strong,
body[data-theme="light"] .year-card h3,
body[data-theme="light"] #year-title,
body[data-theme="light"] #year-summary,
body[data-theme="light"] #year-strongest,
body[data-theme="light"] #year-weakest,
body[data-theme="light"] #year-financial-state,
body[data-theme="light"] #year-investments,
body[data-theme="light"] #year-loans {
  color: var(--text-primary) !important;
}

body[data-theme="light"] .ready-stat.money strong,
body[data-theme="light"] .ready-stat.environment strong,
body[data-theme="light"] .ready-stat.trust strong {
  color: var(--text-primary) !important;
}

/* Final polish pass */
body {
  background: var(--bg-main);
  color: var(--text-primary);
}

.screen.active {
  animation: screen-fade-in 0.58s ease-out;
}

.modal {
  animation: modal-fade-in 0.42s ease-out;
}

.home-card,
.start-card,
.end-card,
.settings-card,
.modal-card,
.rules-summary-card,
.rules-info-card,
.rules-reminder,
.mode-detail-card,
.round-picker,
.mode-picker-block,
.character-picker,
.board-panel,
.panel {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--ui-shadow) !important;
}

.home-card,
.start-card,
.end-card {
  padding: var(--space-8);
  border-radius: var(--radius-xl);
}

.home-card h1,
.start-card h1,
.end-card h2 {
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.home-subtitle,
.lead,
.home-lead,
.rules-reminder p,
.rules-list li,
.card-description,
.card-tone,
.decision-option-copy,
.education-copy,
.performance-summary,
#strategy-summary,
#education-summary,
#loan-description,
#investment-description,
#mode-description,
#character-description,
#rules-mode-goal,
#rules-mode-win,
#rules-mode-lose,
.token-picker-note,
.selected-token-label,
.settings-note,
.dice-caption,
.hud-condition,
.hud-status-text,
.finance-alert {
  color: var(--text-secondary) !important;
}

.eyebrow,
.build-stamp,
.step-indicator,
.summary-label,
.status-kicker,
.center-kicker,
.decision-option-label,
.dice-label {
  color: var(--text-muted) !important;
}

.home-actions,
.setup-actions,
.round-options,
.card-choices,
.year-actions,
.settings-choice-row,
.rules-summary-grid,
.rules-layout,
.ready-stat-grid,
.end-actions {
  gap: var(--space-4);
}

.mode-picker-block,
.round-picker,
.rules-summary-card,
.rules-info-card,
.rules-reminder,
.mode-detail-card,
.settings-section,
.loan-summary,
.year-insights {
  border-radius: var(--radius-lg);
}

.mode-picker,
.character-picker {
  gap: var(--space-4);
}

.mode-option,
.character-option,
.round-option {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06) !important;
  min-height: 64px;
}

.mode-option {
  padding: var(--space-5);
  border-radius: var(--radius-lg);
}

.character-option {
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  align-content: start;
  text-align: center;
}

.character-icon {
  justify-self: center;
  margin-bottom: var(--space-2);
}

.character-title,
.mode-option strong,
.decision-option-title,
.rules-summary-card strong,
.rules-info-card h3,
.rules-reminder h3,
.mode-detail-card h3,
.settings-header h3,
.settings-section h4,
#year-title,
#loan-title,
#investment-title,
#card-title {
  color: var(--text-primary) !important;
}

.mode-option span,
.character-copy,
.mode-detail-card p,
.mode-detail-grid strong,
.rules-mode-meta p,
.settings-toggle small,
.settings-select small {
  color: var(--text-secondary) !important;
}

.mode-option.selected,
.character-option.selected,
.round-option.selected,
.settings-choice.selected {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14), 0 12px 24px rgba(59, 130, 246, 0.12) !important;
}

.round-option {
  min-height: 110px;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
}

.round-option span {
  display: inline-block;
  margin-top: var(--space-2);
  color: var(--text-primary) !important;
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
}

.game-layout {
  gap: var(--space-4);
}

.gameplay-hud {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  padding: var(--space-4) !important;
  gap: var(--space-3) var(--space-4) !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06) !important;
}

.hud-group {
  gap: var(--space-3);
}

.hud-pill,
.hud-dice,
.dice-display {
  background: var(--bg-soft) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: none !important;
}

.hud-pill {
  padding: var(--space-3) var(--space-4);
}

.hud-pill span,
.hud-pill strong,
.dice-label,
.dice-caption,
#year-counter,
#turn-counter,
#dice-result,
#money-stat,
#debt-stat,
#environment-stat,
#trust-stat {
  color: var(--text-primary) !important;
}

.hud-condition,
.dice-caption,
.finance-alert,
#status-text {
  color: var(--text-secondary) !important;
}

.finance-alert {
  background: var(--bg-soft) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

.dice-face,
.hud-dice .dice-face {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

body[data-theme="light"] .board-panel,
body[data-theme="light"] .board-center,
body[data-theme="light"] .center-insert,
body[data-theme="light"] .center-branding,
body[data-theme="light"] .insert-card,
body[data-theme="light"] .status-card,
body[data-theme="light"] .mini-stats-card,
body[data-theme="light"] .mini-stat {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
}

body[data-theme="light"] .board-center {
  background: var(--bg-main) !important;
}

body[data-theme="light"] .center-branding,
body[data-theme="light"] .insert-card,
body[data-theme="light"] .mini-stat {
  background: var(--bg-soft) !important;
}

.decision-card,
.loan-card,
.investment-card,
.year-card {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-xl) !important;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12) !important;
}

.decision-card {
  width: min(680px, 95vw);
  max-width: 95vw;
  padding: var(--space-6);
}

.decision-card.ready {
  animation: decision-card-enter 0.4s ease-out forwards;
}

.decision-card.resolved {
  animation: decision-card-settle 0.3s ease-out forwards;
}

.decision-card.closing {
  animation: decision-card-exit 0.22s ease-in forwards;
}

.decision-card-header,
.year-card .year-stats,
.year-card .year-insights,
.loan-card .year-insights {
  margin-bottom: var(--space-4);
}

.decision-card-header .eyebrow {
  background: var(--bg-soft) !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border);
}

.card-feedback {
  background: var(--bg-soft) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  animation: feedback-fade-in 0.3s ease-out;
}

.decision-button {
  min-height: 56px;
  padding: var(--space-4);
  border-radius: var(--radius-lg) !important;
}

.decision-button-positive,
.decision-button-risky {
  background: var(--bg-soft) !important;
  border: 1px solid var(--border) !important;
}

.year-card {
  padding: var(--space-6);
}

.year-stats {
  gap: var(--space-3);
}

.year-stats > div,
.year-insights,
.end-stats div,
.end-breakdown div,
.end-planning-summary,
.rules-summary-card,
.rules-info-card,
.rules-reminder,
.mode-detail-card {
  background: var(--bg-soft) !important;
  border: 1px solid var(--border) !important;
}

.settings-modal .modal-card,
.settings-card {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
}

.settings-toggle span,
.settings-range span,
.settings-select span,
.settings-choice,
label,
.simple-mode-toggle span {
  color: var(--text-primary) !important;
}

.settings-note,
.simple-mode-toggle small {
  color: var(--text-secondary) !important;
}

.primary-button,
.secondary-button,
.settings-choice,
.decision-button,
.round-option,
.mode-option,
.character-option {
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.primary-button {
  min-height: 48px;
  border-radius: var(--radius-pill);
}

.secondary-button {
  min-height: 48px;
  border-radius: var(--radius-pill);
}

.stat-feedback-bubble {
  animation: stat-fade-out 1.2s ease forwards;
}

.board-center .center-insert {
  position: relative;
  overflow: hidden;
  min-height: 230px;
}

.center-intro {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: var(--space-4);
  text-align: center;
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s ease;
}

.center-intro .center-roll-hint {
  margin: var(--space-3) auto 0;
  width: fit-content;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}

.center-intro.fading-out {
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
}

.island-visual.intro {
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
}

.island-visual.active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.island-grid-visual {
  align-content: center;
  justify-content: center;
  padding: clamp(0.5rem, 1.4vw, 0.9rem);
  image-rendering: pixelated;
}

.island-grid {
  position: absolute;
  inset: 9% 9% 17%;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--grid-size, 6), 1fr);
  grid-template-rows: repeat(var(--grid-size, 6), 1fr);
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: #5f7f93;
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.28),
    inset 0 -12px 0 rgba(15, 23, 42, 0.1),
    0 14px 28px rgba(15, 23, 42, 0.16);
  image-rendering: pixelated;
  overflow: hidden;
}

.island-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1 / 1;
  border: 0;
  color: transparent;
  overflow: visible;
  image-rendering: pixelated;
  transition: background-color 0.45s ease, background-image 0.45s ease, opacity 0.45s ease, transform 0.45s ease, filter 0.45s ease;
}

.island-cell::before,
.island-cell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  image-rendering: pixelated;
  transition: opacity 0.45s ease, transform 0.45s ease, filter 0.45s ease;
}

.terrain-sand {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.1) 0 12%, transparent 12% 100%),
    linear-gradient(0deg, rgba(92, 64, 24, 0.08) 0 12%, transparent 12% 100%),
    #d9b36f;
  background-size: 14px 14px;
}

.terrain-dull-grass {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.07) 0 12%, transparent 12% 100%),
    linear-gradient(0deg, rgba(92, 64, 24, 0.14) 0 12%, transparent 12% 100%),
    #7f8f45;
  background-size: 14px 14px;
}

.terrain-dirt {
  background:
    linear-gradient(90deg, rgba(77, 43, 20, 0.12) 0 12%, transparent 12% 100%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 12%, transparent 12% 100%),
    #9a6a3b;
  background-size: 14px 14px;
}

.terrain-dirt-path {
  background:
    linear-gradient(90deg, rgba(77, 43, 20, 0.12) 0 12%, transparent 12% 100%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 12%, transparent 12% 100%),
    #b98243;
  background-size: 14px 14px;
}

.terrain-grass {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.1) 0 12%, transparent 12% 100%),
    linear-gradient(0deg, rgba(22, 101, 52, 0.12) 0 12%, transparent 12% 100%),
    #68b64a;
  background-size: 14px 14px;
}

.terrain-lush {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.13) 0 12%, transparent 12% 100%),
    linear-gradient(0deg, rgba(20, 83, 45, 0.16) 0 12%, transparent 12% 100%),
    linear-gradient(135deg, transparent 0 64%, rgba(187, 247, 208, 0.22) 64% 78%, transparent 78%),
    #2f9d50;
  background-size: 14px 14px, 14px 14px, 20px 20px, auto;
}

.terrain-ash {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.08) 0 12%, transparent 12% 100%),
    linear-gradient(0deg, rgba(15, 23, 42, 0.12) 0 12%, transparent 12% 100%),
    #78716c;
  background-size: 14px 14px;
}

.terrain-lava {
  background:
    linear-gradient(90deg, rgba(251, 146, 60, 0.6) 0 10%, transparent 10% 100%),
    linear-gradient(0deg, rgba(127, 29, 29, 0.54) 0 12%, transparent 12% 100%),
    #3f1d14;
  background-size: 14px 14px;
  animation: lava-flicker 1.2s ease-in-out infinite;
}

.terrain-basalt {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.08) 0 12%, transparent 12% 100%),
    linear-gradient(0deg, rgba(0,0,0,0.16) 0 12%, transparent 12% 100%),
    #44403c;
  background-size: 14px 14px;
}

.terrain-basalt-lush {
  background:
    linear-gradient(90deg, rgba(134, 239, 172, 0.18) 0 12%, transparent 12% 100%),
    linear-gradient(0deg, rgba(0,0,0,0.14) 0 12%, transparent 12% 100%),
    linear-gradient(135deg, transparent 0 64%, rgba(187, 247, 208, 0.18) 64% 78%, transparent 78%),
    #3f6212;
  background-size: 14px 14px, 14px 14px, 20px 20px, auto;
}

.terrain-water,
.terrain-shallow-water {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.22) 0 12%, transparent 12% 100%),
    linear-gradient(0deg, rgba(14, 116, 144, 0.18) 0 12%, transparent 12% 100%),
    #22a7c9;
  background-size: 14px 14px;
  animation: water-shimmer 1.8s linear infinite;
}

.terrain-shallow-water {
  background-color: #5cc7d8;
}

.terrain-rock {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.08) 0 12%, transparent 12% 100%),
    linear-gradient(0deg, rgba(15, 23, 42, 0.16) 0 12%, transparent 12% 100%),
    #7c8589;
  background-size: 14px 14px;
}

.terrain-cliff-edge {
  background:
    linear-gradient(90deg, rgba(92, 64, 24, 0.18) 0 18%, transparent 18% 100%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 30%, transparent 30% 100%),
    #6b4a2b;
  background-size: 14px 14px;
}

.object-tree::after,
.object-building::after,
.object-house::after,
.object-townhall::after,
.object-shelter::after,
.object-market::after,
.object-water::after,
.object-person::after,
.object-bush::after,
.object-flower::after,
.object-rock::after,
.object-well::after,
.object-bridge::after,
.object-fence::after,
.object-dock::after,
.object-windmill::after,
.object-farm::after,
.object-signpost::after {
  content: "";
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  image-rendering: pixelated;
  pointer-events: none;
}

.object-tree::after {
  width: 58%;
  height: 78%;
  background:
    linear-gradient(90deg, transparent 42%, #7c4a26 42% 58%, transparent 58%),
    linear-gradient(90deg, transparent 14%, #15803d 14% 86%, transparent 86%),
    linear-gradient(0deg, transparent 38%, #22c55e 38% 86%, transparent 86%);
  background-size: 100% 100%, 100% 58%, 78% 100%;
  background-position: center bottom, center 18%, center 0;
  background-repeat: no-repeat;
}

.object-tree.object-stage-0::after {
  width: 28%;
  height: 34%;
  background:
    linear-gradient(90deg, transparent 42%, #7c4a26 42% 58%, transparent 58%),
    linear-gradient(0deg, transparent 42%, #86efac 42% 78%, transparent 78%);
  background-size: 100% 100%, 100% 100%;
  background-repeat: no-repeat;
}

.object-tree.object-stage-1::after {
  width: 44%;
  height: 58%;
}

.object-tree.object-stage-2::after {
  width: 70%;
  height: 88%;
}

.object-large {
  z-index: 2;
}

.object-part {
  opacity: 0.9;
  filter: brightness(0.95);
}

.object-part::after {
  display: none;
}

.object-building::after,
.object-house::after,
.object-townhall::after,
.object-shelter::after,
.object-market::after {
  width: 68%;
  height: 54%;
  background:
    linear-gradient(90deg, transparent 40%, rgba(15, 23, 42, 0.34) 40% 56%, transparent 56%),
    linear-gradient(135deg, #b45309 0 35%, #f59e0b 36% 100%);
  box-shadow: inset 0 -5px 0 rgba(120, 53, 15, 0.35);
}

.object-house::after {
  background:
    linear-gradient(90deg, transparent 40%, rgba(15, 23, 42, 0.34) 40% 56%, transparent 56%),
    linear-gradient(135deg, #1d4ed8 0 35%, #dbeafe 36% 100%);
}

.object-townhall::after {
  width: 78%;
  height: 66%;
  background:
    linear-gradient(90deg, transparent 44%, #1e293b 44% 56%, transparent 56%),
    linear-gradient(135deg, #1d4ed8 0 32%, #f8fafc 33% 100%);
  box-shadow: inset 0 -6px 0 rgba(30, 41, 59, 0.18);
}

.object-shelter::after {
  background:
    linear-gradient(90deg, transparent 40%, rgba(15, 23, 42, 0.32) 40% 56%, transparent 56%),
    linear-gradient(135deg, #92400e 0 35%, #fbbf24 36% 100%);
}

.object-market::after {
  background:
    linear-gradient(90deg, #ef4444 0 25%, #f8fafc 25% 50%, #ef4444 50% 75%, #f8fafc 75%),
    linear-gradient(135deg, #7c2d12 0 35%, #f97316 36% 100%);
  background-size: 100% 28%, 100% 100%;
  background-repeat: no-repeat;
  background-position: top, bottom;
}

.object-building.object-stage-0::after,
.object-shelter.object-stage-0::after,
.object-market.object-stage-0::after {
  width: 44%;
  height: 24%;
  background: rgba(120, 53, 15, 0.55);
}

.object-water {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.28) 0 12%, transparent 12% 100%),
    #38bdf8;
  background-size: 14px 14px;
  animation: water-shimmer 1.6s linear infinite;
}

.object-water::after {
  inset: 14%;
  width: auto;
  height: auto;
  left: 14%;
  bottom: 14%;
  transform: none;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.32) 0 18%, transparent 18% 100%),
    rgba(14, 165, 233, 0.55);
  background-size: 10px 10px;
}

.object-bush::after {
  width: 56%;
  height: 42%;
  bottom: 16%;
  background:
    linear-gradient(90deg, transparent 8%, #15803d 8% 92%, transparent 92%),
    linear-gradient(0deg, transparent 18%, #22c55e 18% 82%, transparent 82%);
  background-size: 100% 72%, 78% 100%;
  background-position: center bottom, center center;
  background-repeat: no-repeat;
}

.object-flower::after {
  width: 60%;
  height: 46%;
  bottom: 16%;
  background:
    linear-gradient(90deg, transparent 0 12%, #facc15 12% 26%, transparent 26% 38%, #f472b6 38% 52%, transparent 52% 64%, #facc15 64% 78%, transparent 78%),
    linear-gradient(0deg, transparent 0 48%, #16a34a 48% 62%, transparent 62%);
}

.object-rock::after {
  width: 56%;
  height: 44%;
  bottom: 14%;
  background:
    linear-gradient(135deg, #94a3b8 0 38%, #64748b 39% 72%, #475569 73%);
}

.object-well::after {
  width: 48%;
  height: 48%;
  bottom: 14%;
  background:
    linear-gradient(90deg, transparent 34%, #38bdf8 34% 66%, transparent 66%),
    linear-gradient(0deg, #64748b 0 24%, #94a3b8 24% 78%, #475569 78%);
}

.object-bridge::after {
  width: 88%;
  height: 34%;
  bottom: 34%;
  background:
    linear-gradient(90deg, #7c4a26 0 16%, #a16207 16% 32%, #7c4a26 32% 48%, #a16207 48% 64%, #7c4a26 64% 80%, #a16207 80%),
    linear-gradient(0deg, transparent 0 38%, #4b2e16 38% 56%, transparent 56%);
}

.object-fence::after {
  width: 90%;
  height: 46%;
  bottom: 20%;
  background:
    linear-gradient(90deg, #7c4a26 0 12%, transparent 12% 32%, #7c4a26 32% 44%, transparent 44% 64%, #7c4a26 64% 76%, transparent 76%),
    linear-gradient(0deg, transparent 0 42%, #a16207 42% 56%, transparent 56%);
}

.object-dock::after {
  width: 88%;
  height: 48%;
  bottom: 8%;
  background:
    linear-gradient(90deg, #7c4a26 0 18%, #a16207 18% 36%, #7c4a26 36% 54%, #a16207 54% 72%, #7c4a26 72%),
    linear-gradient(0deg, transparent 0 58%, #4b2e16 58% 70%, transparent 70%);
}

.object-windmill::after {
  width: 78%;
  height: 82%;
  bottom: 8%;
  background:
    linear-gradient(90deg, transparent 46%, #7c4a26 46% 56%, transparent 56%),
    linear-gradient(45deg, transparent 0 40%, #f8fafc 40% 48%, transparent 48% 52%, #f8fafc 52% 60%, transparent 60%),
    linear-gradient(0deg, #92400e 0 42%, transparent 42%);
}

.object-farm::after {
  width: 82%;
  height: 62%;
  bottom: 16%;
  background:
    linear-gradient(90deg, rgba(22, 101, 52, 0.55) 0 16%, transparent 16% 28%, rgba(22, 101, 52, 0.55) 28% 44%, transparent 44% 56%, rgba(22, 101, 52, 0.55) 56% 72%, transparent 72%),
    #8b5e34;
}

.object-signpost::after {
  width: 44%;
  height: 58%;
  bottom: 14%;
  background:
    linear-gradient(90deg, transparent 42%, #7c4a26 42% 58%, transparent 58%),
    linear-gradient(0deg, transparent 52%, #f59e0b 52% 78%, transparent 78%);
}

.object-person::after {
  width: 26%;
  height: 42%;
  background:
    linear-gradient(90deg, transparent 28%, #facc15 28% 72%, transparent 72%),
    linear-gradient(90deg, transparent 30%, #2563eb 30% 70%, transparent 70%);
  background-size: 100% 36%, 100% 72%;
  background-position: top, bottom;
  background-repeat: no-repeat;
  animation: person-wander 2.6s ease-in-out infinite;
}

.overlay-crack::before {
  background:
    linear-gradient(135deg, transparent 0 42%, rgba(69, 26, 3, 0.58) 42% 47%, transparent 47%),
    linear-gradient(45deg, transparent 0 56%, rgba(69, 26, 3, 0.38) 56% 60%, transparent 60%);
}

.overlay-heat::before {
  background:
    linear-gradient(90deg, transparent 0 18%, rgba(239, 68, 68, 0.18) 18% 30%, transparent 30% 70%, rgba(239, 68, 68, 0.16) 70% 82%, transparent 82%),
    linear-gradient(45deg, transparent 0 42%, rgba(251, 146, 60, 0.46) 42% 47%, transparent 47%);
}

.island-theme-grassland .island-grid {
  background: #4f7d39;
  border-radius: 10px;
  box-shadow:
    inset 0 0 0 3px rgba(28, 52, 28, 0.28),
    inset 0 -12px 0 rgba(55, 31, 13, 0.18),
    0 16px 30px rgba(15, 23, 42, 0.18);
}

.island-theme-grassland .terrain-grass,
.island-theme-grassland .terrain-lush,
.island-theme-grassland .terrain-dull-grass,
.island-theme-grassland .terrain-grassland-dead,
.island-theme-grassland .terrain-grassland-struggling,
.island-theme-grassland .terrain-grassland-healthy,
.island-theme-grassland .terrain-grassland-thriving,
.island-theme-grassland .terrain-dirt,
.island-theme-grassland .terrain-dirt-path,
.island-theme-grassland .terrain-water,
.island-theme-grassland .terrain-shallow-water,
.island-theme-grassland .terrain-rock,
.island-theme-grassland .terrain-cliff-edge {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.island-theme-grassland .terrain-grass {
  background-image: url("assets/grassland-tiles/grass.png");
}

.island-theme-grassland .terrain-grassland-dead {
  background-image:
    linear-gradient(rgba(104, 67, 32, 0.62), rgba(104, 67, 32, 0.62)),
    url("assets/grassland-tiles/dirt-path.png");
  filter: saturate(0.56) brightness(0.76);
}

.island-theme-grassland .terrain-grassland-struggling {
  background-image:
    linear-gradient(rgba(136, 102, 44, 0.44), rgba(136, 102, 44, 0.44)),
    url("assets/grassland-tiles/grass.png");
  filter: saturate(0.68) brightness(0.84);
}

.island-theme-grassland .terrain-grassland-healthy {
  background-image:
    linear-gradient(rgba(74, 148, 48, 0.08), rgba(74, 148, 48, 0.08)),
    url("assets/grassland-tiles/grass.png");
  filter: saturate(1.08) brightness(1.02);
}

.island-theme-grassland .terrain-lush,
.island-theme-grassland .terrain-grassland-thriving {
  background-image:
    linear-gradient(rgba(111, 211, 61, 0.18), rgba(111, 211, 61, 0.18)),
    url("assets/grassland-tiles/grass.png");
  filter: saturate(1.28) brightness(1.1);
}

.island-theme-grassland .terrain-dull-grass {
  background-image:
    linear-gradient(rgba(99, 91, 36, 0.38), rgba(99, 91, 36, 0.38)),
    url("assets/grassland-tiles/grass.png");
  filter: saturate(0.72) brightness(0.86);
}

.island-theme-grassland .terrain-dirt,
.island-theme-grassland .terrain-dirt-path {
  background-image: url("assets/grassland-tiles/dirt-path.png");
}

.island-theme-grassland .terrain-water,
.island-theme-grassland .terrain-shallow-water,
.island-theme-grassland .object-water {
  background-image: url("assets/grassland-tiles/water.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  animation: none;
}

.island-theme-grassland.stage-grassland-dead .terrain-water,
.island-theme-grassland.stage-grassland-dead .terrain-shallow-water,
.island-theme-grassland.stage-grassland-dead .object-water {
  background-image:
    linear-gradient(rgba(103, 71, 35, 0.7), rgba(103, 71, 35, 0.7)),
    url("assets/grassland-tiles/dirt-path.png");
  filter: saturate(0.48) brightness(0.72);
}

.island-theme-grassland.stage-grassland-struggling .terrain-water,
.island-theme-grassland.stage-grassland-struggling .terrain-shallow-water,
.island-theme-grassland.stage-grassland-struggling .object-water,
.island-theme-grassland.stage-grass .terrain-water,
.island-theme-grassland.stage-grass .terrain-shallow-water,
.island-theme-grassland.stage-grass .object-water {
  background-image:
    linear-gradient(rgba(96, 105, 58, 0.42), rgba(96, 105, 58, 0.42)),
    url("assets/grassland-tiles/water.png");
  filter: saturate(0.68) brightness(0.82);
}

.island-theme-grassland.stage-grassland-healthy .terrain-water,
.island-theme-grassland.stage-grassland-healthy .terrain-shallow-water,
.island-theme-grassland.stage-grassland-healthy .object-water,
.island-theme-grassland.stage-grassland-thriving .terrain-water,
.island-theme-grassland.stage-grassland-thriving .terrain-shallow-water,
.island-theme-grassland.stage-grassland-thriving .object-water {
  filter: saturate(1.18) brightness(1.08);
}

.island-theme-grassland .terrain-rock,
.island-theme-grassland .terrain-cliff-edge {
  background-image: url("assets/grassland-tiles/stone.png");
}

.island-theme-grassland .object-tree::after,
.island-theme-grassland .object-house::after,
.island-theme-grassland .object-townhall::after,
.island-theme-grassland .object-market::after,
.island-theme-grassland .object-bush::after,
.island-theme-grassland .object-flower::after {
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: contain;
  box-shadow: none;
}

.island-theme-grassland .object-tree::after {
  width: 112%;
  height: 128%;
  bottom: 0;
  background-image: url("assets/grassland-tiles/tree.png");
}

.island-theme-grassland .object-tree.object-stage-0::after {
  width: 62%;
  height: 72%;
}

.island-theme-grassland .object-tree.object-stage-1::after {
  width: 92%;
  height: 108%;
}

.island-theme-grassland .object-tree.object-stage-2::after {
  width: 126%;
  height: 142%;
}

.island-theme-grassland .object-house::after,
.island-theme-grassland .object-townhall::after {
  width: 142%;
  height: 132%;
  bottom: -4%;
  background-image: url("assets/grassland-tiles/house.png");
}

.island-theme-grassland .object-market::after {
  width: 136%;
  height: 118%;
  bottom: -2%;
  background-image: url("assets/grassland-tiles/market.png");
}

.island-theme-grassland .object-bush::after,
.island-theme-grassland .object-flower::after {
  width: 110%;
  height: 92%;
  bottom: -2%;
  background-image: url("assets/grassland-tiles/bush.png");
}

.island-theme-grassland.stage-grassland-dead .object-tree::after {
  opacity: 0.12;
  transform: translateX(-50%) scale(0.74);
  filter: grayscale(1) sepia(0.8) saturate(0.5) brightness(0.55);
}

.island-theme-grassland.stage-grassland-struggling .object-tree::after,
.island-theme-grassland.stage-grass .object-tree::after {
  opacity: 0.72;
  transform: translateX(-50%) scale(0.78);
  filter: saturate(0.68) brightness(0.82);
}

.island-theme-grassland.stage-grassland-healthy .object-tree::after,
.island-theme-grassland.stage-grassland-thriving .object-tree::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  filter: saturate(1.12) brightness(1.04);
}

.island-theme-grassland.stage-grassland-dead .object-bush::after,
.island-theme-grassland.stage-grassland-dead .object-flower::after,
.island-theme-grassland.stage-grassland-struggling .object-bush::after,
.island-theme-grassland.stage-grassland-struggling .object-flower::after,
.island-theme-grassland.stage-grass .object-bush::after,
.island-theme-grassland.stage-grass .object-flower::after {
  opacity: 0;
  transform: translateX(-50%) scale(0.72);
}

.island-theme-grassland.stage-grassland-healthy .object-bush::after,
.island-theme-grassland.stage-grassland-healthy .object-flower::after,
.island-theme-grassland.stage-grassland-thriving .object-bush::after,
.island-theme-grassland.stage-grassland-thriving .object-flower::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.island-theme-grassland.stage-grassland-thriving .island-cell[data-object=""]::before {
  inset: 46% 12% 10%;
  opacity: 0.34;
  background-image: url("assets/grassland-tiles/bush.png");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: contain;
}

.island-theme-desert .island-grid {
  background: #d6a75e;
  border-radius: 10px;
  box-shadow:
    inset 0 0 0 3px rgba(107, 71, 28, 0.3),
    inset 0 -12px 0 rgba(91, 55, 24, 0.2),
    0 16px 30px rgba(15, 23, 42, 0.18);
}

.island-theme-desert .terrain-sand,
.island-theme-desert .terrain-dirt,
.island-theme-desert .terrain-dirt-path,
.island-theme-desert .terrain-grass,
.island-theme-desert .terrain-lush,
.island-theme-desert .terrain-water,
.island-theme-desert .terrain-shallow-water,
.island-theme-desert .terrain-rock,
.island-theme-desert .terrain-cliff-edge {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.island-theme-desert .terrain-sand {
  background-image: url("assets/desert-tiles/sand.png");
}

.island-theme-desert .terrain-dirt,
.island-theme-desert .terrain-dirt-path {
  background-image: url("assets/desert-tiles/dirt-path.png");
}

.island-theme-desert .terrain-grass {
  background-image:
    linear-gradient(rgba(91, 146, 54, 0.16), rgba(91, 146, 54, 0.16)),
    url("assets/desert-tiles/sand.png");
  filter: saturate(1.08) brightness(1.02);
}

.island-theme-desert .terrain-lush {
  background-image:
    linear-gradient(rgba(56, 140, 73, 0.24), rgba(56, 140, 73, 0.24)),
    url("assets/desert-tiles/sand.png");
  filter: saturate(1.16) brightness(1.04);
}

.island-theme-desert .terrain-water,
.island-theme-desert .terrain-shallow-water,
.island-theme-desert .object-water {
  background-image: url("assets/desert-tiles/oasis.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  animation: none;
}

.island-theme-desert .terrain-rock,
.island-theme-desert .terrain-cliff-edge {
  background-image: url("assets/desert-tiles/stone.png");
}

.island-theme-desert .object-tree::after,
.island-theme-desert .object-shelter::after,
.island-theme-desert .object-market::after,
.island-theme-desert .object-bush::after,
.island-theme-desert .object-flower::after {
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: contain;
  box-shadow: none;
}

.island-theme-desert .object-tree::after {
  width: 112%;
  height: 136%;
  bottom: -2%;
  background-image: url("assets/desert-tiles/palm.png");
}

.island-theme-desert .object-tree.object-stage-0::after {
  width: 58%;
  height: 76%;
}

.island-theme-desert .object-tree.object-stage-1::after {
  width: 88%;
  height: 112%;
}

.island-theme-desert .object-tree.object-stage-2::after {
  width: 120%;
  height: 146%;
}

.island-theme-desert .object-shelter::after {
  width: 142%;
  height: 132%;
  bottom: -4%;
  background-image: url("assets/desert-tiles/shelter.png");
}

.island-theme-desert .object-market::after {
  width: 140%;
  height: 126%;
  bottom: -4%;
  background-image: url("assets/desert-tiles/market.png");
}

.island-theme-desert .object-bush::after,
.island-theme-desert .object-flower::after {
  width: 106%;
  height: 92%;
  bottom: -2%;
  background-image: url("assets/desert-tiles/plant.png");
}

.island-theme-volcanic .island-grid {
  background: #3f3f46;
  border-color: rgba(239, 68, 68, 0.34);
  border-radius: 10px;
  box-shadow:
    inset 0 0 0 3px rgba(24, 24, 27, 0.38),
    inset 0 -12px 0 rgba(127, 29, 29, 0.24),
    0 16px 30px rgba(15, 23, 42, 0.2);
}

.island-theme-volcanic .terrain-ash,
.island-theme-volcanic .terrain-basalt,
.island-theme-volcanic .terrain-basalt-lush,
.island-theme-volcanic .terrain-lava,
.island-theme-volcanic .terrain-rock,
.island-theme-volcanic .terrain-cliff-edge {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.island-theme-volcanic .terrain-ash {
  background-image: url("assets/volcanic-tiles/ash.png");
}

.island-theme-volcanic .terrain-basalt {
  background-image: url("assets/volcanic-tiles/basalt.png");
}

.island-theme-volcanic .terrain-basalt-lush {
  background-image:
    linear-gradient(rgba(70, 140, 78, 0.16), rgba(70, 140, 78, 0.16)),
    url("assets/volcanic-tiles/basalt.png");
  filter: saturate(1.12) brightness(1.04);
}

.island-theme-volcanic .terrain-lava {
  background-image: url("assets/volcanic-tiles/lava.png");
  animation: lava-flicker 1.2s ease-in-out infinite;
}

.island-theme-volcanic .terrain-rock,
.island-theme-volcanic .terrain-cliff-edge {
  background-image: url("assets/volcanic-tiles/stone.png");
}

.island-theme-volcanic .object-tree::after,
.island-theme-volcanic .object-shelter::after,
.island-theme-volcanic .object-market::after,
.island-theme-volcanic .object-bush::after,
.island-theme-volcanic .object-flower::after {
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: contain;
  box-shadow: none;
}

.island-theme-volcanic .object-tree::after {
  width: 110%;
  height: 132%;
  bottom: -2%;
  background-image: url("assets/volcanic-tiles/tree.png");
}

.island-theme-volcanic .object-tree.object-stage-0::after {
  width: 58%;
  height: 74%;
}

.island-theme-volcanic .object-tree.object-stage-1::after {
  width: 88%;
  height: 108%;
}

.island-theme-volcanic .object-tree.object-stage-2::after {
  width: 120%;
  height: 142%;
}

.island-theme-volcanic .object-shelter::after {
  width: 140%;
  height: 130%;
  bottom: -4%;
  background-image: url("assets/volcanic-tiles/shelter.png");
}

.island-theme-volcanic .object-market::after {
  width: 140%;
  height: 126%;
  bottom: -4%;
  background-image: url("assets/volcanic-tiles/market.png");
}

.island-theme-volcanic .object-bush::after,
.island-theme-volcanic .object-flower::after {
  width: 106%;
  height: 92%;
  bottom: -2%;
  background-image: url("assets/volcanic-tiles/shrub.png");
}

.player-token.token-sprite {
  top: 0.26rem !important;
  right: 0.26rem !important;
  width: 1.85rem !important;
  height: 2.1rem !important;
  border: 0 !important;
  border-radius: 0 !important;
  background-color: transparent !important;
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
  box-shadow: 0 10px 16px rgba(17, 24, 39, 0.2) !important;
  color: transparent !important;
}

.player-token.token-sprite-boy {
  background-image: url("assets/character-tokens/boy.png") !important;
}

.player-token.token-sprite-girl {
  background-image: url("assets/character-tokens/girl.png") !important;
}

.player-token.token-sprite-cat {
  background-image: url("assets/character-tokens/cat.png") !important;
}

.player-token.token-sprite-dog {
  background-image: url("assets/character-tokens/dog.png") !important;
}

.player-token.token-sprite-car {
  background-image: url("assets/character-tokens/car.png") !important;
}

.player-token.token-sprite-tree {
  background-image: url("assets/character-tokens/tree.png") !important;
}

@media (max-width: 760px) {
  .player-token.token-sprite {
    top: 0.18rem !important;
    right: 0.18rem !important;
    width: 1.35rem !important;
    height: 1.55rem !important;
  }
}

.cell-changed {
  animation: cell-pop 0.46s ease-out;
}

.reaction-positive .island-grid {
  animation: grid-good-pulse 0.75s ease-out;
}

.reaction-negative .island-grid {
  animation: grid-bad-shake 0.55s ease-out;
}

.mode-picker,
.character-picker,
.island-picker,
.round-options {
  display: block;
}

.carousel-shell {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}

.carousel-card {
  min-height: 180px;
  width: 100%;
  justify-content: center;
  text-align: center;
  animation: carousel-card-in 0.28s ease-out;
}

.island-world-card {
  display: grid;
  gap: var(--space-4);
  min-height: 560px;
  padding: clamp(1rem, 2.4vw, 1.5rem);
  text-align: left;
  border: 2px solid rgba(59, 130, 246, 0.14);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.98)),
    var(--bg-elevated);
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.14);
  transform-origin: center;
  animation: island-card-swap 0.34s ease-out;
}

.island-world-card.selected {
  border-color: rgba(59, 130, 246, 0.52);
  box-shadow: 0 26px 52px rgba(59, 130, 246, 0.18);
}

.island-world-grassland {
  background:
    linear-gradient(180deg, rgba(236, 253, 245, 0.9), rgba(255, 255, 255, 0.98)),
    var(--bg-elevated);
}

.island-world-desert {
  background:
    linear-gradient(180deg, rgba(254, 243, 199, 0.88), rgba(255, 255, 255, 0.98)),
    var(--bg-elevated);
}

.island-world-volcanic {
  background:
    linear-gradient(180deg, rgba(254, 226, 226, 0.78), rgba(255, 255, 255, 0.98)),
    var(--bg-elevated);
}

.island-preview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 0;
  min-height: 145px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 3px solid rgba(15, 23, 42, 0.14);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.28);
  image-rendering: pixelated;
}

.island-preview span {
  position: relative;
  min-height: 34px;
  image-rendering: pixelated;
}

.island-preview-grassland span {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.12) 0 18%, transparent 18%),
    #5fbf52;
  background-size: 12px 12px;
}

.island-preview-grassland span:nth-child(3n)::after,
.island-preview-grassland span:nth-child(7)::after {
  content: "";
  position: absolute;
  left: 28%;
  bottom: 10%;
  width: 46%;
  height: 68%;
  background:
    linear-gradient(90deg, transparent 42%, #7c4a26 42% 58%, transparent 58%),
    linear-gradient(90deg, transparent 14%, #15803d 14% 86%, transparent 86%),
    linear-gradient(0deg, transparent 38%, #22c55e 38% 86%, transparent 86%);
  background-size: 100% 100%, 100% 58%, 78% 100%;
  background-position: center bottom, center 18%, center 0;
  background-repeat: no-repeat;
}

.island-preview-desert span {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.16) 0 16%, transparent 16%),
    #d9b36f;
  background-size: 12px 12px;
}

.island-preview-desert span:nth-child(4n)::after,
.island-preview-desert span:nth-child(6)::after {
  content: "";
  position: absolute;
  inset: 18%;
  background:
    linear-gradient(135deg, transparent 0 42%, rgba(69, 26, 3, 0.52) 42% 48%, transparent 48%),
    linear-gradient(45deg, transparent 0 58%, rgba(69, 26, 3, 0.38) 58% 63%, transparent 63%);
}

.island-preview-volcanic span {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.08) 0 14%, transparent 14%),
    #44403c;
  background-size: 12px 12px;
}

.island-preview-volcanic span:nth-child(2n)::after,
.island-preview-volcanic span:nth-child(11)::after {
  content: "";
  position: absolute;
  inset: 34% 0;
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.45);
}

.island-card-header {
  display: grid;
  gap: var(--space-2);
}

.island-card-header strong {
  color: var(--text-primary);
  font-size: clamp(1.45rem, 4vw, 2rem);
  font-weight: var(--weight-extrabold);
  line-height: 1;
}

.island-card-header em {
  color: var(--text-secondary);
  font-style: normal;
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}

.difficulty-badge {
  width: fit-content;
  padding: 0.42rem 0.72rem;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.difficulty-beginner {
  background: #dcfce7;
  border-color: rgba(34, 197, 94, 0.35);
}

.difficulty-medium {
  background: #fef3c7;
  border-color: rgba(245, 158, 11, 0.38);
}

.difficulty-hard {
  background: #fee2e2;
  border-color: rgba(239, 68, 68, 0.38);
}

.island-card-description {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: 1.45;
}

.island-stat-preview {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.island-stat-preview span {
  padding: 0.52rem 0.68rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

.money-chip {
  color: #8a6d00;
}

.environment-chip {
  color: #15803d;
}

.trust-chip {
  color: #1d4ed8;
}

.island-card-info-grid {
  display: grid;
  gap: var(--space-3);
}

.island-card-info-grid section {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.island-card-info-grid span {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.island-card-info-grid strong {
  color: var(--text-primary);
  font-size: var(--text-sm);
  line-height: 1.35;
}

.island-overview-card {
  margin-top: var(--space-4);
  opacity: 0.94;
}

.compact-world-summary {
  grid-template-columns: 1fr;
}

.carousel-arrow {
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.carousel-arrow:hover,
.carousel-arrow:focus-visible {
  border-color: var(--button-primary);
  transform: translateY(-1px);
}

.carousel-dots {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: var(--space-2);
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--border);
}

.carousel-dot.active {
  width: 22px;
  background: var(--button-primary);
}

.locked-badge {
  display: inline-flex;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  margin: var(--space-2) auto 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.character-option.locked {
  opacity: 1;
  filter: grayscale(0.18);
}

.character-option.locked .character-icon {
  opacity: 0.72;
}

.island-visual {
  position: relative;
  display: grid;
  align-content: end;
  min-height: 210px;
  overflow: hidden;
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #e0f2fe 0%, #fef3c7 52%, #d6b06f 100%);
  transition: opacity 0.5s ease, transform 0.5s ease, filter 0.55s ease, background 0.55s ease, border-color 0.3s ease;
}

.island-visual > div {
  position: absolute;
  inset: 0;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.island-terrain {
  background:
    radial-gradient(circle at 25% 68%, rgba(120, 83, 40, 0.22), transparent 18%),
    radial-gradient(circle at 72% 70%, rgba(80, 120, 70, 0.18), transparent 20%);
}

.island-cracks {
  opacity: 0;
  background:
    linear-gradient(35deg, transparent 0 44%, rgba(91, 55, 24, 0.42) 45% 46%, transparent 47% 100%),
    linear-gradient(125deg, transparent 0 55%, rgba(91, 55, 24, 0.34) 56% 57%, transparent 58% 100%);
}

.island-water {
  opacity: 0.15;
  background: radial-gradient(ellipse at 50% 78%, rgba(59, 130, 246, 0.72), transparent 28%);
  animation: water-shimmer 3.8s ease-in-out infinite;
}

.island-grass {
  opacity: 0;
  transform: scale(0.5);
  transform-origin: center bottom;
  animation: grass-sway 2.8s ease-in-out infinite;
}

.grass-a {
  background: radial-gradient(circle at 30% 65%, rgba(34, 197, 94, 0.78), transparent 10%);
}

.grass-b {
  background: radial-gradient(circle at 56% 56%, rgba(34, 197, 94, 0.72), transparent 12%);
  animation-delay: 0.35s;
}

.grass-c {
  background: radial-gradient(circle at 74% 68%, rgba(22, 163, 74, 0.72), transparent 11%);
  animation-delay: 0.7s;
}

.island-tree {
  position: absolute;
  width: 28px;
  height: 42px;
  opacity: 0;
  transform: translateY(10px) scale(0.2);
  transform-origin: center bottom;
  transition: opacity 0.45s ease, transform 0.55s cubic-bezier(0.2, 1.45, 0.4, 1);
}

.island-tree::before,
.island-tree::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.island-tree::before {
  bottom: 0;
  width: 5px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: #7c4a26;
}

.island-tree::after {
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: inset 0 -5px 0 rgba(21, 128, 61, 0.25);
  animation: tree-sway 3.2s ease-in-out infinite;
}

.tree-a {
  left: 25%;
  top: 38%;
}

.tree-b {
  left: 58%;
  top: 30%;
  transition-delay: 0.1s;
}

.tree-c {
  left: 72%;
  top: 48%;
  transition-delay: 0.2s;
}

.island-building {
  position: absolute;
  bottom: 22%;
  width: 34px;
  height: 28px;
  border-radius: 6px 6px 3px 3px;
  opacity: 0;
  transform: translateY(10px);
  background: #f8fafc;
  border: 2px solid rgba(15, 23, 42, 0.16);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.island-building::before {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: -10px;
  height: 10px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: #e6b800;
}

.building-a {
  left: 16%;
}

.building-b {
  right: 17%;
}

.island-person {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  opacity: 0;
  background: #3b82f6;
  box-shadow: 0 7px 0 rgba(59, 130, 246, 0.55);
}

.person-a {
  left: 30%;
  top: 62%;
  animation: person-walk-a 8s linear infinite;
}

.person-b {
  left: 62%;
  top: 62%;
  animation: person-walk-b 9s linear infinite;
}

.person-c {
  left: 46%;
  top: 50%;
  animation: person-walk-c 11s linear infinite;
}

.island-birds {
  opacity: 0;
  background:
    radial-gradient(circle at 35% 22%, rgba(15, 23, 42, 0.45) 0 2px, transparent 3px),
    radial-gradient(circle at 52% 18%, rgba(15, 23, 42, 0.45) 0 2px, transparent 3px),
    radial-gradient(circle at 68% 24%, rgba(15, 23, 42, 0.45) 0 2px, transparent 3px);
  animation: birds-drift 7s ease-in-out infinite;
}

.island-dust {
  opacity: 0;
  background:
    radial-gradient(circle at 20% 64%, rgba(202, 138, 4, 0.32), transparent 6%),
    radial-gradient(circle at 74% 70%, rgba(202, 138, 4, 0.28), transparent 8%),
    radial-gradient(circle at 48% 76%, rgba(202, 138, 4, 0.24), transparent 7%);
  animation: dust-float 4s ease-in-out infinite;
}

.island-wildlife {
  opacity: 0;
  background:
    radial-gradient(circle at 38% 38%, rgba(15, 23, 42, 0.5) 0 2px, transparent 3px),
    radial-gradient(circle at 68% 36%, rgba(15, 23, 42, 0.5) 0 2px, transparent 3px);
}

.island-feedback-overlay {
  opacity: 0;
  background: transparent;
  pointer-events: none;
}

.island-visual strong,
.island-visual span {
  position: relative;
  z-index: 1;
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.82);
  color: #0f172a;
}

.island-visual.active .island-stage-message {
  display: none;
}

.island-visual strong {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

.island-visual span {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: #334155;
}

.stage-dead,
.stage-cracked {
  background: linear-gradient(180deg, #d6c0a3 0%, #b88b56 62%, #7c4a26 100%);
}

.stage-dead .island-water,
.stage-cracked .island-water,
.stage-dead .island-grass {
  opacity: 0;
}

.env-critical,
.combo-depleted {
  filter: saturate(0.52) brightness(0.9);
}

.env-critical .island-cracks,
.env-damaged .island-cracks {
  opacity: 0.8;
}

.env-critical .island-dust,
.env-damaged .island-dust {
  opacity: 0.82;
}

.stage-small-life .grass-a,
.stage-recovery .grass-a {
  --growth-scale: 0.68;
  opacity: 0.32;
}

.stage-grass .grass-a,
.stage-grass .grass-b,
.stage-growing .grass-a,
.stage-growing .grass-b {
  --growth-scale: 0.86;
  opacity: 0.56;
}

.stage-lush .island-grass,
.stage-paradise .island-grass,
.combo-thriving .island-grass {
  --growth-scale: 1.04;
  opacity: 0.82;
}

.stage-grass .tree-a {
  opacity: 0.75;
  transform: translateY(0) scale(0.42);
}

.stage-growing .tree-a,
.stage-growing .tree-b {
  opacity: 0.9;
  transform: translateY(0) scale(0.72);
}

.stage-lush .island-tree,
.stage-paradise .island-tree,
.combo-thriving .island-tree {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.budget-mid .building-a,
.budget-high .island-building {
  opacity: 1;
  transform: translateY(0);
  animation: build-rise 0.55s ease-out;
}

.budget-low .building-a {
  opacity: 0.55;
  transform: translateY(2px);
}

.budget-debt .island-building {
  opacity: 0.24;
  filter: grayscale(0.65);
}

.trust-mid .person-a,
.trust-high .person-a,
.trust-high .person-b,
.trust-high .person-c,
.combo-thriving .island-person {
  opacity: 1;
}

.trust-low .person-a {
  opacity: 0.42;
}

.trust-broken .island-person {
  opacity: 0;
}

.stage-lush .island-water,
.stage-paradise .island-water {
  opacity: 0.52;
}

.stage-grass .island-water {
  opacity: 0.24;
  transform: scale(0.78);
}

.stage-growing .island-water {
  opacity: 0.38;
  transform: scale(0.92);
}

.stage-paradise .island-wildlife {
  opacity: 1;
}

.stage-paradise .island-birds,
.combo-thriving .island-birds {
  opacity: 1;
}

.reaction-positive {
  animation: island-positive-pulse 0.65s ease-out;
}

.reaction-negative {
  animation: island-negative-shake 0.42s ease-out;
}

.reaction-positive .island-feedback-overlay {
  animation: positive-glow 0.75s ease-out;
}

.reaction-negative .island-feedback-overlay {
  animation: negative-flash 0.65s ease-out;
}

@keyframes carousel-card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes island-card-swap {
  from {
    opacity: 0;
    transform: translateX(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes grass-sway {
  0%, 100% { transform: translateX(0) scale(var(--growth-scale, 1)); }
  50% { transform: translateX(2px) scale(var(--growth-scale, 1)); }
}

@keyframes tree-sway {
  0%, 100% { transform: translateX(-50%) rotate(-1deg); }
  50% { transform: translateX(-50%) rotate(2deg); }
}

@keyframes water-shimmer {
  0%, 100% { filter: brightness(1); transform: scale(0.96); }
  50% { filter: brightness(1.18); transform: scale(1.02); }
}

@keyframes build-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes dust-float {
  0%, 100% { transform: translateX(0) translateY(0); }
  50% { transform: translateX(6px) translateY(-4px); }
}

@keyframes birds-drift {
  0%, 100% { transform: translateX(-8px); }
  50% { transform: translateX(10px) translateY(-3px); }
}

@keyframes person-walk-a {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(48px, -14px); }
}

@keyframes person-walk-b {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-52px, 12px); }
}

@keyframes person-walk-c {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(28px, 22px); }
}

@keyframes island-positive-pulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

@keyframes island-negative-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

@keyframes positive-glow {
  0% { opacity: 0; background: rgba(34, 197, 94, 0); }
  35% { opacity: 1; background: rgba(34, 197, 94, 0.16); }
  100% { opacity: 0; background: rgba(34, 197, 94, 0); }
}

@keyframes negative-flash {
  0% { opacity: 0; background: rgba(239, 68, 68, 0); }
  35% { opacity: 1; background: rgba(239, 68, 68, 0.12); }
  100% { opacity: 0; background: rgba(239, 68, 68, 0); }
}

@keyframes tile-effect-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.92);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.03);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -22px) scale(1);
  }
}

@keyframes tile-glow-start {
  0% { box-shadow: 0 0 0 0 rgba(230, 184, 0, 0); }
  40% { box-shadow: 0 0 0 7px rgba(230, 184, 0, 0.3), 0 12px 26px rgba(230, 184, 0, 0.2); }
  100% { box-shadow: 0 0 0 0 rgba(230, 184, 0, 0); }
}

@keyframes tile-pulse-community {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
  45% { box-shadow: 0 0 0 7px rgba(59, 130, 246, 0.24), 0 10px 24px rgba(59, 130, 246, 0.16); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

@keyframes tile-pulse-environment {
  0% { filter: saturate(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
  45% { filter: saturate(1.25) sepia(0.12); box-shadow: 0 0 0 7px rgba(34, 197, 94, 0.22), 0 10px 24px rgba(120, 83, 45, 0.14); }
  100% { filter: saturate(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@keyframes tile-warning-shake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-3px); box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.18); }
  36% { transform: translateX(3px); }
  54% { transform: translateX(-2px); }
  72% { transform: translateX(2px); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes tile-teleport-flash {
  0% { opacity: 1; transform: scale(1); }
  35% { opacity: 0.62; transform: scale(0.94); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.2); }
  100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes token-step-pop {
  0% { transform: translateY(4px) scale(0.92); }
  62% { transform: translateY(-3px) scale(1.06); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes cell-pop {
  0% { transform: scale(0.72); opacity: 0.45; }
  62% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes water-shimmer {
  from { background-position: 0 0; }
  to { background-position: 12px 0; }
}

@keyframes lava-flicker {
  0%, 100% { filter: brightness(1) saturate(1); }
  50% { filter: brightness(1.18) saturate(1.22); }
}

@keyframes person-wander {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(2px, -1px); }
}

@keyframes grid-good-pulse {
  0% { filter: saturate(1); }
  45% { filter: saturate(1.32) brightness(1.08); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.18), 0 14px 28px rgba(15, 23, 42, 0.16); }
  100% { filter: saturate(1); }
}

@keyframes grid-bad-shake {
  0%, 100% { transform: translateX(0); filter: saturate(1); }
  25% { transform: translateX(-3px); filter: saturate(0.72); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

.island-visual .island-grid {
  inset: 9% 9% 17%;
}

body[data-theme="light"] .year-modal .modal-card,
body[data-theme="light"] .year-card,
body[data-theme="light"] .year-card .year-stats,
body[data-theme="light"] .year-card .year-insights,
body[data-theme="light"] .year-card .year-planning-notes,
body[data-theme="light"] .year-card .year-event-note,
body[data-theme="light"] .year-card .year-reflection,
body[data-theme="light"] .rules-screen .rules-summary-card,
body[data-theme="light"] .rules-screen .rules-info-card,
body[data-theme="light"] .rules-screen .ready-stat {
  background: var(--bg-elevated) !important;
  background-image: none !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08) !important;
}

body[data-theme="light"] .year-card .year-stats > div,
body[data-theme="light"] .year-card .year-insights,
body[data-theme="light"] .year-card .year-planning-notes,
body[data-theme="light"] .year-card .year-event-note,
body[data-theme="light"] .year-card .year-reflection,
body[data-theme="light"] .rules-screen .ready-stat {
  background: var(--bg-soft) !important;
  background-image: none !important;
}

body[data-theme="light"] .year-card span,
body[data-theme="light"] .year-card p,
body[data-theme="light"] .rules-screen .rules-summary-card p,
body[data-theme="light"] .rules-screen .rules-info-card p,
body[data-theme="light"] .rules-screen .ready-stat span {
  color: var(--text-secondary) !important;
}

body[data-theme="light"] .year-card h3,
body[data-theme="light"] .year-card strong,
body[data-theme="light"] .rules-screen .rules-summary-card strong,
body[data-theme="light"] .rules-screen .rules-info-card h3,
body[data-theme="light"] .rules-screen .ready-stat strong {
  color: var(--text-primary) !important;
}

/* Final polish pass: keep the board, setup flow, and modals readable across small screens. */
html,
body {
  width: 100%;
  overflow-x: hidden;
}

.app-shell {
  overflow-x: hidden;
  overflow-y: auto;
}

.screen {
  min-height: 100dvh;
}

.home-card,
.start-card,
.end-card,
.modal-card {
  max-width: calc(100vw - 2rem);
}

.primary-button,
.secondary-button,
.decision-button,
.round-option,
.settings-choice,
.carousel-arrow {
  min-height: 44px;
  overflow-wrap: anywhere;
}

.space {
  min-width: 0 !important;
  min-height: 0 !important;
}

.space-name,
.space-badge,
.hud-pill span,
.hud-pill strong,
.hud-condition,
.character-title,
.character-copy,
.character-bonus-chip,
.rules-summary-card strong,
.mode-detail-grid strong {
  overflow-wrap: anywhere;
}

.space-name {
  hyphens: auto;
}

.gameplay-hud,
.hud-group,
.home-actions,
.setup-actions,
.end-actions,
.card-choices {
  min-width: 0;
}

.board-panel {
  width: min(100%, 1080px);
}

.board {
  width: min(100%, 72dvh, 860px);
}

@media (max-width: 760px) {
  .screen {
    padding: 0.75rem;
  }

  .home-card,
  .start-card,
  .end-card,
  .modal-card {
    max-width: calc(100vw - 1.5rem);
    padding: 1rem !important;
    border-radius: 18px !important;
  }

  .setup-actions,
  .home-actions,
  .end-actions,
  .card-choices {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .setup-actions .primary-button,
  .setup-actions .secondary-button,
  .home-actions .primary-button,
  .home-actions .secondary-button,
  .end-actions .primary-button,
  .end-actions .secondary-button,
  .card-choices .decision-button {
    width: 100%;
  }

  .game-header {
    margin-bottom: 0.35rem;
  }

  .game-header h2 {
    margin-bottom: 0;
    font-size: 1.25rem;
  }

  .gameplay-hud {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 0.45rem !important;
  }

  .hud-group {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .hud-actions {
    justify-content: stretch;
  }

  .hud-pill,
  .hud-dice,
  .hud-roll-button {
    width: 100%;
    min-width: 0 !important;
  }

  .hud-roll-button,
  .hud-dice {
    grid-column: 1 / -1;
  }

  .board-panel {
    width: 100%;
    min-height: auto;
    padding: 0.55rem !important;
    border-radius: 16px !important;
  }

  .board {
    width: min(100%, 92vw, 76dvh);
    max-height: none;
  }

  .space {
    padding: 0.28rem !important;
    border-width: 1px !important;
    border-radius: 10px !important;
  }

  .space.corner {
    border-radius: 14px !important;
  }

  .space-name {
    font-size: 0.58rem !important;
    line-height: 1.05 !important;
    -webkit-line-clamp: 2;
  }

  .space-index,
  .space-badge {
    font-size: 0.48rem !important;
  }

  .space-badge {
    padding: 0.18rem 0.3rem !important;
  }

  .board-center {
    padding: 0.45rem !important;
    border-radius: 14px !important;
  }

  .center-insert,
  .board-center .center-insert {
    min-height: 0 !important;
  }

  .island-grid {
    inset: 8% 8% 14% !important;
    border-radius: 8px !important;
  }

  .island-stage-label {
    font-size: 0.62rem !important;
  }

  .modal {
    padding: 0.75rem;
    align-items: flex-start;
    overflow-y: auto;
  }

  .decision-card,
  .year-card,
  .loan-card,
  .investment-card {
    width: 100%;
    max-height: calc(100dvh - 1.5rem);
    overflow-y: auto;
  }

  .rules-summary-grid,
  .rules-layout,
  .mode-detail-grid {
    grid-template-columns: 1fr !important;
  }

  .character-sprite {
    width: 4rem;
    height: 4.4rem;
  }
}

@media (max-width: 430px) {
  .hud-group {
    grid-template-columns: 1fr;
  }

  .space-name {
    font-size: 0.52rem !important;
  }

  .space-badge {
    display: none;
  }

  .player-token.token-sprite {
    width: 1.1rem !important;
    height: 1.3rem !important;
  }
}

/* Board safety layer: prevent responsive/theme cleanup from collapsing the game board. */
.game-screen.active .game-layout {
  display: grid !important;
}

.game-screen.active .board-panel {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: min(100%, 1080px) !important;
  min-height: clamp(360px, 68dvh, 820px) !important;
  margin-inline: auto !important;
}

.game-screen.active .board {
  display: block !important;
  position: relative !important;
  width: min(100%, 68dvh, 820px) !important;
  min-width: min(100%, 320px) !important;
  max-width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  flex: 0 0 auto !important;
}

.game-screen.active .board-center {
  display: flex !important;
}

@media (max-width: 760px) {
  .game-screen.active .board-panel {
    min-height: min(92vw, 560px) !important;
    padding: 0.5rem !important;
  }

  .game-screen.active .board {
    width: min(100%, 90vw, 560px) !important;
    min-width: min(100%, 280px) !important;
  }
}

@media (max-width: 360px) {
  .game-screen.active .board {
    min-width: min(100%, 250px) !important;
  }
}

/* Pixel map safety layer: keep terrain art visible after theme/mobile overrides. */
.game-screen.active .island-grid {
  display: grid !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.game-screen.active .island-cell {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
}

.game-screen.active .island-theme-grassland .terrain-grass,
.game-screen.active .island-theme-grassland .terrain-grassland-healthy {
  background:
    url("assets/grassland-tiles/grass.png") center / cover no-repeat,
    #68b64a !important;
}

.game-screen.active .island-theme-grassland .terrain-grassland-thriving,
.game-screen.active .island-theme-grassland .terrain-lush {
  background:
    linear-gradient(rgba(111, 211, 61, 0.18), rgba(111, 211, 61, 0.18)),
    url("assets/grassland-tiles/grass.png") center / cover no-repeat,
    #7bd256 !important;
}

.game-screen.active .island-theme-grassland .terrain-grassland-struggling,
.game-screen.active .island-theme-grassland .terrain-dull-grass {
  background:
    linear-gradient(rgba(136, 102, 44, 0.44), rgba(136, 102, 44, 0.44)),
    url("assets/grassland-tiles/grass.png") center / cover no-repeat,
    #8e8b3d !important;
}

.game-screen.active .island-theme-grassland .terrain-grassland-dead,
.game-screen.active .island-theme-grassland .terrain-dirt,
.game-screen.active .island-theme-grassland .terrain-dirt-path {
  background:
    url("assets/grassland-tiles/dirt-path.png") center / cover no-repeat,
    #9a6a3b !important;
}

.game-screen.active .island-theme-grassland .terrain-water,
.game-screen.active .island-theme-grassland .terrain-shallow-water {
  background:
    url("assets/grassland-tiles/water.png") center / cover no-repeat,
    #22a7c9 !important;
}

.game-screen.active .island-theme-grassland .terrain-rock,
.game-screen.active .island-theme-grassland .terrain-cliff-edge {
  background:
    url("assets/grassland-tiles/stone.png") center / cover no-repeat,
    #7c8589 !important;
}

.game-screen.active .island-theme-desert .terrain-sand {
  background:
    url("assets/desert-tiles/sand.png") center / cover no-repeat,
    #d9b36f !important;
}

.game-screen.active .island-theme-desert .terrain-dirt,
.game-screen.active .island-theme-desert .terrain-dirt-path {
  background:
    url("assets/desert-tiles/dirt-path.png") center / cover no-repeat,
    #b98243 !important;
}

.game-screen.active .island-theme-desert .terrain-water,
.game-screen.active .island-theme-desert .terrain-shallow-water {
  background:
    url("assets/desert-tiles/oasis.png") center / cover no-repeat,
    #22a7c9 !important;
}

.game-screen.active .island-theme-desert .terrain-rock,
.game-screen.active .island-theme-desert .terrain-cliff-edge {
  background:
    url("assets/desert-tiles/stone.png") center / cover no-repeat,
    #8b6a3a !important;
}

.game-screen.active .island-theme-volcanic .terrain-ash {
  background:
    url("assets/volcanic-tiles/ash.png") center / cover no-repeat,
    #78716c !important;
}

.game-screen.active .island-theme-volcanic .terrain-basalt,
.game-screen.active .island-theme-volcanic .terrain-basalt-lush {
  background:
    url("assets/volcanic-tiles/basalt.png") center / cover no-repeat,
    #44403c !important;
}

.game-screen.active .island-theme-volcanic .terrain-lava {
  background:
    url("assets/volcanic-tiles/lava.png") center / cover no-repeat,
    #3f1d14 !important;
}

.game-screen.active .island-theme-volcanic .terrain-rock,
.game-screen.active .island-theme-volcanic .terrain-cliff-edge {
  background:
    url("assets/volcanic-tiles/stone.png") center / cover no-repeat,
    #57534e !important;
}

.game-screen.active .island-cell::after {
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
}

.game-screen.active .island-theme-grassland .object-tree::after {
  background-image: url("assets/grassland-tiles/tree.png") !important;
}

.game-screen.active .island-theme-grassland .object-house::after,
.game-screen.active .island-theme-grassland .object-townhall::after {
  background-image: url("assets/grassland-tiles/house.png") !important;
}

.game-screen.active .island-theme-grassland .object-market::after {
  background-image: url("assets/grassland-tiles/market.png") !important;
}

.game-screen.active .island-theme-grassland .object-bush::after,
.game-screen.active .island-theme-grassland .object-flower::after {
  background-image: url("assets/grassland-tiles/bush.png") !important;
}

.game-screen.active .island-theme-desert .object-tree::after {
  background-image: url("assets/desert-tiles/palm.png") !important;
}

.game-screen.active .island-theme-desert .object-shelter::after {
  background-image: url("assets/desert-tiles/shelter.png") !important;
}

.game-screen.active .island-theme-desert .object-market::after {
  background-image: url("assets/desert-tiles/market.png") !important;
}

.game-screen.active .island-theme-desert .object-bush::after,
.game-screen.active .island-theme-desert .object-flower::after {
  background-image: url("assets/desert-tiles/plant.png") !important;
}

.game-screen.active .island-theme-volcanic .object-tree::after {
  background-image: url("assets/volcanic-tiles/tree.png") !important;
}

.game-screen.active .island-theme-volcanic .object-shelter::after {
  background-image: url("assets/volcanic-tiles/shelter.png") !important;
}

.game-screen.active .island-theme-volcanic .object-market::after {
  background-image: url("assets/volcanic-tiles/market.png") !important;
}

.game-screen.active .island-theme-volcanic .object-bush::after,
.game-screen.active .island-theme-volcanic .object-flower::after {
  background-image: url("assets/volcanic-tiles/shrub.png") !important;
}

@keyframes screen-fade-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modal-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes decision-card-enter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes decision-card-settle {
  0% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-1px) scale(1.008);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 760px) {
  .screen {
    padding: var(--space-3);
  }

  .home-card,
  .start-card,
  .end-card,
  .decision-card,
  .loan-card,
  .investment-card,
  .year-card {
    padding: var(--space-4);
  }

  .home-actions,
  .setup-actions,
  .end-actions {
    gap: var(--space-3);
  }

  .gameplay-hud {
    padding: var(--space-3) !important;
  }

  .hud-group {
    gap: var(--space-2);
  }

  .hud-pill {
    min-width: 0;
    padding: var(--space-3);
  }

  .decision-card {
    width: min(95vw, 680px);
  }

  .decision-button,
  .primary-button,
  .secondary-button,
  .round-option {
    min-height: 52px;
  }
}

/* Final summary readability guard: keep year and ending text on clear surfaces across themes. */
.year-card,
.end-card {
  background: var(--bg-elevated) !important;
  background-image: none !important;
  color: var(--text-primary) !important;
}

.year-card .year-stats > div,
.year-card .year-insights,
.year-card .year-planning-notes,
.year-card #year-event-note,
.year-card #year-reflection,
.end-card .end-stats > div,
.end-card .end-breakdown > div,
.end-card .end-planning-summary,
.end-card .education-copy {
  background: var(--bg-soft) !important;
  background-image: none !important;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}

.year-card #year-summary,
.year-card .year-insights strong,
.year-card .year-stats strong,
.year-card #year-title,
.end-card #ending-title,
.end-card #strategy-summary,
.end-card .end-stats strong,
.end-card .end-breakdown strong,
.end-card .end-planning-summary strong {
  color: var(--text-primary) !important;
}

.year-card .eyebrow,
.end-card .eyebrow,
.year-card .year-stats span,
.year-card .year-insights p,
.end-card .performance-summary,
.end-card #education-summary,
.end-card .reflection-line,
.end-card .end-breakdown span {
  color: var(--text-secondary) !important;
}

/* Gameplay center cleanup: once the intro fades, let the island visual fill the board center. */
.center-intro.fading-out {
  display: none !important;
}

.center-intro.fading-out + .island-visual.active {
  min-height: 100% !important;
  height: 100% !important;
}

.game-screen.active .board-center .center-insert {
  grid-template-rows: 1fr !important;
  min-height: 0 !important;
}

.game-screen.active .island-visual.active {
  width: 100%;
  min-height: 100% !important;
  height: 100%;
  align-content: center !important;
  padding: clamp(0.45rem, 1vw, 0.8rem) !important;
}
