:root {
  color-scheme: dark;
  --paper: #f6deb0;
  --ink: #2f2015;
  --brass: #bc9261;
  --green: #213c30;
  --deep: #18251e;
  font-family: Georgia, "Times New Roman", serif;
  background: #211d18;
  color: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid #ffdc95; outline-offset: 3px; }
[hidden] { display: none !important; }

.demo-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 1760px);
  min-height: 100svh;
  height: 100dvh;
  margin-inline: auto;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  gap: clamp(5px, 1.15dvh, 12px);
  background: #261f17 url('assets/cardboard/cloth-grain.webp') center / 210px auto;
  background-blend-mode: multiply;
}

.demo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-inline: clamp(3px, 1.6vw, 22px);
}
.demo-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #ffdfa2;
  font-size: clamp(20px, 3vw, 31px);
  font-weight: 900;
  text-decoration: none;
  text-shadow: 0 2px #120e0b;
}
.demo-brand img {
  width: clamp(30px, 4.8vw, 44px);
  height: auto;
  border: 1px solid #a07a4e;
  border-radius: 8px;
}
.demo-sound {
  min-height: 40px;
  padding: 5px 14px;
  border: 1px solid #aa8052;
  border-radius: 6px;
  background: #2b2d20;
  color: #f4d8a3;
  font-weight: 700;
}
.demo-sound[aria-pressed='false'] { color: #c3a488; }
.demo-sound[aria-pressed='true']::before { content: '♪'; margin-right: .4em; color: #eec07d; }

.demo-arena {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  isolation: isolate;
  min-height: 0;
  overflow: clip;
  border: clamp(2px, .42vw, 6px) solid #956745;
  border-radius: 11px;
  background: #61513d url('assets/act-two/small/meadow.webp') center / cover no-repeat;
  box-shadow: 0 1px 0 #d2a469, 0 4px 15px #100e0bb0, inset 0 0 0 1px #d2a469;
}
.demo-field { position: relative; min-height: 0; }
#demo-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}
.demo-hud {
  position: absolute;
  inset: clamp(6px, 1.5vmin, 16px) clamp(7px, 1.8vmin, 22px) auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  pointer-events: none;
}
.demo-combatant {
  --bar: #b4d78b;
  width: min(100%, 252px);
  padding: clamp(4px, 1.1vmin, 11px);
  border: 1px solid #bb9364;
  border-radius: 6px;
  background: #23382dec;
  box-shadow: inset 0 0 0 1px #e5cc8a35, 0 2px 5px #2c241ab0;
  color: #fff0cd;
}
.demo-enemy {
  --bar: #f2a268;
  justify-self: end;
  background: #613429ef;
}
.demo-health-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  font-size: clamp(11px, 1.6vw, 17px);
  line-height: 1.07;
}
.demo-health-label span { flex: none; font-variant-numeric: tabular-nums; }
.demo-combatant progress {
  display: block;
  width: 100%;
  height: clamp(5px, 1.05vmin, 10px);
  margin-top: 5px;
  appearance: none;
  overflow: clip;
  border: 0;
  border-radius: 10px;
  background: #171b17a8;
  color: var(--bar);
}
.demo-combatant progress::-webkit-progress-bar { background: #171b17a8; border-radius: 10px; }
.demo-combatant progress::-webkit-progress-value { background: var(--bar); border-radius: 10px; }
.demo-combatant progress::-moz-progress-bar { background: var(--bar); border-radius: 10px; }
.demo-round {
  min-width: 0;
  margin: 0;
  padding: 5px .9em;
  border: 1px solid #ba855a;
  border-radius: 5px;
  background: #742f26ec;
  color: #ffe9ba;
  font-size: clamp(11px, 1.55vw, 17px);
  font-weight: 700;
  text-align: center;
}

.demo-shell:not([data-state='ready']) .demo-intro,
.demo-shell:is([data-state='ready'], [data-state='won'], [data-state='lost'], [data-state='error']) .demo-hud,
.demo-shell:is([data-state='ready'], [data-state='won'], [data-state='lost']) .demo-footer,
.demo-shell[data-state='error'] .demo-controls { display: none; }

.demo-banner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(8px, 2vw, 28px);
  margin: 0 clamp(5px, 1.1vw, 16px) clamp(5px, 1.1vw, 14px);
  padding: clamp(9px, 1.25vw, 18px) clamp(14px, 3.65vw, 55px);
  border: 2px solid #eec48a;
  border-radius: clamp(10px, 1.6vw, 24px);
  color: #302114;
  background: linear-gradient(90deg, #c083482c, #fff2bd21 25%, #fff2bd21 75%, #c083482c),
    #efcc96 url('assets/cardboard/paper-grain.webp') 0 0 / 300px 90px repeat;
  box-shadow: 0 3px 6px #4d281b8f, inset 0 0 7px #9f5e3f57, inset 0 0 0 2px #fff0beb0;
}
.demo-banner::before {
  content: '';
  position: absolute;
  inset: clamp(3px, .45vw, 7px);
  border: 1px dashed #95623c;
  border-radius: inherit;
  box-shadow: 0 1px #fff1bcaa;
  pointer-events: none;
}
.demo-banner :is(h1, h2) {
  margin: 0;
  font-size: clamp(24px, 3.65vw, 56px);
  line-height: 1.02;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.demo-shell[data-state='won'] .demo-banner h2 { color: #3f461f; }
.demo-shell[data-state='lost'] .demo-banner h2 { color: #87251d; }
.demo-banner-copy p {
  margin: .3em 0 0;
  font-size: clamp(13px, 1.75vw, 23px);
  line-height: 1.2;
  text-wrap: pretty;
}
.demo-banner-copy p:empty { display: none; }
.demo-banner :is(.demo-main-action, .demo-secondary-action) {
  display: inline-grid;
  place-items: center;
  min-height: clamp(44px, 5.7vw, 65px);
  padding: 5px clamp(10px, 2.05vw, 31px);
  border: 2px solid #815234;
  border-radius: clamp(6px, .9vw, 13px);
  background: #f1d5a56b;
  color: #302114;
  font-size: clamp(14px, 2.25vw, 32px);
  font-weight: 850;
  line-height: 1.04;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 0 #8b59283b, inset 0 0 0 1px #ffe9b97a;
}
.demo-banner .demo-main-action,
.demo-shell[data-state='lost'] .demo-banner .demo-secondary-action {
  border-color: #39421d;
  color: #fff0cc;
  background: linear-gradient(#66743d55, #29371989), #596636 url('assets/cardboard/cloth-grain.webp') center / 200px auto;
  background-blend-mode: normal, multiply;
  box-shadow: 0 2px 0 #5038235e, inset 0 0 0 1px #b9b1748f;
  text-shadow: 0 1px #343c20;
}
.demo-banner :is(a, button):hover:not(:disabled) { filter: brightness(1.12); }
.demo-banner :is(a, button):focus-visible { outline-color: #66371f; }
.demo-banner button:disabled { opacity: .6; cursor: wait; }
.demo-result-actions { display: flex; flex-wrap: wrap; gap: clamp(6px, 1.45vw, 22px); }
.demo-status {
  margin: 0;
  color: #e5be89;
  font-size: clamp(11px, 1.2vw, 14px);
  line-height: 1.12;
  text-align: center;
}
.demo-status:empty, [data-state='ready'] .demo-status { display: none; }

.demo-footer { min-width: 0; }
.demo-turn-note {
  display: grid;
  align-content: center;
  gap: 2px;
  min-height: 35px;
  margin-bottom: clamp(4px, .75dvh, 8px);
}
.demo-intent {
  margin: 0;
  color: #ffd896;
  font-size: clamp(12px, 1.5vw, 17px);
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-wrap: balance;
}
.demo-controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(3px, .85vw, 13px);
  width: min(100%, 940px);
  margin-inline: auto;
}
.demo-controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(3px, .7vw, 9px);
  min-width: 0;
  min-height: clamp(48px, 8.8dvh, 64px);
  padding: 4px .45em;
  border: 1px solid #a4af68;
  border-radius: 8px;
  background: #e5bd84 url('assets/direct-trade/parchment.webp') center / 100% 100%;
  box-shadow: inset 0 0 0 2px #66744080, 0 2px 0 #130f0b;
  color: var(--ink);
  font-size: clamp(11px, 1.45vw, 16px);
  font-weight: 850;
  line-height: 1.03;
  text-align: center;
}
.demo-controls button:not(:disabled):hover { filter: brightness(1.1); }
.demo-controls button:disabled {
  border-color: #947d5e;
  background-color: #c3ae91;
  background-blend-mode: multiply;
  box-shadow: inset 0 0 0 1px #956a4880, 0 2px 0 #130f0b;
  color: #291b12;
  cursor: default;
}
.demo-controls button[data-current] {
  border-color: #ffe7a2;
  box-shadow: inset 0 0 0 2px #c98a3c, 0 0 11px #ffcc7175;
}
.demo-controls button img { flex: none; width: clamp(16px, 3.8vw, 40px); height: auto; max-height: 37px; object-fit: contain; }
.demo-controls button:disabled :is(img, .demo-extinguisher-icon) { opacity: .65; }
.demo-action-caption {
  display: grid;
  align-content: center;
  gap: 3px;
  min-width: 0;
}
.demo-action-caption small {
  display: block;
  min-height: 1em;
  color: #59361f;
  font-size: clamp(9px, 1.08vw, 12px);
  font-weight: 700;
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.demo-controls button:disabled .demo-action-caption small { color: #34261c; }
.demo-extinguisher-icon {
  position: relative;
  flex: none;
  width: clamp(14px, 2vw, 25px);
  height: clamp(20px, 3vw, 35px);
  margin: 4px 3px 0;
  border: 2px solid #42271b;
  border-radius: .45em .45em .24em .24em;
  background: linear-gradient(#ffffff2b, transparent), linear-gradient(#a84e36 30%, #ebcc91 30% 56%, #933a2b 56%);
  box-shadow: inset -2px 0 #641d22, 0 1px #f5cc91;
}
.demo-extinguisher-icon::before {
  position: absolute;
  inset: -.38em 16% auto;
  height: .32em;
  border-radius: 35% 35% 0 0;
  background: #42271b;
  content: '';
}
.demo-extinguisher-icon::after {
  position: absolute;
  top: -.18em;
  left: 76%;
  width: 65%;
  height: 56%;
  border: solid #42271b;
  border-width: 2px 2px 0 0;
  border-radius: 0 .4em 0 0;
  content: '';
}
.demo-no-script { padding: 8px; font-weight: bold; text-align: center; }

@media (orientation: landscape) and (max-height: 470px) {
  .demo-shell { padding-block: max(3px, env(safe-area-inset-top)) max(5px, env(safe-area-inset-bottom)); gap: 4px; }
  .demo-brand img { width: 28px; }
  .demo-brand { font-size: 20px; }
  .demo-sound { min-height: 28px; font-size: 13px; }
  .demo-banner { padding-block: clamp(7px, 2.4dvh, 11px); }
  .demo-banner :is(h1, h2) { font-size: clamp(20px, 4vw, 38px); }
  .demo-banner-copy p { font-size: clamp(12px, 1.9vw, 17px); }
  .demo-turn-note { min-height: 28px; gap: 0; }
  .demo-controls button img { max-width: 25px; }
  .demo-extinguisher-icon { height: 23px; }
}

@media (orientation: landscape) and (max-height: 300px) {
  .demo-combatant { width: min(100%, 166px); padding: 3px 5px; }
  .demo-combatant progress { margin-top: 3px; }
  .demo-round { padding: 4px 7px; }
  .demo-banner { padding-inline: 12px; }
  .demo-banner :is(a, button) { padding-inline: 9px; font-size: 14px; }
}

@media (max-width: 560px) {
  .demo-controls button { flex-direction: column; gap: 3px; padding: 3px 1px; }
  .demo-action-caption { gap: 2px; }
  .demo-intent { font-size: 12px; }
}

@media (orientation: portrait) {
  .demo-shell { grid-template-rows: auto minmax(370px, 1fr) auto; }
  .demo-hud { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .demo-controls button { min-height: 56px; }
}

@media (orientation: portrait) and (max-width: 560px) {
  .demo-banner { grid-template-columns: 1fr; padding: 12px 16px; }
  .demo-banner :is(h1, h2) { font-size: clamp(24px, 6.5vw, 33px); }
  .demo-banner :is(a, button) { justify-self: start; }
}
