:root {
  --bg: #0f1216;
  --panel: rgba(17, 21, 27, 0.82);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #eef2f6;
  --muted: #9aa7b4;
  --accent: #2fbf9f;
  --accent-warm: #ffb46b;
  --danger: #ff6b6b;
  --radius: 14px;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

/* `display` rules on .overlay/.panel would otherwise beat the default
   [hidden] { display: none } and leave invisible click blockers around. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

/* ---------------------------------------------------------------- boot card */

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 20%, #1b2531, #0b0e12 70%);
  z-index: 20;
}

.card {
  width: min(92vw, 460px);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.card h1 {
  margin: 0 0 10px;
  font-size: 26px;
  letter-spacing: 0.02em;
}

.lead {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
}

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"] {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 15px;
  margin-bottom: 14px;
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.13); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

button.primary {
  background: var(--accent);
  border-color: transparent;
  color: #06231d;
  font-weight: 700;
}
button.primary:hover:not(:disabled) { background: #3ad8b5; }

.status {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
  min-height: 1.2em;
}
.status.error { color: var(--danger); }

/* ---------------------------------------------------------------------- HUD */

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

.panel {
  position: absolute;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

.panel header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.panel h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.badge {
  margin-left: auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 10px currentColor;
  transition: background 0.3s ease;
}
.dot.meeting { background: var(--accent); }
.dot.presentation { background: var(--accent-warm); }
.dot.crowded { background: var(--danger); }

#panel-ai { top: 16px; left: 16px; width: 264px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.metrics div {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
}
.metrics span {
  display: block;
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.metrics small { font-size: 10px; color: var(--muted); }

.reason {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.6;
  color: #cfd8e3;
  min-height: 2.4em;
}

.log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 118px;
  overflow-y: auto;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.log li {
  padding: 3px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log li.expand { color: var(--accent); }
.log li.shrink { color: var(--accent-warm); }

#panel-people { top: 16px; right: 16px; width: 210px; }
#people {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 42vh;
  overflow-y: auto;
  font-size: 12.5px;
}
#people li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
#people i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}
#people .tag {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
}

.controls {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  pointer-events: auto;
  max-width: 94vw;
}

.help {
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 430px);
}
.help ul { margin: 0 0 10px; padding-left: 18px; font-size: 12.5px; line-height: 1.9; }
.help b { color: var(--accent); font-weight: 700; }
.hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.7; }

.filebtn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.filebtn:hover { background: rgba(255, 255, 255, 0.13); }

/* The bundled VRM is licensed with `creditNotation: required`, so this line
   stays on screen while the app is running. */
.credit {
  position: absolute;
  left: 16px;
  bottom: 12px;
  margin: 0;
  max-width: 42vw;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.toast {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  margin: 0;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(47, 191, 159, 0.92);
  color: #06231d;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

@media (max-width: 720px) {
  #panel-ai { width: 200px; padding: 11px 12px; }
  #panel-people { display: none; }
  .metrics span { font-size: 17px; }
  .log { max-height: 70px; }
  .controls { gap: 6px; bottom: 12px; }
  .credit { max-width: 90vw; bottom: 58px; left: 8px; font-size: 10px; }
  button { padding: 8px 10px; font-size: 12px; }
}
