/* Paradox Core: 悖论核心 Stylesheet */
:root {
  --bg-dark: #060913;
  --bg-card: rgba(15, 23, 42, 0.78);
  --border-neon: rgba(0, 243, 255, 0.35);
  --cyan-glow: #00f3ff;
  --magenta-glow: #ff0055;
  --gold-glow: #fbbf24;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif;
  color: var(--text-main);
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* CRT Scanline & Rewind Filter Overlay */
#rewind-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.1s ease;
  mix-blend-mode: screen;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 0, 85, 0.15) 0px,
    rgba(255, 0, 85, 0.15) 2px,
    transparent 2px,
    transparent 4px
  );
}

#rewind-overlay.active {
  opacity: 1;
  animation: rewindGlitch 0.2s infinite;
}

@keyframes rewindGlitch {
  0% { transform: translateY(0); filter: hue-rotate(0deg); }
  50% { transform: translateY(-2px); filter: hue-rotate(90deg) contrast(1.4); }
  100% { transform: translateY(1px); filter: hue-rotate(0deg); }
}

/* --- HUD Overlay --- */
#hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 14px) 16px env(safe-area-inset-bottom, 16px) 16px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.hud-panel {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-neon);
  border-radius: 14px;
  padding: 8px 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 243, 255, 0.15);
  pointer-events: auto;
}

.epoch-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--cyan-glow);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.epoch-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.score-panel {
  text-align: right;
}

.score-num {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-main);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

.combo-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--magenta-glow);
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 0, 85, 0.15);
  border: 1px solid rgba(255, 0, 85, 0.4);
}

/* Time Rewind Gauge */
.gauge-container {
  position: absolute;
  top: 76px;
  left: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.gauge-bar-outer {
  width: 100%;
  max-width: 380px;
  height: 8px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(0, 243, 255, 0.4);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

.gauge-bar-inner {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--cyan-glow), var(--magenta-glow));
  border-radius: 999px;
  transition: width 0.05s linear;
}

.gauge-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--cyan-glow);
  letter-spacing: 1.5px;
  text-shadow: 0 0 6px rgba(0, 243, 255, 0.6);
}

/* Floating Utility Buttons */
.utility-btns {
  position: absolute;
  top: 108px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
  z-index: 15;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-neon);
  color: var(--text-main);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.btn-icon:active {
  transform: scale(0.92);
}

/* Bottom Controls */
.bottom-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  margin-bottom: 8px;
}

.btn-rewind {
  width: min(280px, 80vw);
  padding: 14px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 0, 85, 0.25), rgba(0, 243, 255, 0.25));
  border: 1.5px solid var(--magenta-glow);
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 2px;
  box-shadow: 0 0 20px rgba(255, 0, 85, 0.4), inset 0 0 10px rgba(255, 0, 85, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  backdrop-filter: blur(10px);
}

.btn-rewind.rewinding, .btn-rewind:active {
  background: linear-gradient(135deg, var(--magenta-glow), #990033);
  box-shadow: 0 0 35px rgba(255, 0, 85, 0.8), inset 0 0 20px #ffffff;
  transform: scale(0.96);
}

.controls-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* --- Modals --- */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 7, 18, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: auto;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-box {
  width: min(440px, 92vw);
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid var(--border-neon);
  border-radius: 20px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(0, 243, 255, 0.2);
  animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.92) translateY(16px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cyan-glow);
  margin-bottom: 6px;
}

.modal-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--text-main);
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-item {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(0, 243, 255, 0.2);
  border-radius: 12px;
  padding: 8px;
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-val {
  font-size: 18px;
  font-weight: 900;
  color: var(--cyan-glow);
  margin-top: 2px;
}

.btn-primary {
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, var(--cyan-glow), #00a8ff);
  border: none;
  border-radius: 14px;
  color: #060913;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
  transition: all 0.2s ease;
}

.btn-primary:active {
  transform: scale(0.97);
  filter: brightness(1.15);
}

.btn-secondary {
  width: 100%;
  padding: 11px 20px;
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 14px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
}

.btn-secondary:active {
  background: rgba(255, 255, 255, 0.05);
}

.keys-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 12px;
}
