/* ============================================================
   PATH OF LUMEN — ui.css
   Panels, buttons, HUD, modals, how-to, settings, toasts
   ============================================================ */

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  min-width: 220px;
  padding: 14px 26px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, #232845, #171b3a);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.08s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
  touch-action: manipulation;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.btn:hover,
.btn:focus-visible {
  border-color: rgba(80, 224, 255, 0.6);
  box-shadow: var(--glow-cyan), 0 6px 18px rgba(0, 0, 0, 0.35);
  outline: none;
}
.btn:active {
  transform: translateY(2px) scale(0.98);
}
.btn--primary {
  background: linear-gradient(180deg, #35c8ff, #1b86e8);
  border-color: rgba(120, 224, 255, 0.7);
  color: #04121e;
  box-shadow: 0 6px 24px rgba(27, 134, 232, 0.45);
}
.btn--primary:hover,
.btn--primary:focus-visible {
  box-shadow: 0 6px 30px rgba(53, 200, 255, 0.7);
}
.btn--danger {
  background: linear-gradient(180deg, #5a2233, #3c1622);
  border-color: rgba(255, 91, 106, 0.4);
  color: #ffd2d8;
}
.btn--danger:hover,
.btn--danger:focus-visible {
  border-color: rgba(255, 91, 106, 0.8);
  box-shadow: 0 0 18px rgba(255, 91, 106, 0.35);
}
.btn--toggle {
  min-width: 84px;
  text-align: center;
}
.btn--toggle.on {
  background: linear-gradient(180deg, #2dd08a, #1a9f6b);
  border-color: rgba(105, 240, 174, 0.6);
  color: #03231a;
}
.btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ---------- Panels ---------- */
.panel {
  background: linear-gradient(180deg, rgba(24, 28, 60, 0.96), rgba(13, 15, 36, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 34px 38px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  width: min(560px, 90vw);
  max-height: 88dvh;
  overflow-y: auto;
}
.panel-title {
  font-size: clamp(24px, 5vw, 34px);
  font-weight: 900;
  letter-spacing: 3px;
  text-align: center;
  margin-bottom: 22px;
  background: linear-gradient(180deg, #fff, var(--cyan-soft));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.panel-title.success {
  background: linear-gradient(180deg, #fff, var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.panel-title.danger {
  background: linear-gradient(180deg, #fff, var(--red));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.panel-foot {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

/* ---------- Main menu ---------- */
#screen-menu {
  background:
    radial-gradient(90% 70% at 50% 0%, #1a2148 0%, var(--bg-0) 70%);
}
.menu-panel {
  position: relative;
  z-index: 2;
  text-align: center;
}
.menu-title {
  margin-bottom: 6px;
}
.menu-subtitle {
  letter-spacing: 4px;
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 30px;
}
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.menu-deco {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(30px);
  animation: drift ease-in-out infinite;
}
.orb--big {
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, rgba(80, 224, 255, 0.28), transparent 65%);
  top: -80px;
  left: -120px;
  animation-duration: 9s;
}
.orb--small {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(155, 123, 255, 0.3), transparent 65%);
  bottom: -60px;
  right: -90px;
  animation-duration: 12s;
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.08); }
}

/* ---------- How to play ---------- */
.howto-body {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}
.howto-body h3 {
  color: var(--cyan-soft);
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 16px 0 6px;
}
.howto-body h3:first-child { margin-top: 0; }
.howto-body p, .howto-body li {
  color: #c6cde9;
}
.howto-body ul {
  padding-left: 20px;
}
.howto-body li { margin: 3px 0; }
.howto-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin-top: 6px;
}
.control-key {
  display: inline-block;
  background: #1d2247;
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 1px 8px;
  font-weight: 700;
  color: var(--cyan-soft);
}

/* ---------- Settings ---------- */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.setting-row:last-of-type { border-bottom: none; }
.setting-label {
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 14px;
  color: #d4dcf5;
}
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 180px;
  height: 6px;
  border-radius: 999px;
  background: #232a55;
  outline: none;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--cyan));
  box-shadow: var(--glow-cyan);
  cursor: pointer;
}
.range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--cyan));
  box-shadow: var(--glow-cyan);
  cursor: pointer;
}
.settings-extra {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 0;
  z-index: 15;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud-left, .hud-right, .hud-center {
  display: flex;
  align-items: center;
  gap: 14px;
}
.hud-btn {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(16, 19, 44, 0.7);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.hud-btn:hover, .hud-btn:focus-visible {
  border-color: rgba(80, 224, 255, 0.6);
  box-shadow: var(--glow-cyan);
  outline: none;
}
.hud-level {
  font-weight: 800;
  letter-spacing: 2px;
  font-size: 15px;
  background: rgba(16, 19, 44, 0.7);
  border: 1px solid var(--line);
  padding: 11px 16px;
  border-radius: 12px;
  backdrop-filter: blur(6px);
}
.hud-level span { color: var(--cyan-soft); }
.hud-center {
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.hud-lumen {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--amber);
  background: rgba(16, 19, 44, 0.7);
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 209, 102, 0.25);
  backdrop-filter: blur(6px);
}
.hud-lumen span { color: #fff; }
.progress-ring {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-dim);
  background: rgba(16, 19, 44, 0.7);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
#hud-collected { color: var(--cyan-soft); font-weight: 800; }
#hud-total { color: var(--ink-dim); }
.hud-timer {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  background: rgba(16, 19, 44, 0.7);
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

/* ---------- Modals ---------- */
.modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 5, 14, 0.72);
  backdrop-filter: blur(4px);
  z-index: 40;
  animation: fade-in 0.25s ease;
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-panel {
  text-align: center;
  animation: pop-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes pop-in {
  from { transform: scale(0.86); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}
.complete-stats {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin: 14px 0 20px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stat-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.stat-value {
  font-size: 28px;
  font-weight: 900;
  color: var(--cyan-soft);
}
.confirm-text {
  color: #c6cde9;
  text-align: center;
  margin: 4px 0 18px;
}

/* ---------- Direction hint (mobile / tutorial) ---------- */
.direction-hint {
  position: absolute;
  right: 22px;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  grid-template-areas:
    " .  up  . "
    "left c right"
    " . down  . ";
  grid-template-columns: auto auto auto;
  gap: 8px;
  z-index: 30;
  width: 190px;
  padding: 12px;
  border-radius: 20px;
  background: rgba(10, 13, 32, 0.68);
  border: 1px solid rgba(120, 140, 255, 0.18);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35),
              0 0 28px rgba(80, 224, 255, 0.08);
  backdrop-filter: blur(8px);
  pointer-events: none;
}
@media (max-width: 700px) {
  .direction-hint {
    right: 12px;
    width: 174px;
    padding: 9px;
    gap: 5px;
  }

  .dh-arrow {
    width: 50px;
    height: 50px;
    font-size: 22px;
    border-radius: 13px;
  }
}

@media (orientation: portrait) and (max-width: 640px) {
  .direction-hint {
    right: 10px;
    top: auto;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
    transform: none;
  }
}
.dh-arrow {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--cyan-soft);
  background: rgba(16, 19, 44, 0.72);
  border: 1px solid var(--line);
  pointer-events: auto;
  cursor: pointer;
}
.dh-arrow:active,
.dh-arrow.pressed {
  background: var(--cyan);
  color: #04121e;
  box-shadow: var(--glow-cyan);
}
.dh-up { grid-area: up; }
.dh-down { grid-area: down; }
.dh-left { grid-area: left; }
.dh-right { grid-area: right; }
.dh-center {
  grid-area: c;
  align-self: center;
  justify-self: center;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-align: center;
  color: var(--ink-dim);
  line-height: 1.4;
}

/* ---------- Toast ---------- */
.toast {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 26px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 19, 44, 0.92);
  border: 1px solid var(--line);
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--ink);
  z-index: 60;
  box-shadow: var(--glow-cyan);
  animation: toast-in 0.25s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
