:root {
  color-scheme: dark;
  --cream: #fff0cd;
  --ink: #312523;
  --muted: #6a564c;
  --pine: #193e32;
  --wine: #872d3b;
  --gold: #f8d08a;
  --line: #ceaf85;
  --serif: "STIX Two Text", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font: 16px/1.45 var(--sans);
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100svh; color: var(--cream);
  background-color: #142b40;
  background-image: radial-gradient(ellipse at 17% 8%, #5c8ca15c, transparent 51%),
    radial-gradient(ellipse at 84% 90%, #5f476f50, transparent 62%),
    linear-gradient(160deg,#28435b,#172e43 67%,#232d48);
}
button,input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
button:focus-visible, input:focus-visible, input:focus-visible + span { outline: 3px solid #bf7727; outline-offset: 3px; }
.top { border-bottom: 1px solid #b2c9ce38; background: #112a3bd6; }
.top-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1240px; margin: auto; padding: 10px clamp(16px,3.8vw,48px);
}
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 12px; font: 600 22px var(--serif); letter-spacing: -.025em; }
.signet {
  display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid #ddb27d;
  outline: 1px solid #ba926957; outline-offset: 3px; border-radius: 48% 48% 50% 50%;
  color: var(--gold); font: 24px/1 Georgia,serif;
}
.tools { display: flex; align-items: center; gap: 8px; }
.demo { color: #edd3ad; font-size: .88rem; padding-right: 7px; }
.tools button,.close {
  display: grid; place-items: center; width: 39px; height: 39px; padding: 0;
  border: 1px solid #bb906f80; border-radius: 50%; color: #ffe8ba; background: #254151; font: bold 20px var(--serif);
}
.tools button:hover { background: #355369; }
#sound { position: relative; }
#sound[aria-pressed=false]::after { content: ""; width: 18px; height: 2px; transform: rotate(-48deg); position: absolute; background: #f3d49e; box-shadow: 0 1px 0 #3c2029; }
#sound[aria-pressed=true] { background: var(--cream); color: #51242b; }
.book {
  position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0,1fr);
  align-items: stretch; max-width: min(1020px, max(790px, 128svh)); margin: clamp(12px,2.4vh,30px) auto 32px;
  width: calc(100% - 64px); padding: 9px; border: 1px solid #96acbc; border-radius: 15px;
  background: linear-gradient(135deg,#96b7c8,#7595aa 46%,#617c8f 53%,#829eb0);
  box-shadow: 0 4px 1px #112a37,0 6px 0 -1px #637b87,0 18px 55px #08142385;
}
.mount {
  display: grid; grid-template-columns: minmax(0,1fr); align-content: center; gap: 6px; min-width: 0; margin: 0;
  padding: clamp(4px,.55vw,8px);
  background: linear-gradient(115deg,#385a6b,#264152 93%,#203a4a);
  box-shadow: inset 0 0 0 1px #bed8dd78;
  border-radius: 8px 1px 1px 8px;
}
.scene {
  position: relative; isolation: isolate; width: 100%; aspect-ratio: 3 / 4; overflow: hidden;
  background: #203844; border: 1px solid #d3b472; border-radius: 4px;
  box-shadow: 0 2px 8px #122820a8;
}
#tree { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene-tools {
  display: flex; gap: 5px; align-items: center; justify-content: space-between; color-scheme: dark;
}
.scene-tools label {
  position: relative; display: inline-flex; align-items: center; min-height: 34px;
  color: #fffaeb; background: #172c43ef; border: 1px solid #e3d9b688;
  border-radius: 17px; font: 600 .83rem var(--sans);
}
.location-picker { max-width: 56%; min-width: 0; }
.location-picker::after {
  position: absolute; right: 10px; content: ""; width: 5px; height: 5px;
  border-right: 1.5px solid; border-bottom: 1.5px solid; transform: translateY(-2px) rotate(45deg); pointer-events: none;
}
.location-picker select {
  display: block; width: 100%; appearance: none; border: 0; border-radius: inherit;
  padding: 7px 24px 7px 10px; background: transparent; color: inherit; font: inherit;
  cursor: pointer; text-overflow: ellipsis;
}
.location-picker select:disabled { opacity: 1; cursor: default; }
.location-picker option { color: #fffaeb; background: #172c43; }
.camera-setting { gap: 5px; padding: 4px 9px; cursor: pointer; white-space: nowrap; }
.camera-setting input { margin: 0; width: 14px; height: 14px; accent-color: #ffcf80; }
.scene-tools label:focus-within { outline: 2px solid #ffdb96; outline-offset: 2px; }
.leaf,dialog {
  color-scheme: light; color: var(--ink); background-color: #f6e7c9;
  background-image: radial-gradient(ellipse at 80% 20%, #fff7e5 0, #fff8ea66 45%, transparent 70%),
    repeating-linear-gradient(15deg, transparent 0 4px, #8c5a2a05 4px 5px);
}
.leaf {
  position: relative; min-width: 0; border-radius: 1px 8px 7px 1px;
  display: flex; flex-direction: column; justify-content: center; gap: clamp(14px,2.5vh,25px);
  padding: clamp(26px,3vw,48px) clamp(20px,2.5vw,42px);
  box-shadow: inset 12px 0 15px -13px #61442e, inset -3px 0 0 #ddbf95, inset -5px 0 0 #ffefd2;
}
.leaf::before {
  content:""; pointer-events: none; position: absolute; inset: 9px 10px 9px 7px;
  border: 1px solid #b388552e; border-right-color: #b3885540; border-radius: 0 3px 3px 0;
}
.bookmark {
  position: absolute; right: clamp(24px,3vw,44px); top: 0; display: grid; place-items: start center;
  height: clamp(28px,4.5vh,48px); width: 25px; padding-top: 4px; background: linear-gradient(90deg,#7a2935,#a0444c 49%,#873640);
  clip-path: polygon(0 0,100% 0,100% 100%,50% 77%,0 100%); color: #f7cb82; font: 16px/1 var(--serif);
}
h1,h2,p { margin: 0; }
.intro h1 {
  color: #3e2228; font: 500 clamp(52px,4.8vw,75px)/.94 var(--serif);
  letter-spacing: -.058em;
}
.intro h1 em { display: block; color: var(--wine); font-weight: 400; }
.intro p { margin-top: 14px; color: var(--muted); font-size: 1rem; max-width: 33ch; }
.wallet {
  display: flex; align-items: center; gap: 8px; min-height: 54px; padding: 8px 14px; margin-bottom: 17px;
  background: radial-gradient(at 85% -70%,#426846,transparent 75%),#214538;
  color: #fbebc9; border: 1px solid #183e2d; border-radius: 7px;
  box-shadow: inset 0 0 0 2px #274936, inset 0 0 0 3px #d0b47b51;
}
.coin { border: 1px solid #dcb978; border-radius: 50%; width: 23px; height: 23px; text-align: center; font: 23px/21px var(--serif); color: #ffe3a1; }
.wallet-label { font-size: .91rem; font-weight: 550; }
#balance { margin-left: auto; color: #ffebae; font-size: clamp(1rem,2vw,1.28rem); font-variant-numeric: tabular-nums; white-space: nowrap; }
.settings { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(8px,1.2vw,18px); }
.setting label,legend { display: block; padding: 0; font-size: .88rem; color: #554037; font-weight: 650; }
.perk-setting { container-type:inline-size; min-width:0; margin-top:12px; }
.perk-options { display:flex; flex-wrap:wrap; gap:4px; margin-top:5px; }
.perk-options label {
  display:flex; flex:1 1 auto; align-items:center; justify-content:center; gap:5px;
  min-width:0; min-height:44px; padding:4px 7px; border:1px solid #b79974; border-radius:6px;
  background:#fff5e1; color:#493c30; font-size:.88rem; line-height:1.16; font-weight:600;
  cursor:pointer;
}
.perk-options input { width:16px; height:16px; flex:none; margin:0; accent-color:var(--pine); }
.perk-options label:has(input:checked) { border-color:#316049; background:#e3ecd8; color:#23432f; }
.perk-options label:focus-within { outline:2px solid #a46129; outline-offset:1px; }
#perk:disabled label { cursor:default; }
@container (max-width:405px) {
  .perk-options { display:grid; grid-template-columns:minmax(0,.92fr) minmax(0,1.35fr); }
  .perk-options label:last-child { grid-column:1 / -1; }
}
#perk-description { margin:6px 0 0; color:var(--muted); font-size:.89rem; line-height:1.4; }
#perk-description:empty { display:none; }
#perk-surcharge { display:flex; align-items:baseline; justify-content:space-between; gap:8px; margin-top:5px; color:var(--muted); font-size:.89rem; }
#perk-fee { font-variant-numeric:tabular-nums; color:var(--ink); white-space:nowrap; }
fieldset { border:0; padding:0; margin:0; min-width:0; }
.stepper,#count { margin-top: 6px; height: 44px; border: 1px solid #b79974; border-radius: 6px; background: #fff5e1; }
.stepper { display: grid; grid-template-columns: 30px minmax(0,1fr) 30px; align-items: stretch; }
.stepper button {
  padding: 0; border: 0; background: transparent; color: #743d3c; font-size: 23px; font-weight: 550;
}
.stepper button:disabled,fieldset:disabled { opacity: .55; }
.amount { display: flex; align-items: center; justify-content: center; gap: 2px; min-width:0; }
.amount input { width: 5.15ch; min-width: 0; padding: 1px 0; border: 0; background: transparent; color: var(--ink); font-weight: 720; text-align: center; }
#stake-unit { color: #735a49; font-size: .75rem; }
#count { display:flex; align-items:stretch; padding:3px; gap:1px; }
#count label { position:relative; min-width:0; flex:1; cursor:pointer; }
#count input { position:absolute; opacity:0; width:1px; height:1px; }
#count span { display:grid; place-items:center; height:100%; border-radius:3px; font-weight:650; color:#5d4c42; }
#count input:checked+span { color:#fff1d1; background:#63343a; box-shadow:inset 0 0 0 1px #5b2d35; }
.sum,.outcome-top { display:flex; align-items:baseline; justify-content:space-between; gap:8px; }
.sum { margin:16px 0 8px; font-size:.95rem; }
.sum span,.outcome-top span { color:var(--muted); }
.sum strong,.outcome-top strong { font-variant-numeric:tabular-nums; font-weight:680; }
.primary {
  display:block; width:100%; min-height:51px; padding:8px 12px; border:1px solid #6b2831; border-radius:7px;
  background:linear-gradient(175deg,#ad4651,#8a303f 65%,#752936); color:#fff0ce;
  font:700 1.12rem var(--sans); letter-spacing:.005em;
  box-shadow:inset 0 0 0 2px #903643,inset 0 0 0 3px #d99e7d85,0 2px 0 #542631;
  transition:filter .18s,transform .18s;
}
.primary:hover:enabled { filter:brightness(1.1); }
.primary:active:enabled { transform:translateY(1px); }
.primary:disabled { opacity:.72; box-shadow:inset 0 0 0 2px #903643,inset 0 0 0 3px #d99e7d70; }
.outcome { margin-top:16px; padding-top:12px; border-top:1px dashed #b99a77; }
.outcome-top { font-size:.94rem; }
.outcome-top strong { color:var(--pine); }
.outcome p { color:var(--muted); font-size:.86rem; line-height:1.4; margin-top:2px; overflow-wrap:anywhere; }
.error { color:#832a35; margin-top:8px; font-size:.9rem; }
.refill { border:0; border-bottom:1px solid currentColor; padding:3px 0; margin-top:4px; color:#572e3a; font-weight:650; background:transparent; }
dialog { border:1px solid #b89562; width:min(440px,91vw); max-height:85svh; padding:28px; border-radius:12px; box-shadow:0 15px 70px #130b14a8; }
dialog::backdrop { background:#1a101bd6; }
dialog h2 { color:#652a37; font:500 36px/1.05 var(--serif); letter-spacing:-.04em; margin:6px 38px 18px 0; }
dialog p { margin-bottom:13px; }
dialog h3 { margin:16px 0 7px; color:var(--pine); font:600 1.4rem var(--serif); }
.perk-rules { margin:0 0 13px; }
.perk-rules dt { margin:8px 0 0; font-weight:700; color:#69343c; }
.perk-rules dd { margin:1px 0 0; }
dialog .primary { margin-top:18px; }
.close { float:right; border-color:#b99c77; color:#5d3d34; background:#fff4df; }
@media(min-width:801px) and (max-width:980px) {
  .book { width:calc(100% - 32px); }
  .leaf { padding:35px 19px 26px; }
  .settings { grid-template-columns: 1.15fr .85fr; }
  .stepper { grid-template-columns:25px minmax(0,1fr) 25px; }
}
@media(max-width:800px) {
  .top-inner { max-width:600px; padding:5px 16px; }
  .brand { font-size:19px; gap:9px; }
  .signet { width:21px; height:21px; font-size:19px; outline-offset:2px; }
  .tools { gap:5px; }
  .tools button { height:34px; width:34px; }
  .book {
    display:flex; flex-direction:column; max-width:min(550px,max(378px,56svh)); width:calc(100% - 8px); margin:6px auto 20px; padding:3px;
    border-radius:11px; background: #859fb0;
  }
  .leaf { display:contents; }
  .leaf::before,.bookmark { display:none; }
  .intro,.panel { background-color:#f6e7c9; background-image:linear-gradient(110deg,transparent,#fff5df 64%,transparent); }
  .intro { order:0; padding:6px 12px; text-align:center; border-radius:5px 5px 0 0; }
  .intro h1 { font-size:clamp(34px,9.5vw,46px); line-height:1; }
  .intro h1 em { display:inline; }
  .intro p { display:none; }
  .mount { order:1; gap:4px; padding:4px 2px 2px; border-radius:0; }
  .scene { width:100%; }
  .scene-tools { padding:0 1px; }
  .scene-tools label { min-height: 32px; font-size: .78rem; }
  .panel { order:2; display:grid; grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr); align-items:center; column-gap:12px; padding:9px 10px 11px; border-radius:0 0 5px 5px; color:var(--ink); color-scheme:light; }
  .panel > * { grid-column:1 / -1; }
  .wallet { min-height:39px; padding:5px 11px; margin-bottom:9px; }
  .wallet-label { font-size:.875rem; }
  #balance { font-size:1rem; }
  .coin { width:20px; height:20px; font-size:20px; line-height:18px; }
  .settings { grid-template-columns:1.12fr .88fr; gap:12px; }
  .perk-setting { margin-top:8px; }
  .stepper,#count { margin-top:4px; height:42px; }
  .sum { grid-column:1; margin:8px 0 0; align-items:flex-start; flex-direction:column; gap:0; line-height:1.25; }
  #launch { grid-column:2; margin-top:8px; }
  .primary { min-height:44px; font-size:1.02rem; }
  .outcome { margin-top:9px; padding-top:7px; }
}
@media(max-width:355px) {
  .book {width:calc(100% - 4px);}
  .camera-setting { padding-inline:5px; }
  .location-picker select { padding-inline:7px 16px; }
  .location-picker::after { right:6px; }
  .panel { padding-inline:9px; }
  .settings { gap:6px; }
  .stepper { grid-template-columns:25px minmax(0,1fr) 25px; }
}
@media(max-width:800px) and (max-height:710px) {
  .panel .sum, #launch { grid-row:1; margin:0 0 8px; }
}
@media(prefers-reduced-motion:reduce) { * { transition:none !important; } }
