:root {
  --sky-top: #fef1ca;
  --sky-bottom: #dff4ff;
  --grass-light: #d8efbc;
  --grass-mid: #bfdc9a;
  --ink: #22304b;
  --muted: #5c6b83;
  --panel: rgba(255, 252, 245, 0.78);
  --panel-strong: rgba(255, 252, 245, 0.92);
  --panel-soft: rgba(255, 252, 245, 0.56);
  --border: rgba(255, 255, 255, 0.76);
  --shadow: rgba(58, 80, 116, 0.16);
  --accent: #ea7e55;
  --accent-strong: #b65538;
  --accent-soft: rgba(255, 222, 185, 0.78);
  --secondary: #3d77cf;
  --secondary-strong: #224f9d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.7), transparent 22%),
    radial-gradient(circle at 82% 18%, rgba(255, 220, 186, 0.34), transparent 20%),
    radial-gradient(circle at 78% 84%, rgba(181, 238, 255, 0.3), transparent 26%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 100%);
}

body {
  padding:
    calc(12px + env(safe-area-inset-top))
    calc(12px + env(safe-area-inset-right))
    calc(12px + env(safe-area-inset-bottom))
    calc(12px + env(safe-area-inset-left));
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

button {
  appearance: none;
  border: 0;
  font: inherit;
}

.game-shell {
  max-width: 1680px;
  min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
  margin: 0 auto;
}

.board-shell {
  position: relative;
  overflow: hidden;
  min-height: clamp(620px, 84dvh, 1040px);
  border-radius: 34px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.38), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
    var(--panel);
  border: 2px solid rgba(255, 255, 255, 0.68);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 24px 42px var(--shadow);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: clamp(620px, 84dvh, 1040px);
  touch-action: none;
}

.board-hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 12px 104px;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hud-row-top {
  align-items: flex-start;
}

.hud-row-bottom {
  justify-content: space-between;
  align-items: flex-end;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.utility-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: auto;
}

.utility-button {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(55, 75, 118, 0.1);
  box-shadow: 0 8px 16px rgba(60, 79, 113, 0.1);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.utility-button[aria-pressed="true"] {
  color: white;
  background: linear-gradient(180deg, var(--secondary) 0%, var(--secondary-strong) 100%);
}

.back-link,
.wave-button,
.inspector-actions button,
.difficulty-button,
.overlay-actions button,
.utility-button,
.shop-item {
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, opacity 150ms ease;
}

.back-link:hover,
.wave-button:not(:disabled):hover,
.inspector-actions button:not(:disabled):hover,
.difficulty-button:hover,
.overlay-actions button:hover,
.utility-button:not(:disabled):hover,
.shop-item:hover {
  transform: translateY(-2px);
}

.back-link:active,
.wave-button:not(:disabled):active,
.inspector-actions button:not(:disabled):active,
.difficulty-button:active,
.overlay-actions button:active,
.utility-button:not(:disabled):active,
.shop-item:active {
  transform: translateY(0) scale(0.98);
}

.back-link,
.wave-button,
.shop-item,
.difficulty-button,
.overlay-actions button,
.inspector-actions button {
  border-radius: 18px;
  font-weight: 900;
}

.inspector-actions .target-mode {
  grid-column: 1 / -1;
  min-height: 34px;
}

.back-link,
.wave-button,
.status-strip,
.stats-ribbon,
.shop-item,
.inspector-card {
  pointer-events: auto;
}

.back-link,
.wave-button,
.inspector-actions button,
.difficulty-button,
.overlay-actions button {
  min-height: 52px;
  padding: 14px 18px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: inset 0 0 0 1px rgba(55, 75, 118, 0.08);
}

.wave-button,
.difficulty-button,
.overlay-actions button,
.inspector-actions button {
  color: white;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 12px 20px rgba(188, 85, 52, 0.22);
  cursor: pointer;
}

.wave-button.secondary,
.inspector-actions .secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(55, 75, 118, 0.1);
  box-shadow: none;
}

.wave-button:disabled,
button:disabled {
  opacity: 0.48;
  cursor: default;
  box-shadow: none;
}

.back-link:focus-visible,
.wave-button:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(61, 119, 207, 0.42);
  outline-offset: 3px;
}

.stats-ribbon {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(72px, 1fr));
  gap: 6px;
  max-width: min(860px, calc(100% - 210px));
  padding: 6px;
  border-radius: 18px;
  background: rgba(255, 252, 245, 0.44);
  border: 1px solid rgba(255, 255, 255, 0.56);
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 18px rgba(60, 79, 113, 0.09);
}

.stat-chip {
  padding: 7px 10px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(61, 83, 127, 0.08);
}

.stat-label,
.panel-label,
.overlay-label,
.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stat-label {
  color: var(--muted);
}

.stat-value {
  display: block;
  margin-top: 4px;
  font-size: clamp(17px, 1.6vw, 22px);
  font-weight: 900;
}

.status-strip {
  max-width: min(460px, 72vw);
  padding: 8px 11px;
  border-radius: 16px;
  background: rgba(255, 252, 245, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 18px rgba(60, 79, 113, 0.1);
}

.panel-label,
.eyebrow {
  color: var(--accent-strong);
}

.panel-copy,
.overlay-copy,
.overlay-note,
.shop-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(244, 233, 210, 0.44);
  backdrop-filter: blur(10px);
}

.hidden {
  display: none;
}

.overlay-card {
  width: min(520px, 100%);
  padding: 28px 24px 22px;
  border-radius: 30px;
  text-align: center;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 42px rgba(74, 91, 129, 0.18);
}

.overlay-label {
  color: var(--secondary-strong);
}

.overlay-title {
  margin: 8px 0 0;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 0.95;
}

.overlay-copy {
  margin-top: 14px;
}

.overlay-note {
  margin-top: 14px;
  font-size: 14px;
}

.setup-mute-button {
  display: block;
  width: max-content;
  margin: 12px auto 0;
  padding: 9px 15px;
  border: 1px solid rgba(93, 126, 104, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #334b3b;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.setup-mute-button:hover {
  background: #fff;
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.garden-picker {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  text-align: left;
}

.garden-picker span {
  color: var(--secondary-strong);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.garden-picker select {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid rgba(55, 75, 118, 0.14);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-weight: 800;
}

.career-summary,
.garden-record,
.end-stats {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(55, 75, 118, 0.11);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
}

.career-summary {
  grid-template-columns: repeat(4, 1fr);
}

.resume-run-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 9px;
  padding: 11px 12px;
  border: 1px solid rgba(63, 125, 82, 0.22);
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(222, 244, 210, 0.92), rgba(255, 250, 231, 0.88));
  text-align: left;
}

.daily-contract-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 9px;
  padding: 11px 12px;
  border: 1px solid rgba(205, 112, 54, 0.25);
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(255, 240, 189, 0.94), rgba(245, 222, 255, 0.88));
  text-align: left;
}

.garden-tour-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 9px;
  padding: 11px 12px;
  border: 1px solid rgba(72, 106, 181, 0.25);
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(220, 237, 255, 0.94), rgba(231, 222, 255, 0.9));
  text-align: left;
}

.garden-tour-card.completed {
  border-color: rgba(71, 147, 82, 0.35);
  background: linear-gradient(135deg, rgba(218, 245, 222, 0.95), rgba(224, 237, 255, 0.9));
}

.garden-tour-copy,
.garden-tour-actions {
  min-width: 0;
}

.garden-tour-copy span {
  display: block;
  color: #405da2;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.garden-tour-copy strong {
  display: block;
  margin-top: 2px;
}

.garden-tour-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.3;
}

.garden-tour-actions {
  display: flex;
  gap: 7px;
}

.daily-contract-card.completed {
  border-color: rgba(71, 147, 82, 0.35);
  background: linear-gradient(135deg, rgba(222, 244, 210, 0.94), rgba(255, 243, 205, 0.9));
}

.daily-contract-copy {
  min-width: 0;
}

.daily-contract-copy span {
  display: block;
  color: #a0532f;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.daily-contract-copy strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 16px;
}

.daily-contract-copy p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.daily-contract-actions {
  display: flex;
  gap: 7px;
}

.daily-contract-actions button {
  padding: 10px 12px;
  white-space: nowrap;
}

.companion-guide {
  display: grid;
  gap: 8px;
  margin-top: 9px;
  padding: 10px 12px;
  border: 1px solid rgba(73, 123, 81, 0.22);
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(229, 246, 211, 0.92), rgba(220, 237, 255, 0.88));
  text-align: left;
}

.companion-guide-heading span {
  display: block;
  color: #4f7955;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.companion-guide-heading strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 14px;
}

.companion-guide-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.companion-recipe-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.companion-recipe {
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid color-mix(in srgb, var(--recipe-color) 32%, transparent);
  border-radius: 11px;
  background: rgba(255, 255, 255, .64);
}

.companion-recipe strong,
.companion-recipe span,
.companion-recipe em {
  display: block;
}

.companion-recipe strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.companion-recipe span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.companion-recipe em {
  margin-top: 3px;
  color: #536578;
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.22;
}

.elite-guide {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  padding: 9px 11px;
  border: 1px solid rgba(95, 91, 139, 0.18);
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(243, 239, 255, 0.92), rgba(255, 241, 229, 0.9));
  text-align: left;
}

.elite-guide-heading span {
  display: block;
  color: #6d5c92;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.elite-guide-heading strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 14px;
}

.elite-guide-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.elite-guide-grid > div {
  min-width: 0;
  padding: 6px 7px;
  border-top: 3px solid var(--elite-color);
  border-radius: 9px;
  background: rgba(255, 255, 255, .65);
}

.elite-guide-grid strong,
.elite-guide-grid span {
  display: block;
}

.elite-guide-grid strong {
  color: var(--ink);
  font-size: 10px;
}

.elite-guide-grid span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.25;
}

.resume-run-card.hidden {
  display: none;
}

.resume-run-copy {
  min-width: 0;
}

.resume-run-copy span {
  display: block;
  color: #59705d;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.resume-run-copy strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 16px;
}

.resume-run-copy p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.resume-run-actions {
  display: flex;
  gap: 7px;
}

.resume-run-actions button {
  padding: 10px 12px;
  white-space: nowrap;
}

.career-stat strong,
.garden-record strong,
.end-stat strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
}

.garden-record {
  grid-template-columns: 1fr auto;
  margin-top: 10px;
}

.garden-medals {
  color: #d46a35;
  letter-spacing: 0.08em;
  text-align: right;
}

.garden-trait,
.garden-encounter {
  grid-column: 1 / -1;
  display: grid;
  gap: 2px;
  margin-top: 3px;
  padding-top: 10px;
  border-top: 1px solid rgba(55, 75, 118, 0.1);
  color: #40526e;
}

.garden-trait strong,
.garden-encounter strong {
  font-size: 14px;
}

.garden-trait span,
.garden-encounter span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.garden-encounter {
  border-top-style: dashed;
  color: #7b4b42;
}

#startOverlay .overlay-card {
  width: min(660px, 100%);
  max-height: calc(100% - 8px);
  padding: 15px 20px 14px;
  overflow-y: auto;
}

#startOverlay .overlay-title {
  font-size: clamp(34px, 4vw, 44px);
}

#startOverlay .overlay-copy {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.32;
}

#startOverlay .career-summary {
  margin-top: 8px;
  padding: 7px 11px;
}

#startOverlay .resume-run-card {
  margin-top: 8px;
}

#startOverlay .daily-contract-card {
  margin-top: 8px;
}

#startOverlay .garden-tour-card {
  margin-top: 8px;
}

#startOverlay .companion-guide {
  margin-top: 8px;
}

#startOverlay .elite-guide {
  margin-top: 8px;
}

#startOverlay .difficulty-grid {
  margin-top: 9px;
}

#startOverlay .garden-picker {
  margin-top: 8px;
}

#startOverlay .garden-record {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 7px 11px;
}

#startOverlay .garden-trait,
#startOverlay .garden-encounter {
  grid-column: auto;
}

#startOverlay .overlay-note {
  margin-top: 6px;
  font-size: 12px;
}

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

.boon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.boon-option {
  min-height: 174px;
  padding: 18px 15px;
  border: 1px solid rgba(61, 119, 207, 0.14);
  border-radius: 20px;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 8%, var(--boon-soft, rgba(255, 222, 185, 0.8)), transparent 38%),
    rgba(255, 255, 255, 0.76);
  box-shadow: 0 12px 20px rgba(58, 80, 116, 0.12);
  cursor: pointer;
  text-align: left;
}

.boon-option:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 28px rgba(58, 80, 116, 0.17);
}

.boon-icon {
  display: block;
  margin-bottom: 12px;
  font-size: 30px;
}

.boon-name {
  display: block;
  margin-bottom: 7px;
  color: var(--secondary-strong);
  font-size: 17px;
  font-weight: 950;
}

.boon-description {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.4;
}

.cultivar-card {
  width: min(680px, 100%);
}

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

.cultivar-option {
  min-height: 190px;
}

.cultivar-cost {
  display: inline-flex;
  margin-top: 14px;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--secondary-strong);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.02em;
}

.end-stats {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  text-align: center;
}

.pause-card {
  max-width: 440px;
}

.build-dock {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 4;
  display: grid;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.3), transparent 34%),
    var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  box-shadow: 0 16px 26px rgba(40, 57, 90, 0.1);
  pointer-events: auto;
}

.inspector-title {
  margin: 1px 0 0;
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1;
}

.shop-hint {
  margin: 0;
  padding: 0 2px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.shop-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 188px);
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.shop-item {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  width: 100%;
  padding: 8px 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(61, 83, 127, 0.1);
  box-shadow: none;
}

.shop-item::after {
  content: attr(data-hotkey);
  position: absolute;
  top: 5px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(61, 83, 127, 0.1);
  font-size: 9px;
  font-weight: 900;
}

.shop-item.active {
  background: linear-gradient(180deg, rgba(255, 230, 191, 0.96) 0%, rgba(255, 215, 158, 0.92) 100%);
  border-color: rgba(217, 133, 67, 0.32);
}

.shop-item.insufficient {
  opacity: 0.58;
}

.shop-item.active.insufficient {
  opacity: 0.86;
}

.shop-icon {
  width: 30px;
  height: 30px;
  display: block;
  border-radius: 10px;
  padding: 2px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.78);
}

.shop-meta {
  text-align: left;
}

.shop-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.05;
}

.shop-copy {
  display: none;
}

.shop-cost {
  font-size: 13px;
  font-weight: 900;
}

.inspector-card {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  display: grid;
  gap: 8px;
  padding: 10px 11px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.74);
  width: min(280px, calc(100vw - 32px));
  max-width: 286px;
  box-shadow: 0 12px 24px rgba(40, 57, 90, 0.11);
}

.inspector-card.is-empty {
  display: none;
}

.panel-heading,
.inspector-body {
  display: grid;
  gap: 6px;
}

.panel-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inspector-close {
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(61, 83, 127, 0.1);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: none;
}

.inspector-close:hover {
  background: rgba(255, 255, 255, 0.9);
}

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

.inspector-stat {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

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

.inspector-actions button {
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1;
}

@media (max-width: 1120px) {
  .stats-ribbon {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
    max-width: min(560px, calc(100% - 200px));
  }

  .build-dock {
    gap: 6px;
  }
}

@media (max-width: 820px) {
  body {
    padding:
      calc(10px + env(safe-area-inset-top))
      calc(10px + env(safe-area-inset-right))
      calc(10px + env(safe-area-inset-bottom))
      calc(10px + env(safe-area-inset-left));
  }

  .game-shell {
    min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 20px);
  }

  .board-shell,
  #gameCanvas {
    min-height: clamp(560px, 100dvh, 900px);
    border-radius: 26px;
  }

  .board-hud {
    padding: 10px 10px 96px;
  }

  .hud-row-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .back-link,
  .wave-button {
    width: 100%;
  }

  .hud-actions {
    width: 100%;
    grid-column: 1 / -1;
  }

  .stats-ribbon {
    grid-column: 1 / -1;
    order: 3;
    max-width: none;
    gap: 8px;
    padding: 8px;
  }

  .status-strip {
    max-width: min(68vw, 430px);
  }

  .utility-button {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 11px;
  }

  .overlay {
    padding: 14px;
  }

  .overlay-card {
    padding: 24px 18px 18px;
    border-radius: 24px;
  }

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

  .career-summary { grid-template-columns: repeat(2, 1fr); }
  .end-stats { grid-template-columns: repeat(2, 1fr); }

  #startOverlay .garden-trait,
  #startOverlay .garden-encounter {
    grid-column: 1 / -1;
  }

  .boon-grid {
    grid-template-columns: 1fr;
    max-height: 52dvh;
    overflow-y: auto;
  }

  .boon-option {
    min-height: 0;
  }

  .build-dock {
    left: 10px;
    right: 10px;
    bottom: 10px;
    gap: 4px;
    padding: 6px 7px;
    border-radius: 18px;
  }

  .shop-grid {
    grid-auto-columns: minmax(128px, 39vw);
    gap: 6px;
  }

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

  .inspector-card {
    gap: 6px;
    padding: 9px 10px;
    max-width: none;
    width: min(270px, calc(100vw - 22px));
  }

  .panel-heading .panel-copy,
  #inspectorCopy,
  .shop-hint {
    display: none;
  }

  .inspector-stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .companion-recipe-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

  .garden-tour-actions > * {
    flex: 1;
  }

  .daily-contract-actions > * {
    flex: 1;
  }

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

  .resume-run-actions > * {
    flex: 1;
  }

  .board-hud {
    padding-bottom: 92px;
  }

  .hud-row-bottom {
    gap: 6px;
  }

  .status-strip {
    max-width: calc(100% - 94px);
  }

  .utility-actions {
    display: grid;
    gap: 4px;
  }

  .utility-button {
    min-width: 88px;
    min-height: 32px;
    padding: 5px 8px;
    font-size: 10px;
  }

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

  .stat-chip {
    padding: 9px 10px;
  }

  .stat-value {
    font-size: 18px;
  }

  .shop-grid {
    grid-auto-columns: minmax(120px, 38vw);
  }

  .shop-item {
    min-height: 54px;
    padding: 7px 8px;
  }

  .panel-copy {
    font-size: 12px;
  }

  .shop-title {
    font-size: 13px;
  }

  .shop-cost {
    font-size: 12px;
  }

  .inspector-card {
    width: min(248px, calc(100vw - 18px));
  }

  .inspector-actions button {
    min-height: 36px;
    padding: 7px 8px;
    font-size: 12px;
  }
}
