/* ═══════════════════════════════════════════════ AUTH GATE OVERLAY */
#gate-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  background-image:
    linear-gradient(rgba(0,212,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
}
@keyframes gate-fade-out {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.03); }
}
#gate-overlay.unlocking { animation: gate-fade-out 0.6s ease forwards; pointer-events: none; }
#gate-overlay .gate-card {
  width: 100%; max-width: 480px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  overflow: hidden; box-shadow: 0 0 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,212,255,0.05);
}
#gate-overlay .gate-header {
  padding: 28px 32px 20px; border-bottom: 1px solid var(--border); text-align: center;
}
#gate-overlay .gate-logo {
  font-family: 'Barlow', sans-serif; font-size: 22px; font-weight: 900;
  letter-spacing: 2px; margin-bottom: 8px;
}
#gate-overlay .gate-logo .gsp { color: var(--accent); }
#gate-overlay .gate-subtitle {
  font-size: 12px; color: var(--text3); font-family: var(--mono);
  letter-spacing: 1px; text-transform: uppercase;
}
#gate-overlay .gate-body { padding: 28px 32px 32px; }
#gate-overlay .g-stage-label {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 2px; color: var(--text3);
  margin-bottom: 20px; display: flex; align-items: center; gap: 8px;
}
#gate-overlay .g-stage-label::before, #gate-overlay .g-stage-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
#gate-overlay .g-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 24px; }
#gate-overlay .g-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--surface3); border: 1px solid var(--border2); transition: background 0.3s;
}
#gate-overlay .g-dot.done { background: var(--green); border-color: var(--green); }
#gate-overlay .g-dot.active { background: var(--accent); border-color: var(--accent); }
#gate-overlay .btn-primary {
  background: var(--accent) !important; color: #0a0d12 !important;
  transform: none !important; box-shadow: none !important; margin-top: 0 !important;
}
#gate-overlay .btn-primary:hover:not(:disabled) { background: var(--accent2) !important; }
#gate-overlay .btn-primary:disabled { opacity: 0.35; }
/* TOS */
#gate-overlay .tos-box {
  height: 160px; overflow-y: auto; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
  font-size: 10.5px; line-height: 1.8; color: var(--text3); font-family: var(--mono);
  margin-bottom: 10px; scrollbar-width: thin; scrollbar-color: var(--border2) transparent;
}
#gate-overlay .tos-box::-webkit-scrollbar { width: 5px; }
#gate-overlay .tos-box::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
#gate-overlay .tos-hint {
  font-family: var(--mono); font-size: 11px; color: var(--text3);
  text-align: center; margin-bottom: 14px; min-height: 16px; transition: color 0.3s;
}
/* Fleeing checkbox */
#gate-overlay .checkbox-arena {
  position: relative; height: 220px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 12px; overflow: hidden;
}
#gate-overlay .flee-item {
  position: absolute; display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text2); white-space: nowrap; cursor: pointer; user-select: none;
  padding: 6px 10px; border: 1px solid var(--border2); border-radius: 6px;
  background: var(--surface3); transition: border-color 0.2s;
}
#gate-overlay .flee-item input[type=checkbox] {
  width: 14px; height: 14px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer;
}
#gate-overlay .arena-hint {
  position: absolute; bottom: 8px; right: 12px;
  font-family: var(--mono); font-size: 10px; color: var(--text3);
}
#gate-overlay .cb-error {
  font-family: var(--mono); font-size: 11px; color: var(--red);
  text-align: center; min-height: 16px; margin-bottom: 12px;
}
/* Precision Slider */
#gate-overlay .slider-target-display {
  font-family: var(--mono); font-size: 12px; color: var(--text2); margin-bottom: 8px; text-align: center;
}
#gate-overlay .slider-target-display span { color: var(--orange); font-weight: 700; font-size: 15px; }
#gate-overlay input[type=range].hell-slider {
  width: 100%; -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 3px; background: var(--surface3); outline: none;
}
#gate-overlay input[type=range].hell-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
  border: 2px solid var(--bg); box-shadow: 0 0 8px rgba(0,212,255,0.5);
}
#gate-overlay .slider-feedback {
  font-family: var(--mono); font-size: 11px; text-align: center; min-height: 18px; margin-bottom: 20px;
}
#gate-overlay .slider-feedback.ok    { color: var(--green); }
#gate-overlay .slider-feedback.close { color: var(--orange); }
#gate-overlay .slider-feedback.off   { color: var(--red); }
/* Cascade */
#gate-overlay .cascade-card {
  background: var(--surface2); border: 1px solid rgba(255,170,0,0.35);
  border-radius: 10px; padding: 18px; margin-bottom: 14px;
}
#gate-overlay .cascade-prereq-label {
  font-family: var(--mono); font-size: 10px; color: var(--orange);
  letter-spacing: 2px; text-transform: uppercase; margin-bottom: 8px;
}
#gate-overlay .cascade-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
#gate-overlay .cascade-desc  { font-size: 12px; color: var(--text2); margin-bottom: 16px; line-height: 1.6; }
#gate-overlay .countdown-display { text-align: center; margin-bottom: 14px; }
#gate-overlay .countdown-num {
  font-family: var(--mono); font-size: 42px; font-weight: 700; color: var(--accent); line-height: 1;
}
#gate-overlay .countdown-sub { font-size: 11px; color: var(--text3); font-family: var(--mono); margin-top: 4px; }
#gate-overlay .phrase-box {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  background: var(--surface3); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; text-align: center;
}
#gate-overlay .phrase-input {
  width: 100%; background: var(--surface3); border: 1px solid var(--border2);
  color: var(--text); font-family: var(--mono); font-size: 12px;
  padding: 10px 12px; border-radius: 6px; outline: none; transition: border-color 0.2s;
}
#gate-overlay .phrase-input:focus { border-color: var(--accent); }
#gate-overlay .phrase-fb { font-family: var(--mono); font-size: 11px; text-align: center; min-height: 18px; margin-top: 8px; }
#gate-overlay .hover-zone {
  width: 90px; height: 90px; border: 2px dashed var(--accent); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px; font-size: 26px; cursor: crosshair;
  transition: background 0.2s, border-color 0.2s; user-select: none;
}
#gate-overlay .hover-zone.hovered { background: rgba(0,212,255,0.08); }
#gate-overlay .hover-zone.done { border-color: var(--green); color: var(--green); background: rgba(0,255,136,0.06); }
#gate-overlay .hover-prog-text { font-family: var(--mono); font-size: 11px; color: var(--text3); text-align: center; margin-bottom: 8px; }
#gate-overlay .hover-bar-wrap { background: var(--surface3); border-radius: 4px; height: 4px; overflow: hidden; }
#gate-overlay .hover-bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.1s linear; width: 0%; }
/* Fuse bar */
#gate-overlay .fuse-bar-wrap {
  height: 5px; background: var(--surface3); border-radius: 3px; overflow: hidden;
  border: 1px solid rgba(255,80,40,0.2); margin-bottom: 12px;
}
#gate-overlay .fuse-bar-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, #ff2020 0%, #ff6600 50%, #ffaa00 100%);
  box-shadow: 0 0 8px rgba(255,80,40,0.6); will-change: width;
}
#gate-overlay .fuse-label {
  font-family: var(--mono); font-size: 10px; color: var(--text3);
  letter-spacing: 1.5px; text-transform: uppercase;
  display: flex; justify-content: space-between; margin-bottom: 5px;
}
#gate-overlay .sim-timer-wrap { margin-bottom: 10px; }
/* Simon Says */
#gate-overlay .simon-header { text-align: center; margin-bottom: 16px; }
#gate-overlay .simon-round { font-family: var(--mono); font-size: 11px; color: var(--text3); margin-bottom: 4px; }
#gate-overlay .simon-status { font-size: 13px; font-weight: 600; color: var(--text2); min-height: 20px; }
/* Simon canvas — no tile IDs, class names, or onclick attributes in the DOM */
#gate-overlay #b-sim-canvas {
  width: 100%; aspect-ratio: 1; border-radius: 10px;
  cursor: pointer; display: block; margin-bottom: 16px;
}
#gate-overlay .simon-sequence {
  display: flex; gap: 4px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 14px; min-height: 20px;
}
#gate-overlay .seq-dot {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid var(--border2); background: var(--surface3); transition: background 0.1s;
}
#gate-overlay .seq-dot.filled { transition: background 0.1s; }
#gate-overlay .simon-start-btn {
  width: 100%; padding: 12px; background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text2); border-radius: 8px; font-family: var(--sans); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
#gate-overlay .simon-start-btn:hover { border-color: var(--accent); color: var(--accent); }
/* Gate success */
#gate-overlay .gate-success { text-align: center; padding: 12px 0 4px; }
#gate-overlay .g-success-icon {
  font-size: 40px; margin-bottom: 12px; animation: gate-pop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes gate-pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#gate-overlay .g-success-title { font-size: 20px; font-weight: 700; color: var(--green); margin-bottom: 6px; }
#gate-overlay .g-success-sub { font-size: 13px; color: var(--text2); }
