:root {
  --cyber-red: #ff3b30;
  --cyber-red-glow: rgba(255, 59, 48, 0.6);
  --cyber-cyan: #00f0ff;
  --cyber-cyan-glow: rgba(0, 240, 255, 0.6);
  --cyber-yellow: #fcee0a;
  --cyber-yellow-glow: rgba(252, 238, 10, 0.6);
  --cyber-orange: #ff7c43;
  --bg-dark: #070305;
  --bg-grid: rgba(255, 59, 48, 0.015);
  --font-hud: 'Rajdhani', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
  --font-sci: 'Orbitron', sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: #fff;
  font-family: var(--font-hud);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* CRT Scanlines and Screen Noise */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.04),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.04)
  );
  background-size: 100% 4px, 6px 100%;
  z-index: 100;
  pointer-events: none;
  opacity: 0.8;
}

.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.035'/%3E%3C/svg%3E");
  z-index: 99;
  pointer-events: none;
}

/* Main Container with red ambient glow */
.hud-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1200px;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* Deep crimson ambient radial glow matching the image */
  background: radial-gradient(circle at center, rgba(139, 0, 20, 0.22) 0%, rgba(20, 4, 10, 0.85) 60%, rgba(7, 3, 5, 1) 100%);
  border: 1px solid rgba(255, 59, 48, 0.08);
  box-shadow: inset 0 0 100px rgba(255, 59, 48, 0.05);
  overflow: hidden;
}

/* Background HUD lines and decoration */
.hud-background-elements {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.grid-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: 50px 50px;
  background-image: 
    linear-gradient(to right, var(--bg-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--bg-grid) 1px, transparent 1px);
  mask-image: radial-gradient(circle, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle, black 30%, transparent 80%);
  opacity: 0.6;
}

/* Faint labels in background */
.faint-hud-text {
  position: absolute;
  font-family: var(--font-sci);
  font-weight: 900;
  font-size: 4rem;
  color: rgba(255, 59, 48, 0.02);
  letter-spacing: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  text-shadow: 0 0 15px rgba(255, 59, 48, 0.01);
}

.left-text {
  left: 5%;
}

.right-text {
  right: -5%;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

/* Tech panel boxes and brackets */
.tech-box {
  position: absolute;
  border: 1px solid rgba(255, 59, 48, 0.1);
  width: 120px;
  height: 250px;
  top: 50%;
  transform: translateY(-50%);
}

.left-bracket {
  left: 8%;
  border-right: none;
}

.left-bracket::after {
  content: '';
  position: absolute;
  right: 0;
  top: 20px;
  width: 10px;
  height: 1px;
  background: rgba(255, 59, 48, 0.2);
}

.right-bracket {
  right: 8%;
  border-left: none;
}

.right-bracket::after {
  content: '';
  position: absolute;
  left: 0;
  top: 20px;
  width: 10px;
  height: 1px;
  background: rgba(255, 59, 48, 0.2);
}

/* Corner ticks */
.tech-corner {
  position: absolute;
  width: 25px;
  height: 25px;
  border: 2px solid rgba(255, 59, 48, 0.15);
}

.top-left { top: 40px; left: 40px; border-right: none; border-bottom: none; }
.top-right { top: 40px; right: 40px; border-left: none; border-bottom: none; }
.bottom-left { bottom: 40px; left: 40px; border-right: none; border-top: none; }
.bottom-right { bottom: 40px; right: 40px; border-left: none; border-top: none; }

.decor-hud-svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 85%;
  height: 85%;
}

/* Active Glitch Flash Layer */
.glitch-screen-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 240, 255, 0.15);
  opacity: 0;
  z-index: 15;
  pointer-events: none;
  transition: opacity 0.05s ease;
}

/* Center Widget Container */
.time-skip-hud-wrapper {
  position: relative;
  width: 480px;
  height: 480px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5;
}

.dial-widget {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Outer wheel ring */
.dial-ring-outer {
  position: absolute;
  width: 84%;
  height: 84%;
  border-radius: 50%;
  border: 1px dashed rgba(255, 59, 48, 0.2);
  box-shadow: 0 0 25px rgba(255, 59, 48, 0.05);
  pointer-events: none;
}

.dial-ring-outer::before {
  content: '';
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 59, 48, 0.05);
}

/* SVG Tracks overlay */
.dial-svg-track {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

/* Ring decorations in SVG */
.svg-ring-dashed-1 {
  fill: none;
  stroke: rgba(255, 59, 48, 0.18);
  stroke-width: 5;
  stroke-dasharray: 2 12;
}

.svg-ring-dashed-2 {
  fill: none;
  stroke: rgba(255, 59, 48, 0.25);
  stroke-width: 8;
  stroke-dasharray: 10 4;
}

/* Dynamic Glowing Cyan Active Track Segment */
.svg-active-arc {
  fill: none;
  stroke: var(--cyber-cyan);
  stroke-width: 8;
  filter: url(#cyan-glow);
  stroke-linecap: round;
  opacity: 0.85;
}

/* Slider handles */
.slider-handle {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-dark);
  border: 3.5px solid #1a0f14;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  cursor: grab;
  /* Shift to align center of handle with center coordinates */
  transform: translate(-50%, -50%);
  transition: box-shadow 0.2s ease, transform 0.08s linear;
}

.slider-handle:active {
  cursor: grabbing;
}

.handle-core {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.target-handle {
  box-shadow: 0 0 15px var(--cyber-cyan-glow);
}

.target-handle .handle-core {
  background: var(--cyber-cyan);
  box-shadow: 0 0 10px var(--cyber-cyan);
}

.start-handle {
  box-shadow: 0 0 12px var(--cyber-red-glow);
  pointer-events: none; /* Starting handle stays locked during a single skipping skip */
}

.start-handle .handle-core {
  background: var(--cyber-red);
  box-shadow: 0 0 8px var(--cyber-red);
}

/* Glowing filters */
.cyan-glow {
  filter: drop-shadow(0 0 4px var(--cyber-cyan));
}

.red-glow {
  filter: drop-shadow(0 0 4px var(--cyber-red));
}

/* Inner Dial Panel (Dark Core) */
.dial-ring-inner {
  position: absolute;
  width: 62%;
  height: 62%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 8, 12, 0.98) 0%, rgba(7, 3, 5, 1) 100%);
  border: 2px solid rgba(255, 59, 48, 0.4);
  box-shadow: 
    inset 0 0 25px rgba(255, 59, 48, 0.25),
    0 0 40px rgba(0, 0, 0, 0.8);
  z-index: 4;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

/* Central text readouts */
.dial-core-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.wait-duration {
  font-family: var(--font-sci);
  color: var(--cyber-red);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.1rem;
  margin-bottom: 0.4rem;
  text-shadow: 0 0 12px rgba(255, 59, 48, 0.7);
  text-transform: uppercase;
}

.time-readout {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: 0.05rem;
}

.time-start {
  color: var(--cyber-red);
  text-shadow: 0 0 10px rgba(255, 59, 48, 0.4);
}

.time-arrow {
  color: var(--cyber-red);
  font-size: 1.1rem;
  opacity: 0.8;
  margin: 0 0.1rem;
}

.time-target {
  color: var(--cyber-cyan);
  text-shadow: 0 0 12px var(--cyber-cyan-glow);
}

/* Cardinal Hotspots (Sunrise, Sun, Sunset, Moon) */
.cardinal-hotspot {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background-color: rgba(7, 3, 5, 0.95);
  border: 1.5px solid rgba(255, 59, 48, 0.35);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 8;
  transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.cardinal-hotspot:hover {
  transform: scale(1.15);
  border-color: var(--cyber-cyan);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.3);
}

.cardinal-hotspot:active {
  transform: scale(0.95);
}

/* Active hotspot indicators */
.cardinal-hotspot.active {
  border-color: var(--cyber-cyan);
  background-color: rgba(0, 240, 255, 0.06);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.hotspot-border {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 1px solid rgba(255, 59, 48, 0.08);
  pointer-events: none;
  transition: all 0.25s ease;
}

.cardinal-hotspot:hover .hotspot-border {
  border-color: rgba(0, 240, 255, 0.25);
  transform: scale(1.05);
}

.hotspot-icon-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.svg-icon {
  width: 24px;
  height: 24px;
  transition: filter 0.25s ease;
}

/* Specific alignments on 480x480 circle */
/* Radial offset is 200px (41.6% from center) */
.hotspot-top {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}
.hotspot-top:hover {
  transform: translateX(-50%) scale(1.15);
}
.hotspot-top:active {
  transform: translateX(-50%) scale(0.95);
}

.hotspot-right {
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}
.hotspot-right:hover {
  transform: translateY(-50%) scale(1.15);
}
.hotspot-right:active {
  transform: translateY(-50%) scale(0.95);
}

.hotspot-bottom {
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
}
.hotspot-bottom:hover {
  transform: translateX(-50%) scale(1.15);
}
.hotspot-bottom:active {
  transform: translateX(-50%) scale(0.95);
}

.hotspot-left {
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
}
.hotspot-left:hover {
  transform: translateY(-50%) scale(1.15);
}
.hotspot-left:active {
  transform: translateY(-50%) scale(0.95);
}

/* Icon glowing tints */
.yellow-accent svg { filter: drop-shadow(0 0 3px rgba(252, 238, 10, 0.4)); }
.orange-accent svg { filter: drop-shadow(0 0 3px rgba(255, 124, 67, 0.4)); }
.teal-accent svg { filter: drop-shadow(0 0 3px rgba(0, 240, 255, 0.4)); }
.blue-accent svg { filter: drop-shadow(0 0 3px rgba(0, 240, 255, 0.4)); }

/* PlayStation Action Buttons Container */
.action-buttons-container {
  display: flex;
  justify-content: center;
  gap: 3.5rem;
  margin-top: 2rem;
  z-index: 5;
}

/* PS buttons styling */
.hud-action-btn {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  cursor: pointer;
  padding: 8px 24px;
  position: relative;
  font-family: var(--font-hud);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.15rem;
  color: #fff;
  transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
  outline: none;
}

/* Slanted visual tech look */
.hud-action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(7, 3, 5, 0.85);
  border: 1px solid rgba(255, 59, 48, 0.25);
  transform: skewX(-15deg);
  z-index: -1;
  transition: all 0.25s ease;
}

.hud-action-btn:hover::before {
  border-color: var(--cyber-cyan);
  background: rgba(0, 240, 255, 0.08);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.hud-action-btn:hover {
  color: var(--cyber-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
  transform: translateY(-2px);
}

.hud-action-btn:active {
  transform: translateY(1px);
}

/* Button PlayStation Icons */
.btn-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: rgba(7, 3, 5, 0.95);
  border: 1.5px solid rgba(0, 240, 255, 0.35);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 5px rgba(0, 240, 255, 0.1);
  transform: skewX(-15deg); /* counteract button skew */
  transition: all 0.25s ease;
}

.hud-action-btn:hover .btn-icon {
  border-color: var(--cyber-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.ps-x-svg, .ps-o-svg, .ps-triangle-svg {
  transform: skewX(15deg); /* correct inner svg rotation */
}

/* Audio activation hint */
.audio-hint {
  position: absolute;
  bottom: 25px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: rgba(255, 59, 48, 0.35);
  letter-spacing: 0.1rem;
  cursor: pointer;
  transition: color 0.2s ease;
  z-index: 5;
  border-bottom: 1px dotted rgba(255, 59, 48, 0.2);
  padding-bottom: 2px;
}

.audio-hint:hover {
  color: var(--cyber-cyan);
}

/* ==========================================================================
   ANIMATIONS & SKIPPING STATES
   ========================================================================== */

/* Glitch animation during skipping */
.hud-container.hud-skipping {
  animation: hudGlitch 0.2s infinite;
}

.hud-container.hud-skipping .dial-ring-inner {
  animation: coreGlitch 0.15s infinite;
}

.hud-skipping .svg-active-arc {
  animation: arcGlitch 0.3s infinite;
}

/* Rapid spin classes for skipping skip */
.hud-skipping .target-handle {
  transition: none !important;
}

@keyframes hudGlitch {
  0% { border-color: rgba(255, 59, 48, 0.08); }
  50% { border-color: rgba(0, 240, 255, 0.3); }
  100% { border-color: rgba(255, 59, 48, 0.08); }
}

@keyframes coreGlitch {
  0% { border-color: rgba(255, 59, 48, 0.4); box-shadow: inset 0 0 25px rgba(255, 59, 48, 0.25); }
  50% { border-color: var(--cyber-cyan); box-shadow: inset 0 0 35px rgba(0, 240, 255, 0.35); }
  100% { border-color: rgba(255, 59, 48, 0.4); box-shadow: inset 0 0 25px rgba(255, 59, 48, 0.25); }
}

@keyframes arcGlitch {
  0% { stroke-width: 8; opacity: 0.85; }
  50% { stroke-width: 12; opacity: 1; filter: drop-shadow(0 0 8px var(--cyber-cyan)); }
  100% { stroke-width: 8; opacity: 0.85; }
}

/* Pulse highlight for targeted buttons */
@keyframes buttonPulse {
  0% { box-shadow: 0 0 5px rgba(0, 240, 255, 0.2); }
  50% { box-shadow: 0 0 20px rgba(0, 240, 255, 0.6); }
  100% { box-shadow: 0 0 5px rgba(0, 240, 255, 0.2); }
}

.hud-skipping .btn-confirm::before {
  animation: buttonPulse 0.4s infinite;
  background: rgba(0, 240, 255, 0.15) !important;
  border-color: var(--cyber-cyan) !important;
}

/* ==========================================================================
   HIGH-FIDELITY RESPONSIVE TIERING & ADAPTATIONS
   ========================================================================== */

/* 1. Tablet Viewports & Low Height Desktop (e.g. iPad, smaller laptops) */
@media (max-width: 1024px), (max-height: 800px) {
  .left-bracket, .right-bracket, .left-text, .right-text {
    display: none !important;
  }
  .tech-corner {
    width: 18px;
    height: 18px;
  }
  .top-left { top: 20px; left: 20px; }
  .top-right { top: 20px; right: 20px; }
  .bottom-left { bottom: 20px; left: 20px; }
  .bottom-right { bottom: 20px; right: 20px; }
  
  .time-skip-hud-wrapper {
    width: 400px;
    height: 400px;
  }
  .action-buttons-container {
    gap: 2rem;
    margin-top: 1.5rem;
  }
}

/* 2. Mobile Portrait Viewports (Smartphones, e.g. iPhone, Pixel) */
@media (max-width: 768px) {
  .tech-corner, .decor-hud-svg {
    display: none !important;
  }
  .hud-container {
    padding: 15px;
    border: none;
    box-shadow: none;
  }
  .time-skip-hud-wrapper {
    width: 90vw;
    height: 90vw;
    max-width: 320px;
    max-height: 320px;
    margin: 1rem 0;
  }
  .dial-ring-outer {
    width: 82%;
    height: 82%;
  }
  .dial-ring-inner {
    width: 60%;
    height: 60%;
  }
  .slider-handle {
    width: 28px;
    height: 28px;
  }
  .cardinal-hotspot {
    width: 38px;
    height: 38px;
  }
  .wait-duration {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
  }
  .time-readout {
    font-size: 1.05rem;
  }
  .action-buttons-container {
    flex-direction: row;
    gap: 0.8rem;
    width: 100%;
    padding: 0 10px;
    margin-top: 1.5rem;
  }
  .hud-action-btn {
    flex: 1;
    padding: 6px 10px;
    font-size: 0.85rem;
    letter-spacing: 0.08rem;
    justify-content: center;
    gap: 0.4rem;
  }
  .btn-icon {
    width: 20px;
    height: 20px;
  }
  .audio-hint {
    bottom: 12px;
    font-size: 0.65rem;
    text-align: center;
    width: calc(100% - 30px);
  }
}

/* 3. Landscape Mobile Viewports (Low Heights, e.g. rotated smartphones) */
@media (max-height: 500px) and (orientation: landscape) {
  .hud-container {
    flex-direction: row !important;
    justify-content: space-evenly !important;
    align-items: center !important;
    padding: 10px 20px !important;
  }
  .time-skip-hud-wrapper {
    width: 58vh !important;
    height: 58vh !important;
    max-width: 240px !important;
    max-height: 240px !important;
    margin: 0 !important;
  }
  .action-buttons-container {
    flex-direction: column !important;
    justify-content: center !important;
    gap: 0.6rem !important;
    margin-top: 0 !important;
    width: auto !important;
  }
  .hud-action-btn {
    width: 160px !important;
    flex: none !important;
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
    letter-spacing: 0.08rem !important;
  }
  .slider-handle {
    width: 22px !important;
    height: 22px !important;
  }
  .cardinal-hotspot {
    width: 30px !important;
    height: 30px !important;
  }
  .hotspot-top { top: 4px !important; }
  .hotspot-right { right: 4px !important; }
  .hotspot-bottom { bottom: 4px !important; }
  .hotspot-left { left: 4px !important; }
  
  .wait-duration {
    font-size: 0.95rem !important;
    margin-bottom: 0.1rem !important;
  }
  .time-readout {
    font-size: 0.85rem !important;
  }
  .audio-hint {
    display: none !important; /* Hide hint on low landscape screens to save precious space */
  }
}
