:root {
  color-scheme: light;
  --page: #f8f5ef;
  --paper: #fffdf9;
  --stage: #f1e6d7;
  --line: #e5dbcd;
  --ink: #302a26;
  --muted: #6d6259;
  --accent: #873338;
  --tint: #f9ebe6;
  font: 15px/1.45 "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-height: 100svh; margin: 0; display: grid; place-items: center; }
button, input, summary { font: inherit; }
button, summary { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
button:focus-visible, summary:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.icons, .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
button svg, summary svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.workspace { width: min(1190px, calc(100% - 48px)); display: grid; grid-template-columns: minmax(0, 1fr) minmax(285px, 330px); gap: 15px; align-items: center; margin-block: 18px; }
.stage { position: relative; isolation: isolate; min-width: 0; height: clamp(400px, 77svh, 730px); border: 1px solid var(--line); border-radius: 22px; background: var(--stage); }
.stage[data-alpha="false"] { background: #e9dccc; }
.surface { position: absolute; inset: 2% 3% 7%; display: grid; place-items: center; }
.screen { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.screen.poster { z-index: 1; }
.screen.native, .screen#reference { z-index: 2; }
.screen.transition-frame { z-index: 3; }
.screen.native.preparing { visibility: hidden; }
.effects-frame { position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.effects-canvas, .effects-fallback { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.effects-canvas { opacity: 0; }
.effects-frame[data-native="true"] .effects-canvas { opacity: 1; }
.effects-frame[data-native="true"] .effects-fallback { visibility: hidden; }
.prop-hotspot { position: absolute; z-index: 3; padding: 0; border: 0; border-radius: 10px; background: transparent; pointer-events: auto; }
.toy-hotspot { left: 5.5%; top: 61%; width: 20%; height: 18%; }
.bag-hotspot { left: 66.5%; top: 74%; width: 27%; height: 22%; }
.prop-hotspot:hover { background: #fff8e717; }
.stage-bag-count { position: absolute; z-index: 2; left: 80.48%; top: 85.54%; transform: translate(-50%, -50%); display: grid; place-items: center; min-width: 1.8em; height: 1.8em; padding: 0 .25em; border-radius: 50%; background: #fff8e9; box-shadow: 0 1px 5px #66432226; color: #873338; font-size: 1.05em; font-weight: 800; }
.retry-hotspot { position: absolute; z-index: 4; left: 69.29%; top: 69.46%; width: 20.95%; height: 6.43%; padding: 0; border: 1px solid #b77b72; border-radius: 8px; background: #fff6e9; color: #873338; font-size: 1em; font-weight: 750; pointer-events: auto; }
.effects-frame[data-native="true"] .retry-hotspot { border-color: transparent; background: transparent; color: transparent; }
.bag-panel { position: absolute; z-index: 5; left: 60%; top: 61%; display: grid; gap: 6px; width: 33%; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 5px 15px #49321f1a; color: var(--muted); font-size: 1em; pointer-events: auto; }
.bag-panel button { min-height: 30px; padding: 4px 5px; border: 0; border-radius: 6px; background: var(--accent); color: white; font-size: 1em; }
.fallback-feedback { position: absolute; left: 80%; top: 61%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 25%; height: 17%; border: 1px solid #d8c7b3; border-radius: 12px; background: #fffaf0; box-shadow: 3px 6px 0 #bea78d66; color: #467c60; font-size: 3.5em; font-weight: 750; }
.fallback-feedback[data-action="error"] { color: #ad3a43; }
.fallback-feedback[data-action="favorite"] { color: #ba465e; }
.fallback-feedback[data-action="wait"]::after { content: ""; position: absolute; bottom: 14%; left: 10%; width: min(80%, var(--progress, 0%)); height: 5px; border-radius: 5px; background: #679c85; }
.effects-frame[data-native="true"] .fallback-feedback { display: none; }
.empty-stage { max-width: 24ch; margin: 0; color: var(--muted); font-size: .85rem; text-align: center; }
.transport { position: absolute; z-index: 4; bottom: 12px; left: 50%; display: flex; gap: 2px; padding: 3px; border: 1px solid #d8c8b6; border-radius: 13px; background: var(--paper); transform: translateX(-50%); box-shadow: 0 2px 9px #43301d09; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #594d45; }
.icon-button:hover:not(:disabled), .settings[open] summary { color: var(--accent); background: var(--tint); }
#play { color: var(--accent); }
.settings { position: relative; }
.settings summary { list-style: none; }
.settings summary::-webkit-details-marker { display: none; }
.settings-panel { position: absolute; z-index: 6; bottom: 49px; right: -35px; display: grid; gap: 9px; width: 184px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); box-shadow: 0 8px 24px #4732201e; }
.mode-options { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 5px; }
.mode-option, .settings-share { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 32px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); font-size: .77rem; font-weight: 650; white-space: nowrap; }
.mode-option[aria-pressed="true"], .mode-option:hover, .settings-share:hover:not(:disabled) { color: var(--accent); border-color: #d6aea8; background: var(--tint); }
.settings-share svg { width: 16px; height: 16px; }
.switch-label { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .78rem; }
.switch-label input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.share-url { min-width: 0; width: 100%; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: white; font-size: .73rem; }

.controls { min-width: 0; display: grid; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.view-options { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #f2ebe1; }
.view-option { min-height: 33px; padding: 5px 9px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: .8rem; font-weight: 650; }
.view-option[aria-pressed="true"] { color: var(--accent); background: var(--paper); border-color: #e5d4c3; box-shadow: 0 1px 3px #49321f0c; }
.look-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.look-option { display: grid; grid-template-rows: 120px auto; gap: 4px; min-width: 0; padding: 5px 4px 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); font-size: .74rem; line-height: 1.2; font-weight: 650; text-align: center; }
.look-thumbnail { display: block; overflow: hidden; height: 120px; border-radius: 6px; background: #f4ecdf; }
.look-option img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; }
.look-option[aria-pressed="true"], .look-option:hover { color: var(--accent); border-color: #d6aea8; background: var(--tint); }
.workspace[data-view="looks"] .surface { inset: 3% 3% 9%; }
.workspace[data-view="looks"] .transport { gap: 3px; }
.character-options { display: flex; align-items: center; justify-content: center; gap: 9px; }
.theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.theme-option { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 35px; padding: 5px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); font-size: .74rem; font-weight: 650; }
.theme-option[aria-pressed="true"], .theme-option:hover { color: var(--accent); border-color: #d6aea8; background: var(--tint); }
.theme-option img { width: 22px; height: 24px; border-radius: 4px; object-fit: cover; object-position: center 20%; }
.character-option { position: relative; isolation: isolate; overflow: hidden; width: 70px; height: 66px; padding: 0; border: 1px solid var(--line); border-radius: 13px; background: #f2e7d9; }
.character-option img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 12%; transform: scale(2.05); transform-origin: 50% 24%; }
.character-option:hover, .character-option[aria-pressed="true"] { border-color: #a96162; }
.character-option[aria-pressed="true"] { box-shadow: 0 0 0 2px #be83804a; }
.cue-options, .shop-actions { display: grid; gap: 6px; }
.cue-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shop-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 11px; border-top: 1px solid var(--line); }
.cue-option, .shop-button { display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 42px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-size: .8rem; line-height: 1.2; font-weight: 650; text-align: left; }
.cue-option { justify-content: center; text-align: center; }
.cue-option[aria-pressed="true"], .cue-option:hover:not(:disabled), .shop-button:hover { color: var(--accent); border-color: #d6aea8; background: var(--tint); }
.shop-button svg { width: 16px; height: 16px; }
.shop-button[aria-pressed="true"] { color: var(--accent); border-color: #d6aea8; background: var(--tint); }
.shop-button[data-shop="favorite"][aria-pressed="true"] svg { fill: var(--accent); }
.counter { flex: none; display: inline-grid; place-items: center; min-width: 20px; height: 19px; margin-left: auto; padding-inline: 4px; border-radius: 20px; color: #5d5149; background: #efe8df; font-size: .69rem; font-weight: 750; }
.counter[data-filled="true"] { color: var(--accent); background: #f2ded8; }
.shop-footer { display: flex; min-height: 34px; align-items: center; justify-content: space-between; gap: 7px; }
.shop-footer .icon-button { width: 32px; height: 32px; margin-left: auto; }
.shop-footer .icon-button svg { width: 17px; height: 17px; }
.shop-status { display: inline-flex; align-items: center; max-width: 100%; min-height: 25px; padding: 3px 7px; border-radius: 6px; color: #435c43; background: #ecf2e9; font-size: .77rem; font-weight: 650; }
.shop-status:empty { visibility: hidden; }
.shop-status[data-tone="error"] { color: #8c3037; background: #faebe6; }
.shop-status[data-tone="pending"] { color: #65543c; background: #f3e9d7; }

.workspace:fullscreen, .workspace.expanded { width: 100%; height: 100svh; margin: 0; padding: 16px; background: var(--page); }
.workspace.expanded { position: fixed; z-index: 10; inset: 0; }
.workspace:fullscreen .stage, .workspace.expanded .stage { height: calc(100svh - 32px); }

@media (max-width: 725px) {
  body { align-items: start; }
  .workspace { width: calc(100% - 24px); grid-template-columns: 1fr; gap: 9px; margin-block: 9px; }
  .stage { position: sticky; z-index: 5; top: 6px; height: clamp(267px, 44svh, 430px); border-radius: 16px; }
  .surface { inset: 1% 2% 9%; }
  .transport { bottom: 7px; }
  .icon-button { width: 37px; height: 37px; }
  .controls { gap: 9px; padding: 10px; border-radius: 14px; }
  .look-option { grid-template-rows: 100px auto; }
  .look-thumbnail { height: 100px; }
  .character-option { width: 61px; height: 57px; border-radius: 11px; }
  .shop-actions { padding-top: 8px; }
  .workspace:fullscreen, .workspace.expanded { padding: 9px; overflow: auto; align-content: start; }
  .workspace:fullscreen .stage, .workspace.expanded .stage { height: clamp(267px, 44svh, 430px); }
}

@media (max-width: 340px) {
  .cue-option, .shop-button { padding-inline: 5px; font-size: .74rem; }
  .shop-button { gap: 4px; }
}
