/* Galaxy AI — Mintaka & the Fold. Cinematic night UI: deep space,
   gold accents, moonlit glass. */

:root {
  --gold: #ffd76a;
  --gold-dim: #c8a84a;
  --ink: #e8ecf5;
  --ink-dim: #a8b0c8;
  --glass: rgba(10, 14, 30, 0.62);
  --glass-border: rgba(255, 215, 106, 0.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #04040e;
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app, #app canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* Cinematic vignette + top glow. */
#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background:
    radial-gradient(ellipse 120% 90% at 50% 42%, transparent 55%, rgba(0, 0, 8, 0.42) 100%),
    linear-gradient(to bottom, rgba(4, 4, 16, 0.35), transparent 18%);
}

/* Floating 3D labels. */
#labels {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  overflow: hidden;
}
.label {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(8, 10, 24, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(2px);
  will-change: transform;
}
.label-star { color: #d8e4ff; }
.label-faint-star {
  color: #1a1408;
  background: linear-gradient(180deg, #ffe89a, #ffd76a);
  border-color: #fff2c8;
  font-weight: 600;
  box-shadow: 0 0 18px rgba(255, 215, 106, 0.55);
}
.label-path { color: var(--gold); border-color: rgba(255, 215, 106, 0.4); }
.label-place { color: #e8ecf5; }
.label-grove { color: #b8f0d8; border-color: rgba(127, 224, 195, 0.45); }
.label-creature { color: #e0d4ff; border-color: rgba(180, 140, 255, 0.4); }
.label-wildlife { color: #d8e8d0; }
.label-neighbor {
  color: #ffe9c4;
  border-color: rgba(255, 200, 110, 0.45);
  font-weight: 600;
}
.label-home { color: #c8d4f0; font-size: 11px; }
.label-arrash {
  color: #1a1408;
  background: linear-gradient(180deg, #ffe89a, #e8b84a);
  border-color: #fff2c8;
  font-weight: 700;
  box-shadow: 0 0 16px rgba(255, 215, 106, 0.5);
}
.label-moon { color: #f2ead8; font-size: 13px; }
.label-reserved {
  color: #ffd76a;
  border-style: dashed;
  border-color: rgba(255, 215, 106, 0.55);
  background: rgba(30, 24, 8, 0.6);
}
.label-warning {
  color: #ffd8d0;
  border-color: rgba(255, 90, 70, 0.65);
  background: rgba(40, 8, 6, 0.62);
  font-weight: 600;
}
.label-clickable { pointer-events: auto; cursor: pointer; }

/* Top HUD. */
#hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 18px;
  background: linear-gradient(to bottom, rgba(4, 4, 16, 0.72), transparent);
  pointer-events: none;
}
#brand {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff6dd;
  text-shadow: 0 0 18px rgba(255, 215, 106, 0.45), 0 2px 8px rgba(0, 0, 0, 0.8);
}
#brand span {
  font-weight: 400;
  color: var(--ink-dim);
  font-size: 14px;
}
#travel-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: auto;
}
button {
  appearance: none;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  letter-spacing: 0.03em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(255, 215, 106, 0.3);
}
button:disabled { opacity: 0.55; cursor: default; }
button.primary {
  background: linear-gradient(180deg, rgba(255, 215, 106, 0.22), rgba(255, 215, 106, 0.1));
  border-color: var(--gold);
  color: #fff2c8;
  font-weight: 600;
}

/* World panel. */
#world-panel {
  position: fixed;
  left: 18px;
  bottom: 52px;
  z-index: 10;
  max-width: 340px;
  padding: 14px 18px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}
#world-title {
  margin: 0 0 4px;
  font-size: 21px;
  letter-spacing: 0.03em;
  color: #fff6dd;
  text-shadow: 0 0 14px rgba(255, 215, 106, 0.35);
}
#world-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-dim);
}
#world-phase {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--gold);
  letter-spacing: 0.03em;
}

/* Actions: shift form + VR. */
#actions {
  position: fixed;
  right: 18px;
  bottom: 52px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: 280px;
}
#shift-form {
  border-color: var(--gold);
  color: #fff2c8;
  font-weight: 600;
  background: linear-gradient(180deg, rgba(255, 215, 106, 0.22), rgba(255, 215, 106, 0.08));
}
#vr-status {
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-dim);
  text-align: right;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}

/* Dialogue bubble. */
#bubble {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(12px);
  z-index: 12;
  width: min(560px, calc(100vw - 36px));
  padding: 14px 18px 10px;
  background: rgba(12, 14, 32, 0.86);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  cursor: pointer;
}
#bubble.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
#bubble-name {
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
#bubble-text {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
}
#bubble-hint {
  margin-top: 8px;
  font-size: 11px;
  color: var(--ink-dim);
  text-align: right;
}

/* Toast. */
#toast {
  position: fixed;
  left: 50%;
  top: 76px;
  transform: translateX(-50%) translateY(-8px);
  z-index: 12;
  max-width: min(620px, calc(100vw - 36px));
  padding: 10px 18px;
  background: rgba(12, 14, 32, 0.82);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--ink);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Fold transition fade. */
#fold-fade {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(30, 20, 60, 0.88), rgba(4, 4, 16, 0.97));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
#fold-fade.show { opacity: 1; }
#fold-fade-text {
  font-size: 22px;
  letter-spacing: 0.14em;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(255, 215, 106, 0.6);
  animation: fadePulse 1.6s ease-in-out infinite;
}
@keyframes fadePulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

/* Loading. */
#loading {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #04040e;
  transition: opacity 0.8s ease;
}
#loading.hidden {
  opacity: 0;
  pointer-events: none;
}
#loading .moon {
  font-size: 54px;
  animation: moonFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 0 24px rgba(255, 215, 106, 0.6));
}
@keyframes moonFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.loading-text {
  font-size: 15px;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
}

#controls-hint {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 9;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: rgba(232, 236, 245, 0.55);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
}

@media (max-width: 720px) {
  #brand span { display: none; }
  #world-panel {
    left: 12px;
    right: 12px;
    bottom: 118px;
    max-width: none;
    padding: 10px 14px;
  }
  #world-title { font-size: 17px; }
  #world-desc { font-size: 12.5px; }
  #actions { right: 12px; bottom: 48px; }
  #controls-hint { display: none; }
  #bubble { bottom: 200px; }
  .label { font-size: 11px; }
}
