:root {
  color-scheme: dark;
  --ink: #f2f2e7;
  --muted: #acb2a8;
  --accent: #dcf58a;
  --base: #131615;
  --line: #ffffff24;
  --glass: #141815e8;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: 'Segoe UI', Arial, sans-serif;
  color: var(--ink);
  background: var(--base);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { display: flex; flex-direction: column; height: 100dvh; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; color: inherit; }
a { color: inherit; }
button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icons { position: absolute; width: 0; height: 0; overflow: hidden; }
.tool svg, .screen-nav svg, .gallery-hint svg, .heading-indicator svg, .meme-panel a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.topbar {
  min-height: 64px;
  padding: env(safe-area-inset-top, 0px) clamp(14px, 3.1vw, 48px) 0;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid #ffffff1c;
  background: var(--base);
  z-index: 3;
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-size: 16px; font-weight: 850; letter-spacing: .115em; white-space: nowrap; }
.brand-o { color: var(--accent); }
.brand small { font: 11px ui-monospace, monospace; letter-spacing: .02em; color: var(--accent); padding: 4px 6px; border: 1px solid #dcf58a46; border-radius: 3px; }
.brand-mark { position: relative; display: grid; place-items: center; width: 28px; height: 24px; margin-right: 3px; }
.brand-mark i { position: absolute; width: 23px; height: 14px; border: 1px solid var(--accent); border-radius: 50%; }
.brand-mark i:nth-child(2) { transform: rotate(57deg); }
.brand-mark i:nth-child(3) { transform: rotate(-57deg); }
.top-actions { display: flex; gap: 8px; }
.tool { border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: transparent; color: var(--ink); padding: 9px 12px; min-height: 44px; border-radius: 6px; }
.tool:hover, .tool:focus-visible { color: var(--accent); background: #ffffff12; }
.tool:disabled { opacity: .38; cursor: default; background: transparent; color: var(--ink); }
.top-tool { font-size: 13px; }
.top-tool:hover { background: #ffffff0b; }
.square { width: 44px; height: 44px; padding: 0; }
#stage { position: relative; flex: 1; min-height: 0; overflow: hidden; isolation: isolate; background: #171e17; touch-action: none; -webkit-user-select: none; user-select: none; }
#panorama { width: 100%; height: 100%; display: block; position: absolute; inset: 0; cursor: grab; }
#panorama:focus-visible { outline-offset: -3px; }
#stage.dragging #panorama { cursor: grabbing; }
.stage-shadow { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(0deg, #0b100fba, transparent 21%), linear-gradient(118deg, #080e0bbd, transparent min(44%, 600px)); transition: opacity .25s ease; }
.scene-hud { position: absolute; z-index: 3; top: clamp(20px, 5.3vh, 56px); left: clamp(16px, 3.5vw, 58px); pointer-events: none; text-shadow: 0 2px 22px #060907b0; transition: opacity .25s ease; }
.scene-kicker { color: var(--accent); font: 600 11px ui-monospace, monospace; letter-spacing: .19em; display: flex; align-items: center; gap: 8px; }
.scene-kicker > span { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px #dcf58a76; }
h1 { font-size: clamp(35px, 5.8vw, 84px); line-height: .91; font-weight: 800; letter-spacing: -.07em; margin: 16px 0 12px; }
h1 span { color: var(--accent); }
.scene-hud p { margin: 0; font-size: clamp(12px, 1.25vw, 15px); color: #ededdd; }
#stage.engaged .scene-hud, #stage.gallery-active .scene-hud { opacity: 0; }
#stage.engaged .stage-shadow, #stage.gallery-active .stage-shadow { opacity: .66; }
#hotspots, .screen-layer { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.pin { position: absolute; pointer-events: auto; width: 40px; height: 40px; border: 0; background: transparent; display: grid; place-items: center; padding: 0; isolation: isolate; transform: translate(-50%, -50%); border-radius: 50%; }
.pin::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: #1e261ae6; border: 1px solid #e2f69cd9; box-shadow: 0 0 0 3px #daff9b1a, 0 2px 12px #0008; z-index: -1; transition: background .15s ease, color .15s ease; }
.pin:hover::before, .pin:focus-visible::before { background: var(--accent); }
.pin svg { width: 14px; height: 14px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pin:hover svg, .pin:focus-visible svg { stroke: #1d2413; }
.pin-label { display: none; position: absolute; left: 50%; bottom: calc(100% + 2px); transform: translateX(-50%); padding: 7px 9px; white-space: nowrap; color: var(--ink); background: #101611ed; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; pointer-events: none; }
.pin:is(:hover,:focus-visible) .pin-label { display: block; }
.view-tools { display: flex; flex-direction: column; gap: 6px; position: absolute; z-index: 4; bottom: calc(25px + var(--safe-bottom)); right: clamp(12px, 3vw, 44px); }
.tool-group { display: flex; flex-direction: column; background: var(--glass); border: 1px solid var(--line); border-radius: 8px; }
.tool-group .tool + .tool { border-top: 1px solid var(--line); }
.tool[aria-pressed="true"] { color: var(--accent); }
.heading-indicator { z-index: 3; position: absolute; bottom: calc(36px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 7px; font: 12px ui-monospace, monospace; color: var(--accent); pointer-events: none; text-shadow: 0 2px 10px black; }
.gallery-hint { z-index: 4; position: absolute; bottom: calc(84px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 8px 11px; max-width: calc(100% - 30px); white-space: nowrap; background: var(--glass); border: 1px solid var(--line); border-radius: 6px; font-size: 12px; pointer-events: none; }
.gallery-hint > svg, #slide-count { color: var(--accent); }
.gallery-hint-text { color: var(--muted); }
.monitor-gallery { pointer-events: auto; position: absolute; top: 0; left: 0; width: 480px; height: 360px; transform-origin: 0 0; background: #141712; border-radius: 9%; overflow: hidden; isolation: isolate; touch-action: none; }
.slide-image, .slide-feedback { position: absolute; left: var(--photo-left, 0); top: var(--photo-top, 0); width: var(--photo-width, 100%); height: var(--photo-height, 100%); }
.slide-image { border: 0; padding: 0; background: #101510; cursor: pointer; }
.slide-image:focus-visible { outline-offset: -2px; }
.slide-image img { width: 100%; height: 100%; min-height: 0; position: absolute; inset: 0; object-fit: contain; filter: saturate(.91) sepia(.08) brightness(.94); pointer-events: none; }
.screen-texture { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 33% 17%, #f6ffbd23, transparent 57%), repeating-linear-gradient(0deg, #00000037 0 1px, transparent 1px 4px); box-shadow: inset 0 0 48px #11180c9e; }
.screen-nav { position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #f3ffcf; pointer-events: auto; }
.screen-nav::before { content: ''; grid-area: 1 / 1; width: 26px; height: 26px; border: 1px solid #deeeac70; border-radius: 7px; background: #192016; }
.screen-nav:hover::before, .screen-nav:focus-visible::before { background: var(--accent); }
.screen-nav:hover, .screen-nav:focus-visible { color: #151e13; }
.screen-nav:focus-visible { outline: none; }
.screen-nav:focus-visible::before { outline: 2px solid var(--accent); outline-offset: 3px; }
.screen-nav svg { grid-area: 1 / 1; z-index: 1; width: 15px; height: 15px; }
.image-feedback { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; padding: 8px; font-size: 13px; line-height: 1.25; text-align: center; color: var(--muted); }
.image-feedback button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; background: #192016; color: var(--accent); pointer-events: auto; }
.image-feedback button:hover { background: #283123; }
.slide-feedback { pointer-events: none; }
.panel-backdrop { position: absolute; z-index: 5; inset: 0; background: #12151244; cursor: default; }
.meme-panel { z-index: 6; position: absolute; top: 14px; right: 14px; bottom: calc(14px + var(--safe-bottom)); width: min(390px, 48vw); padding: 18px clamp(14px, 2vw, 27px) 24px; overflow: auto; overscroll-behavior: contain; touch-action: pan-y; user-select: text; border-radius: 12px; border: 1px solid #b4c2a541; background: #171d18fa; box-shadow: 0 16px 52px #0008; }
.panel-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-top .tool { margin-right: -7px; flex: none; }
.region { font: 12px ui-monospace, monospace; color: var(--accent); letter-spacing: .1em; }
.meme-panel h2, dialog h2 { letter-spacing: -.045em; font-size: clamp(25px, 3vw, 36px); line-height: 1.06; margin: 3px 0 18px; }
.meme-panel figure { margin: 0; --panel-photo-height: min(35vh, 280px); }
.meme-panel figure img, .panel-feedback { width: 100%; height: var(--panel-photo-height); border: 1px solid var(--line); background: #0d120e; border-radius: 7px; }
.meme-panel figure img { display: block; object-fit: contain; }
.meme-panel figcaption { color: var(--muted); font-size: 11px; margin-top: 6px; }
.meme-panel p { margin: 20px 0; font-size: 15px; line-height: 1.53; }
.meme-panel a { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 13px; text-underline-offset: 3px; }
.meme-panel a svg { width: 15px; height: 15px; }
dialog { color: var(--ink); background: #171d18; border: 1px solid #b4c2a541; border-radius: 12px; padding: 18px 24px; width: min(440px, calc(100vw - 28px)); box-shadow: 0 16px 52px #0008; touch-action: pan-y; user-select: text; }
dialog::backdrop { background: #0a100bd0; }
dialog h2 { margin: 0; }
dialog dl { margin: 10px 0 3px; }
dialog dl div { padding: 12px 0; border-top: 1px solid var(--line); }
dialog dt { color: var(--accent); font-weight: 600; margin-bottom: 5px; }
dialog dd { margin: 0; font-size: 14px; line-height: 1.4; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; position: absolute; inset: 0; z-index: 3; pointer-events: none; color: var(--muted); background: #141915dc; font-size: 14px; }
.loading-ring { width: 18px; height: 18px; border: 2px solid #dcf58a33; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.loading.failed .loading-ring { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (orientation: portrait) {
  .meme-panel { top: auto; left: 8px; right: 8px; bottom: calc(8px + var(--safe-bottom)); width: auto; max-height: min(72%, 640px); padding: 8px 15px 16px; }
  .meme-panel h2 { margin-bottom: 12px; }
  .meme-panel figure { --panel-photo-height: min(24dvh, 230px); }
  .meme-panel p { margin: 11px 0; }
}
@media (max-width: 700px) {
  .topbar { min-height: 54px; }
  .top-tool span, .heading-indicator { display: none; }
  .top-tool { width: 44px; padding: 0; }
  .top-actions { gap: 0; }
  .view-tools { bottom: calc(12px + var(--safe-bottom)); }
  .gallery-hint { bottom: calc(67px + var(--safe-bottom)); }
}
@media (max-width: 420px) {
  .brand { gap: 5px; font-size: 14px; letter-spacing: .075em; }
  .brand small { display: none; }
  .brand-mark { width: 22px; height: 20px; margin-right: 0; }
  .brand-mark i { width: 19px; height: 11px; }
}
@media (max-width: 380px) {
  .gallery-hint-text { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { transition: none !important; animation-duration: 2.5s !important; }
}
