:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f7f0e4;
  background: #0a1117;
}
* { box-sizing: border-box; }
html, body, #app { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #0a1117; }
#app { position: relative; isolation: isolate; }
#scene { display: block; width: 100%; height: 100%; outline: none; }
.panel {
  position: absolute;
  z-index: 20;
  left: 50%;
  top: 50%;
  width: min(520px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  padding: 20px 22px;
  border: 1px solid rgba(255, 222, 171, .22);
  border-radius: 16px;
  background: rgba(18, 21, 23, .9);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
  backdrop-filter: blur(14px);
}
.panel p { margin: 7px 0 0; color: rgba(247, 240, 228, .72); line-height: 1.45; }
.loading { display: flex; align-items: center; gap: 16px; }
.spinner { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%; border: 3px solid rgba(255,255,255,.13); border-top-color: #ffd99d; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { border-color: rgba(255, 137, 112, .45); }
.title-card {
  position: absolute;
  z-index: 5;
  left: clamp(18px, 3vw, 48px);
  top: clamp(18px, 3vw, 42px);
  max-width: 490px;
  pointer-events: none;
  text-shadow: 0 2px 18px rgba(0,0,0,.55);
  transition: opacity .35s ease;
}
.title-card .eyebrow { display: block; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: rgba(255,225,178,.8); margin-bottom: 8px; }
.title-card h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(26px, 3.4vw, 52px); font-weight: 500; line-height: 1.02; }
.title-card p { margin: 10px 0 0; max-width: 470px; color: rgba(247,240,228,.74); font-size: clamp(12px, 1.15vw, 16px); line-height: 1.45; }
.controls {
  position: absolute;
  z-index: 7;
  right: clamp(14px, 2.4vw, 36px);
  top: clamp(14px, 2.4vw, 32px);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: min(560px, 64vw);
}
button {
  appearance: none;
  border: 1px solid rgba(255, 226, 184, .2);
  border-radius: 999px;
  color: #f7f0e4;
  background: rgba(15, 20, 24, .62);
  backdrop-filter: blur(10px);
  padding: 9px 13px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
button:hover { background: rgba(58, 49, 39, .72); border-color: rgba(255, 222, 171, .42); }
button:active { transform: scale(.97); }
button[aria-pressed="true"] { background: rgba(102, 78, 47, .62); border-color: rgba(255, 224, 174, .45); }
.status-card {
  position: absolute;
  z-index: 6;
  left: clamp(18px, 3vw, 48px);
  bottom: clamp(16px, 2.7vw, 34px);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid rgba(255, 226, 184, .16);
  border-radius: 999px;
  background: rgba(12, 18, 22, .56);
  backdrop-filter: blur(10px);
  color: rgba(247,240,228,.78);
  font-size: 12px;
}
.phase-dot { width: 7px; height: 7px; border-radius: 50%; background: #ffd48a; box-shadow: 0 0 13px rgba(255, 191, 92, .8); }
.help-toggle {
  position: absolute;
  z-index: 8;
  right: 18px;
  bottom: 18px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-family: Georgia, serif;
  font-size: 17px;
}
.help-panel {
  position: absolute;
  z-index: 7;
  right: 18px;
  bottom: 64px;
  width: min(390px, calc(100% - 36px));
  padding: 16px 17px;
  border: 1px solid rgba(255, 226, 184, .18);
  border-radius: 14px;
  background: rgba(12, 18, 22, .82);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 55px rgba(0,0,0,.35);
  font-size: 12px;
  line-height: 1.5;
  color: rgba(247,240,228,.75);
}
.help-panel strong { color: #fff3df; }
.help-panel p { margin: 8px 0 0; }
@media (max-width: 760px) {
  .title-card { max-width: 62vw; }
  .title-card p { display: none; }
  .controls { max-width: 54vw; }
  .controls button { padding: 8px 10px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.8s; } }
