:root {
  --bg-top: #f5cf83;
  --bg-mid: #f4b170;
  --bg-bottom: #7fd0ef;
  --panel: rgba(48, 22, 10, 0.84);
  --panel-soft: rgba(255, 247, 228, 0.9);
  --panel-border: rgba(255, 255, 255, 0.22);
  --text-strong: #fff8ea;
  --text-soft: rgba(255, 248, 234, 0.82);
  --accent: #ffe27a;
  --shadow: rgba(34, 12, 4, 0.28);
  --page-gutter: clamp(10px, 2.2vw, 34px);
  --panel-radius: clamp(18px, 2vw, 28px);
  --panel-gap: clamp(12px, 1.5vw, 24px);
  --frame-padding: clamp(10px, 1.25vw, 18px);
}

* {
  box-sizing: border-box;
}

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

html {
  font-size: clamp(14px, calc(0.42vw + 11px), 18px);
}

body {
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text-strong);
  background:
    radial-gradient(circle at top left, rgba(255, 250, 226, 0.72), transparent 26%),
    radial-gradient(circle at 86% 16%, rgba(255, 227, 130, 0.45), transparent 20%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 42%, var(--bg-bottom) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  opacity: 0.25;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: calc(100vw - var(--page-gutter) - var(--page-gutter));
  margin: 0 auto;
  padding: clamp(14px, 2vw, 32px) 0 clamp(20px, 3vw, 44px);
}

.hero {
  margin-bottom: var(--panel-gap);
}

.hero-copy,
.game-frame,
.noscript {
  backdrop-filter: blur(12px);
  background: linear-gradient(180deg, rgba(79, 35, 13, 0.88), var(--panel));
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius);
  box-shadow: 0 24px 80px var(--shadow);
}

.hero-copy {
  padding: clamp(18px, 2vw, 34px);
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 1;
}

h1 em {
  font-style: italic;
  color: var(--accent);
}

.admin-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.info-modal__copy code,
.page-footer__status code {
  padding: 0.12em 0.4em;
  border-radius: 999px;
  background: rgba(255, 236, 164, 0.14);
  color: #ffe07f;
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 0.92em;
}

.info-modal__button--ghost {
  color: var(--text-strong);
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.page-footer {
  width: calc(100vw - var(--page-gutter) - var(--page-gutter));
  margin: clamp(16px, 2vw, 28px) auto clamp(20px, 3vw, 36px);
  padding: 0 clamp(4px, 1vw, 12px);
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 1.4vw, 20px) clamp(16px, 2vw, 28px);
  align-items: baseline;
  justify-content: space-between;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.5;
}

.page-footer__status {
  margin: 0;
  flex: 1 1 280px;
}

.page-footer__actions {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px;
}

.page-footer__link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.page-footer__link:hover,
.page-footer__link:focus-visible {
  outline: none;
  color: #fff8ea;
}

.page-footer__link--ghost {
  color: var(--text-soft);
}

.page-footer-paid {
  width: calc(100vw - var(--page-gutter) - var(--page-gutter));
  margin: clamp(16px, 2vw, 28px) auto clamp(20px, 3vw, 36px);
  padding: 0 clamp(4px, 1vw, 12px);
  text-align: center;
}

.page-footer-paid__link {
  font-size: 8pt;
  font-weight: 600;
  line-height: 1.35;
  color: #095240;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.page-footer-paid__link:hover,
.page-footer-paid__link:focus-visible {
  color: #0d4538;
  outline: none;
}

.page-footer-paid__link:focus-visible {
  outline: 2px solid #0d6848;
  outline-offset: 3px;
  border-radius: 2px;
}

.game-frame {
  position: relative;
  overflow: hidden;
  padding: var(--frame-padding);
}

#game {
  display: block;
  width: 100%;
  height: clamp(360px, min(68vh, 56.25vw), 900px);
  border-radius: calc(var(--panel-radius) - 6px);
  background: linear-gradient(180deg, #9ce3ff 0%, #7ccaf4 100%);
  image-rendering: pixelated;
}

.hud {
  position: absolute;
  top: calc(var(--frame-padding) + 10px);
  bottom: auto;
  left: calc(var(--frame-padding) + 12px);
  right: auto;
  z-index: 1;
  max-width: calc(100% - 2 * var(--frame-padding) - 24px);
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  padding: clamp(8px, 1vw, 12px) clamp(11px, 1.15vw, 16px);
  border-radius: 999px;
  background: rgba(22, 9, 2, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff5d5;
  font-size: clamp(0.78rem, calc(0.58vw + 0.46rem), 0.95rem);
  line-height: 1.4;
  pointer-events: none;
}

.hud__currency {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hud__currency-icon,
.currency-mark {
  display: inline-grid;
  place-items: center;
  min-width: 1.15em;
  color: #f5c749;
  text-shadow: 0 1px 0 rgba(111, 63, 7, 0.75);
  font-weight: 800;
}

.info-modal[hidden] {
  display: none;
}

.info-modal {
  position: absolute;
  inset: var(--frame-padding);
  z-index: 3;
  display: grid;
  place-items: center;
  padding: clamp(14px, 2vw, 24px);
  background: rgba(17, 7, 2, 0.38);
  backdrop-filter: blur(8px);
}

.info-modal__panel {
  width: min(100%, 520px);
  padding: 24px 24px 22px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(64, 28, 10, 0.96), rgba(42, 17, 6, 0.94));
  box-shadow: 0 26px 70px rgba(23, 9, 2, 0.38);
}

#info-modal {
  container-type: inline-size;
  place-items: center;
  padding: clamp(8px, 1.25vw, 16px);
}

#info-modal .info-modal__panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  width: fit-content;
  max-width: calc(100% - clamp(14px, 3%, 26px));
  height: auto;
  max-height: calc(100% - clamp(14px, 3%, 26px));
  min-height: 0;
  padding: clamp(20px, 2.5vw, 38px);
  border-radius: calc(var(--panel-radius) - 4px);
}

#info-modal .info-modal__eyebrow,
#info-modal .info-modal__panel h2,
#info-modal .info-modal__copy {
  margin-left: auto;
  margin-right: auto;
  width: auto;
  align-self: center;
  max-width: 45rem;
}

#info-modal .info-modal__copy {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 0.5rem;
  scrollbar-gutter: stable;
  font-size: clamp(1.04rem, calc(0.52vw + 0.88rem), 1.22rem);
  line-height: 1.72;
}

#info-modal .info-modal__button {
  flex: 0 0 auto;
  align-self: center;
  width: auto;
  max-width: 45rem;
}

@supports (container-type: inline-size) {
  /* Content width cap uses the overlay (#info-modal), not the shrink-wrapped panel. */
  #info-modal .info-modal__eyebrow,
  #info-modal .info-modal__panel h2,
  #info-modal .info-modal__copy {
    max-width: min(45rem, calc(100cqi - clamp(40px, 10cqi, 72px)));
  }

  #info-modal .info-modal__button {
    max-width: min(45rem, calc(100cqi - clamp(40px, 10cqi, 72px)));
  }
}

#info-modal .info-modal__copy img {
  max-width: min(100%, 460px);
}

#info-modal .info-modal__panel h2 {
  font-size: clamp(1.85rem, 3.3vw, 2.7rem);
  line-height: 1.02;
}

#info-modal .info-modal__eyebrow {
  font-size: 0.82rem;
}

.info-modal__eyebrow {
  margin: 0 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
}

.info-modal__panel h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.05;
}

.info-modal__copy {
  margin: 14px 0 18px;
  color: var(--text-soft);
  line-height: 1.6;
}

.info-modal__copy p,
.settings-preview__body p {
  margin: 0 0 0.85rem;
}

.info-modal__copy p:last-child,
.settings-preview__body p:last-child,
.info-modal__copy ul:last-child,
.settings-preview__body ul:last-child,
.info-modal__copy ol:last-child,
.settings-preview__body ol:last-child {
  margin-bottom: 0;
}

.info-modal__copy ul,
.info-modal__copy ol,
.settings-preview__body ul,
.settings-preview__body ol {
  margin: 0 0 0.85rem;
  padding-left: 1.3rem;
}

.info-modal__copy a,
.settings-preview__body a {
  color: #ffe28f;
}

.info-modal__copy img,
.settings-preview__body img {
  display: block;
  max-width: min(100%, 420px);
  height: auto;
  margin: 0.85rem 0;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.settings-preview__meta {
  margin: 0 0 18px;
  color: rgba(255, 246, 212, 0.7);
  font-size: 0.88rem;
  line-height: 1.5;
}

.info-modal__button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  color: #4f2b08;
  background: linear-gradient(180deg, #ffe88b, #efc554);
  cursor: pointer;
}

.info-modal__button:hover,
.info-modal__button:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(255, 214, 109, 0.28);
}

.admin-modal__panel {
  width: min(100%, 540px);
}

.admin-modal__form {
  margin-top: 18px;
}

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

.admin-modal__field span {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-modal__field input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text-strong);
  background: rgba(255, 255, 255, 0.08);
}

.admin-modal__field input:focus {
  outline: none;
  border-color: rgba(255, 226, 122, 0.72);
  box-shadow: 0 0 0 3px rgba(255, 226, 122, 0.16);
}

.admin-modal__error {
  min-height: 1.4em;
  margin: 2px 0 14px;
  color: #ffcf95;
  font-size: 0.92rem;
}

/*
 * Settings and image-picker modals escape the .game-frame and take over the
 * full browser viewport while open. The base .info-modal rule positions
 * absolute inside the frame; these overrides switch to position:fixed so the
 * editor has the whole window to work with regardless of game canvas size.
 */
#settings-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  padding: clamp(12px, 2vw, 32px);
}

#settings-modal .info-modal__panel.settings-modal__panel {
  width: min(100%, 1280px);
  max-width: calc(100vw - clamp(24px, 4vw, 64px));
  max-height: calc(100vh - clamp(24px, 4vw, 64px));
}

.settings-modal__panel {
  width: min(100%, 1120px);
  max-height: min(88vh, 860px);
  overflow: auto;
}

.settings-modal__header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.settings-modal__intro {
  max-width: 42rem;
  margin-bottom: 0;
}

.settings-section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section__header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.settings-section__eyebrow,
.settings-preview__eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
}

.settings-section__header h3 {
  margin: 0;
  font-size: clamp(1.3rem, 2.5vw, 1.75rem);
}

.settings-section__copy {
  margin: 10px 0 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.settings-section__save {
  margin: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff1c7;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: nowrap;
}

.settings-box-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.settings-box-picker__button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  color: #fff4da;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.settings-box-picker__button.is-active {
  color: #4f2b08;
  background: linear-gradient(180deg, #ffe88b, #efc554);
  border-color: transparent;
}

.settings-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.85fr);
  gap: 22px;
  margin-top: 20px;
}

.settings-editor {
  display: grid;
  gap: 18px;
}

.settings-editor__block,
.settings-preview__card {
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  padding: 18px;
}

.settings-editor__label-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.settings-editor__label {
  margin: 0;
  color: var(--text-strong);
  font-size: 1rem;
  font-weight: 700;
}

.settings-editor__hint {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

.settings-value-field {
  display: inline-flex;
  align-items: center;
  width: min(100%, 280px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(12, 5, 2, 0.24);
  overflow: hidden;
}

.settings-value-field:focus-within {
  border-color: rgba(255, 226, 122, 0.58);
  box-shadow: 0 0 0 3px rgba(255, 226, 122, 0.12);
}

.settings-value-field__prefix {
  display: inline-grid;
  place-items: center;
  align-self: stretch;
  min-width: 48px;
  color: #f5c749;
  background: rgba(255, 226, 122, 0.12);
  font-size: 1.25rem;
  font-weight: 800;
}

.settings-value-field input {
  width: 100%;
  border: 0;
  padding: 14px 16px;
  font: inherit;
  color: var(--text-strong);
  background: transparent;
}

.settings-value-field input:focus {
  outline: none;
}

.settings-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.settings-toolbar__button {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  min-width: 42px;
  padding: 8px 10px;
  font: inherit;
  font-weight: 700;
  color: #fff2cf;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.settings-toolbar__button:hover,
.settings-toolbar__button:focus-visible,
.settings-box-picker__button:hover,
.settings-box-picker__button:focus-visible {
  outline: none;
  border-color: rgba(255, 226, 122, 0.54);
  box-shadow: 0 0 0 3px rgba(255, 226, 122, 0.12);
}

.settings-editor__field {
  min-height: 170px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 5, 2, 0.24);
  color: var(--text-strong);
  line-height: 1.6;
  overflow: auto;
}

.settings-editor__field--header {
  min-height: 92px;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.25;
}

.settings-editor__field--body {
  min-height: 220px;
}

.settings-editor__field:focus {
  outline: none;
  border-color: rgba(255, 226, 122, 0.58);
  box-shadow: 0 0 0 3px rgba(255, 226, 122, 0.12);
}

.settings-editor__field:empty::before {
  content: attr(data-placeholder);
  color: rgba(255, 248, 234, 0.4);
}

.settings-editor__field img {
  max-width: min(100%, 320px);
  height: auto;
  border-radius: 14px;
}

.settings-preview__title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.1;
  font-weight: 700;
}

.settings-preview__body {
  margin: 14px 0 18px;
  color: var(--text-soft);
  line-height: 1.6;
}

.image-picker-modal {
  z-index: 30;
}

/*
 * Like the settings modal, the image picker covers the full browser viewport
 * (and stacks above settings via the higher z-index below).
 */
#image-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  padding: clamp(12px, 2vw, 32px);
}

#image-picker-modal .info-modal__panel.image-picker-modal__panel {
  width: min(100%, 1100px);
  max-width: calc(100vw - clamp(24px, 4vw, 64px));
  max-height: calc(100vh - clamp(24px, 4vw, 64px));
}

.image-picker-modal__panel {
  width: min(100%, 920px);
  max-height: min(88vh, 780px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
  padding: 24px 24px 22px;
}

.image-picker-modal__header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.image-picker-modal__intro {
  max-width: 44rem;
  margin-bottom: 0;
}

.image-picker-modal__body {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 18px;
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
}

.image-picker-modal__section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.image-picker-modal__section h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: #fff4d3;
}

.image-picker-modal__section--library {
  grid-row: span 2;
}

.image-picker-modal__hint {
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.45;
}

.image-picker-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  overflow: auto;
  padding: 4px;
  min-height: 0;
}

.image-picker-library__item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  font: inherit;
  color: #fff4d3;
  text-align: left;
}

.image-picker-library__item:hover,
.image-picker-library__item:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 213, 122, 0.12);
}

.image-picker-library__item.is-active {
  border-color: var(--accent);
  background: rgba(255, 213, 122, 0.2);
  box-shadow: 0 0 0 2px rgba(255, 213, 122, 0.25);
}

.image-picker-library__thumb {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
}

.image-picker-library__thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.image-picker-library__name {
  margin: 0;
  font-size: 0.78rem;
  word-break: break-all;
  color: #fff4d3;
}

.image-picker-library__empty {
  margin: 0;
  padding: 12px;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.image-picker-upload {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.image-picker-upload__label {
  font-size: 0.85rem;
  color: #fff4d3;
}

.image-picker-upload__input {
  font: inherit;
  color: #fff4d3;
}

.image-picker-modal__section--preview {
  gap: 8px;
}

.image-picker-preview {
  display: grid;
  place-items: center;
  min-height: 140px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px dashed rgba(255, 255, 255, 0.16);
}

.image-picker-preview img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.image-picker-preview__placeholder {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.88rem;
  text-align: center;
}

.image-picker-preview__source {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-soft);
  word-break: break-all;
  min-height: 1em;
}

.image-picker-modal__alt-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: #fff4d3;
}

.image-picker-modal__alt-field input {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.28);
  color: #fff4d3;
  font: inherit;
}

.image-picker-modal__alt-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.image-picker-modal__error {
  margin: 0;
  min-height: 1.2em;
  color: #ffb37a;
  font-size: 0.85rem;
}

.image-picker-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.image-picker-modal__actions .info-modal__button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .image-picker-modal__body {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .image-picker-modal__section--library {
    grid-row: auto;
  }
}

.touch-controls {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: clamp(18px, 5vw, 42px);
  margin-top: clamp(12px, 2vw, 20px);
  padding: clamp(8px, 1.6vw, 16px) clamp(4px, 1vw, 12px) 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.touch-controls__dpad {
  display: grid;
  grid-template-columns: repeat(3, clamp(48px, 13vw, 72px));
  grid-template-rows: repeat(3, clamp(48px, 13vw, 72px));
  gap: clamp(5px, 1.2vw, 9px);
}

.touch-controls__actions {
  display: flex;
  align-items: flex-end;
  gap: clamp(12px, 3vw, 22px);
}

.touch-control {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  color: #fff4d3;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04)),
    rgba(57, 24, 8, 0.76);
  box-shadow: 0 12px 26px rgba(24, 8, 2, 0.28);
  font: inherit;
  font-size: clamp(0.68rem, 2vw, 0.9rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  touch-action: none;
}

.touch-control.is-pressed,
.touch-control:active {
  transform: translateY(2px);
  background:
    linear-gradient(180deg, rgba(255, 226, 122, 0.36), rgba(255, 255, 255, 0.08)),
    rgba(80, 39, 11, 0.9);
  box-shadow: inset 0 4px 10px rgba(50, 20, 5, 0.32);
}

.touch-control--up {
  grid-column: 2;
  grid-row: 1;
}

.touch-control--left {
  grid-column: 1;
  grid-row: 2;
}

.touch-controls__dpad-center {
  grid-column: 2;
  grid-row: 2;
  border-radius: 16px;
  background: rgba(255, 226, 122, 0.13);
  border: 1px solid rgba(255, 226, 122, 0.18);
}

.touch-control--right {
  grid-column: 3;
  grid-row: 2;
}

.touch-control--down {
  grid-column: 2;
  grid-row: 3;
}

.touch-control__glyph {
  display: block;
  line-height: 1;
  font-size: clamp(1.1rem, 3.2vw, 1.55rem);
  font-weight: 700;
  letter-spacing: 0;
}

.touch-control--a,
.touch-control--b {
  width: clamp(58px, 15vw, 88px);
  height: clamp(58px, 15vw, 88px);
  border-radius: 999px;
  color: #4f2b08;
  background: linear-gradient(180deg, #fff09c, #efc554);
  font-size: clamp(1.15rem, 5vw, 1.75rem);
}

.touch-control--b {
  background: linear-gradient(180deg, #d9f1ff, #8bc9e9);
}

.noscript {
  width: calc(100vw - var(--page-gutter) - var(--page-gutter));
  margin: 0 auto 32px;
  padding: 16px 20px;
}

/*
 * Show the on-screen controls on actual touch devices (hover:none / pointer:coarse)
 * AND when the viewport is narrow enough to be treated as a mobile-sized browser
 * (max-width: 860px matches the rest of the mobile breakpoint in this file).
 * Without the width-based trigger, desktop browsers resized narrow still report
 * hover:hover + pointer:fine, so the controls would stay hidden.
 */
@media (hover: none), (pointer: coarse), (max-width: 860px) {
  .touch-controls {
    display: flex;
  }
}

/*
 * Landscape overlay layout: D-pad pinned to the left side of the game frame,
 * A/B pinned to the right. Triggers for real touch devices in landscape AND
 * for narrow landscape browser windows so the desktop resize case works too.
 */
@media
  (hover: none) and (orientation: landscape),
  (pointer: coarse) and (orientation: landscape),
  (max-width: 860px) and (orientation: landscape) {
  .touch-controls {
    position: absolute;
    inset: var(--frame-padding);
    z-index: 2;
    align-items: flex-end;
    margin: 0;
    padding: clamp(10px, 2vw, 24px);
    pointer-events: none;
  }

  .touch-controls__dpad,
  .touch-controls__actions {
    pointer-events: auto;
  }

  .touch-controls__dpad {
    grid-template-columns: repeat(3, clamp(44px, 8vw, 64px));
    grid-template-rows: repeat(3, clamp(44px, 8vw, 64px));
  }

  .touch-control--a,
  .touch-control--b {
    width: clamp(54px, 10vw, 82px);
    height: clamp(54px, 10vw, 82px);
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding-top: clamp(10px, 3vw, 18px);
  }

  .hero-copy {
    padding: 18px;
  }

  .settings-modal__header,
  .settings-section__header,
  .settings-editor__label-row {
    flex-direction: column;
  }

  .settings-workspace {
    grid-template-columns: 1fr;
  }

  .settings-section__save {
    white-space: normal;
  }

  #game {
    height: clamp(340px, 64vh, 620px);
  }

  .hud {
    top: calc(var(--frame-padding) + 10px);
    bottom: auto;
    left: calc(var(--frame-padding) + 10px);
    right: auto;
    max-width: calc(100% - 2 * var(--frame-padding) - 20px);
    border-radius: 20px;
    flex-direction: row;
  }

}


/* ── Splash screen ───────────────────────────────────────────────────────── */
.splash-screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(79, 35, 13, 0.96), rgba(34, 10, 2, 0.98));
  border-radius: calc(var(--panel-radius) - 6px);
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.splash-screen.is-hidden {
  opacity: 0;
}

.splash-screen h1 {
  margin: 0;
  text-align: center;
  padding: 0 clamp(16px, 4vw, 48px);
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.1;
  color: var(--text-strong, #fff4d3);
  text-shadow: 0 2px 24px rgba(0,0,0,0.6);
}

.splash-screen h1 em {
  font-style: italic;
  color: var(--accent, #ffd76e);
}

/* ── Victory overlay ─────────────────────────────────────────────────────── */
.victory-overlay {
  display: none;
}

.victory-overlay:not([hidden]) {
  box-sizing: border-box;
  position: absolute;
  inset: 0;
  z-index: 22;
  background:
    radial-gradient(ellipse 120% 80% at 50% 70%, rgba(48, 4, 12, 0.55) 0%, transparent 55%),
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(18, 4, 8, 0.45) 0%, transparent 45%),
    rgba(10, 3, 6, 0.78);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 8px 10px 8px;
  gap: 6px;
  animation: victoryFadeIn 0.8s ease forwards;
}

@keyframes victoryFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.victory-overlay__layout {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
}

.victory-overlay__spacer {
  flex: 1 1 32px;
  min-height: 0;
  width: 100%;
  max-width: 320px;
  pointer-events: none;
}

.victory-overlay__top {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.victory-overlay__subtitle {
  margin: -1px 0 0;
  max-width: 300px;
  width: 100%;
  padding: 0 12px;
  font-size: 14px;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.38;
  color: rgba(255, 168, 158, 0.9);
  text-shadow:
    0 0 12px rgba(90, 12, 28, 0.55),
    0 0 20px rgba(180, 40, 50, 0.25);
}

.victory-overlay__chart-card {
  flex: 0 1 auto;
  box-sizing: border-box;
  width: 320px;
  max-width: 100%;
  max-height: 100%;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(62, 8, 16, 0.35);
  box-shadow:
    0 0 0 1px rgba(120, 20, 30, 0.12),
    0 10px 40px rgba(8, 0, 6, 0.55),
    inset 0 1px 0 rgba(255, 240, 240, 0.06);
  background:
    linear-gradient(180deg, rgba(52, 6, 14, 0.14) 0%, transparent 42%),
    linear-gradient(165deg, rgba(255, 248, 240, 0.97), rgba(235, 222, 210, 0.96));
  color: #2a1610;
}

.victory-overlay__chart-stage {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 0;
}

.victory-overlay__chart-wrap {
  position: relative;
  width: 280px;
  max-width: 100%;
  margin: 0 auto;
  flex-shrink: 1;
}

.victory-overlay__chart {
  display: block;
  width: 100%;
  height: auto;
}

.victory-overlay__slice--special_interests {
  filter: drop-shadow(0 0 14px rgba(140, 0, 28, 0.65))
    drop-shadow(0 0 4px rgba(40, 0, 8, 0.9));
}

.victory-overlay__slice--people {
  filter: drop-shadow(0 2px 6px rgba(20, 80, 70, 0.35));
}

.victory-overlay__chart-surface {
  opacity: 0;
  transform: translateY(18px) scale(0.86) rotate(-8deg);
  transform-origin: 50% 50%;
}

.victory-overlay.is-chart-visible .victory-overlay__chart-surface {
  opacity: 1;
  transform: translateY(0) scale(1) rotate(0deg);
  transition:
    opacity 0.5s ease,
    transform 0.75s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.victory-overlay__total {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  min-width: 116px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(252, 244, 240, 0.94);
  border: 1px solid rgba(90, 24, 36, 0.22);
  box-shadow:
    0 6px 22px rgba(40, 4, 12, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  color: #4a1620;
  font-size: 15px;
  font-weight: 900;
  transform: translate(-50%, -50%);
}

.victory-overlay__legend {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  flex: 0 0 auto;
}

.victory-overlay__legend-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(140, 83, 32, 0.08);
}

.victory-overlay__legend-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.victory-overlay__legend-swatch {
  margin-top: 4px;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(58, 36, 16, 0.12);
  flex-shrink: 0;
}

.victory-overlay__legend-label {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.32;
  color: #402813;
}

.victory-overlay__legend-value {
  color: #8a5417;
  font-size: 12px;
  font-weight: 800;
  white-space: normal;
}

.victory-overlay__legend-item--people {
  background: rgba(32, 118, 104, 0.1);
  border: 1px solid rgba(32, 118, 104, 0.22);
}

.victory-overlay__legend-item--people .victory-overlay__legend-value {
  color: #1d5c52;
}

.victory-overlay__legend-item--special_interests {
  background: linear-gradient(135deg, rgba(74, 8, 22, 0.16), rgba(32, 4, 14, 0.1));
  border: 1px solid rgba(110, 14, 38, 0.5);
  box-shadow: inset 0 0 0 1px rgba(200, 48, 72, 0.1);
  animation: victorySpecialInterestPulse 2.8s ease-in-out infinite;
}

.victory-overlay__legend-item--special_interests .victory-overlay__legend-label {
  color: #2c050c;
}

.victory-overlay__legend-item--special_interests .victory-overlay__legend-value {
  color: #580618;
  font-weight: 900;
}

@keyframes victorySpecialInterestPulse {
  0%,
  100% {
    box-shadow:
      inset 0 0 0 1px rgba(200, 48, 72, 0.1),
      0 0 0 0 transparent;
  }

  50% {
    box-shadow:
      inset 0 0 0 1px rgba(220, 56, 82, 0.18),
      0 0 20px rgba(90, 6, 22, 0.2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .victory-overlay__legend-item--special_interests {
    animation: none;
  }
}

.victory-overlay__emphasis {
  margin: 0;
  flex: 0 0 auto;
  padding: 9px 6px 0;
  border-top: 2px solid rgba(86, 10, 26, 0.5);
  text-align: center;
  font-size: 13px;
  line-height: 1.42;
  letter-spacing: 0.012em;
  color: rgba(36, 14, 14, 0.95);
  font-weight: 600;
  background: linear-gradient(180deg, rgba(62, 10, 22, 0.08), transparent 72%);
}

.victory-overlay__emphasis-stat {
  display: block;
  margin-bottom: 8px;
  font-size: 22px;
  line-height: 1.06;
  font-weight: 900;
  letter-spacing: 0.045em;
  color: #38020c;
  text-shadow:
    0 0 26px rgba(200, 36, 52, 0.5),
    0 1px 0 rgba(255, 200, 200, 0.12);
}

.victory-overlay__emphasis-body {
  display: block;
  font-weight: 600;
}

.victory-overlay__emphasis-evil {
  font-weight: 800;
  color: #2a040d;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(120, 14, 38, 0.55);
}

.victory-overlay__emphasis-drown {
  font-style: italic;
  font-weight: 600;
  color: rgba(48, 18, 14, 0.92);
}

.victory-overlay__title {
  margin: 0;
  color: #ffc8b8;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.02em;
  text-shadow:
    0 0 18px rgba(180, 32, 48, 0.55),
    0 0 28px rgba(255, 210, 150, 0.25);
  padding: 0 12px;
}

.victory-replay {
  appearance: none;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: rgba(48, 22, 10, 0.88);
  color: var(--accent);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 9px 22px;
  cursor: pointer;
  letter-spacing: 0.05em;
  box-shadow: 0 0 28px rgba(255, 226, 122, 0.3), 0 4px 18px rgba(34, 12, 4, 0.45);
  transition:
    background 0.15s,
    box-shadow 0.15s,
    transform 0.1s;
}

.victory-replay:hover {
  background: rgba(72, 36, 14, 0.96);
  box-shadow: 0 0 44px rgba(255, 226, 122, 0.55), 0 6px 22px rgba(34, 12, 4, 0.5);
}

.victory-replay:active {
  transform: scale(0.95);
}

.victory-overlay__fine-print {
  flex: 0 0 auto;
  margin: 0;
  padding: 2px 12px 1px;
  text-align: center;
  font-size: 8pt;
  line-height: 1.3;
  color: rgba(255, 226, 220, 0.48);
}

.victory-overlay__fine-print a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.victory-overlay__fine-print a:hover {
  color: rgba(255, 236, 230, 0.72);
}

/* ── Hunter Rand funding (post–full-victory; scroll reveal) ──────────────── */
.hunter-funding {
  position: relative;
  margin-top: var(--panel-gap);
  border: 1px solid rgba(32, 120, 92, 0.22);
  border-radius: var(--panel-radius);
  box-shadow:
    0 18px 48px rgba(24, 80, 64, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  background: transparent;
  color: #173d32;
}

/*
 * Backdrop blur lives on ::before instead of this section so 3D flips inside
 * .hunter-funding__flip-inner stay in a real preserved-3D context — ancestor
 * backdrop-filter tends to flatten backface-visibility (mirrored front on flip).
 */
.hunter-funding::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
  backdrop-filter: blur(12px);
  background: linear-gradient(168deg, rgba(244, 252, 248, 0.98), rgba(208, 236, 222, 0.95));
}

.hunter-funding:focus {
  outline: none;
}

.hunter-funding:focus-visible {
  outline: 2px solid #1e7d6e;
  outline-offset: 3px;
}

.hunter-funding__inner {
  position: relative;
  z-index: 1;
  max-width: 26rem;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 32px);
  display: grid;
  gap: 14px;
}

.hunter-funding__title {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 750;
  line-height: 1.18;
}

.hunter-funding__title em {
  font-style: italic;
  color: #0d6848;
}

.hunter-funding__lead {
  margin: -2px auto 0;
  font-size: 1.02rem;
  line-height: 1.42;
  color: rgba(22, 60, 50, 0.92);
  font-weight: 600;
  text-align: center;
  max-width: 28rem;
}

.hunter-funding__lead strong {
  color: #095240;
}

.hunter-funding__flip-scope {
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  perspective: 1100px;
}

.hunter-funding__flip-root {
  width: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

.hunter-funding__flip-inner {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.4, 0.02, 0.2, 1);
}

.hunter-funding__flip-inner.is-flipped {
  transform: rotateY(180deg);
}

.hunter-funding__face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.hunter-funding__face--front {
  position: relative;
  z-index: 1;
  transform: translateZ(1px);
  -webkit-transform: translateZ(1px);
}

.hunter-funding__face--back {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  min-height: 100%;
  transform: rotateY(180deg) translateZ(1px);
  -webkit-transform: rotateY(180deg) translateZ(1px);
}

.hunter-funding__flip-inner:not(.is-flipped) .hunter-funding__face--back {
  pointer-events: none;
}

.hunter-funding__flip-inner.is-flipped .hunter-funding__face--front {
  pointer-events: none;
}

.hunter-funding__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: clamp(14px, 2.2vw, 22px) clamp(14px, 2vw, 20px);
  border-radius: calc(var(--panel-radius) - 6px);
  border: 1px solid rgba(46, 120, 100, 0.16);
  background:
    radial-gradient(circle at 30% -10%, rgba(255, 255, 252, 0.75), transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 253, 0.88), rgba(232, 248, 240, 0.62));
}

.hunter-funding__card--flip-face {
  width: 100%;
}

.hunter-funding__card--back {
  height: 100%;
  min-height: 320px;
  border: 1px solid rgba(46, 120, 100, 0.18);
  background:
    radial-gradient(circle at 50% -20%, rgba(255, 255, 255, 0.55), transparent 48%),
    linear-gradient(160deg, rgba(250, 255, 253, 0.99), rgba(228, 246, 236, 0.97));
}

.hunter-funding__back-inner {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  width: 100%;
}

.hunter-funding__back-logos {
  --back-logo-circle-h: min(148px, 52vw);
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 3.2vw, 22px);
  width: 100%;
  flex-shrink: 0;
}

.hunter-funding__back-img {
  display: block;
  flex: 0 0 auto;
  width: auto;
  object-fit: contain;
  object-position: center center;
}

.hunter-funding__back-img--circle {
  height: var(--back-logo-circle-h);
}

.hunter-funding__back-img--rt {
  height: calc(var(--back-logo-circle-h) * 0.38);
}

.hunter-funding__back-title {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 800;
  color: #0d4538;
  line-height: 1.3;
}

.hunter-funding__back-copy {
  margin: 0;
  max-width: 24rem;
  font-size: 0.93rem;
  line-height: 1.52;
  color: rgba(22, 60, 50, 0.92);
}

.hunter-funding__back-actions {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.hunter-funding__donate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  align-self: center;
  appearance: none;
  border-radius: 999px;
  padding: 13px 30px;
  font: inherit;
  font-size: 15px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  color: #fdfefa;
  border: 2px solid rgba(10, 90, 66, 0.55);
  background: linear-gradient(180deg, #128a62, #0d6848);
  box-shadow:
    0 0 18px rgba(40, 160, 120, 0.22),
    0 3px 12px rgba(24, 60, 50, 0.18);
  transition: filter 0.15s, box-shadow 0.15s, transform 0.1s;
}

.hunter-funding__donate:hover {
  filter: brightness(1.06);
  box-shadow:
    0 0 24px rgba(40, 180, 130, 0.32),
    0 4px 14px rgba(24, 60, 50, 0.2);
}

.hunter-funding__donate:active {
  transform: scale(0.97);
}

.hunter-funding__donate:focus-visible {
  outline: 2px solid #095240;
  outline-offset: 3px;
}

.hunter-funding__back-link {
  align-self: center;
  appearance: none;
  border-radius: 999px;
  padding: 10px 20px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  color: #0d4538;
  border: 2px solid rgba(14, 102, 80, 0.45);
  background: rgba(255, 255, 253, 0.85);
  box-shadow: 0 2px 10px rgba(24, 60, 50, 0.1);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}

.hunter-funding__back-link:hover {
  background: rgba(232, 250, 244, 0.96);
  box-shadow: 0 4px 14px rgba(24, 60, 50, 0.12);
}

.hunter-funding__back-link:active {
  transform: scale(0.97);
}

.hunter-funding__chart-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.hunter-funding__chart-wrap {
  position: relative;
  width: min(280px, 100%);
  margin: 0 auto;
}

.hunter-funding__chart {
  display: block;
  width: 100%;
  height: auto;
}

.hunter-funding__slice--everyday {
  filter: drop-shadow(0 2px 5px rgba(16, 80, 72, 0.22));
}

.hunter-funding__slice--llc {
  filter: drop-shadow(0 2px 4px rgba(40, 50, 60, 0.18));
}

.hunter-funding__chart-surface {
  opacity: 0;
  transform: translateY(14px) scale(0.9);
  transform-origin: 50% 50%;
}

.hunter-funding.is-chart-visible .hunter-funding__chart-surface {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    opacity 0.45s ease,
    transform 0.72s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hunter-funding__total {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  min-width: 108px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 253, 0.96);
  border: 1px solid rgba(46, 120, 100, 0.25);
  box-shadow:
    0 5px 20px rgba(24, 80, 64, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  color: #0d6848;
  font-size: 15px;
  font-weight: 900;
  transform: translate(-50%, -50%);
}

.hunter-funding__legend {
  width: 100%;
  display: grid;
  gap: 8px;
}

.hunter-funding__legend-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(30, 125, 110, 0.08);
  border: 1px solid rgba(30, 125, 110, 0.18);
}

.hunter-funding__legend-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.hunter-funding__legend-swatch {
  margin-top: 4px;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(20, 60, 50, 0.12);
  flex-shrink: 0;
}

.hunter-funding__legend-label {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  color: #184236;
}

.hunter-funding__legend-value {
  font-size: 12px;
  font-weight: 800;
  color: rgba(22, 80, 62, 0.88);
  white-space: normal;
}

.hunter-funding__legend-item--llc .hunter-funding__legend-label {
  color: #2c3540;
}

.hunter-funding__legend-item--llc .hunter-funding__legend-value {
  color: #3d4652;
}

.hunter-funding__footnote {
  margin: 4px 0 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.42;
  color: rgba(22, 60, 50, 0.85);
}

.hunter-funding__footnote-strong {
  font-weight: 800;
  color: #0d6848;
}

.hunter-funding .victory-replay.hunter-funding__support,
.hunter-funding__support {
  border-width: 2px;
  border-color: rgba(14, 102, 80, 0.55);
  color: #0d4538;
  background: rgba(255, 253, 250, 0.96);
  box-shadow:
    0 0 20px rgba(40, 180, 130, 0.18),
    0 3px 12px rgba(24, 60, 50, 0.12);
}

.hunter-funding .victory-replay.hunter-funding__support:hover,
.hunter-funding__support:hover {
  background: rgba(232, 250, 244, 0.98);
  box-shadow:
    0 0 28px rgba(40, 180, 130, 0.28),
    0 4px 14px rgba(24, 60, 50, 0.14);
}

@media (prefers-reduced-motion: reduce) {
  .hunter-funding.is-chart-visible .hunter-funding__chart-surface {
    transition-duration: 0.01ms;
  }

  .hunter-funding__flip-inner {
    transition-duration: 0.01ms;
  }
}

/* ── Music toggle button ──────────────────────────────────────────────────── */
.music-toggle {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 20;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(48, 22, 10, 0.78);
  color: var(--text-strong);
  font-size: 1.15rem;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(34, 12, 4, 0.32);
  transition: background 0.15s, transform 0.1s;
  user-select: none;
}

.music-toggle:hover {
  background: rgba(70, 35, 14, 0.92);
}

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