/* HomeView 3D viewer: control bar across the top, full-bleed stage, info panel bottom-left. */

:root {
  color-scheme: dark;
  --scene: #1B2524;
  --bar: #1B2524;
  --line: #2C3836;
  --btn-line: #3A4846;
  --text: #E4E8E6;
  --text-soft: #9AA5A2;
  --mint: #5DBE94;
  --mint-ink: #0F1A16;
  --panel: rgba(15, 17, 15, 0.82);
  --label-bg: rgba(15, 17, 15, 0.82);
  --copper: #D9965A;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  display: flex;
  flex-direction: column;
  background: var(--scene);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font: inherit; color: inherit; }

button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

/* ---------- Bar ---------- */

.bar {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 16px 20px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 3;
}

.bar__title { margin-right: auto; }
.bar__title h1 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; }
.bar__title p { margin: 0; font-size: 12px; color: var(--text-soft); }

.group { display: flex; flex-wrap: wrap; gap: 6px; }

.btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid var(--btn-line);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { border-color: var(--mint); }

.btn--floor[aria-pressed="true"] {
  border-color: var(--mint);
  background: var(--mint);
  color: var(--mint-ink);
}

.btn--tool[aria-pressed="true"] { border-color: var(--mint); color: var(--mint); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}
.brand:hover { color: #fff; }

.is-embed .brand { display: none; }
.full-link { display: none; }
.is-embed .full-link { display: inline-flex; }

/* ---------- Stage ---------- */

.stage {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

.poster {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--scene);
  transition: opacity .5s ease;
  z-index: 1;
}
.poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.35;
}
.poster p {
  position: relative;
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.poster.is-done { opacity: 0; pointer-events: none; }

.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }

.lbl {
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  text-align: center;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--label-bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
}
.lbl span {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--text-soft);
}

/* ---------- Info panel ---------- */

.info {
  position: absolute;
  left: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: min(320px, calc(100% - 40px));
  max-height: calc(100% - 40px);
  overflow: auto;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 2;
}

.info__kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mint);
}

.info__caption { margin: 4px 0 0; font-size: 14px; line-height: 1.5; }

.sched { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }

.sched summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
  padding: 4px 0;
}
.sched summary:hover { color: var(--text); }

.sched table {
  width: 100%;
  margin-top: 6px;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.sched td { padding: 4px 0; border-top: 1px solid var(--line); }
.sched td.n {
  text-align: right;
  white-space: nowrap;
  padding-left: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-soft);
}
.sched tr.tot td { font-weight: 600; color: var(--text); }

.sched .note { margin: 8px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--text-soft); }

/* ---------- Hint, toast, touch gate ---------- */

.hint {
  position: absolute;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--text-soft);
  z-index: 2;
}

.toast {
  position: absolute;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 12.5px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
  z-index: 2;
}
.toast.is-on { opacity: 1; }

.gate {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: rgba(15, 17, 15, 0.25);
  cursor: pointer;
  touch-action: pan-y;
}
.gate span {
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--mint-ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.done {
  position: absolute;
  right: 16px;
  top: 16px;
  z-index: 2;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
  .bar { padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); gap: 10px 12px; }
  .brand { order: 1; letter-spacing: 0.24em; }
  .group { order: 2; flex: 1 1 100%; }
  .group[role="group"] { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .group .btn { flex: 1 1 auto; justify-content: center; }
  .btn { min-height: 40px; padding: 0 10px; font-size: 11px; letter-spacing: 0.06em; }
  .long { display: none; }
  .info { left: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: calc(100% - 24px); padding: 10px 12px; }
  .info__caption { font-size: 13px; }
  .hint { display: none; }
  .lbl { font-size: 10.5px; padding: 2px 5px; }
  .lbl span { font-size: 9.5px; }
}
