/* Product preview: preserve the real desktop ratio and keep every control readable. */
:root {
  --panel-width: clamp(360px, 32vw, 420px);
  --desktop-aspect: 1.777777778;
  --preview-area-height: 100dvh;
  --preview-area-width: calc(100vw - var(--panel-width));
  --desktop-width: min(var(--preview-area-width), calc(var(--preview-area-height) * var(--desktop-aspect)));
  --desktop-height: calc(var(--desktop-width) / var(--desktop-aspect));
  --desktop-left: calc((var(--preview-area-width) - var(--desktop-width)) / 2);
  --desktop-top: calc((var(--preview-area-height) - var(--desktop-height)) / 2);
  --desktop-taskbar: calc(var(--desktop-height) * 35 / 940);
  font-size: 14px;
  line-height: 1.45;
}
#studio { min-width: 0; }
#stage { min-width: 0; background: #0b171b; }
#stage .brand, #stage .scene-copy, #stage .stage-bottom, .stage-grain { display: none !important; }
#desktop-preview {
  position: fixed;
  left: var(--desktop-left);
  top: var(--desktop-top);
  width: var(--desktop-width);
  height: var(--desktop-height);
  object-fit: contain;
  object-position: center;
  display: block;
  user-select: none;
  pointer-events: none;
  background: #10273a;
}
#scene, #snow-layer {
  position: fixed;
  inset: auto;
  left: var(--desktop-left);
  top: var(--desktop-top);
  width: var(--desktop-width);
  height: calc(var(--desktop-height) - var(--desktop-taskbar));
}
#panel { min-width: 0; min-height: 0; }
.panel-header { gap: 14px; padding: 22px 22px 18px; }
.panel-header > div { min-width: 0; }
.panel-header h2 { font-size: 30px; line-height: 1.15; letter-spacing: -.4px; overflow-wrap: anywhere; }
.eyebrow { font-size: 12px; line-height: 1.5; letter-spacing: 1.3px; }
.icon-btn, .panel-footer .icon-btn {
  min-width: 44px; width: 44px; min-height: 44px; height: 44px; flex: none; font-size: 18px;
}
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 0 16px; }
.tabs button { min-width: 0; min-height: 48px; padding: 10px 2px; font-size: 12px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
#panel-scroll { min-width: 0; min-height: 0; padding: 22px; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; }
#panel-scroll section { min-width: 0; }
.section-label { font-size: 12px; line-height: 1.5; letter-spacing: 1px; gap: 10px; flex-wrap: wrap; overflow-wrap: anywhere; }
.section-label .tiny { flex: none; font-size: 12px; }
.section-label:not(:first-child) { margin-top: 28px; }
.presets { gap: 8px; }
.presets button { min-width: 0; padding-bottom: 0; }
.presets b { display: block; padding: 8px 4px; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.preset-art { height: 72px; background-size: auto 70px; }
.preset-art.quiet { background-size: auto 52px; }
.themes { flex-wrap: wrap; gap: 10px; }
.themes button { width: 44px; height: 44px; flex: none; outline-offset: 2px; }
.themes span { margin-left: 0; font-size: 13px; min-width: 90px; flex: 1; }
.text-btn { min-height: 44px; padding: 9px 0; font-size: 13px; line-height: 1.5; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.text-btn.active { padding: 9px 12px; }
.text-btn.subtle { font-size: 13px; }
.element-row { min-height: 52px; gap: 10px; padding: 5px 0; }
.element-thumb, .element-symbol { width: 36px; flex: none; }
.element-thumb { height: 40px; }
.element-label { min-width: 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
/* A full 44px hit area surrounds the compact visual switch. */
.switch, .switch:checked { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 8px; }
.switch:after { content: ''; position: absolute; inset: 10px 0; border: 1px solid #60746c; border-radius: 20px; background: #142122; }
.switch:before { z-index: 1; width: 18px; height: 18px; top: 13px; left: 3px; background: #8c9f94; }
.switch:checked:after { border-color: #adc3a6; background: #adc3a6; }
.switch:checked:before { left: 23px; background: #203a2c; }
.inset { padding: 16px; }
.inset p, .note, .advent-heading p, .advent-explainer p, .collection-card p, #gift-message p { font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.mini-title, .inset strong, .advent-explainer strong { font-size: 14px; line-height: 1.5; }
.ornaments { gap: 8px; flex-wrap: wrap; }
.ornaments button:not(.text-btn) { width: 44px; height: 44px; flex: none; outline-offset: 2px; }
.ornaments .star-gem { font-size: 31px; line-height: 44px; }
.ornaments .text-btn { padding: 8px; }
.edge-buttons { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.edge-buttons button { min-width: 0; min-height: 44px; padding: 10px 4px; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.range-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; font-size: 14px; margin: 18px 0; }
.range-row > span { min-width: 0; overflow-wrap: anywhere; }
.range-row output { font-size: 13px; white-space: nowrap; }
.range-row input { grid-column: 1 / -1; }
input[type=range] { display: block; height: 40px; background: transparent; padding: 0; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 5px; background: #40544d; }
input[type=range]::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -8px; border: 2px solid #f1dfb9; }
input[type=range]::-moz-range-track { height: 4px; border-radius: 5px; background: #40544d; }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 2px solid #f1dfb9; border-radius: 50%; background: var(--gold); }
.action-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.action-pair button, .wide-btn, .collection-card button { min-width: 0; min-height: 44px; padding: 11px 12px; font-size: 13px; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.select-row { display: flex; flex-direction: column; align-items: stretch; gap: 8px; font-size: 14px; line-height: 1.5; margin: 18px 0; }
.select-row span { min-width: 0; overflow-wrap: anywhere; }
.select-row select { width: 100%; min-width: 0; max-width: none; min-height: 44px; padding: 10px 8px; font-size: 13px; text-overflow: ellipsis; }
.system-switch { min-height: 48px; gap: 14px; font-size: 14px; line-height: 1.5; }
.system-switch span { min-width: 0; overflow-wrap: anywhere; }
.shortcuts > div { min-height: 44px; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.shortcuts span { min-width: 0; overflow-wrap: anywhere; }
kbd { font-size: 12px; line-height: 1.5; padding: 7px 9px; white-space: nowrap; }
.decoration-group h4 { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.gift-actions { padding-left: 0; flex-wrap: wrap; gap: 8px; }
.gift-actions .text-btn { font-size: 13px; max-width: 100%; }
.gift-size-controls { gap: 5px; flex: none; }
.gift-size-controls button, .size-buttons button { min-width: 44px; width: 44px; min-height: 44px; height: 44px; font-size: 18px; }
.gift-size-controls output, .size-buttons output { min-width: 45px; font-size: 13px; }
.size-buttons { flex-wrap: wrap; }
.size-buttons button[data-size-reset] { width: auto; font-size: 13px; padding: 8px 12px; }
#calendar { gap: 8px; }
#calendar button { height: auto; min-height: 78px; padding: 8px 3px; font-size: 20px; }
#calendar small { font-size: 12px; line-height: 1.4; }
#calendar button.owned span { font-size: 12px; }
#calendar button.review img { height: 46px; }
.advent-heading h3 { font-size: 29px; line-height: 1.2; }
.advent-types { gap: 8px; }
.advent-types span { font-size: 12px; line-height: 1.4; padding: 6px 8px; }
section[data-page="advent"] h4 { font-size: 12px; line-height: 1.5; letter-spacing: 1px; }
.collection-card { align-items: flex-start; min-width: 0; }
.collection-card > div { min-width: 0; }
.collection-card > img { flex: none; }
.collection-card strong { font-size: 14px; overflow-wrap: anywhere; }
.collection-actions { gap: 8px; }
#gift-message { font-size: 14px; }
#performance-status, #performance-result { font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
#performance-result { overflow-x: auto; }
#performance-result table { font-size: 13px; }
.panel-footer { height: auto; min-height: 64px; display: grid; grid-template-columns: 8px minmax(0, 1fr) 44px; gap: 8px; padding: 10px 22px; font-size: 12px; line-height: 1.5; }
.panel-footer #animate-preview { grid-column: 1 / -1; margin: 0; padding: 8px 0; }
.panel-footer .icon-btn { margin-left: 0; }
#save-status { min-width: 0; overflow-wrap: anywhere; }
#toast { left: calc(var(--desktop-left) + var(--desktop-width) / 2); top: calc(var(--desktop-top) + 16px); bottom: auto; width: max-content; max-width: min(520px, calc(var(--desktop-width) - 24px)); font-size: 13px; line-height: 1.5; padding: 12px 16px; }
#edit-banner { left: calc(var(--desktop-left) + 12px); top: calc(var(--desktop-top) + 64px); bottom: auto; max-width: calc(var(--desktop-width) - 24px); font-size: 12px; line-height: 1.5; }
#loading { font-size: 14px; line-height: 1.5; }
#overlay-pill button { height: 44px; width: 44px; }
body.overlay #scene, body.overlay #snow-layer { inset: 0; width: 100%; height: 100%; }
body.overlay #toast { top: 18px; left: 50%; max-width: calc(100vw - 24px); }
body.overlay #edit-banner { left: 12px; top: 64px; max-width: calc(100vw - 24px); }
@media (max-width: 900px) {
  :root { --panel-width: 360px; }
  .panel-header { padding: 18px 18px 14px; }
  #panel-scroll { padding: 18px; }
  .panel-footer { padding-inline: 18px; }
}
@media (max-width: 900px) {
  :root { --panel-width: 0px; --preview-area-width: 100vw; --preview-area-height: min(36dvh, 300px); }
  #studio { display: block; overflow: hidden; }
  #stage { height: var(--preview-area-height); min-height: 0; }
  #panel { position: fixed; inset: var(--preview-area-height) 0 0; width: 100%; border-top: 1px solid #ffffff1c; border-left: 0; }
  #scene, #snow-layer { left: var(--desktop-left); top: var(--desktop-top); width: var(--desktop-width); height: calc(var(--desktop-height) - var(--desktop-taskbar)); }
  .panel-header { padding: 14px 18px 10px; }
  .panel-header .eyebrow { font-size: 12px; letter-spacing: 1px; }
  .panel-header h2 { font-size: 27px; margin-top: 5px; }
  .tabs { gap: 4px; padding: 0 12px; }
  .tabs button { font-size: 13px; padding: 8px 3px; }
  #panel-scroll { padding: 18px; }
  #toast { top: calc(var(--desktop-top) + 10px); max-width: calc(var(--desktop-width) - 20px); font-size: 12px; }
  #edit-banner { top: calc(var(--desktop-top) + 50px); font-size: 12px; }
  .panel-footer { min-height: 60px; padding: 8px 18px; }
}
@media (max-width: 380px) {
  .tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabs button { min-height: 44px; }
  .action-pair { grid-template-columns: 1fr; }
  .panel-header { padding-inline: 14px; }
  #panel-scroll { padding: 16px 14px; }
  .panel-footer { padding-inline: 14px; }
}
@media (max-height: 600px) and (max-width: 900px) {
  :root { --preview-area-height: 30dvh; }
  .panel-header h2 { font-size: 24px; }
  .panel-header { padding-top: 10px; padding-bottom: 8px; }
}

/* The browser demo contains the core decoration set only. */
.demo-no-advent [data-tab="advent"],
.demo-no-advent [data-page="advent"],
.demo-no-advent #advent-controls { display: none !important; }
.demo-no-advent .tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* The public studio exposes three actions that run in the product engine. */
.moment-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-top:10px}
.moment-actions button{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:4px;min-height:52px;padding:6px 3px;border:1px solid #8e835f;border-radius:6px;background:#27372c;color:#f5ead3;font-size:13px;line-height:1.2;overflow-wrap:anywhere}
.moment-actions i{font:normal 17px/1 Georgia;color:#f0d599}
.moment-actions button:hover,.moment-actions button:focus-visible{background:#374834}
#web-edition{color:#f0d599;text-underline-offset:3px;margin-right:10px;text-decoration:underline;font-size:13px}
#web-moments{margin-bottom:20px}
