:root {
  --ink: #1f1d1a; --mute: #8a857d; --line: rgba(31, 29, 26, .09);
  --glass: rgba(255, 253, 249, .72); --accent: #2f5bd3; --warn: #b4542c;
  --serif: 'Instrument Serif', Georgia, serif; --sans: 'Inter', system-ui, sans-serif;
  --panel-w: 360px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { color: var(--ink); font: 14px/1.45 var(--sans); background: #f3ede4; overflow: hidden; }

/* ── stage: the whole window ── */
.stage { position: fixed; inset: 0; background: radial-gradient(110% 90% at 38% 40%, #fffdf9 0%, #f6f1e9 55%, #e9e0d2 100%); }
#scene, #leaders, #labels { position: absolute; inset: 0; }
#scene { z-index: 1; } #scene canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#leaders, #labels { z-index: 3; pointer-events: none; }
.lbl { position: absolute; transform: translateY(-50%); font-size: 12px; white-space: nowrap; }
.lbl b { font-weight: 600; } .lbl span { color: var(--mute); margin-left: 6px; }
.stage-title { position: absolute; left: 32px; top: 76px; z-index: 2; pointer-events: none; transition: opacity .3s; }
.stage-title em { display: block; font: italic 400 clamp(44px, 6.4vw, 96px)/.92 var(--serif); letter-spacing: -.015em; }
.stage-title span { display: block; margin-top: 10px; font-size: 15px; color: var(--mute); }
.cap { position: absolute; bottom: 22px; z-index: 2; font: 600 10px var(--sans); letter-spacing: .16em; text-transform: uppercase; color: #a39b8f; pointer-events: none; }
.cap-l { left: 32px; } .cap-r { right: calc(var(--panel-w) + 44px); }
body.panel-closed .cap-r { right: 32px; }
.stage-ctl { position: absolute; left: 50%; bottom: 18px; transform: translateX(calc(-50% - var(--panel-w) / 2)); z-index: 4; display: flex; gap: 22px; color: var(--mute); font-size: 12px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 999px; padding: 8px 18px; }
body.panel-closed .stage-ctl { transform: translateX(-50%); }
.stage-ctl label { display: flex; align-items: center; gap: 8px; }
.stage-ctl input { width: 120px; }

/* ── top bar: floats over the stage ── */
.bar { position: fixed; top: 14px; left: 16px; right: 16px; z-index: 10; display: flex; align-items: center; gap: 14px; pointer-events: none; }
.bar > * { pointer-events: auto; }
.crumb { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); text-decoration: none; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); }
#presets { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
#presets a { font: 500 12px var(--sans); color: var(--ink); text-decoration: none; padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
#presets a.on { background: var(--ink); color: #fff; }
#lang, .toggle { font: 500 12px var(--sans); color: var(--ink); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; cursor: pointer; }
#lang { margin-left: auto; }
.toggle { font-weight: 600; }

/* ── panel: frosted sheet on the right ── */
.panel { position: fixed; z-index: 9; top: 64px; right: 16px; bottom: 16px; width: var(--panel-w); overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 22px 26px; border-radius: 18px; background: var(--glass); backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2);
  border: 1px solid var(--line); box-shadow: 0 30px 60px -30px rgba(60, 40, 20, .25); transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .25s; scrollbar-width: thin; }
body.panel-closed .panel { transform: translateX(calc(100% + 24px)); opacity: 0; pointer-events: none; }
.no { color: var(--mute); font-size: 12px; }
h1 { font: 400 30px/1.05 var(--serif); margin: 4px 0 14px; }
h1 em { color: var(--mute); }
h2 { font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .1em; margin: 22px 0 8px; color: var(--mute); }
h2 small { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; }
.readout { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 6px; }
.big { font: 400 58px/1 var(--serif); display: flex; align-items: baseline; gap: 10px; }
.big small { font: italic 20px var(--serif); color: var(--mute); }
.how { margin-top: 6px; position: relative; }
.how summary { list-style: none; cursor: pointer; color: var(--mute); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.how summary::-webkit-details-marker { display: none; }
.how summary i { font: 600 10px var(--sans); font-style: normal; width: 15px; height: 15px; border-radius: 50%; border: 1px solid currentColor; display: inline-grid; place-items: center; }
.how summary:hover { color: var(--ink); }
.how-body { margin-top: 8px; padding: 12px 14px; background: rgba(255,255,255,.75); border: 1px solid var(--line); border-radius: 12px; font-size: 12.5px; line-height: 1.5; }
.how-body b { display: block; margin-bottom: 4px; }
.how-body ol { margin: 0; padding-left: 18px; color: #4a4640; }
.how-body li { margin: 3px 0; }
@media (hover: hover) { .how:not([open]):hover .how-body { display: block; position: absolute; left: 0; right: 0; z-index: 5; box-shadow: 0 20px 40px -20px rgba(0,0,0,.3); } .how:not([open]) .how-body { display: none; } }
.field { margin: 12px 0; }
.row { display: flex; justify-content: space-between; font-size: 12px; color: var(--mute); }
.row b { color: var(--ink); font-weight: 600; }
.ticks { color: #b5b0a7; font-size: 11px; }
input[type=range] { width: 100%; accent-color: var(--ink); }

#stack { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }
#stack li { display: grid; grid-template-columns: 12px 1fr 56px auto; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.6); }
#stack li.hot { border-color: var(--ink); }
.sw { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.2); }
#stack .h { width: 56px; }
#stack .tools button { border: 0; background: none; cursor: pointer; color: var(--mute); padding: 2px 3px; font-size: 13px; }
#stack .tools button:hover { color: var(--ink); }
#stack .nm { font-size: 12.5px; line-height: 1.2; } #stack .nm small { color: var(--mute); margin-left: 4px; }
.add { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.add button { font: 500 11.5px var(--sans); border: 1px solid var(--line); background: rgba(255,255,255,.7); border-radius: 999px; padding: 4px 10px; cursor: pointer; color: var(--ink); }
.add button:hover { border-color: var(--ink); }

.warn { list-style: none; padding: 0; margin: 12px 0 0; }
.warn li { color: var(--warn); font-size: 12px; padding-left: 14px; position: relative; margin: 4px 0; }
.warn li::before { content: '!'; position: absolute; left: 0; font-weight: 700; }
.shop { list-style: none; padding: 0; margin: 0; }
.shop li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dotted var(--line); padding: 4px 0; font-size: 13px; }
.shop li b { font-weight: 600; white-space: nowrap; }
.notes { margin: 0; font-size: 12.5px; }
.notes dt { font-weight: 600; margin-top: 8px; } .notes dd { margin: 2px 0 0; color: var(--mute); }
.cta { display: block; margin-top: 20px; text-align: center; background: var(--accent); color: #fff; text-decoration: none; padding: 11px; border-radius: 12px; font-weight: 600; }
.foot { color: var(--mute); font-size: 11.5px; margin-top: 14px; text-align: center; } .foot a { color: inherit; }

/* ── phone: cake on top, recipe as a sheet underneath ── */
@media (max-width: 860px) {
  :root { --panel-w: 0px; }
  body { overflow: auto; }
  .stage { position: relative; height: 64vh; height: 64svh; }
  .stage-title { left: 18px; top: 64px; } .stage-title em { font-size: 40px; }
  .cap { display: none; }
  .stage-ctl { bottom: 12px; gap: 12px; padding: 6px 12px; } .stage-ctl input { width: 80px; }
  .bar { position: absolute; top: 10px; left: 10px; right: 10px; gap: 6px; }
  .crumb span { display: none; }
  .panel { position: relative; top: auto; right: auto; bottom: auto; width: auto; margin: -18px 10px 16px; overflow: visible; }
  .toggle { display: none; }
  #lang { padding: 6px 8px; }
}

.photo-btn { font: 600 12px var(--sans); border: 0; background: var(--ink); color: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.photo-btn:disabled { opacity: .5; cursor: progress; }
.photo-box { position: absolute; z-index: 6; left: 32px; bottom: 76px; width: min(460px, calc(100vw - var(--panel-w) - 90px)); background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: 16px; padding: 10px; box-shadow: 0 30px 60px -30px rgba(60,40,20,.35); }
.photo-box .frame { position: relative; aspect-ratio: 1344 / 1024; border-radius: 10px; overflow: hidden; background: #efe7db; }
.photo-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-box img:not([src]) { visibility: hidden; }
.photo-box .wait { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--mute); font-size: 13px; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%) #efe7db; background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
.photo-box .wait:empty { display: none; }
.photo-box p { margin: 8px 4px 2px; font-size: 11.5px; color: var(--mute); }
.photo-box .x { position: absolute; top: 14px; right: 14px; z-index: 2; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 16px; cursor: pointer; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (max-width: 860px) { .photo-box { left: 10px; right: 10px; width: auto; bottom: 60px; } }
