@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700;900&family=Share+Tech+Mono&display=swap');

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

button { touch-action: manipulation; }

:root {
  --c1: #ff0080; --c2: #ff6600; --c3: #ffff00;
  --c4: #00ff88; --c5: #00ffff; --c6: #0088ff; --c7: #aa00ff;
}

body {
  background: #000;
  color: #fff;
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 8px 48px;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

h1 {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(1.2rem, 5vw, 2rem);
  letter-spacing: 0.08em;
  margin-bottom: 20px;
  background: linear-gradient(90deg,
    var(--c1), var(--c2), var(--c3), var(--c4),
    var(--c5), var(--c6), var(--c7), var(--c1));
  background-size: 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* Sound controls */
.sound-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.sound-label {
  color: #444;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  margin-right: 2px;
}

.vol-btn {
  background: transparent;
  border: 1px solid #2a2a2a;
  color: #555;
  font-family: inherit;
  font-size: 0.75rem;
  padding: 4px 10px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.2s;
  border-radius: 3px;
}

.vol-btn:hover {
  border-color: #444;
  color: #888;
}

.vol-btn.active {
  border-color: #00ffff;
  color: #00ffff;
  text-shadow: 0 0 6px #00ffff;
  box-shadow: 0 0 8px #00ffff33;
}

.vol-btn.active.mute {
  border-color: #ff4444;
  color: #ff4444;
  text-shadow: 0 0 6px #ff4444;
  box-shadow: 0 0 8px #ff444433;
}

/* Instruction text (mania) */
.instruction {
  font-size: 0.72rem;
  color: #ff0080;
  text-shadow: 0 0 8px #ff008066;
  letter-spacing: 0.06em;
  margin-top: -8px;
  margin-bottom: 14px;
  min-height: 1.2em;
  text-align: center;
}

/* Difficulty buttons */
.difficulty {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.diff-btn {
  background: transparent;
  border: 2px solid #333;
  color: #666;
  font-family: inherit;
  font-size: 0.78rem;
  padding: 6px 14px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.2s;
  border-radius: 4px;
}

.diff-btn:hover:not(:disabled) {
  border-color: #555;
  color: #aaa;
}

.diff-btn.active {
  border-color: #00ffff;
  color: #00ffff;
  text-shadow: 0 0 8px #00ffff;
  box-shadow: 0 0 10px #00ffff44;
}

.diff-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.diff-btn[data-diff="mania"] {
  border-color: #440020;
  color: #882244;
}

.diff-btn[data-diff="mania"]:hover:not(:disabled) {
  border-color: #882244;
  color: #cc4466;
}

.diff-btn[data-diff="mania"].active {
  border-color: #ff0080;
  color: #ff0080;
  text-shadow: 0 0 8px #ff0080;
  box-shadow: 0 0 10px #ff008044;
}

/* Status bar */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(85vw, 420px);
  margin-bottom: 16px;
  padding: 10px 16px;
  border: 1px solid #1a1a1a;
  border-radius: 6px;
  background: #050505;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 56px;
}

.stat-label {
  color: #444;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

.stat-value {
  color: #fff;
  font-size: 1.1rem;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.phase-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.phase-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  padding: 4px 14px;
  border-radius: 3px;
  transition: color 0.3s, border-color 0.3s, text-shadow 0.3s, box-shadow 0.3s;
  border: 1px solid #333;
  color: #444;
  min-width: 90px;
  text-align: center;
}

.phase-label.watch {
  color: #ffff00;
  border-color: #ffff00;
  text-shadow: 0 0 8px #ffff00;
  box-shadow: 0 0 8px #ffff0033;
}

.phase-label.press {
  color: #00ff88;
  border-color: #00ff88;
  text-shadow: 0 0 8px #00ff88;
  box-shadow: 0 0 8px #00ff8833;
  animation: blink 0.9s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Progress dots */
.progress-dots {
  display: flex;
  gap: 4px;
  min-height: 10px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 120px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid #333;
  background: #111;
  transition: background 0.1s, border-color 0.1s, box-shadow 0.1s;
}

.dot.done {
  background: #00ff88;
  border-color: #00ff88;
  box-shadow: 0 0 6px #00ff88;
}

/* Grid */
.grid {
  display: grid;
  gap: 10px;
  width: min(85vw, 420px);
  aspect-ratio: 1;
  margin-bottom: 20px;
}

.tile {
  background: var(--tile-tint, #090909);
  border: 2px solid;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.08s, box-shadow 0.08s, transform 0.08s, border-color 0.08s;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.06), transparent 65%);
}

.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.45), transparent 55%);
  opacity: 0;
  transition: opacity 0.08s;
}

.tile.lit {
  background: var(--tile-color);
  box-shadow:
    0 0 18px var(--tile-color),
    0 0 36px var(--tile-glow),
    inset 0 0 12px rgba(255,255,255,0.15);
  border-color: var(--tile-color) !important;
  transform: scale(0.94);
}

.tile.lit::after { opacity: 1; }

.tile.wrong {
  background: #ff1a1a !important;
  box-shadow: 0 0 28px #ff1a1a, 0 0 56px #ff1a1a88 !important;
  border-color: #ff1a1a !important;
  transform: scale(0.94);
  animation: shake 0.35s ease;
}

.tile.disabled { cursor: default; pointer-events: none; }

@keyframes shake {
  0%, 100% { transform: scale(0.94) translateX(0); }
  25%       { transform: scale(0.94) translateX(-6px); }
  75%       { transform: scale(0.94) translateX(6px); }
}

/* Start button */
.start-btn {
  background: transparent;
  border: 2px solid #00ffff;
  color: #00ffff;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 44px;
  cursor: pointer;
  letter-spacing: 0.12em;
  border-radius: 4px;
  transition: all 0.2s;
  text-shadow: 0 0 8px #00ffff;
  box-shadow: 0 0 14px #00ffff44;
}

.start-btn:hover {
  background: #00ffff18;
  box-shadow: 0 0 24px #00ffff66;
}

.start-btn:active { transform: scale(0.96); }

/* Abort button */
.abort-btn {
  background: transparent;
  border: 1px solid #555;
  color: #999;
  font-family: inherit;
  font-size: 0.78rem;
  padding: 8px 24px;
  cursor: pointer;
  letter-spacing: 0.08em;
  border-radius: 4px;
  transition: all 0.2s;
  margin-top: 12px;
}

.abort-btn:hover {
  border-color: #ff4444;
  color: #ff4444;
  box-shadow: 0 0 8px #ff444433;
}

.abort-btn:active { transform: scale(0.96); }

/* Game Over overlay */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.overlay.show { display: flex; }

.overlay-box {
  border: 2px solid #ff0080;
  padding: 36px 52px;
  text-align: center;
  box-shadow: 0 0 50px #ff008066, inset 0 0 30px #ff008011;
  background: #060606;
  border-radius: 10px;
}

.over-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  color: #ff0080;
  text-shadow: 0 0 24px #ff0080;
  margin-bottom: 20px;
  letter-spacing: 0.1em;
}

.over-label {
  font-size: 0.7rem;
  color: #555;
  letter-spacing: 0.14em;
  margin-bottom: 4px;
}

.over-score {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 6px;
}

.over-best {
  font-size: 0.78rem;
  min-height: 1.3em;
  margin-bottom: 28px;
  letter-spacing: 0.08em;
}

.over-best.new-record {
  color: #ffff00;
  text-shadow: 0 0 10px #ffff00;
  animation: blink 0.7s ease-in-out 3;
}

.over-best.existing {
  color: #555;
}

/* Share button */
.share-btn {
  background: transparent;
  border: 2px solid #aaa;
  color: #aaa;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 10px 28px;
  cursor: pointer;
  letter-spacing: 0.08em;
  border-radius: 4px;
  transition: all 0.2s;
  margin-bottom: 12px;
}

.share-btn:hover {
  border-color: #fff;
  color: #fff;
  box-shadow: 0 0 12px #ffffff44;
}

.share-btn:active { transform: scale(0.96); }

.over-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Footer */
footer {
  margin-top: auto;
  padding-top: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

footer a {
  color: #555;
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  transition: color 0.2s;
}

footer a:hover {
  color: #aaa;
}

.footer-tags {
  color: #333;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}
