:root {
  color-scheme: dark;
  --bg: #11181d;
  --panel: #192228;
  --line: #34434a;
  --text: #f0ede4;
  --dim: #b5c1c3;
  --gold: #edd0a0;
  font: 16px/1.5 system-ui, "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p, figure { margin: 0; }
h1 { font-size: clamp(1.5rem, 5vw, 2.65rem); font-weight: 650; letter-spacing: .07em; line-height: 1.2; }
h2 { font-size: 1.04rem; font-weight: 650; }
input, button, select, textarea { font: inherit; }
button, select, .link-button {
  min-height: 43px; border: 1px solid var(--line); border-radius: 7px;
  background: #212c32; color: var(--text); padding: .55rem .8rem;
}
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
button:hover:not(:disabled), .link-button:hover { border-color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
a { color: var(--gold); }
input:not([type="checkbox"]), textarea {
  padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 7px;
  background: var(--bg); color: var(--text); min-width: 0; width: 100%;
}
input[type="checkbox"] { accent-color: var(--gold); width: 1rem; height: 1rem; }
.primary { background: var(--gold); border-color: var(--gold); color: #23201b; font-weight: 700; }
.secondary { width: 100%; }
#open-stage-camera { margin-top: 8px; }
.link-button { display: inline-flex; align-items: center; text-decoration: none; font-size: .875rem; }
.text-button { background: transparent; color: var(--gold); padding-inline: .6rem; }
.muted, .eyebrow { color: var(--dim); font-size: .84rem; }
.eyebrow { letter-spacing: .14em; }
.remote { max-width: 830px; padding: 33px 16px 70px; margin: auto; }
.remote-header { display: flex; justify-content: space-between; align-items: end; gap: 10px; margin-bottom: 22px; }
.remote-header h1 { margin-top: 6px; }
.live-indicator { color: #b9e7b9; font-size: .82rem; white-space: nowrap; }
.live-indicator::before { content: '●'; font-size: .65rem; padding-right: .4rem; }
.start-panel {
  display: grid; grid-template-columns: minmax(100px, 230px) 1fr; align-items: center; gap: clamp(14px, 5vw, 38px);
  overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
}
.start-panel img { display: block; width: 100%; height: 100%; object-fit: cover; min-height: 228px; }
.start-panel > div { padding: 18px 16px 18px 0; }
.start-panel p { margin: .6rem 0 1rem; max-width: 28rem; color: var(--dim); font-size: .92rem; }
.remote-controls { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.preview-panel { display: flex; align-items: center; gap: 14px; }
.preview-art { width: 88px; flex: 0 0 88px; border-radius: 5px; }
.preview-meta { display: grid; gap: 6px; min-width: 0; justify-items: start; }
#preview-effect { position: absolute; bottom: 13%; left: 5%; right: 5%; text-align: center; color: white; font: 600 .65rem serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch, .control-options label { display: inline-flex; align-items: center; gap: .36rem; }
.segmented, .cue-grid { display: grid; gap: 6px; }
.segmented { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 12px; }
.segmented button[aria-pressed="true"], .cue-grid button[aria-pressed="true"] { border-color: #b69768; color: var(--gold); background: #352d24; }
.cue-grid { grid-template-columns: repeat(auto-fit, minmax(83px, 1fr)); margin-bottom: 12px; }
.cue-grid .numbers { display: flex; gap: 5px; grid-column: 1 / -1; }
.numbers button { flex: 1; min-width: 0; padding-inline: .1rem; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.control-options { display: flex; flex-wrap: wrap; gap: 12px; margin: 13px 0; font-size: .88rem; }
.poster-layout { margin-top: 13px; display: grid; grid-template-columns: minmax(80px, 132px) minmax(0, 1fr); align-items: start; gap: 13px; }
#poster-preview { width: 100%; height: auto; border-radius: 4px; background: var(--bg); }
.photo-inputs { display: grid; gap: .55rem; margin-top: .9rem; }
.photo-inputs label { display: grid; gap: .25rem; }
#blog-fields { margin-top: 0; }
#poster-download { margin-top: .6rem; }
.photo-viewer { display: grid; min-height: 100vh; min-height: 100dvh; place-items: center; background: #000; }
.photo-viewer img { display: block; max-width: 100%; max-height: 100vh; max-height: 100dvh; object-fit: contain; }
.photo-card { position: relative; }
.photo-card.blog { width: min(100vw, 71.4286vh); width: min(100vw, 71.4286dvh); }
.photo-card.blog #live-photo { width: 100%; }
#blog-target { position: absolute; top: 23.1481%; left: 4.4444%; width: 91.1111%; height: 73.6772%; object-fit: cover; }
.photo-viewer.blog { background: #fbfcf9; }
#audience-loading {
  position: fixed; inset: 50% 16px auto; margin: 0; text-align: center;
  color: #27352f; font-size: 1rem;
}
#audience-loading a { color: inherit; }
#live-photo { position: relative; }
#audience-connection {
  position: fixed; bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  max-width: calc(100% - 30px); width: max-content; padding: 6px 12px;
  background: #14181ee8; color: #fff; border-radius: 6px; font-size: .9rem; z-index: 2;
}
.poster-controls { display: grid; gap: 6px; }
.poster-controls label { font-size: .82rem; color: var(--dim); }
.poster-controls button { margin-top: 3px; }
#poster-save-dialog { width: min(92%, 460px); max-height: 92vh; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; }
#poster-save-dialog::backdrop { background: #000b; }
#poster-save-image { display: block; max-width: 100%; max-height: 73vh; margin: auto; object-fit: contain; }
.backstage summary { cursor: pointer; font-size: .95rem; }
.backstage p { color: var(--dim); margin: 10px 0; font-size: .86rem; }
.remote-status { min-height: 1.3em; margin-top: 12px; color: var(--gold); font-size: .87rem; }
.gallery { width: min(100% - 28px, 520px); margin: 0 auto; padding: 16px 0 24px; }
.gallery-header { display: flex; justify-content: space-between; color: var(--dim); font-size: .78rem; letter-spacing: .13em; padding-bottom: 12px; }
.gallery-header span { color: var(--text); }
.artwork { position: relative; aspect-ratio: 3 / 4; overflow: hidden; isolation: isolate; background: #141d24; }
.exhibit .artwork { border-radius: 3px; }
.artwork img, #camera-feed { position: absolute; display: block; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.art-look, .art-mirror { opacity: 0; transition: opacity .58s ease-out; }
.art-look { clip-path: ellipse(24% 20% at 38% 22%); mask-image: radial-gradient(ellipse 24% 20% at 38% 22%, black 64%, transparent 100%); }
.artwork[data-look="true"] .art-look { opacity: 1; }
.art-mirror { clip-path: polygon(76% 13%, 94% 7%, 95% 20%, 89% 59%, 71% 59%, 72% 49%); mask-image: radial-gradient(ellipse 17% 26% at 83% 34%, black 55%, transparent 100%); }
.artwork .art-mirror { opacity: var(--mirror-opacity, 0); }
#camera-feed { object-fit: cover; }
#camera-ghost {
  position: absolute; top: 8%; left: 45%; width: 43%; height: 73%;
  background: url("/mirror.webp") 94% 23% / 395% auto no-repeat;
  mask-image: radial-gradient(ellipse 46% 47% at 50% 53%, black 12%, transparent 100%);
  opacity: .63; mix-blend-mode: screen; pointer-events: none;
  animation: apparition 1.2s ease-out both;
}
.effect-text {
  position: absolute; inset: auto 7% 17%; text-align: center; overflow-wrap: anywhere;
  color: #e6ebdd; font: 600 clamp(1.75rem, 8vw, 3.8rem)/1.15 Georgia, "Songti SC", SimSun, serif;
  text-shadow: 0 0 20px #16232d, 1px 2px 5px #000;
  animation: apparition .85s ease-out both;
}
@keyframes apparition { from { opacity: 0; filter: blur(5px); } }
figcaption { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; }
figcaption h1 { font-size: clamp(1.22rem, 5vw, 1.7rem); }
figcaption p, .gallery-status { color: var(--dim); font-size: .8rem; margin-top: 5px; }
.blackout { position: fixed; inset: 0; z-index: 9; display: grid; grid-template-rows: 1fr 15dvh; background: #000; touch-action: manipulation; }
.blackout button { min-width: 0; border: 0; border-radius: 0; background: transparent; color: #777; }
.exit-blackout { position: absolute; top: max(env(safe-area-inset-top), 5px); right: 0; z-index: 1; }
.zones { display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: 1fr 1fr; height: 100%; }
.zones .advance { grid-column: span 3; }
.blackout-reset { width: 100%; height: 100%; }
.stage-camera {
  position: fixed; inset: 0; z-index: 9; background: #08090a; color: #fff;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px;
  padding: max(8px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom));
}
.stage-camera header button { background: transparent; min-height: 43px; }
.stage-viewfinder { display: grid; place-items: center; min-height: 0; }
.stage-viewfinder img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.stage-viewfinder.captured img { animation: shutter-preview .24s ease-out both; }
.stage-camera-controls { display: grid; justify-items: center; gap: 3px; }
.stage-camera-controls p { min-height: 1.2em; font-size: .85rem; }
.stage-camera .shutter {
  width: 66px; height: 66px; border: 5px solid #08090a; outline: 2px solid #fff;
  border-radius: 50%; background: #fff; padding: 0;
}
.stage-camera .shutter:focus-visible { box-shadow: 0 0 0 6px var(--gold); }
@keyframes shutter-preview { from { opacity: .55; } to { opacity: 1; } }
@media (min-width: 700px) {
  .remote-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .remote-controls > :nth-child(2) { grid-column: 1; grid-row: 2 / 4; }
  .remote-controls > :nth-child(3) { grid-column: 2; grid-row: 1 / 3; }
  .remote-controls > :nth-child(4) { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
