/* ── CSS Variables ── */
:root {
  --blue: #00aaff;
  --red: #ff2244;
  --amber: #ffaa00;
  --gold: #ffd700;
  --dim: rgba(255, 255, 255, 0.22);
  --bg: rgba(12, 16, 24, 0.95);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  overflow: hidden;
  background: #000;
  font-family: 'Share Tech Mono', monospace;
  color: #fff;
}

/* ── Canvas ── */
canvas#c {
  position: fixed;
  top: 0;
  left: 0;
  display: block;
  width: 100vw;
  height: 100vh;
}

/* ── Alarm VFX overlay ── */
#alarm-vfx {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  background: rgba(255, 0, 0, 0);
  transition: background 0.06s;
}

/* ── NEOBRUTALIST INTRO SCREEN ── */
#intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: #FFE500;
  background-image: radial-gradient(#000 1px, transparent 1px);
  background-size: 20px 20px;
  color: #000;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: opacity 0.6s;
}

/* Typography for intro */
.intro-text-black { color: #000; }
.intro-font-black { font-weight: 900; }
.intro-font-bold { font-weight: 700; }
.intro-uppercase { text-transform: uppercase; }
.intro-tracking-tighter { letter-spacing: -0.05em; }
.intro-tracking-widest { letter-spacing: 0.1em; }

/* Header */
.intro-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 105;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  height: 4rem;
  background-color: #0D0D0D;
  border-bottom: 5px solid #000;
}

.intro-header-title {
  color: #00F5FF;
  font-weight: 900;
  letter-spacing: -0.05em;
  font-size: 1.25rem;
}

.intro-blinking-cursor {
  width: 0.75rem;
  height: 1.5rem;
  background-color: #FFE500;
  animation: blink 1s step-end infinite;
}

.intro-header-icons {
  display: flex;
  gap: 1rem;
  align-items: center;
}

@media (max-width: 768px) {
  .intro-header-icons { display: none; }
}

.intro-icon {
  color: #000;
  background-color: #FFE500;
  padding: 0.25rem;
  font-weight: 700;
}

.intro-status-dots {
  display: flex;
  gap: 0.5rem;
}

.intro-dot {
  width: 0.75rem;
  height: 0.75rem;
}

.intro-dot-orange { background-color: #FF6B00; }
.intro-dot-cyan { background-color: #00F5FF; }
.intro-dot-green { background-color: #00FF41; }

/* Main Content */
.intro-main {
  flex-grow: 1;
  padding-top: 6rem;
  padding-bottom: 5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  max-width: 80rem;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3rem;
}

/* Hero Section */
.intro-hero {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.intro-live-badge {
  display: inline-block;
  background-color: #00F5FF;
  color: #000;
  border: 3px solid #000;
  padding: 0.25rem 1rem;
  font-weight: 700;
  box-shadow: 6px 6px 0px #000;
  align-self: flex-start;
}

.intro-title {
  font-size: 3.75rem;
  line-height: 0.9;
  margin: 0;
}

@media (min-width: 768px) {
  .intro-title { font-size: 8rem; }
}

.intro-title-offset {
  margin-left: 3rem;
}

@media (min-width: 768px) {
  .intro-title-offset { margin-left: 6rem; }
}

.intro-subtitle {
  font-size: 1.25rem;
  max-width: 42rem;
  margin-top: 1rem;
}

@media (min-width: 768px) {
  .intro-subtitle { font-size: 1.5rem; }
}

/* Layout Grid */
.intro-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

@media (min-width: 1024px) {
  .intro-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
}

/* Description Card */
.intro-desc-card {
  background-color: #0D0D0D;
  border: 4px solid #000;
  padding: 2rem;
  box-shadow: 7px 7px 0px #00F5FF;
  position: relative;
}

@media (min-width: 1024px) {
  .intro-desc-card {
    grid-column: span 7 / span 7;
  }
}

.intro-desc-text {
  color: #00FF41;
  font-size: 1.25rem;
  line-height: 1.625;
}

.intro-pc-badge {
  background-color: #9B00FF;
  padding: 0.125rem 0.5rem;
  color: #000;
  font-weight: 900;
}

.intro-desc-action {
  border-top: 3px solid rgba(0, 245, 255, 0.3);
  padding-top: 1.5rem;
  margin-top: 3rem;
  color: #FF6B00;
  font-weight: 900;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* Controls */
.intro-controls {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .intro-controls {
    grid-column: span 5 / span 5;
  }
}

.intro-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.intro-key-card {
  border: 3px solid #000;
  padding: 1rem;
  box-shadow: 4px 4px 0px #000;
}

.intro-key-card-cyan { background-color: #00F5FF; }
.intro-key-card-orange { background-color: #FF6B00; }

.intro-key-title {
  font-size: 0.6875rem;
  color: #000;
  font-weight: 900;
  display: block;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.intro-key-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.intro-key-row:last-child {
  margin-bottom: 0;
}

.intro-key {
  border: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #000;
}

.intro-key-yellow {
  background-color: #FFE500;
}

.intro-key-cyan {
  background-color: #00F5FF;
}

.intro-key-square {
  width: 2rem;
  height: 2rem;
}

.intro-key-wide {
  width: 3rem;
  height: 2rem;
  font-size: 0.75rem;
}

.intro-key-label {
  flex-grow: 1;
  border: 2px solid #000;
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  background-color: #FFE500;
  color: #000;
}

/* Enter Button */
#enter-btn {
  width: 100%;
  background-color: #0D0D0D;
  color: #FFE500;
  border: 4px solid #000;
  padding: 1.5rem 0;
  font-size: 1.875rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  box-shadow: 7px 7px 0px #00F5FF;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

#enter-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 9px 9px 0px #00F5FF;
}

#enter-btn:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

/* Footer / Status Bar */
.intro-footer {
  position: fixed;
  bottom: 4px;
  left: 0;
  width: calc(100% - 4px);
  z-index: 105;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  height: 2.5rem;
  background-color: #0D0D0D;
  border: 3px solid #000;
  border-left: none;
  box-shadow: 4px 4px 0px #FF2D2D;
}

.intro-status-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  height: 100%;
  font-size: 0.6875rem;
  text-transform: uppercase;
  font-weight: 700;
  border-right: 3px solid #000;
}

.intro-status-green { background-color: #00FF41; color: #000; }
.intro-status-dark { color: #00F5FF; }
.intro-status-green-text { color: #00FF41; }

/* Background Elements */
.intro-bg-element {
  position: fixed;
  top: 25%;
  right: -5rem;
  pointer-events: none;
  opacity: 0.2;
  display: none;
}

@media (min-width: 1280px) {
  .intro-bg-element { display: block; }
}

.intro-bg-square {
  width: 24rem;
  height: 24rem;
  border: 40px solid #000;
  transform: rotate(45deg);
}

.material-symbols-outlined {
  font-size: inherit;
}

/* ── HUD ── */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

/* ── TOUR UI ── */
.tour-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #0D0D0D;
  border: 4px solid #000;
  box-shadow: 6px 6px 0px #FFE500;
  padding: 30px;
  width: 450px;
  pointer-events: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 15px;
  color: #fff;
}

#tour-step-card {
  width: 600px;
  max-width: 90vw;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 13, 13, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 2px #00F5FF;
  border: none;
  animation: popDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popDown {
  from {
    transform: translate(-50%, -100%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.tour-title {
  color: #FFE500;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -1px;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.tour-text {
  color: #fff;
  font-size: 14px;
  line-height: 1.6;
}

.tour-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.tour-btn {
  padding: 12px;
  font-family: inherit;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  border: 2px solid #000;
  text-align: center;
  transition: transform 0.1s, box-shadow 0.1s;
}

.tour-btn-primary {
  background: #00F5FF;
  color: #000;
  box-shadow: 3px 3px 0px #000;
}

.tour-btn-primary:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px #000;
}

.tour-btn-secondary {
  background: transparent;
  color: #FFE500;
  border: 2px solid #FFE500;
}

.tour-btn-secondary:hover {
  background: rgba(255, 229, 0, 0.1);
}

.tour-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #333;
  padding-bottom: 10px;
  margin-bottom: 5px;
}

.tour-badge {
  background: #FF6B00;
  color: #000;
  padding: 2px 8px;
  font-weight: 900;
  font-size: 12px;
}

.tour-count {
  color: #00F5FF;
  font-weight: bold;
  font-family: 'Share Tech Mono', monospace;
}

.tour-step-title {
  color: #00FF41;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: bold;
  font-size: 20px;
}

.tour-step-desc {
  color: #ccc;
  font-size: 14px;
  line-height: 1.5;
  min-height: 60px;
}

.tour-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
}

.tour-action-pill {
  background: rgba(0, 245, 255, 0.15);
  color: #00F5FF;
  border: 1px solid #00F5FF;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 20px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.tour-controls-hint {
  color: #666;
  font-size: 11px;
}

.tour-progress-bg {
  height: 4px;
  background: #222;
  width: 100%;
  margin-top: 10px;
}

.tour-progress-fill {
  height: 100%;
  background: #FFE500;
  width: 0%;
  transition: width 0.1s linear;
}

/* Progress bar */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--blue);
  transition: width 0.5s, background 0.4s;
  z-index: 51;
}

/* Crosshair */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  z-index: 52;
}

#crosshair::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 1px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.6);
}

#crosshair::after {
  content: '';
  position: absolute;
  height: 100%;
  width: 1px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.6);
}

/* Stage panel */
#stage-panel {
  position: fixed;
  top: 20px;
  left: 20px;
  max-width: 380px;
  background: var(--bg);
  border-left: 4px solid var(--stage-color, var(--blue));
  padding: 20px 24px;
  border-radius: 0 6px 6px 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#stage-label {
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--dim);
  margin-bottom: 4px;
}

#stage-name {
  font-size: 20px;
  color: var(--stage-color, var(--blue));
  transition: color 0.4s;
  margin-bottom: 12px;
  font-weight: bold;
}

#stage-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 2.0;
}

/* Registers */
#registers {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg);
  border: 1px solid rgba(0, 170, 255, 0.25);
  padding: 18px 24px;
  border-radius: 6px;
  font-size: 16px;
  line-height: 2.4;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#r-pc {
  color: var(--blue);
  font-weight: bold;
}

#r-sp {
  color: var(--gold);
  font-weight: bold;
}

#r-irq {
  color: var(--dim);
  font-size: 14px;
  margin-top: 4px;
}

/* Speed control */
#speed-control {
  position: fixed;
  top: 160px;
  right: 20px;
  background: var(--bg);
  border: 1px solid rgba(0, 255, 136, 0.25);
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 15px;
  color: #00ff88;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-align: right;
  min-width: 140px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* IRQ prompt */
#irq-prompt {
  position: fixed;
  bottom: 62px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 34, 68, 0.1);
  border: 1px solid rgba(255, 34, 68, 0.3);
  padding: 9px 22px;
  border-radius: 4px;
  font-size: 12px;
  color: #ff6680;
  letter-spacing: 2px;
  animation: pulseBlink 2.4s ease-in-out infinite;
}

@keyframes pulseBlink {

  0%,
  100% {
    opacity: 0.55;
  }

  50% {
    opacity: 1.0;
  }
}

/* Hint */
#hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(4, 8, 16, 0.75);
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.28);
  letter-spacing: 2px;
  transition: opacity 1.5s;
}

/* ── LOADING SCREEN ── */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #020508;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Share Tech Mono', monospace;
}

.main-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 700px;
}

.loader {
  width: 100%;
}

.trace-bg {
  stroke: #333;
  stroke-width: 1.8;
  fill: none;
}

.trace-flow {
  stroke-width: 1.8;
  fill: none;
  stroke-dasharray: 40 400;
  stroke-dashoffset: 438;
  filter: drop-shadow(0 0 6px currentColor);
  animation: flow 3s cubic-bezier(0.5, 0, 0.9, 1) infinite;
}

.yellow {
  stroke: #ffea00;
  color: #ffea00;
}

.blue {
  stroke: #00ccff;
  color: #00ccff;
}

.green {
  stroke: #00ff15;
  color: #00ff15;
}

.purple {
  stroke: #9900ff;
  color: #9900ff;
}

.red {
  stroke: #ff3300;
  color: #ff3300;
}

@keyframes flow {
  to {
    stroke-dashoffset: 0;
  }
}


.loading-notice {
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.loading-notice-text {
  background: linear-gradient(135deg, #fdfcfc, #e87517, #fdfcfc, #e87517, #fdfcfc);
  background-size: 300% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  animation: shimmer 6s linear infinite;
}

@keyframes shimmer {
  0% {
    background-position: 300% 0;
  }

  100% {
    background-position: -300% 0;
  }
}

.loading-notice-icon {
  color: #ffea00;
  filter: drop-shadow(0 0 4px #ffea00aa);
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}