/* SciBit G.01 — Target Range */

@font-face {
  font-family: 'Instrument Sans';
  src: url('../../Res/Fonts/instrument-sans-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Instrument Serif';
  src: url('../../Res/Fonts/instrument-serif.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #05070a;
  --panel: rgba(8, 12, 18, 0.96);
  --ink: #e8eef5;
  --muted: #93a2b3;
  --cyan: #3de0e0;
  --cyan-dim: rgba(61, 224, 224, 0.25);
  --accent: #ff6b35;
  --line: rgba(147, 162, 179, 0.18);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Instrument Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  cursor: crosshair;
}

/* Loader */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: radial-gradient(circle at 50% 50%, #0b1118 0%, #05070a 70%);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--cyan);
  animation: spin 1s linear infinite;
}

.loader-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* HUD */
.hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
}

.hud-top {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(5, 7, 10, 0.55);
  border: 1px solid var(--line);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
}

.hud-brand img {
  display: block;
  filter: brightness(1.2);
}

.hud-title {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}

.hud-fig {
  color: var(--cyan);
}

.hud-help {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(61, 224, 224, 0.08);
  color: var(--cyan);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.hud-help:hover, .hud-help:focus-visible {
  background: rgba(61, 224, 224, 0.18);
  border-color: var(--cyan);
  outline: none;
}

.game-timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 5px 12px 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(5, 7, 10, 0.55);
  font-family: 'Instrument Sans', monospace, sans-serif;
}

.timer-label {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.timer-digits {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(61, 224, 224, 0.35);
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.game-timer.low .timer-digits {
  color: var(--accent);
  text-shadow: 0 0 16px rgba(255, 107, 53, 0.55);
  animation: timerPulse 0.8s ease-in-out infinite;
}

.game-timer.critical .timer-digits {
  color: #ff4d4d;
  text-shadow: 0 0 20px rgba(255, 77, 77, 0.65);
  animation: timerPulse 0.4s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

.hud-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.crosshair {
  width: 8px;
  height: 8px;
  background: rgba(61, 224, 224, 0.5);
  border-radius: 50%;
  position: relative;
  pointer-events: none;
}

.hit-marker {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.5);
  transition: none;
}

.hit-marker.show {
  animation: hitPulse 0.25s ease-out forwards;
}

@keyframes hitPulse {
  0% { opacity: 1; transform: scale(0.5); }
  100% { opacity: 0; transform: scale(1.4); }
}

.score-popup {
  position: absolute;
  top: calc(50% - 48px);
  left: 50%;
  z-index: 200;
  transform: translate(-50%, -50%) scale(0.6);
  padding: 8px 18px;
  border-radius: 8px;
  background: rgba(255, 107, 53, 0.2);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
  font-size: 1.3rem;
  opacity: 0;
  pointer-events: none;
  transition: none;
  text-shadow: 0 0 10px rgba(255, 107, 53, 0.4);
}

.score-popup.show {
  animation: scorePop 0.9s ease-out forwards;
}

@keyframes scorePop {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.6); }
  40% { opacity: 1; transform: translate(-50%, -110%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(1); }
}

.hud-bottom {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: rgba(5, 7, 10, 0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.score-board {
  display: flex;
  flex-direction: column;
  min-width: 90px;
}

.score-label {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--muted);
}

.score-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cyan);
  line-height: 1.1;
}

.progress {
  flex: 1;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.voucher-teaser {
  max-width: 160px;
  text-align: right;
  font-size: 0.8rem;
  color: var(--muted);
}

.voucher-teaser.unlocked {
  color: var(--accent);
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease, background 0.2s ease;
  border: 1px solid transparent;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--cyan);
  color: #021417;
  box-shadow: 0 0 20px rgba(61, 224, 224, 0.25);
}

.btn-primary:hover, .btn-primary:focus-visible {
  background: #5fffff;
  box-shadow: 0 0 28px rgba(61, 224, 224, 0.4);
  outline: none;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-ghost:hover, .btn-ghost:focus-visible {
  border-color: var(--cyan);
  color: var(--cyan);
  outline: none;
}

/* Overlay */
.overlay, .voucher, .help {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 7, 10, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  overflow: hidden;
}

.overlay.open, .voucher.open, .help.open {
  opacity: 1;
  visibility: visible;
}

.overlay-card, .voucher-card, .help-card {
  width: min(680px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  position: relative;
}

.overlay-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(5, 7, 10, 0.7);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s;
}

.overlay-close:hover:not(:disabled), .overlay-close:focus-visible:not(:disabled) {
  background: rgba(61, 224, 224, 0.12);
  border-color: var(--cyan);
  outline: none;
}

.overlay-close:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.overlay-countdown {
  position: absolute;
  top: 24px;
  right: 66px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}

.overlay-fig, .voucher-badge {
  display: block;
  margin-bottom: 8px;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--cyan);
  text-transform: uppercase;
}

.voucher-badge {
  color: var(--accent);
}

.overlay-title, .voucher-title, .help-card h2 {
  margin: 0 0 16px;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 400;
  line-height: 1.1;
}

.overlay-body {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.overlay-body h3 {
  margin: 24px 0 10px;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 600;
}

.overlay-body p {
  margin: 0 0 14px;
}

.overlay-body ul, .overlay-body ol {
  margin: 0 0 16px;
  padding-left: 22px;
}

.overlay-body li {
  margin-bottom: 8px;
}

.overlay-body strong {
  color: var(--ink);
  font-weight: 600;
}

.overlay-more {
  margin-top: 20px;
}

.overlay-more a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--cyan);
  border-radius: 8px;
  background: rgba(61, 224, 224, 0.1);
  color: var(--cyan);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.overlay-more a:hover,
.overlay-more a:focus-visible {
  background: rgba(61, 224, 224, 0.2);
  box-shadow: 0 0 20px rgba(61, 224, 224, 0.25);
}

.voucher-code {
  display: inline-block;
  padding: 14px 28px;
  margin: 10px 0 20px;
  background: rgba(61, 224, 224, 0.1);
  border: 2px dashed var(--cyan);
  border-radius: 10px;
  color: var(--cyan);
  font-family: 'Instrument Sans', monospace, sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.voucher-note {
  color: var(--muted);
  margin-bottom: 8px;
}

.voucher-terms {
  grid-column: 1 / -1;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 18px;
}

/* Forms */
.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid.two {
  grid-template-columns: repeat(2, 1fr);
}

.form-grid .full {
  grid-column: 1 / -1;
}

@media (max-width: 540px) {
  .form-grid.two {
    grid-template-columns: 1fr;
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-field input,
.form-field textarea,
.form-field select {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(61, 224, 224, 0.1);
}

.form-field textarea {
  min-height: 100px;
  resize: vertical;
}

.form-field select option {
  background: #0b1118;
  color: var(--ink);
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Help */
.help-card ul {
  margin: 0 0 24px;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.help-card li {
  margin-bottom: 10px;
}

.help-card strong {
  color: var(--ink);
}

/* Toast */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  padding: 12px 24px;
  background: var(--panel);
  border: 1px solid var(--cyan);
  border-radius: 10px;
  color: var(--ink);
  font-size: 0.95rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(61, 224, 224, 0.1);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  visibility: visible;
}

/* Lock prompt */
.lock-prompt {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 10, 0.7);
  color: var(--muted);
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lock-prompt.show {
  opacity: 1;
}

/* Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .hud-top {
    padding: 8px 12px;
  }

  .hud-title {
    font-size: 0.65rem;
  }

  .hud-bottom {
    flex-wrap: wrap;
    gap: 10px;
  }

  .voucher-teaser {
    order: 3;
    width: 100%;
    text-align: left;
  }

  .overlay-card, .voucher-card, .help-card {
    padding: 22px;
  }
}
