/* SciBit G.03 — Rock Paper Scissors */

@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;
  --gold: #ffd35c;
  --bad: #ff5d7a;
  --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: manipulation;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}

/* 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;
}

/* Loss meter */
.loss-meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(5, 7, 10, 0.55);
}

.loss-label {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.loss-pips { display: flex; gap: 6px; }

.loss-pips i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 93, 122, 0.5);
  background: transparent;
  transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.loss-pips i.on {
  background: var(--bad);
  box-shadow: 0 0 12px rgba(255, 93, 122, 0.7);
  transform: scale(1.12);
}

.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); }
.record { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.voucher-teaser { max-width: 190px; text-align: right; font-size: 0.8rem; color: var(--muted); }
.voucher-teaser.unlocked { color: var(--accent); font-weight: 600; }

/* Move buttons */
.moves {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 16;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  padding: 10px;
}

.move-btn {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 108px;
  height: 84px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 18, 0.82);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.12s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.move-btn .move-icon { font-size: 2rem; line-height: 1; }
.move-btn .move-name { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.move-btn:hover:not(:disabled),
.move-btn:focus-visible:not(:disabled) {
  border-color: var(--cyan);
  box-shadow: 0 0 24px rgba(61, 224, 224, 0.25);
  outline: none;
  transform: translateY(-2px);
}

.move-btn:active:not(:disabled) { transform: translateY(1px) scale(0.98); }

.move-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.move-btn.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 28px rgba(61, 224, 224, 0.4);
}

/* 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; }

.hidden { display: none !important; }

/* Modals */
.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, .help-fig {
  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;
}

.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-intro { color: var(--muted); line-height: 1.6; margin: 0 0 18px; }
.help-card ul { margin: 0 0 20px; padding-left: 20px; color: var(--muted); line-height: 1.7; }
.help-card li { margin-bottom: 10px; }
.help-card strong { color: var(--ink); }
.progress-note { color: var(--cyan); font-size: 0.85rem; margin: 0 0 18px; }

/* Banner */
.banner {
  position: fixed;
  top: 9%;
  left: 50%;
  z-index: 18;
  transform: translate(-50%, -12px);
  text-align: center;
  padding: 14px 30px;
  border-radius: 14px;
  background: rgba(5, 7, 10, 0.62);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s ease;
  pointer-events: none;
}

.banner.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.banner span { display: block; font-size: 0.7rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--cyan); margin-bottom: 4px; }
.banner strong { font-family: 'Instrument Serif', Georgia, serif; font-size: 1.8rem; font-weight: 400; }

/* 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;
  max-width: min(90vw, 420px);
  text-align: center;
}

.toast.show { opacity: 1; visibility: visible; }

@media (max-width: 640px) {
  .hud-top { padding: 8px 10px; gap: 8px; }
  .hud-title { font-size: 0.62rem; letter-spacing: 0.12em; }
  .loss-meter { padding: 4px 8px; }
  .loss-label { display: none; }
  .hud-bottom { flex-wrap: wrap; gap: 8px; }
  .progress { order: 3; width: 100%; text-align: left; }
  .voucher-teaser { order: 4; width: 100%; max-width: none; text-align: left; }
  .moves { gap: 10px; bottom: calc(150px + env(safe-area-inset-bottom)); }
  .move-btn { width: 88px; height: 72px; }
  .move-btn .move-icon { font-size: 1.7rem; }
  .overlay-card, .voucher-card, .help-card { padding: 22px; }
}
