@font-face {
  font-family: 'Helvetica Neue Medium';
  src: local('Helvetica Neue Medium'), local('HelveticaNeue-Medium');
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  font-family: 'Helvetica Neue Medium', 'Helvetica Neue';
  font-weight: 500;
  font-synthesis: none;
  color-scheme: light;
  color: #202020;
  background: #f3f3f3;
  --muted: #777;
  --line: rgba(0, 0, 0, .08);
  --divider: rgba(0, 0, 0, .10);
  --surface: rgba(255, 255, 255, .88);
  --shadow: 0 2px 8px rgba(0, 0, 0, .018), 0 10px 28px rgba(0, 0, 0, .012);
  --bar-bottom: max(24px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; }
button, input, output { font: inherit; }
h1, h2, p, legend { font-weight: 500; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 2px solid #555; outline-offset: 4px; }
button:disabled { opacity: .45; }
button svg { flex-shrink: 0; }
[hidden] { display: none !important; }
#app, #scene { position: absolute; inset: 0; }
#scene canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
header { position: absolute; top: 30px; left: 34px; pointer-events: none; }
h1 { margin: 0; font-size: 25px; line-height: 1.2; letter-spacing: -.8px; }
body.evening header { color: #f3f3f3; }

/* Scene settings and layout controls share two neighboring glass bars. */
.control-bar {
  position: absolute;
  left: 50%;
  bottom: var(--bar-bottom);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100% - 32px);
  z-index: 8;
}
.control-group {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 5px;
  border: 1px solid rgba(0, 0, 0, .055);
  border-radius: 999px;
  background: rgba(233, 235, 238, .88);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .035), 0 8px 22px rgba(0, 0, 0, .02);
  -webkit-backdrop-filter: blur(26px) saturate(1.1);
  backdrop-filter: blur(26px) saturate(1.1);
}
body.evening .control-group { background: rgba(233, 235, 238, .76); }
.control-bar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 68px;
  height: 57px;
  padding: 8px 22px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #202020;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  transition: background .16s, color .16s, border-color .16s, box-shadow .16s, transform .16s;
}
.control-bar button:hover { background: #f0f0f0; color: #202020; }
.control-bar button[aria-pressed=true], .control-bar button[aria-expanded=true] { color: #202020; }
#edit-toggle[aria-expanded=true] {
  background: rgba(255, 255, 255, .96);
  border-color: rgba(0, 0, 0, .16);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .035), 0 5px 12px rgba(0, 0, 0, .012);
}
.scene-tools { gap: 5px; }
.scene-tools button {
  background: rgba(255, 255, 255, .96);
  border-color: rgba(0, 0, 0, .14);
  box-shadow: 0 4px 7px rgba(0, 0, 0, .07);
  color: #202020;
}
.scene-tools button:hover { background: #fff; }
.scene-tools button[aria-pressed=true] {
  background: #fff;
  border-color: rgba(0, 0, 0, .16);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .045);
  transform: translateY(1px);
  color: #202020;
}
.scene-tools button:active { transform: translateY(2px); }
body.evening .scene-tools button { border-color: rgba(0, 0, 0, .30); }
body.evening .scene-tools button[aria-pressed=true], body.evening #edit-toggle[aria-expanded=true] { border-color: rgba(0, 0, 0, .34); }
.control-bar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.night-icon, body.evening .day-icon { display: none; }
body.evening .night-icon { display: initial; }
.blinds-closed-icon, #blinds-toggle[aria-pressed=true] .blinds-open-icon { display: none; }
#blinds-toggle[aria-pressed=true] .blinds-closed-icon { display: initial; }

.panel {
  position: absolute;
  bottom: calc(var(--bar-bottom) + 88px);
  right: max(24px, calc(50% - 312px));
  width: 312px;
  max-height: calc(100dvh - 150px);
  overflow: auto;
  padding: 25px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(26px) saturate(1.1);
  backdrop-filter: blur(26px) saturate(1.1);
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
  z-index: 7;
}
#detail {
  right: auto;
  bottom: auto;
  width: min(312px, calc(100% - 24px));
  max-height: calc(100dvh - 140px);
}
.panel h2 { margin: 0 30px 10px 0; font-size: 20px; line-height: 1.3; letter-spacing: -.5px; }
.panel p { margin: 10px 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.close-button { position: absolute; top: 19px; right: 18px; width: 26px; height: 26px; display: grid; place-items: center; padding: 0 0 2px; border: 1px solid rgba(0, 0, 0, .04); border-radius: 50%; background: #f0f0f0; color: #777; font-size: 19px; line-height: 1; }
.close-button:hover { color: #222; background: #e8e8e8; }
.material-label { margin-top: 22px; font-size: 11px; color: var(--muted); }
#detail-material { margin: 7px 0 0; font-size: 12px; line-height: 1.5; }
.text-button, .outline-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; background: none; padding: 10px 0; font-size: 11px; }
.text-button:hover { color: #777; }
.outline-button { border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; background: #fff; box-shadow: 0 1px 2px #00000003; }
.outline-button:hover { background: #f5f5f5; }
.panel fieldset { min-width: 0; border: 0; padding: 0; margin: 18px 0 0; }
.panel legend { display: block; width: 100%; border-top: 1px solid var(--divider); padding: 17px 0 0; font-size: 12px; margin-bottom: 7px; }
.panel label { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin: 12px 0 9px; }
.panel output { color: #333; font-variant-numeric: tabular-nums; }
input[type=range] { display: block; width: 100%; height: 17px; margin: 0; appearance: none; background: transparent; accent-color: #333; cursor: ew-resize; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: #dedede; }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 17px; height: 17px; margin-top: -6.5px; border: 1px solid #ccc; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0000000d; }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: #dedede; }
input[type=range]::-moz-range-thumb { width: 15px; height: 15px; border: 1px solid #ccc; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0000000d; }
.editor-bottom { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--divider); padding-top: 16px; margin-top: 22px; }

#hotspots { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.hotspot { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 6px; padding: 8px; transform: translate(-50%, -50%); pointer-events: auto; border: 0; background: transparent; white-space: nowrap; font-size: 10px; transition: opacity .16s; }
.hotspot .dot { display: grid; place-items: center; flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); color: #555; background: var(--surface); font-size: 15px; line-height: 1; box-shadow: 0 1px 3px #00000003; }
.hotspot .dot svg { display: block; width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; }
.hotspot .hotspot-text { padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px; color: #444; background: var(--surface); }
.hotspot .dot, .hotspot .hotspot-text, #hover-label, #toast { -webkit-backdrop-filter: blur(26px) saturate(1.1); backdrop-filter: blur(26px) saturate(1.1); }
.hotspot:hover .dot { background: #292929; border-color: #292929; color: white; }
.hotspot.active { opacity: 0; pointer-events: none; }
.hotspot[data-hidden=true] { opacity: 0; pointer-events: none; }
.hotspot.returning { opacity: 1; pointer-events: none; }
#hover-label { position: absolute; display: none; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; font-size: 11px; box-shadow: 0 2px 8px #00000003; z-index: 9; }
#loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 20px; background: #f3f3f3; color: #777; font-size: 12px; z-index: 10; }
.loading-ring { width: 28px; height: 28px; border: 2px solid #ddd; border-top-color: #777; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: absolute; left: 50%; bottom: calc(var(--bar-bottom) + 90px); transform: translateX(-50%) translateY(6px); padding: 12px 17px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .16s, transform .16s; z-index: 10; }
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 700px) {
  :root { --bar-bottom: max(16px, env(safe-area-inset-bottom)); }
  header { top: 23px; left: 24px; }
  h1 { font-size: 23px; }
  .control-bar { gap: 8px; max-width: calc(100% - 20px); }
  .control-group { gap: 3px; padding: 4px; }
  .control-bar button { min-width: 46px; height: 54px; padding: 8px 14px; font-size: 9px; }
  .panel { right: 20px; width: 306px; bottom: calc(var(--bar-bottom) + 80px); max-height: calc(100dvh - 125px); }
  .hotspot-text { display: none; }
}
@media (max-width: 480px) {
  .control-bar { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 1.15fr); width: calc(100% - 16px); max-width: none; gap: 6px; }
  .control-group { gap: 2px; padding: 4px 3px; }
  .control-bar button { flex: 1 1 0; min-width: 0; padding: 7px 8px; font-size: 9px; letter-spacing: -.15px; }
  .control-bar svg { width: 19px; height: 19px; }
  .panel { right: 10px; width: calc(100% - 20px); padding: 23px; }
  #toast { max-width: calc(100% - 30px); text-align: center; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .loading-ring { animation: none; }
}
