:root {
  color-scheme: dark;
  --bg: #0a0612;
  --panel-bg: #0e0810;
  --panel-surface: rgba(255, 255, 255, 0.03);
  --panel-ink: #fff3cf;
  --ink: #fff3cf;
  --muted: #e8c9a8;
  --muted-soft: rgba(232, 201, 168, 0.88);
  --text-body: #f5e6d0;
  --line: #2a1418;
  --line-soft: rgba(158, 231, 241, 0.1);
  --accent: #9ee7f1;
  --accent-warm: #ffe07a;
  --mars: #c46a4a;
  --bad: #d85f45;
}

@font-face {
  font-family: "Kenney Pixel";
  src: url("assets/ref/assets/Fonts/Kenney Pixel.ttf") format("truetype");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse at 15% 10%, rgba(158, 231, 241, 0.08), transparent 40%),
    radial-gradient(ellipse at 85% 20%, rgba(255, 224, 122, 0.06), transparent 35%),
    radial-gradient(ellipse at 50% 100%, rgba(196, 106, 74, 0.15), transparent 50%),
    linear-gradient(180deg, #0a0612 0%, #140810 45%, #1a0c10 100%);
  color: var(--ink);
  font-family: "Kenney Pixel", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.game-shell {
  width: min(1480px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(400px, 34vw);
  align-items: stretch;
  border: 4px solid var(--line);
  box-shadow:
    0 0 0 2px rgba(158, 231, 241, 0.12),
    0 10px 0 #0a0608,
    0 22px 50px rgba(0, 0, 0, 0.55);
  background: var(--bg);
}

.play-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line-soft);
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  line-height: 0;
  border: none;
  background: #0a0612;
  box-shadow: none;
  overflow: hidden;
}

.music-toggle {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0));
  left: max(10px, env(safe-area-inset-left, 0));
  z-index: 12;
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 10px;
  border: 2px solid #2a1418;
  border-radius: 0;
  background: rgba(20, 8, 12, 0.92);
  color: var(--accent-warm);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 0 10px rgba(255, 224, 122, 0.18);
}

.music-toggle:hover {
  background: rgba(36, 14, 20, 0.96);
  box-shadow: 0 0 14px rgba(255, 224, 122, 0.28);
}

.music-toggle:active {
  transform: scale(0.96);
}

.music-toggle.music-muted {
  color: #9a8a7a;
  box-shadow: none;
}

.mobile-phantom-banner {
  position: absolute;
  left: max(10px, env(safe-area-inset-left, 0));
  right: max(10px, env(safe-area-inset-right, 0));
  bottom: max(12px, env(safe-area-inset-bottom, 0));
  z-index: 14;
  padding: 10px 12px;
  border: 2px solid rgba(255, 224, 122, 0.45);
  background: rgba(10, 6, 18, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.mobile-phantom-banner.hidden {
  display: none;
}

.mobile-phantom-text {
  margin: 0 0 8px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted-soft);
}

.mobile-phantom-btn {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid rgba(255, 224, 122, 0.55);
  background: linear-gradient(180deg, rgba(196, 106, 74, 0.35), rgba(20, 8, 12, 0.95));
  color: var(--accent-warm);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  touch-action: manipulation;
}

body.mobile-phantom-hint.mobile-layout .mobile-controls {
  bottom: max(118px, calc(98px + env(safe-area-inset-bottom, 0)));
}

body.mobile-phantom-hint.mobile-layout .toast {
  bottom: max(196px, calc(176px + env(safe-area-inset-bottom, 0)));
}

.wallet-btn-phantom {
  border-color: rgba(255, 224, 122, 0.55);
  background: linear-gradient(180deg, rgba(196, 106, 74, 0.28), rgba(20, 8, 12, 0.95));
}

.resource-dock {
  flex: 0 0 auto;
  border-top: 3px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 120, 40, 0.06) 0%, transparent 28%),
    linear-gradient(0deg, #0a0612 0%, #120810 100%);
  box-shadow: inset 0 1px 0 rgba(158, 231, 241, 0.08);
}

.resource-dock-inner {
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resource-primary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.resource-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px 10px;
  border: 2px solid #2a1418;
  background: rgba(20, 8, 12, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 3px 0 rgba(0, 0, 0, 0.35);
}

.resource-orb-pill {
  border-color: rgba(255, 210, 92, 0.45);
  background: linear-gradient(135deg, rgba(255, 210, 92, 0.12), rgba(20, 8, 12, 0.92));
}

.resource-crop-pill {
  border-color: rgba(168, 224, 109, 0.4);
  background: linear-gradient(135deg, rgba(168, 224, 109, 0.1), rgba(20, 8, 12, 0.92));
}

.resource-energy-pill {
  border-color: rgba(158, 231, 241, 0.35);
  background: linear-gradient(135deg, rgba(158, 231, 241, 0.08), rgba(20, 8, 12, 0.92));
}

.resource-pill-icon {
  font-size: 22px;
  line-height: 1;
  width: 28px;
  text-align: center;
  filter: drop-shadow(0 0 6px rgba(255, 224, 122, 0.35));
}

.resource-pill-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.resource-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-soft);
}

.resource-value {
  font-size: clamp(18px, 2.2vw, 22px);
  color: var(--accent-warm);
  line-height: 1.1;
  font-weight: normal;
}

.resource-crop-pill .resource-value {
  color: #d8ffb0;
}

.resource-energy-pill .resource-value {
  color: var(--accent);
  font-size: clamp(15px, 1.8vw, 18px);
}

.resource-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.resource-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid rgba(158, 231, 241, 0.18);
  background: rgba(0, 0, 0, 0.35);
  font-size: 12px;
  color: var(--text-body);
}

.resource-chip b {
  color: var(--accent-warm);
  font-weight: normal;
}

/* Boot / loading screen */
.boot-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(158, 231, 241, 0.12), transparent 55%),
    radial-gradient(ellipse at 50% 80%, rgba(196, 106, 74, 0.18), transparent 50%),
    linear-gradient(180deg, #06040c 0%, #0a0612 40%, #140810 100%);
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.boot-screen.boot-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-screen.boot-intro {
  background: #000;
  padding: 0;
}

.intro-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  transition: opacity 0.45s ease;
}

.boot-screen.intro-finished .intro-video {
  opacity: 0;
}

.intro-video-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.intro-skip-btn {
  pointer-events: auto;
  position: absolute;
  top: max(12px, env(safe-area-inset-top, 0));
  right: max(12px, env(safe-area-inset-right, 0));
  padding: 8px 14px;
  border: 2px solid rgba(255, 224, 122, 0.45);
  background: rgba(10, 6, 18, 0.72);
  color: var(--accent-warm);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  backdrop-filter: blur(4px);
}

.intro-skip-btn:hover {
  background: rgba(20, 10, 18, 0.9);
  border-color: rgba(255, 224, 122, 0.7);
}

.intro-loading-hint {
  position: absolute;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom, 0));
  transform: translateX(-50%);
  width: min(320px, 88vw);
  text-align: center;
  padding: 12px 14px;
  border: 2px solid rgba(158, 231, 241, 0.25);
  background: rgba(6, 4, 12, 0.82);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.intro-music-credit {
  margin-top: 8px;
  color: rgba(255, 224, 122, 0.92);
  font-size: 10px;
  line-height: 1.45;
}

.intro-loading-hint.hidden {
  display: none;
}

.onboarding-gate {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: grid;
  place-items: center;
  padding: 16px;
}

.onboarding-gate.hidden {
  display: none;
}

.onboarding-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 12, 0.55);
  backdrop-filter: blur(2px);
}

.onboarding-card {
  position: relative;
  z-index: 1;
  width: min(400px, 94vw);
  padding: 24px 22px 20px;
  text-align: center;
  border: 2px solid rgba(255, 224, 122, 0.45);
  background:
    linear-gradient(180deg, rgba(20, 10, 18, 0.97) 0%, rgba(10, 6, 18, 0.98) 100%);
  box-shadow:
    0 0 0 1px rgba(158, 231, 241, 0.2) inset,
    0 16px 48px rgba(0, 0, 0, 0.55);
}

.onboarding-logo {
  width: 88px;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 12px rgba(255, 210, 92, 0.45));
  margin-bottom: 8px;
}

.onboarding-eyebrow {
  margin: 0 0 4px;
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.onboarding-title {
  margin: 0 0 8px;
  font-size: clamp(20px, 4vw, 28px);
  color: var(--accent-warm);
  letter-spacing: 0.06em;
}

.onboarding-body {
  margin: 0 0 16px;
  font-size: 12px;
  color: var(--muted-soft);
  line-height: 1.5;
}

.onboarding-steps {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 8px;
  text-align: left;
}

.onboarding-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(158, 231, 241, 0.15);
  background: rgba(0, 0, 0, 0.25);
  color: var(--muted);
  font-size: 12px;
}

.onboarding-step.done {
  border-color: rgba(158, 231, 241, 0.35);
  color: var(--accent);
}

.onboarding-step.active {
  border-color: rgba(255, 224, 122, 0.45);
  box-shadow: 0 0 12px rgba(255, 224, 122, 0.12);
}

.onboarding-step-num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 1px solid currentColor;
  font-size: 11px;
}

.onboarding-actions {
  display: grid;
  gap: 10px;
}

.onboarding-btn {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #2a1418;
  background: rgba(20, 8, 12, 0.92);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  touch-action: manipulation;
}

.onboarding-btn.primary {
  border-color: rgba(255, 224, 122, 0.55);
  background: linear-gradient(180deg, rgba(196, 106, 74, 0.35), rgba(20, 8, 12, 0.95));
  color: var(--accent-warm);
}

.onboarding-btn:disabled:not(.done) {
  opacity: 0.45;
  cursor: not-allowed;
}

.onboarding-btn.done {
  opacity: 0.7;
  cursor: default;
}

.onboarding-status {
  margin: 12px 0 0;
  min-height: 14px;
  font-size: 11px;
  color: var(--accent);
}

body.onboarding-active #game,
body.onboarding-active .mobile-controls,
body.onboarding-active .music-toggle {
  pointer-events: none;
}

.boot-screen-inner {
  text-align: center;
  padding: 24px;
  max-width: min(420px, 92vw);
  width: 100%;
}

.boot-card {
  position: relative;
  margin: 0 auto 20px;
  padding: 28px 24px 22px;
  border: 2px solid rgba(255, 224, 122, 0.55);
  background:
    linear-gradient(180deg, rgba(20, 10, 18, 0.96) 0%, rgba(10, 6, 18, 0.98) 100%);
  box-shadow:
    0 0 0 1px rgba(158, 231, 241, 0.25) inset,
    0 12px 40px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.boot-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1px 1px at 78% 22%, rgba(158, 231, 241, 0.85), transparent),
    radial-gradient(1px 1px at 44% 72%, rgba(255, 224, 122, 0.75), transparent),
    radial-gradient(1px 1px at 88% 64%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 24% 48%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 62% 38%, rgba(255, 255, 255, 0.6), transparent);
  opacity: 0.85;
}

.boot-logo-main {
  position: relative;
  z-index: 1;
  width: min(120px, 28vw);
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 16px rgba(255, 210, 92, 0.5));
  margin-bottom: 10px;
}

.boot-logo-wrap {
  position: relative;
  width: min(320px, 88vw);
  margin: 0 auto 12px;
}

.boot-banner {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  border: 2px solid rgba(255, 210, 92, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.boot-logo-mark {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  width: min(100px, 28vw);
  z-index: 2;
}

.boot-logo {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.45));
}

.boot-eyebrow {
  position: relative;
  z-index: 1;
  margin: 0 0 4px;
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.boot-title {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(22px, 4vw, 32px);
  color: var(--accent-warm);
  letter-spacing: 0.08em;
  text-shadow: 0 0 20px rgba(255, 224, 122, 0.25);
}

.boot-subtitle {
  position: relative;
  z-index: 1;
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted-soft);
  letter-spacing: 0.04em;
  line-height: 1.45;
}

.music-credit {
  margin: 0;
  font-size: 10px;
  color: rgba(158, 231, 241, 0.88);
  letter-spacing: 0.03em;
  line-height: 1.4;
}

.boot-card .music-credit {
  position: relative;
  z-index: 1;
  margin-top: 10px;
}

.social-dock-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(158, 231, 241, 0.95);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.15s ease;
}

.social-dock-link:hover,
.social-dock-link:focus-visible {
  color: #fff;
  text-decoration: underline;
}

.social-dock-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(158, 231, 241, 0.45);
  border-radius: 4px;
  font-size: 11px;
  line-height: 1;
}

.music-credit-dock {
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid rgba(158, 231, 241, 0.12);
  text-align: center;
}

.music-credit-panel {
  margin-top: 8px;
  color: var(--muted-soft);
}

.boot-progress-track {
  position: relative;
  width: min(280px, 72vw);
  height: 8px;
  margin: 0 auto 10px;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid #2a1418;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.boot-progress-fill {
  position: relative;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--mars), var(--accent-warm), var(--accent));
  box-shadow: 0 0 12px rgba(158, 231, 241, 0.45);
  transition: width 0.12s ease-out;
}

.boot-progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.45) 50%,
    transparent 100%
  );
  animation: boot-bar-shimmer 1.1s linear infinite;
}

.boot-status {
  margin: 0;
  min-height: 16px;
  font-size: 11px;
  color: var(--accent);
}

body.booting .panel {
  opacity: 0.4;
  pointer-events: none;
  filter: saturate(0.75);
  transition: opacity 0.25s ease, filter 0.25s ease;
}

body:not(.booting) .panel {
  opacity: 1;
  pointer-events: auto;
  filter: none;
}

@keyframes boot-bar-shimmer {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(220%); }
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  image-rendering: pixelated;
}

.toast {
  position: absolute;
  left: 16px;
  bottom: 16px;
  max-width: min(520px, calc(100% - 32px));
  min-height: 38px;
  padding: 10px 12px;
  border: 3px solid #2a1418;
  background: rgba(40, 18, 22, 0.94);
  color: var(--ink);
  font-size: 16px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
  box-shadow: 0 0 12px rgba(158, 231, 241, 0.12);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.panel {
  flex: 0 0 min(400px, 34vw);
  width: min(400px, 34vw);
  border: none;
  background:
    linear-gradient(180deg, rgba(158, 231, 241, 0.04) 0%, transparent 18%),
    linear-gradient(180deg, #120810 0%, #0a0612 100%);
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  align-self: stretch;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.2);
}

.panel-head-premium {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  background: transparent;
  border-bottom: none;
}

.panel-brand {
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid rgba(255, 210, 92, 0.28);
  box-shadow:
    inset 0 -1px 0 rgba(158, 231, 241, 0.12),
    0 8px 24px rgba(0, 0, 0, 0.28);
}

.panel-brand-sky {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: cover;
  object-position: center;
  image-rendering: pixelated;
  filter: saturate(1.2) brightness(1.08);
}

.panel-brand-body {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px 12px;
  background: linear-gradient(90deg, rgba(10, 6, 18, 0.72) 0%, rgba(10, 6, 18, 0.2) 55%, rgba(10, 6, 18, 0.55) 100%);
}

.panel-logo-wrap {
  flex-shrink: 0;
  padding: 4px;
  border: 2px solid rgba(255, 210, 92, 0.55);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 210, 92, 0.18), rgba(20, 8, 12, 0.92));
  box-shadow:
    0 0 0 1px rgba(158, 231, 241, 0.18),
    0 4px 14px rgba(0, 0, 0, 0.35);
}

.panel-logo-main {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 8px rgba(255, 210, 92, 0.35));
}

.panel-logo {
  flex-shrink: 0;
  width: 52px;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.panel-head-text {
  min-width: 0;
}

.panel-head-text h1 {
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: 0.03em;
  color: #fff8e8;
  text-shadow: 0 0 10px rgba(255, 210, 92, 0.25);
}

.panel-head .eyebrow {
  margin: 0 0 2px;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(158, 231, 241, 0.35);
}

.panel-head .tagline {
  font-size: 10px;
  color: #f0d4a8;
}

.panel-command {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.15);
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 12px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(158, 231, 241, 0.25) transparent;
}

.panel-scroll::-webkit-scrollbar {
  width: 6px;
}

.panel-scroll::-webkit-scrollbar-thumb {
  background: rgba(158, 231, 241, 0.2);
  border: 1px solid var(--line);
}

.panel-section {
  border: none;
  background: transparent;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-section:last-of-type {
  border-bottom: none;
}

.panel-section-howto,
.panel-section-coop,
.panel-section-crops,
.panel-section-harvest,
.panel-section-weather,
.panel-section-livestock,
.panel-section-farm,
.panel-section-dungeon,
.panel-section-stats,
.panel-section-character {
  border-left: none;
}

.howto-details {
  border: none;
}

.howto-summary {
  cursor: pointer;
  list-style: none;
  margin-bottom: 8px;
}

.howto-summary::-webkit-details-marker {
  display: none;
}

.howto-summary::after {
  content: " ▾";
  color: var(--muted);
  font-size: 12px;
}

.howto-details:not([open]) .howto-summary::after {
  content: " ▸";
}

.howto-body {
  color: var(--text-body);
  font-size: 14px;
  line-height: 1.68;
}

.howto-steps {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.howto-steps li {
  padding-left: 2px;
}

.howto-steps strong {
  color: var(--accent-warm);
}

.howto-steps em {
  color: var(--accent);
  font-style: normal;
}

.howto-steps kbd {
  font-size: 11px;
  min-width: 18px;
  min-height: 18px;
  padding: 2px 5px;
}

.howto-expect {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.howto-expect strong {
  display: block;
  color: var(--accent);
  font-size: 11px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.howto-expect ul {
  margin: 0;
  padding-left: 16px;
}

.howto-expect li {
  margin-top: 4px;
}

.howto-expect li strong {
  display: inline;
  color: var(--accent-warm);
  text-transform: none;
  font-size: inherit;
}

.visit-empty {
  color: var(--muted);
  font-size: 10px;
}

.panel-section-dungeon {
  background: transparent;
}

.dungeon-card.open {
  box-shadow: none;
  background: rgba(255, 112, 64, 0.06);
  padding: 8px;
  border: 1px solid rgba(255, 112, 64, 0.2);
}

.dungeon-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  align-items: start;
}

.dungeon-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  align-items: start;
}

.dungeon-card.closed {
  opacity: 0.92;
}

.maze-card.open {
  background: rgba(120, 60, 200, 0.08);
  border: 1px solid rgba(179, 136, 255, 0.35);
  padding: 8px;
  box-shadow: 0 0 14px rgba(100, 50, 180, 0.2);
}

.maze-card .dungeon-info strong {
  color: #c9a6ff;
}

.dungeon-monster-icon {
  image-rendering: pixelated;
  border: 2px solid #502818;
  background: rgba(18, 6, 8, 0.95);
  border-radius: 4px;
}

.dungeon-info strong {
  display: block;
  color: #ff9060;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.dungeon-info small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  margin-top: 3px;
}

.dungeon-info small strong {
  display: inline;
  color: var(--accent-warm);
  font-size: inherit;
}

.last-winner {
  color: var(--accent) !important;
}

.dungeon-fight {
  margin-top: 8px;
  width: 100%;
  border-color: #d85f45 !important;
}

.dungeon-fight:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.live-colonies-body {
  margin-bottom: 8px;
}

.live-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.live-header strong {
  color: var(--accent);
  font-size: 12px;
}

.live-header small {
  color: var(--muted);
  font-size: 10px;
}

.live-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 8px;
}

.live-colony {
  display: flex;
  flex-direction: column;
  padding: 5px 7px;
  border: 1px solid var(--line-soft);
  background: var(--panel-surface);
  font-size: 10px;
}

.live-colony.online {
  border-color: rgba(80, 220, 120, 0.4);
}

.live-colony .live-dot {
  color: #666;
  font-size: 8px;
}

.live-colony.online .live-dot {
  color: #50dc78;
}

.live-colony small {
  color: var(--muted);
  font-size: 9px;
}

.online-dot {
  color: #50dc78;
  font-size: 10px;
}

.visit-row span:first-child {
  display: flex;
  align-items: center;
  gap: 4px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-warm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.section-icon {
  image-rendering: pixelated;
  flex-shrink: 0;
}

.section-icon-cow {
  object-fit: none;
  object-position: 0 0;
  width: 32px;
  height: 32px;
}

.treasury-compact {
  padding: 8px 10px;
}

.treasury-compact small {
  font-size: 12px;
  color: var(--text-body);
  line-height: 1.4;
}

.farm-panel-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.crop-starter-note {
  grid-column: 1 / -1;
  margin: 0 0 4px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 224, 122, 0.35);
  background: rgba(255, 224, 122, 0.08);
  color: var(--text-body);
  font-size: 11px;
  line-height: 1.45;
}

.crop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 8px 8px;
  border: 1px solid rgba(255, 210, 92, 0.12);
  background:
    radial-gradient(ellipse at 50% 20%, rgba(255, 210, 92, 0.08), transparent 55%),
    var(--panel-surface);
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.crop-card:hover,
.crop-card.active {
  border-color: rgba(255, 224, 122, 0.55);
  background:
    radial-gradient(ellipse at 50% 15%, rgba(255, 224, 122, 0.14), transparent 60%),
    rgba(255, 224, 122, 0.05);
  box-shadow: 0 0 0 1px rgba(255, 224, 122, 0.08);
  transform: translateY(-1px);
}

.crop-hex-icon {
  image-rendering: pixelated;
  width: 48px;
  height: 52px;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
}

.section-icon-hex {
  image-rendering: pixelated;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.crop-stage {
  image-rendering: pixelated;
  width: 32px;
  height: 16px;
  object-fit: cover;
  object-position: left top;
  opacity: 0.85;
}

.crop-name {
  font-size: 11px;
  color: var(--ink);
  line-height: 1.2;
}

.crop-meta {
  font-size: 9px;
  color: var(--muted);
}

.livestock-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.livestock-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
}

.livestock-sprite {
  image-rendering: pixelated;
  object-fit: none;
  object-position: 0 0;
  width: 52px;
  height: 52px;
  border: 2px solid #2a1418;
  background: rgba(20, 8, 12, 0.8);
}

.livestock-info strong {
  display: block;
  color: var(--accent-warm);
  font-size: 12px;
}

.livestock-info small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
  margin-top: 2px;
}

.livestock-hint {
  color: var(--accent) !important;
  margin-top: 4px !important;
}

.harvest-panel-body,
.weather-panel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.harvest-card,
.weather-card {
  border: 1px solid var(--line-soft);
  background: var(--panel-surface);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.harvest-card.ready {
  border-color: rgba(255, 224, 122, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 224, 122, 0.12);
}

.harvest-card.empty {
  text-align: center;
}

.harvest-progress {
  height: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line-soft);
}

.harvest-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7ecf6a, #ffe07a);
  transition: width 0.2s ease;
}

.harvest-btn:not(:disabled) {
  border-color: rgba(255, 224, 122, 0.55);
  color: #ffe07a;
}

.harvest-hint,
.harvest-extra,
.weather-alert {
  color: var(--text-body);
  font-size: 11px;
  line-height: 1.4;
}

.weather-alert {
  color: #ffb4a8;
}

.weather-card {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
}

.weather-card.weather-solar_storm {
  border-color: rgba(255, 120, 40, 0.4);
}

.weather-card.weather-asteroid {
  border-color: rgba(180, 90, 255, 0.35);
}

.panel-section-stats .stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel-section-stats .stat {
  padding: 8px 6px;
}

.panel-section-stats .stat span {
  font-size: 16px;
}

.panel-section-stats .stat b {
  font-size: 11px;
}

.panel-details {
  flex-shrink: 0;
  border: none;
  border-top: 1px solid var(--line-soft);
  padding: 10px 16px 12px;
  background: rgba(0, 0, 0, 0.2);
}

.panel-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  list-style: none;
}

.panel-details summary::-webkit-details-marker {
  display: none;
}

.panel-details .controls {
  margin-top: 8px;
  padding: 0;
  border: none;
  background: transparent;
}

.panel-details .controls p {
  font-size: 11px;
  margin-top: 4px;
}

.panel-head-text h1 {
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.panel-head .eyebrow {
  margin: 0 0 2px;
  font-size: 10px;
  letter-spacing: 0.1em;
}

.panel-head .tagline {
  font-size: 10px;
  color: var(--muted-soft);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(158, 231, 241, 0.35);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.05;
  color: var(--accent-warm);
}

h2 {
  margin-bottom: 8px;
  font-size: 16px;
  color: var(--ink);
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat,
.seed,
.mission,
.controls {
  border: 1px solid var(--line-soft);
  background: var(--panel-surface);
  padding: 8px 10px;
}

.stat b {
  display: block;
  color: #9ee7f1;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat span {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

/* Onboarding walkthrough */
.tour-launch-btn {
  width: 100%;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid rgba(158, 231, 241, 0.35);
  background: rgba(158, 231, 241, 0.08);
  color: var(--accent);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.tour-launch-btn:hover {
  background: rgba(158, 231, 241, 0.22);
  border-color: var(--accent-warm);
  color: var(--accent-warm);
}

.tour-launch-btn.hidden {
  display: none;
}

.howto-tour-btn {
  margin-top: 10px;
}

body.walkthrough-open {
  overflow: hidden;
}

.walkthrough {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
}

.walkthrough.hidden {
  display: none;
}

.walkthrough-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 12, 0.82);
  backdrop-filter: blur(3px);
}

.walkthrough-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(90vh, 560px);
  overflow-y: auto;
  padding: 20px 18px 16px;
  border: 3px solid #2a1418;
  background: linear-gradient(180deg, #2a1418 0%, #140810 100%);
  box-shadow:
    0 0 0 2px rgba(158, 231, 241, 0.2),
    0 16px 40px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.walkthrough-step-num {
  margin: 0 0 10px;
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.walkthrough-icon {
  display: block;
  width: min(120px, 40vw);
  height: auto;
  margin: 0 auto 12px;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

.walkthrough-title {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--accent-warm);
  line-height: 1.35;
}

.walkthrough-body {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--ink);
  line-height: 1.55;
  text-align: left;
}

.walkthrough-hint {
  margin: 0 0 14px;
  padding: 8px 10px;
  font-size: 10px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.35);
  border-left: 3px solid var(--accent);
  text-align: left;
  line-height: 1.45;
}

.walkthrough-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
}

.walkthrough-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.walkthrough-dot.active {
  background: var(--accent-warm);
  box-shadow: 0 0 8px rgba(255, 224, 122, 0.5);
}

.walkthrough-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 8px;
}

.walkthrough-btn {
  padding: 10px 8px;
  border: 2px solid #2a1418;
  font-family: inherit;
  font-size: 10px;
  cursor: pointer;
}

.walkthrough-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.walkthrough-btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.walkthrough-btn.primary {
  background: var(--accent-warm);
  color: #2a1418;
  font-weight: bold;
}

.walkthrough-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.character-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 16px;
}

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

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

.character-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0;
  text-align: left;
}

.character-field span {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.character-field input {
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  font: inherit;
  padding: 8px 10px;
}

.character-label {
  font-size: 10px;
  color: var(--muted);
  margin: 8px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.character-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
}

.character-panel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.character-card-panel {
  border: 1px solid var(--line-soft);
  background: var(--panel-surface);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.character-card-panel.empty {
  text-align: center;
  align-items: center;
}

.character-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.character-preview {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.character-presence,
.character-hint {
  color: var(--text-body);
  font-size: 12px;
  line-height: 1.45;
}

.character-lock {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.skin-store-modal {
  position: fixed;
  inset: 0;
  z-index: 115;
  display: grid;
  place-items: center;
  padding: 16px;
}

.skin-store-modal.hidden {
  display: none;
}

.skin-store-card {
  text-align: left;
  max-width: 520px;
}

.skin-store-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.skin-store-head .walkthrough-title {
  text-align: left;
  margin-bottom: 4px;
}

.skin-store-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-body);
  line-height: 1.45;
}

.skin-store-balance {
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 224, 122, 0.35);
  background: rgba(255, 224, 122, 0.08);
  color: var(--text-body);
  font-size: 13px;
}

.skin-store-balance strong {
  color: #ffe07a;
  font-size: 15px;
}

.crop-shop-card {
  max-width: 560px;
  max-height: min(88vh, 720px);
  overflow: auto;
  text-align: left;
}

.crop-shop-modal .walkthrough-title,
.crop-shop-modal .skin-store-sub {
  text-align: left;
}

.crop-shop-balance {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  line-height: 1.5;
}

.crop-shop-balance span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.crop-shop-balance span strong {
  font-size: 14px;
}

.crop-shop-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  line-height: 1.45;
}

.crop-shop-section-title {
  margin: 0 0 6px;
  font-size: 13px;
  color: #ffe07a;
  line-height: 1.35;
}

.crop-shop-hint {
  margin: 0 0 12px;
  font-size: 11px;
  color: var(--text-body);
  line-height: 1.5;
}

.crop-shop-hint kbd {
  padding: 1px 4px;
  border: 1px solid rgba(255, 224, 122, 0.35);
  font-size: 10px;
}

.crop-shop-seed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.crop-shop-seed-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  padding: 10px 10px 12px;
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text-body);
  font: inherit;
  font-size: 11px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
}

.crop-shop-seed-card.active {
  border-color: #ffe07a;
  background: rgba(255, 224, 122, 0.1);
  box-shadow: 0 0 0 1px rgba(255, 224, 122, 0.2);
}

.crop-shop-seed-card.cant-afford {
  opacity: 0.78;
}

.crop-shop-seed-icon {
  align-self: center;
  width: 44px;
  height: 48px;
  margin-bottom: 8px;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.crop-shop-seed-name {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: bold;
  color: #fff3cf;
  line-height: 1.3;
}

.crop-shop-seed-stats,
.crop-shop-coop-stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}

.crop-shop-seed-stats li,
.crop-shop-coop-stats li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 10px;
  line-height: 1.4;
}

.crop-shop-seed-stats li > span,
.crop-shop-coop-stats li > span {
  flex: 0 0 auto;
  color: var(--muted-soft);
}

.crop-shop-seed-stats li > b,
.crop-shop-coop-stats li > b {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  font-weight: normal;
  color: #9ee7f1;
  word-break: break-word;
}

.crop-shop-seed-stats li:nth-child(2) > b {
  color: #b8e986;
}

.crop-shop-coop .coop-crop-meta strong {
  display: block;
  margin-bottom: 4px;
}

.crop-shop-coop .coop-crop-meta > small {
  display: block;
  margin-bottom: 8px;
  line-height: 1.4;
}

.crop-shop-coop {
  grid-template-columns: 52px 1fr;
  grid-template-rows: auto auto;
  align-items: start;
}

.crop-shop-coop .coop-buy-btn {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 8px;
}

.crop-shop-tag {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 6px;
  font-size: 9px;
  line-height: 1.2;
  background: #ffe07a;
  color: #2f2119;
  border-radius: 0;
}

.crop-shop-open-btn {
  width: 100%;
  margin-top: 4px;
}

.crop-bay-toolbar {
  margin-bottom: 8px;
}

.crop-bay-toolbar .farm-btn {
  width: 100%;
}

@media (max-width: 480px) {
  .crop-shop-seed-grid {
    grid-template-columns: 1fr;
  }
}

.skin-store-close {
  flex-shrink: 0;
  padding: 6px 10px;
}

.skin-store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.skin-store-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-body);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.skin-store-item:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(158, 231, 241, 0.08);
}

.skin-store-item.active {
  border-color: #ffe07a;
  box-shadow: 0 0 0 1px rgba(255, 224, 122, 0.35);
}

.skin-store-item.owned {
  border-color: rgba(158, 231, 241, 0.45);
}

.skin-store-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.skin-store-item .avatar-icon,
.skin-store-item .gear-icon {
  width: 40px;
  height: 40px;
}

.skin-store-price {
  color: #ffe07a;
  font-size: 10px;
  font-weight: 800;
}

.skin-store-price.free {
  color: #9ee7f1;
}

.skin-store-tag {
  font-size: 9px;
  color: #9ee7f1;
  text-transform: uppercase;
}

.character-modal-status {
  min-height: 18px;
  margin: 8px 0 4px;
  font-size: 11px;
  color: #9ee7f1;
  text-align: center;
}

.character-modal-status.error {
  color: #ffb4a8;
}

.character-modal-status.busy {
  color: #ffe07a;
}

.crop-yield,
.crop-astro {
  font-size: 9px;
  color: #9ee7f1;
  line-height: 1.2;
}

.avatar.locked,
.gear.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.wallet-connected {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wallet-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.wallet-name {
  font-size: 13px;
  color: #ffe07a;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-meta span {
  font-size: 11px;
  color: var(--muted);
}

.panel-command .wallet-bar {
  border: none;
  background: transparent;
  padding: 0;
}

.panel-command .treasury {
  border: 1px solid var(--line-soft);
  background: var(--panel-surface);
  padding: 8px 10px;
}

.wallet-bar,
.treasury,
.mechanics,
.farm-panel-wrap {
  border: 1px solid var(--line-soft);
  background: var(--panel-surface);
  padding: 10px;
}

.wallet-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(196, 106, 74, 0.55);
  background: linear-gradient(180deg, rgba(107, 52, 40, 0.95), rgba(74, 36, 32, 0.95));
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 10px;
  cursor: pointer;
  image-rendering: pixelated;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wallet-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(158, 231, 241, 0.2);
}

.wallet-btn.small {
  width: auto;
  padding: 4px 8px;
  font-size: 11px;
}

.pixel-icon {
  image-rendering: pixelated;
}

.treasury-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.treasury-header strong {
  display: block;
  color: var(--accent-warm);
  font-size: 14px;
}

.treasury-header small {
  color: var(--muted);
  font-size: 11px;
}

.treasury-bar {
  margin: 8px 0 4px;
  height: 10px;
  border: 2px solid #2a1418;
  background: #2a1418;
}

.treasury-fill {
  height: 100%;
  background: linear-gradient(90deg, #9ee7f1, #ffe07a);
  transition: width 0.4s ease;
}

.mechanics-toggle {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line-soft);
  background: var(--panel-surface);
  color: var(--accent);
  font: inherit;
  font-size: 11px;
  padding: 7px 10px;
  cursor: pointer;
  text-align: left;
}

.mechanics-toggle:hover {
  border-color: var(--accent);
}

.mechanics-body {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.mechanics-body p + p {
  margin-top: 6px;
}

.mechanics-body strong {
  color: var(--accent-warm);
}

.farm-panel-empty {
  text-align: center;
  gap: 8px;
}

.farm-empty-icon {
  margin: 0 auto;
  display: block;
}

.farm-parcel-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.farm-level-card {
  background: rgba(20, 8, 12, 0.75);
  border: 1px solid rgba(158, 231, 241, 0.25);
  padding: 8px 10px;
  margin-bottom: 8px;
}

.farm-level-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.farm-level-head strong {
  display: block;
  color: var(--accent-warm);
  font-size: 11px;
}

.farm-level-head small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.level-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: bold;
  padding: 3px 6px;
  border: 2px solid var(--accent);
  background: rgba(10, 6, 18, 0.9);
}

.level-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 4px;
}

.level-bar-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.level-xp {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.quest-tracker {
  margin: 8px 0 4px;
  padding: 8px 10px;
  border: 1px solid rgba(168, 224, 109, 0.35);
  border-radius: 6px;
  background: rgba(20, 40, 24, 0.55);
}

.quest-tracker strong {
  display: block;
  color: #d8ffb0;
  font-size: 11px;
}

.quest-tracker small {
  color: var(--muted);
  font-size: 10px;
}

.farm-expand-roadmap {
  margin: 10px 0;
  display: grid;
  gap: 4px;
}

.expand-tier {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 8px;
  padding: 6px 8px;
  background: rgba(10, 6, 18, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  opacity: 0.65;
}

.expand-tier.active {
  opacity: 1;
  border-color: rgba(168, 224, 109, 0.35);
}

.expand-tier.unlocked:not(.active) {
  opacity: 0.85;
  border-color: rgba(255, 224, 122, 0.2);
}

.expand-tier strong {
  font-size: 10px;
  color: var(--accent);
  grid-column: 1;
}

.expand-tier small {
  font-size: 9px;
  color: var(--muted);
  grid-column: 1;
}

.expand-tier span {
  font-size: 9px;
  color: var(--accent-warm);
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  text-align: right;
}

.visit-level {
  color: var(--accent-warm);
  font-size: 9px;
  margin-right: 2px;
}

.farm-parcel-preview strong {
  display: block;
  color: var(--accent);
  font-size: 12px;
}

.visit-label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.visit-empty {
  color: var(--muted);
  font-size: 10px;
}

.farm-panel small {
  color: var(--text-body);
  font-size: 12px;
  line-height: 1.45;
}

.farm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 8px 0;
}

.farm-btn {
  border: 2px solid #2a1418;
  background: rgba(40, 18, 22, 0.9);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  padding: 6px;
  cursor: pointer;
}

.farm-btn:hover {
  border-color: var(--accent);
}

.visit-leave {
  width: 100%;
  margin-bottom: 8px;
  border-color: var(--accent);
}

.visit-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 120px;
  overflow-y: auto;
}

.visit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line-soft);
  background: var(--panel-surface);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  padding: 5px 8px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease;
}

.visit-row:hover {
  border-color: var(--accent-warm);
}

.visit-row span:last-child {
  color: var(--muted);
  font-size: 10px;
}

.seed-bar,
.avatar-bar,
.gear-bar {
  display: grid;
  gap: 8px;
}

.avatar-bar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.character-pick.avatar-bar {
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.avatar.locked,
.gear.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.avatar.locked .avatar-icon,
.gear.locked .gear-icon {
  filter: grayscale(0.45) brightness(0.85);
}

.gear-bar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.seed {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 52px;
}

.avatar,
.gear {
  border: 1px solid var(--line-soft);
  background: var(--panel-surface);
  min-height: 58px;
  padding: 5px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
  touch-action: manipulation;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.avatar.active,
.gear.active,
.seed.active {
  border-color: var(--accent);
  background: rgba(90, 40, 34, 0.95);
  box-shadow: 0 0 8px rgba(158, 231, 241, 0.15);
}

.avatar-icon,
.gear-icon,
.gear-empty {
  width: 42px;
  height: 42px;
  background-repeat: no-repeat;
  background-position: left top;
  background-size: 168px 42px;
  image-rendering: pixelated;
}

.gear-empty {
  display: block;
  border: 2px solid #2a1418;
  background:
    linear-gradient(45deg, transparent 43%, var(--muted) 43% 57%, transparent 57%),
    rgba(40, 18, 22, 0.86);
}

.avatar-name,
.gear-name {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  text-align: center;
}

.seed-icon {
  width: 32px;
  height: 32px;
  display: block;
  border: 2px solid #2a1418;
  background-color: #3a1c18;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 28px 28px;
  image-rendering: pixelated;
}

.seed strong {
  display: block;
  font-size: 14px;
}

.seed small,
.mission,
.controls {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.42;
}

.mission strong {
  color: var(--accent-warm);
}

.panel-scroll .mission {
  margin: 4px 4px 8px;
  border: none;
  border-left: 2px solid rgba(255, 224, 122, 0.35);
  background: rgba(255, 224, 122, 0.04);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-body);
}

.skin-store-btn {
  margin-top: 6px;
  width: 100%;
}

.controls {
  margin-top: auto;
}

.controls p + p {
  margin-top: 8px;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  min-height: 20px;
  margin-right: 4px;
  padding: 2px 6px;
  border: 2px solid #2a1418;
  background: var(--accent-warm);
  color: #1a0c10;
  font-family: "Kenney Pixel", ui-monospace, monospace;
  font-size: 12px;
}

@media (max-width: 920px) {
  body {
    padding: 0;
    place-items: stretch;
    min-height: 100dvh;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
  }

  .game-shell {
    width: 100%;
    min-height: 100dvh;
    border: none;
    box-shadow: none;
    grid-template-columns: 1fr;
  }

  .game-shell:not(.panel-open) .panel {
    display: none;
  }

  .game-shell.panel-open .panel {
    position: fixed;
    inset: 0;
    z-index: 40;
    width: 100%;
    max-width: none;
    flex: none;
    height: 100dvh;
    max-height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .stage {
    order: 0;
    position: relative;
    z-index: 2;
    border-right: none;
    max-height: min(50dvh, 440px);
  }

  .resource-dock {
    order: 1;
    z-index: 3;
  }

  canvas {
    touch-action: none;
    max-height: min(50dvh, 440px);
  }

  .resource-primary {
    grid-template-columns: 1fr;
  }

  .resource-value {
    font-size: 20px;
  }

  .toast {
    left: max(12px, env(safe-area-inset-left, 0));
    bottom: max(148px, calc(128px + env(safe-area-inset-bottom, 0)));
    font-size: 13px;
    max-width: calc(100% - 24px);
  }

  .panel-toggle {
    display: grid;
    place-items: center;
    position: absolute;
    top: max(10px, env(safe-area-inset-top, 0));
    right: max(10px, env(safe-area-inset-right, 0));
    z-index: 12;
    min-width: 52px;
    min-height: 44px;
    padding: 8px 12px;
    border: 2px solid #2a1418;
    background: rgba(20, 8, 12, 0.92);
    color: var(--accent-warm);
    font: inherit;
    font-size: 12px;
    letter-spacing: 0.04em;
    touch-action: manipulation;
    box-shadow: 0 0 10px rgba(255, 224, 122, 0.18);
  }

  .panel-toggle[hidden] {
    display: none;
  }

  .panel-close {
    display: block;
    width: 100%;
    min-height: 44px;
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 2px solid #2a1418;
    background: rgba(255, 224, 122, 0.12);
    color: var(--accent-warm);
    font: inherit;
    font-size: 12px;
    text-align: left;
    touch-action: manipulation;
  }

  .panel-close[hidden] {
    display: none;
  }

  .mobile-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 11;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    padding:
      8px
      max(10px, env(safe-area-inset-right, 0))
      max(10px, env(safe-area-inset-bottom, 0))
      max(10px, env(safe-area-inset-left, 0));
    pointer-events: none;
  }

  .mobile-controls[hidden] {
    display: none;
  }

  .mobile-dpad,
  .mobile-actions {
    pointer-events: auto;
  }

  .mobile-dpad {
    position: relative;
    width: 132px;
    height: 132px;
    flex: 0 0 auto;
  }

  .mobile-btn {
    border: 2px solid #2a1418;
    background: rgba(20, 8, 12, 0.9);
    color: var(--ink);
    font: inherit;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
  }

  .mobile-dpad-btn {
    position: absolute;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    box-shadow: inset 0 0 0 1px rgba(255, 224, 122, 0.12);
  }

  .mobile-dpad-btn::after {
    content: "";
    display: block;
    width: 0;
    height: 0;
    margin: 0 auto;
    border-style: solid;
  }

  .mobile-dpad-up {
    top: 0;
    left: 44px;
  }

  .mobile-dpad-up::after {
    border-width: 0 8px 12px;
    border-color: transparent transparent var(--accent-warm);
  }

  .mobile-dpad-down {
    bottom: 0;
    left: 44px;
  }

  .mobile-dpad-down::after {
    border-width: 12px 8px 0;
    border-color: var(--accent-warm) transparent transparent;
  }

  .mobile-dpad-left {
    top: 44px;
    left: 0;
  }

  .mobile-dpad-left::after {
    border-width: 8px 12px 8px 0;
    border-color: transparent var(--accent-warm) transparent transparent;
  }

  .mobile-dpad-right {
    top: 44px;
    right: 0;
  }

  .mobile-dpad-right::after {
    border-width: 8px 0 8px 12px;
    border-color: transparent transparent transparent var(--accent-warm);
  }

  .mobile-dpad-btn:active,
  .mobile-action-btn:active,
  .panel-toggle:active {
    background: rgba(90, 40, 34, 0.95);
    border-color: var(--accent);
  }

  .mobile-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: min(240px, 46vw);
  }

  .mobile-action-btn {
    min-height: 48px;
    padding: 8px 6px;
    font-size: 11px;
    letter-spacing: 0.03em;
  }

  .mobile-action-primary {
    background: rgba(255, 224, 122, 0.16);
    color: var(--accent-warm);
    font-size: 16px;
    font-weight: bold;
  }

  .panel {
    height: auto !important;
    max-height: none !important;
  }

  .panel-head-text h1 {
    font-size: 18px;
  }

  .panel-brand-body {
    padding: 10px 12px 12px;
  }

  .panel-logo-main {
    width: 48px;
    height: 48px;
  }

  .panel-brand-sky {
    max-height: 72px;
    object-fit: cover;
  }

  .wallet-bar button,
  .tour-launch-btn,
  .farm-btn,
  .coop-buy-btn,
  .coop-sell-btn,
  .visit-btn,
  .seed,
  .walkthrough-btn {
    min-height: 44px;
  }

  .controls-mobile {
    display: block;
  }

  .controls-desktop {
    display: none;
  }

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

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

  .walkthrough-card,
  .character-card,
  .skin-store-card {
    width: min(100%, 420px);
    max-height: calc(100dvh - 24px);
    overflow: auto;
    margin: 12px;
  }

  .avatar-bar,
  .gear-bar,
  .character-pick,
  .skin-store-grid {
    gap: 8px;
  }

  .avatar,
  .gear {
    min-height: 64px;
  }
}

.controls-mobile {
  display: none;
}

@media (max-width: 620px) {
  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .panel-scroll {
    padding-inline: 8px;
  }

  .panel-command,
  .panel-head,
  .panel-details {
    padding-inline: 12px;
  }

  .mobile-dpad {
    width: 118px;
    height: 118px;
    transform: scale(0.92);
    transform-origin: bottom left;
  }

  .mobile-actions {
    width: min(210px, 50vw);
  }

  .mobile-action-btn {
    font-size: 10px;
  }
}

@media (max-width: 920px) and (orientation: landscape) {
  .stage {
    max-height: 100dvh;
  }

  canvas {
    max-height: 100dvh;
    aspect-ratio: auto;
    height: min(100dvh, 100vw * 0.62);
  }

  .mobile-controls {
    padding-bottom: max(6px, env(safe-area-inset-bottom, 0));
  }

  .mobile-dpad {
    transform: scale(0.82);
  }

  .mobile-actions {
    width: min(220px, 34vw);
  }
}

/* Orbital co-op market */
.coop-market-body {
  display: block;
}

.coop-market-card {
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.22);
  padding: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.coop-market-card.coop-market-open {
  border-color: rgba(168, 224, 109, 0.55);
  box-shadow: 0 0 12px rgba(168, 224, 109, 0.12);
}

.coop-market-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.coop-market-head strong {
  display: block;
  color: var(--accent-warm);
  font-size: 13px;
}

.coop-market-head small {
  display: block;
  color: var(--muted-soft);
  font-size: 10px;
  line-height: 1.35;
}

.coop-balance {
  color: var(--accent) !important;
  margin-top: 2px;
}

.coop-intro {
  margin: 0 0 10px;
  font-size: 10px;
  line-height: 1.45;
  color: var(--text-body);
}

.coop-market-grid {
  display: grid;
  gap: 8px;
}

.coop-crop-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(255, 210, 92, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

.coop-crop-card.locked {
  opacity: 0.55;
}

.coop-crop-meta strong {
  display: block;
  font-size: 12px;
}

.coop-crop-meta small {
  display: block;
  font-size: 9px;
  color: var(--muted-soft);
  line-height: 1.35;
}

.coop-yield {
  color: #a8e06d !important;
}

.coop-limit {
  color: var(--accent) !important;
}

.coop-buy-btn {
  min-width: 88px;
  font-size: 10px;
  padding: 8px 6px;
  white-space: nowrap;
}

.coop-buy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.coop-sell-btn {
  width: 100%;
  margin-top: 10px;
}

.coop-hint {
  margin: 10px 0 0;
  font-size: 10px;
  color: var(--muted-soft);
}

.panel-section-coop .section-title {
  color: var(--accent-warm);
}
