/* Screens (loading, main menu), goals panel, level result card and greybox picker.
   Builds on the glass look in builder.css. */

:root {
  --glass: rgba(20, 32, 35, 0.72);
  --glass-strong: rgba(15, 23, 42, 0.86);
  --accent: #38bdf8;
  --accent-2: #2563eb;
  --ok: #34d399;
  --text: #f1f5f9;
  --muted: #94a3b8;
}

/* ---------- Full-screen screens ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: radial-gradient(circle at 50% 40%, #12305a 0%, #0a0f1d 70%);
}

.screen.hidden {
  display: none;
}

.screen-title {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #67e8f9, #38bdf8 40%, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.screen-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), background 0.18s, box-shadow 0.18s;
}

.screen-btn:hover {
  transform: translateY(-2px) scale(1.02);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.35);
}

.screen-btn.primary {
  background: linear-gradient(135deg, #0284c7, var(--accent-2));
  border-color: transparent;
}

.screen-btn.ghost {
  background: transparent;
  color: var(--muted);
}

.screen-btn.big {
  width: 100%;
  font-size: 1.15rem;
  padding: 16px 22px;
  text-align: left;
}

/* ---------- Loading ---------- */
.loading-logo {
  font-size: 4.5rem;
  filter: drop-shadow(0 10px 24px rgba(56, 189, 248, 0.45));
}

.loading-track {
  width: min(360px, 80vw);
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.loading-bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #67e8f9, var(--accent), #a78bfa);
  transition: width 0.35s ease;
}

.loading-label {
  font-weight: 700;
  color: var(--text);
}

.loading-tip {
  max-width: 420px;
  padding: 0 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Main menu ---------- */
.main-menu {
  align-items: stretch;
  justify-content: center;
}

.menu-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.menu-column {
  position: relative;
  z-index: 1;
  width: min(380px, calc(100vw - 32px));
  margin-left: clamp(16px, 8vw, 120px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-subtitle {
  color: var(--muted);
  font-weight: 600;
  margin: -8px 0 12px;
}

.menu-view {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.menu-view.active {
  display: flex;
}

.menu-card {
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.menu-card h2 {
  font-size: 1.3rem;
  font-weight: 800;
}

.menu-note {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.config-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.config-row > span:first-child {
  width: 80px;
  flex-shrink: 0;
}

.config-row .skin-swatches-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.config-row .skin-swatch-circle {
  width: 28px;
  height: 28px;
  margin: 0;
}

.config-row .skin-swatch-circle.active {
  box-shadow: 0 0 0 3px #0f172a, 0 0 0 5px var(--accent);
}

.config-toggle {
  font-family: inherit;
  font-weight: 800;
  min-width: 64px;
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.1);
}

.config-toggle.on {
  color: #04221a;
  background: var(--ok);
}

.config-value {
  font-family: 'JetBrains Mono', monospace;
  width: 44px;
  text-align: right;
}

/* ---------- Goals panel (right side) ---------- */
.goals-panel {
  position: fixed;
  top: 72px;
  right: 18px;
  width: 250px;
  max-width: calc(100vw - 36px);
  z-index: 30;
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.goals-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: none;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.goals-level {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #04121f;
  background: var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
}

.goals-title {
  flex: 1;
  font-weight: 800;
  font-size: 0.95rem;
}

.goals-toggle {
  color: var(--muted);
  transition: transform 0.2s;
}

.goals-panel.collapsed .goals-toggle {
  transform: rotate(-90deg);
}

.goals-panel.collapsed .goals-body {
  display: none;
}

.goals-body {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.goals-score {
  position: relative;
  font-weight: 900;
  font-size: 0.85rem;
  color: #fbbf24;
}

.goals-score b {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
}

.goals-score-pop {
  position: absolute;
  right: 0;
  top: -6px;
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--ok);
  pointer-events: none;
}

.goal-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.goals-desc {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.goals-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.goals-progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.goals-progress-bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ok), var(--accent));
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.goals-count {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.8rem;
}

.goals-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.goal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  transition: background 0.2s;
}

.goal-item.active {
  background: rgba(56, 189, 248, 0.14);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.45);
}

.goal-item.done {
  opacity: 0.7;
}

.goal-item.done .goal-label {
  text-decoration: line-through;
}

.goal-item.unsupported {
  opacity: 0.45;
}

.goal-check {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.08);
}

.goal-item.done .goal-check {
  background: var(--ok);
  color: #04221a;
  font-weight: 900;
}

.goal-text {
  flex: 1;
  min-width: 0;
}

.goal-label {
  flex: 1;
  font-weight: 800;
  font-size: 0.84rem;
}

.goal-hint {
  margin-top: 4px;
  font-size: 0.76rem;
  line-height: 1.4;
  color: #cbd5e1;
}

.goal-points {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fbbf24;
}

.goals-points {
  font-weight: 800;
  font-size: 0.85rem;
  text-align: right;
}

/* Make room for the goals panel: toast moves left of it, right buttons drop below it */
.has-goals .toast-msg {
  right: 284px;
  top: 72px;
}

/* ---------- Next-step hint (above the block palette) ---------- */
.next-hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 92px;
  margin: 0 auto;
  width: fit-content;
  max-width: min(640px, calc(100vw - 200px));
  z-index: 24;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 9px;
  border-radius: 16px;
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35), 0 8px 28px rgba(0, 0, 0, 0.3);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.35;
  pointer-events: none;
}

.next-hint.hidden {
  display: none;
}

.next-hint-label {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #04121f;
  background: var(--accent);
  padding: 3px 8px;
  border-radius: 999px;
}

/* ---------- Herd bar (top center): nets, home, following ---------- */
.herd-bar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  font-weight: 800;
  pointer-events: auto;
}

.herd-nets {
  display: flex;
  gap: 4px;
}

.herd-net {
  position: relative;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 1rem;
  background: rgba(56, 189, 248, 0.22);
  box-shadow: inset 0 0 0 2px rgba(56, 189, 248, 0.7);
}

/* Recharging: dimmed, with a cyan fill rising from the bottom */
.herd-net.charging {
  filter: grayscale(1);
  opacity: 0.7;
  background: linear-gradient(to top, rgba(56, 189, 248, 0.45) var(--fill), rgba(255, 255, 255, 0.06) var(--fill));
  box-shadow: inset 0 0 0 2px rgba(148, 163, 184, 0.5);
}

.herd-infinite {
  font-size: 1.1rem;
  color: var(--accent);
  margin-left: 2px;
}

.herd-net-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 2.6em;
}

.herd-net-timer.empty {
  color: #fbbf24;
}

.herd-net-timer:empty {
  display: none;
}

.herd-sep {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
}

.herd-stat {
  display: inline-block;
  font-size: 0.95rem;
}

.herd-stat b {
  font-family: 'JetBrains Mono', monospace;
}

.herd-fence b {
  font-family: inherit;
}

.herd-fence[data-state='done'] b {
  color: var(--ok);
}

.herd-fence[data-state='gate'] b,
.herd-fence[data-state='gap'] b {
  color: #fbbf24;
}

/* ---------- Animal hover card ---------- */
#hover-animal-canvas {
  width: 132px;
  height: 96px;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 60%, rgba(56, 189, 248, 0.25), rgba(15, 23, 42, 0.4));
}

.hover-animal-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hover-animal-name {
  font-size: 1.05rem;
  font-weight: 900;
}

.hover-animal-tame {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ok);
}

.hover-animal-name.predator {
  color: #f87171;
}

.hover-animal-tame[data-kind='no'] {
  color: #fbbf24;
}

/* ---------- Level complete card ---------- */
.finish-level-btn {
  position: fixed;
  top: 66px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: fit-content;
  z-index: 60;
}

.finish-level-btn.hidden {
  display: none;
}

.dance-canvas {
  width: 220px;
  height: 200px;
  margin: -10px auto -6px;
  display: block;
}

.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  border-radius: inherit;
}

.confetti-bit {
  position: absolute;
  top: 0;
  width: 8px;
  height: 12px;
  border-radius: 2px;
}

.level-complete-overlay {
  z-index: 200;
}

.level-complete-card {
  position: relative;
  overflow: hidden;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  width: min(420px, calc(100vw - 32px));
  background: var(--glass-strong);
  border-radius: 24px;
  padding: 28px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 0 60px rgba(56, 189, 248, 0.25);
}

.level-complete-burst {
  font-size: 3.4rem;
}

.level-complete-kicker {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ok);
}

.level-complete-title {
  font-size: 1.8rem;
  font-weight: 900;
}

.summary-block {
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 10px 14px;
}

.summary-head {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}

.summary-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-weight: 700;
}

.summary-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.summary-chips li {
  font-weight: 800;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.18);
}

.summary-saved {
  font-size: 1.05rem;
  font-weight: 800;
}

.level-complete-goals {
  list-style: none;
  color: #cbd5e1;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.level-complete-points {
  font-size: 1.2rem;
  font-weight: 900;
  color: #fbbf24;
}

.level-complete-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}

/* ---------- Greybox picker ---------- */
.greybox-panel {
  position: fixed;
  right: 18px;
  bottom: 96px; /* above the Build Kit button */
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(440px, calc(100vw - 36px));
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.greybox-panel .form-select {
  width: auto;
  padding: 6px 8px;
  font-size: 0.78rem;
}

.greybox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.greybox-vfx {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.greybox-vfx.hidden {
  display: none;
}

.greybox-btn {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 8px;
  padding: 6px 9px;
  cursor: pointer;
}

.greybox-btn:hover {
  background: rgba(56, 189, 248, 0.3);
}

.greybox-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fbbf24;
}

@media (max-width: 700px) {
  .goals-panel {
    width: 240px;
  }

  .has-goals .toast-msg {
    right: 18px;
    top: auto;
    bottom: 110px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-bar,
  .goals-progress-bar,
  .screen-btn {
    transition: none;
  }
}
