:root {
  --ui-scale: 1;
}

html, body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: black;
  color: white;
  font-family: 'Roboto', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#game-canvas canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

#ui-stage {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 1920px;
  height: 1080px;
  transform: translate(-50%, -50%) scale(var(--ui-scale));
  transform-origin: center center;
  pointer-events: none;
  z-index: 20;
}

.game-display,
.game-details,
.game-progress,
.game-control-panel,
.game-start,
.instructions,
.look-around-instructions,
#youtube-container {
  pointer-events: none;
}

.game-control-panel button,
.instructions *,
.game-progress input,
.close-instructions h1 {
  pointer-events: auto;
}

.game-details {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  color: white;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.game-details-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  min-width: 320px;
  width: max-content;
  height: auto;
  min-height: 160px;
  padding: 20px 30px;
  border-radius: 16px;
  background: rgba(10, 10, 10, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.game-details-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-width: 320px;
  width: max-content;
  height: auto;
  min-height: 160px;
  padding: 20px 30px;
  border-radius: 16px;
  background: rgba(10, 10, 10, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.score, .streak, .multiplier, .max-streak {
  font-family: 'Bangers', cursive;
  font-size: clamp(40px, 4vw, 58px);
  letter-spacing: 2px;
  line-height: 1.2;
  margin: 0;
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.score, .max-streak {
  color: #00e7ff;
}

.multiplier, .streak {
  color: #ff2020;
}

.game-progress  {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-radius: 16px;
  color: white;
  background: rgba(10, 10, 10, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#rock-meter-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 10px;
}

#rock-meter {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: conic-gradient(#ff0000 50%, #1a1a1a 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  border: 4px solid #333;
}

#rock-meter::before {
  content: '';
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.8);
  position: absolute;
}

#rock-power-timer-container {
  width: 110px;
  height: 8px;
  background: #1a1a1a;
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

#rock-power-timer {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00ffff, #00ff00);
  border-radius: 3px;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px #00ffff;
}

#rock-label {
  margin-top: 12px;
  font-family: 'Bangers', cursive;
  font-size: 38px;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 2px;
  line-height: 1;
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
}

#rock-power-text {
  position: absolute;
  top: -44px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 24px;
  font-weight: bold;
  color: #00ffff;
  text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
  animation: pulse-rock-power 0.5s ease-in-out infinite;
  white-space: nowrap;
}

#space-hint {
  position: absolute;
  top: -90px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  font-weight: bold;
  color: #00ffff;
  text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
  animation: blink 0.5s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes pulse-rock-power {
  0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.7; transform: translateX(-50%) scale(1.05); }
}

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

@keyframes pulse-ready {
  0%, 100% { box-shadow: 0 0 10px #00ffff; }
  50% { box-shadow: 0 0 25px #00ffff, 0 0 35px #00ffff; }
}

.pulse-ready {
  animation: pulse-ready 0.8s ease-in-out infinite;
}

.rock-input {
  background: transparent;
}

.rock-input::-webkit-slider-runnable-track {
  background: white;
}

.red .rock-input::-webkit-slider-runnable-track {
  background: red;
}

.green .rock-input::-webkit-slider-runnable-track {
  background: green;
}

.yellow .rock-input::-webkit-slider-runnable-track {
  background: yellow;
}

#song {
  display: none;
}

.game-control-panel {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-radius: 16px;
  background: rgba(10, 10, 10, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.game-control-panel button {
  width: 200px;
  height: 48px;
  font-family: 'Bangers', cursive;
  font-size: 24px;
  letter-spacing: 1.5px;
  border-radius: 8px;
  margin-bottom: 10px;
  border: 1px solid #444;
  background: #111;
  color: #ddd;
  cursor: pointer;
  transition: all 0.2s;
}

.game-control-panel button:hover {
  background: #1e1e1e;
  border-color: #00e7ff;
  color: #00e7ff;
  transform: translateX(5px);
}

.game-control-panel button:last-child {
  margin-bottom: 0;
}

.game-start {
  position: absolute;
  top: 320px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  text-shadow: 3px 3px black;
  letter-spacing: 1.5px;
  z-index: 20;
  text-align: center;
  width: 100%;
}

.game-start h1 {
  font-size: 58px;
  margin: 0;
}

.game-start h1.countdown-mode {
  font-size: 160px;
  line-height: 1;
  letter-spacing: 4px;
  text-shadow: 0 0 12px rgba(255,255,255,0.35), 4px 4px 0 #000;
}

.look-around-instructions {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  text-shadow: 3px 3px black;
  letter-spacing: 1.5px;
  z-index: 20;
  text-align: center;
}

.instructions {
  position: absolute;
  background: rgba(0, 0, 0, .90);
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-family: 'Roboto', sans-serif;
}

.close-instructions {
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.close-instructions h1:hover {
  cursor: pointer;
}

.close-instructions h1 {
  font-size: 58px;
  font-weight: 700;
  margin-bottom: 10px;
}

.close-instructions h2 {
  font-size: 28px;
  font-weight: 400;
  margin: 0;
}

.instructions-text {
  color: white;
  font-size: 24px;
  width: 560px;
  text-align: justify;
}

.instructions-text li {
  margin-bottom: 5px;
}

.instructions .letters {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  list-style: none;
  font-size: 32px;
  font-weight: 700;
  width: 500px;
  color: black;
}

.instructions .letters li {
  border-radius: 50px;
  width: 58px;
  height: 58px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.instructions .green { background: green; }
.instructions .red { background: red; }
.instructions .yellow { background: yellow; }
.instructions .blue { background: blue; }
.instructions .orange { background: orange; }

#youtube-player {
  max-width: 100%;
  max-height: 100%;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
}

#youtube-container {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0px 4px 15px rgba(0,0,0,0.8);
  border: 4px solid rgba(139, 0, 0, 0.4);
  pointer-events: none;
  width: 620px;
}

.hidden { display: none; }

/* Mobile Orientation Overlay */
@media (orientation: portrait) {
  .is-mobile #mobile-orientation-overlay {
    display: flex;
  }
}

#mobile-orientation-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #0a0a0a;
  z-index: 99999;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: white;
  padding: 40px;
}

#mobile-orientation-overlay h1 {
  font-size: 3.5rem;
  margin-bottom: 20px;
  color: #ff0000;
  text-shadow: 0 0 10px rgba(255,0,0,0.5);
}

#mobile-orientation-overlay p {
  font-size: 1.8rem;
  color: #ccc;
}

.rotate-icon {
  width: 120px;
  height: 120px;
  margin-bottom: 30px;
  animation: rotateDevice 2s ease-in-out infinite;
}

@keyframes rotateDevice {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(-90deg); }
  100% { transform: rotate(-90deg); }
}

