:root {
  --bg: #060606;
  --surface: #0e0e0e;
  --accent: #e8e8e8;
  --dim: #2a2a2a;
  --dimmer: #181818;
  --danger: #ff2233;
  --success: #00ff88;
  --timer-red: #ff1a1a;
  --red-top: #ff5555;
  --red-mid: #cc0000;
  --red-deep: #7a0000;
  --red-base: #4a0000;
  --red-floor: #2a0000;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  cursor: url("../src/cursor/cursor-small.png") 4 4, auto !important;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--accent);
  font-family: 'Roboto Serif', serif;
  user-select: none;
}

button,
[role="button"],
a,
input[type="button"],
input[type="submit"],
input[type="reset"],
label[for],
select,
summary,
input,
textarea,
[contenteditable="true"],
[draggable="true"] {
  cursor: url("../src/cursor/cursor-small.png") 4 4, auto !important;
}

#noise {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
}

#scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 201;
  pointer-events: none;
  opacity: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 1px,
      rgba(0, 0, 0, 0.65) 1px, rgba(0, 0, 0, 0.65) 2px);
}

#static-canvas {
  position: fixed;
  inset: 0;
  z-index: 199;
  pointer-events: none;
  opacity: 0;
}

#glitch-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
}

#title-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.8s ease;
}

#title-screen.out {
  opacity: 0;
  pointer-events: none;
}

.title-badge {
  font-size: 10px;
  letter-spacing: 8px;
  color: #666;
  text-transform: uppercase;
  margin-bottom: 32px;
  animation: fadeUp 1s ease 0.2s both;
}

#title-logo {
  font-size: clamp(38px, 9vw, 82px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -2px;
  color: var(--accent);
  text-align: center;
  position: relative;
  animation: fadeUp 0.9s ease 0.4s both;
}

#title-logo span {
  display: block;
  color: var(--red-mid);
  text-shadow: 0 0 40px rgba(200, 0, 0, 0.5), 0 0 80px rgba(200, 0, 0, 0.2);
}

.title-line {
  width: 60px;
  height: 1px;
  background: #1e1e1e;
  margin: 32px 0;
  animation: fadeUp 0.9s ease 0.7s both;
}

.title-sub {
  font-size: 11px;
  letter-spacing: 4px;
  color: #888;
  text-transform: uppercase;
  text-align: center;
  line-height: 2;
  animation: fadeUp 0.9s ease 0.9s both;
  font-style: italic;
}

#title-best {
  margin-top: 16px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: #888888;
  letter-spacing: 3px;
  animation: fadeUp 0.9s ease 1s both;
}

#title-actions {
  margin-top: 48px;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

#start-btn {
  padding: 16px 44px;
  background: transparent;
  border: 1px solid #1e1e1e;
  color: #777777;
  font-family: 'Roboto Serif', serif;
  font-size: 11px;
  letter-spacing: 6px;
  text-transform: uppercase;
  cursor: url("../src/cursor/cursor-small.png") 4 4, auto;
  transition: border-color 0.3s, color 0.3s, box-shadow 0.3s;
  animation: fadeUp 0.9s ease 1.2s both, pulse-border 3s ease 2s infinite;
}

#fullscreen-btn {
  padding: 16px 28px;
  background: transparent;
  border: 1px solid #1e1e1e;
  color: #666666;
  font-family: 'Roboto Serif', serif;
  font-size: 10px;
  letter-spacing: 5px;
  text-transform: uppercase;
  cursor: url("../src/cursor/cursor-small.png") 4 4, auto;
  transition: border-color 0.3s, color 0.3s, box-shadow 0.3s;
  animation: fadeUp 0.9s ease 1.35s both;
}

#start-btn:hover {
  border-color: var(--red-mid);
  color: #cc4444;
  box-shadow: 0 0 20px rgba(200, 0, 0, 0.15);
}

#fullscreen-btn:hover {
  border-color: #444444;
  color: #b8b8b8;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.08);
}

.title-glitch {
  animation: titleFlicker 0.1s steps(1) infinite;
}

#shake-target {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  width: 100%;
  padding: 40px 20px;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

#stage.live {
  pointer-events: all;
}

#hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  z-index: 10;
}

#game-label {
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -1px;
  color: var(--accent);
  text-transform: none;
}

#game-label span {
  display: block;
  color: var(--red-mid);
  text-shadow: 0 0 24px rgba(200, 0, 0, 0.35), 0 0 48px rgba(200, 0, 0, 0.14);
}

#level-counter {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: #00000000;
  letter-spacing: 3px;
}

#best-score {
  font-size: 9px;
  letter-spacing: 3px;
  color: #666666;
  text-transform: uppercase;
}

#rule-container {
  text-align: center;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-height: 90px;
}

#rule-prefix {
  font-size: 8px;
  letter-spacing: 7px;
  text-transform: uppercase;
  color: #666666;
  font-weight: 400;
}

#rule-text {
  font-size: clamp(17px, 3.2vw, 27px);
  font-weight: 700;
  line-height: 1.35;
  color: #c8c8c8;
  text-align: center;
  min-height: 38px;
}

#rule-sub {
  font-size: 10px;
  color: #777777;
  letter-spacing: 3px;
  text-transform: uppercase;
  min-height: 14px;
  font-style: italic;
}

#timer-wrap {
  display: none;
  flex-direction: column;
  align-items: center;
}

#timer-wrap.active {
  display: flex;
}

#timer-frame {
  background: #080808;
  border: 1px solid #161616;
  border-radius: 6px;
  padding: 10px 24px 12px;
  box-shadow:
    0 0 30px rgba(255, 26, 26, 0.06),
    inset 0 0 16px rgba(0, 0, 0, 0.9),
    inset 0 1px 0 #111;
  position: relative;
}

#timer-display {
  font-family: 'Share Tech Mono', monospace;
  font-size: 48px;
  color: var(--timer-red);
  letter-spacing: 6px;
  line-height: 1;
  min-width: 120px;
  text-align: center;
  text-shadow:
    0 0 8px rgba(255, 26, 26, 0.7),
    0 0 20px rgba(255, 26, 26, 0.4),
    0 0 40px rgba(255, 26, 26, 0.15);
  position: relative;
}

#timer-display::before {
  content: attr(data-ghost);
  position: absolute;
  inset: 0;
  color: rgba(255, 26, 26, 0.05);
  pointer-events: none;
}

#btn-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 240px;
  height: 240px;
  perspective: 600px;
}

#btn-ring {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 1px solid rgba(180, 0, 0, 0.15);
  pointer-events: none;
  z-index: 0;
  animation: ring-pulse 2.5s ease-in-out infinite;
}

#btn-ring2 {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 1px solid rgba(180, 0, 0, 0.07);
  pointer-events: none;
  z-index: 0;
  animation: ring-pulse 2.5s ease-in-out 0.8s infinite;
}

@keyframes ring-pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0;
  }

  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

#btn-floor {
  position: absolute;
  width: 170px;
  height: 30px;
  border-radius: 50%;
  bottom: 14px;
  background: radial-gradient(ellipse, rgba(180, 0, 0, 0.35) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  filter: blur(4px);
}

#the-button {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: none;
  outline: none;
  cursor: url("../src/cursor/cursor-small.png") 4 4, auto;
  position: relative;
  z-index: 2;
  background: radial-gradient(ellipse at 38% 32%,
      #ff7070 0%,
      #e02020 25%,
      #aa0000 52%,
      #6e0000 75%,
      #3a0000 100%);
  box-shadow:
    0 4px 0 #8b0000,
    0 8px 0 #6a0000,
    0 12px 0 #4e0000,
    0 16px 0 #330000,
    0 22px 40px rgba(0, 0, 0, 0.85),
    0 30px 60px rgba(0, 0, 0, 0.5),
    0 0 50px rgba(180, 0, 0, 0.25),
    0 0 100px rgba(180, 0, 0, 0.1),
    inset 0 -6px 12px rgba(0, 0, 0, 0.5),
    inset 0 2px 4px rgba(255, 120, 120, 0.15);

  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Roboto Serif', serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 4px;
  color: rgba(255, 200, 200, 0.5);
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);

  transition:
    transform 0.1s ease,
    box-shadow 0.1s ease,
    background 0.3s ease,
    width 0.4s ease, height 0.4s ease;
}

#the-button::before {
  content: '';
  position: absolute;
  width: 55%;
  height: 42%;
  top: 10%;
  left: 22%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%,
      rgba(255, 210, 210, 0.35) 0%,
      rgba(255, 160, 160, 0.12) 50%,
      transparent 80%);
  pointer-events: none;
  transition: opacity 0.3s;
}

#the-button::after {
  content: '';
  position: absolute;
  width: 70%;
  height: 25%;
  bottom: 8%;
  left: 15%;
  border-radius: 50%;
  background: radial-gradient(ellipse,
      rgba(0, 0, 0, 0.5) 0%, transparent 70%);
  pointer-events: none;
}

#the-button:hover {
  transform: translateY(-8px) scale(1.05);
  box-shadow:
    0 8px 0 #8b0000,
    0 14px 0 #6a0000,
    0 20px 0 #4e0000,
    0 26px 0 #330000,
    0 32px 0 #1a0000,
    0 38px 60px rgba(0, 0, 0, 0.95),
    0 48px 90px rgba(0, 0, 0, 0.6),
    0 0 80px rgba(200, 0, 0, 0.5),
    0 0 140px rgba(200, 0, 0, 0.25),
    inset 0 -8px 16px rgba(0, 0, 0, 0.6),
    inset 0 2px 6px rgba(255, 150, 150, 0.3);
}

#the-button:active,
#the-button.pressed {
  transform: translateY(18px) scale(0.98);
  box-shadow:
    0 1px 0 #8b0000,
    0 2px 0 #6a0000,
    0 3px 0 #4e0000,
    0 6px 12px rgba(0, 0, 0, 0.9),
    0 0 20px rgba(180, 0, 0, 0.15),
    inset 0 -2px 4px rgba(0, 0, 0, 0.7),
    inset 0 6px 12px rgba(0, 0, 0, 0.4),
    inset 0 -2px 2px rgba(0, 0, 0, 0.5);
}

#the-button:active::before,
#the-button.pressed::before {
  opacity: 0.6;
}

#the-button.glow-green {
  background: radial-gradient(ellipse at 38% 32%, #88ffbb 0%, #00cc66 30%, #008844 60%, #003322 100%);
  box-shadow:
    0 4px 0 #006633, 0 8px 0 #004422, 0 12px 0 #002211, 0 16px 0 #001508,
    0 22px 40px rgba(0, 0, 0, 0.85), 0 0 50px rgba(0, 200, 100, 0.3),
    inset 0 -6px 12px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(150, 255, 200, 0.2);
  color: rgba(180, 255, 220, 0.7);
}

#the-button.glow-yellow {
  background: radial-gradient(ellipse at 38% 32%, #ffeeaa 0%, #ddaa00 30%, #996600 60%, #443300 100%);
  box-shadow:
    0 4px 0 #664400, 0 8px 0 #443300, 0 12px 0 #221900, 0 16px 0 #110c00,
    0 22px 40px rgba(0, 0, 0, 0.85), 0 0 50px rgba(220, 170, 0, 0.3),
    inset 0 -6px 12px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 230, 150, 0.2);
  color: rgba(255, 230, 180, 0.7);
}

#the-button.glow-blue {
  background: radial-gradient(ellipse at 38% 32%, #aaccff 0%, #0077cc 30%, #004488 60%, #001133 100%);
  box-shadow:
    0 4px 0 #003366, 0 8px 0 #002244, 0 12px 0 #001122, 0 16px 0 #000811,
    0 22px 40px rgba(0, 0, 0, 0.85), 0 0 50px rgba(0, 120, 220, 0.3),
    inset 0 -6px 12px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(150, 200, 255, 0.2);
  color: rgba(180, 220, 255, 0.7);
}

#the-button.glow-white {
  background: radial-gradient(ellipse at 38% 32%, #ffffff 0%, #cccccc 30%, #888888 60%, #333333 100%);
  box-shadow:
    0 4px 0 #555, 0 8px 0 #333, 0 12px 0 #222, 0 16px 0 #111,
    0 22px 40px rgba(0, 0, 0, 0.85), 0 0 50px rgba(255, 255, 255, 0.15),
    inset 0 -6px 12px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.3);
  color: rgba(80, 80, 80, 0.8);
}

#the-button.invisible {
  opacity: 0;
}

#key-hint {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 30px;
}

.key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border: 1px solid #1e1e1e;
  border-bottom: 3px solid #141414;
  border-radius: 4px;
  background: #0e0e0e;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: #333;
  letter-spacing: 2px;
  transition: border-color 0.1s, color 0.1s;
}

.key-badge.active {
  border-color: #993333;
  border-bottom-color: #661111;
  color: #cc4444;
}

.key-sep {
  color: #888;
  font-size: 12px;
}

#hold-bar-wrap {
  width: 210px;
  height: 3px;
  background: #111;
  border-radius: 2px;
  overflow: hidden;
  display: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

#hold-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #880000, #ff2233);
  box-shadow: 0 0 8px rgba(255, 34, 51, 0.6);
  transition: none;
}

#click-count-display {
  font-family: 'Share Tech Mono', monospace;
  font-size: 44px;
  color: #555555;
  min-height: 52px;
  letter-spacing: 4px;
  transition: color 0.08s;
  text-shadow: 0 0 20px rgba(200, 0, 0, 0);
}

#click-count-display.lit {
  color: #cc2222;
  text-shadow: 0 0 20px rgba(200, 0, 0, 0.4);
}

#feedback {
  font-size: 11px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: transparent;
  min-height: 16px;
  transition: color 0.1s;
}

#feedback.good {
  color: var(--success);
}

#feedback.bad {
  color: var(--danger);
}

#progress-bar-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #0a0a0a;
}

#progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #4a0000, #cc0000);
  box-shadow: 0 0 6px rgba(200, 0, 0, 0.5);
  transition: width 0.4s ease;
  width: 0%;
}

#progress-dots {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 300px;
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #151515;
  transition: background 0.3s, box-shadow 0.3s;
}

.dot.done {
  background: #3a1010;
}

.dot.active {
  background: #cc2222;
  box-shadow: 0 0 6px rgba(200, 0, 0, 0.5);
}

#overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
}

#overlay.visible {
  opacity: 1;
  pointer-events: all;
}

#fail-level-num {
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(80px, 18vw, 160px);
  color: #5a0000;
  line-height: 1;
  letter-spacing: -4px;
  position: relative;
  margin-bottom: -8px;
}

#fail-level-label {
  font-size: 8px;
  letter-spacing: 9px;
  text-transform: uppercase;
  color: #884444;
  margin-bottom: 28px;
}

#fail-main-text {
  font-size: clamp(28px, 6vw, 52px);
  font-weight: 900;
  letter-spacing: -1px;
  color: #cc0000;
  text-shadow: 0 0 40px rgba(180, 0, 0, 0.3);
  margin-bottom: 6px;
}

#fail-sub-text {
  font-size: 10px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: #4d2e2e;
  margin-bottom: 6px;
  font-style: italic;
}

#fail-reason-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: #4e0000;
  letter-spacing: 2px;
  margin-bottom: 36px;
  min-height: 18px;
}

.overlay-divider {
  width: 40px;
  height: 1px;
  background: #1a0000;
  margin: 20px 0;
}

#fail-btn {
  padding: 15px 40px;
  background: transparent;
  border: 1px solid #2a0000;
  color: #441111;
  font-family: 'Roboto Serif', serif;
  font-size: 10px;
  letter-spacing: 6px;
  text-transform: uppercase;
  cursor: url("../src/cursor/cursor-small.png") 4 4, auto;
  transition: all 0.3s;
}

#fail-btn:hover {
  border-color: #661111;
  color: #cc2222;
  box-shadow: 0 0 20px rgba(180, 0, 0, 0.1);
}

#win-screen {
  position: fixed;
  inset: 0;
  z-index: 310;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
}

#win-screen.visible {
  opacity: 1;
  pointer-events: all;
}

#win-num {
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(60px, 14vw, 120px);
  color: #001a09;
  letter-spacing: -3px;
  line-height: 1;
}

#win-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 900;
  color: var(--success);
  text-shadow: 0 0 40px rgba(0, 255, 136, 0.35);
  letter-spacing: -1px;
}

#win-sub {
  font-size: 10px;
  letter-spacing: 6px;
  color: #1a3a2a;
  text-transform: uppercase;
  font-style: italic;
}

#win-score {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: #1a3a2a;
  letter-spacing: 3px;
  margin-top: 8px;
}

#win-btn {
  margin-top: 24px;
  padding: 15px 40px;
  background: transparent;
  border: 1px solid #1a3a2a;
  color: #2a5a3a;
  font-family: 'Roboto Serif', serif;
  font-size: 10px;
  letter-spacing: 6px;
  text-transform: uppercase;
  cursor: url("../src/cursor/cursor-small.png") 4 4, auto;
  transition: all 0.3s;
}

#win-btn:hover {
  border-color: #2a8a4a;
  color: var(--success);
}

#fake-win {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.06s;
}

#fake-win.show {
  opacity: 1;
}

#fake-win h2 {
  font-size: 52px;
  color: var(--success);
  font-weight: 900;
  text-shadow: 0 0 50px var(--success);
}

#fake-win p {
  font-size: 11px;
  color: #1a5a2a;
  letter-spacing: 5px;
  text-transform: uppercase;
}

#terminal-screen {
  position: fixed;
  inset: 0;
  z-index: 320;
  background: #0c0c0c;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow: hidden;
  font-family: 'Courier New', monospace;
  color: #00ff00;
  padding: 20px;
  font-size: 13px;
  line-height: 1.6;
  text-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

#terminal-screen.visible {
  opacity: 1;
  pointer-events: all;
}

#terminal-content {
  overflow-y: auto;
  flex: 1;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #ffffff;
}

.terminal-line {
  margin: 2px 0;
}

.terminal-prompt {
  color: #ffffff;
  font-weight: bold;
}

.terminal-error {
  color: #ff4444;
}

.terminal-success {
  color: #00ff00;
}

.shaking {
  animation: shake 0.07s linear infinite;
}

.glitch-text {
  position: relative;
}

.glitch-text::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: #ff0044;
  animation: glitch-a 0.08s infinite;
}

.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: #00ffcc;
  animation: glitch-b 0.11s infinite;
}

@media (max-width: 480px) {
  #hud-top {
    padding: 16px 18px;
    align-items: flex-start;
  }

  #game-label {
    font-size: 16px;
  }

  #title-actions {
    width: min(100%, 320px);
    flex-direction: column;
  }

  #start-btn,
  #fullscreen-btn {
    width: 100%;
  }

  #the-button {
    width: 150px !important;
    height: 150px !important;
  }

  #btn-wrap {
    width: 190px;
    height: 190px;
  }
}
