/* ============================================================
   GLOBAL & LAYOUT
   ============================================================ */
body {
  background: #bababa;
  margin: 0;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Prevent scrolling and accidental zooming on mobile */
  overflow: hidden;
  touch-action: none; 
}

/* Perspective Container */
.device-wrapper {
  perspective: 1000px;
}

/* Main Device Container */
.device {
  position: relative;
  width: 360px;
  height: 560px;
  transform-style: preserve-3d;
  will-change: transform;
}

/* All PNG Layers */
.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  pointer-events: none;
  backface-visibility: hidden;
}

/* Depth Stack (Z-axis) */
.shell      { transform: translateZ(0); }
.embossed   { transform: translateZ(6px); }
.buttons    { transform: translateZ(10px); }
.logo       { transform: translateZ(14px); }
.screen-art { transform: translateZ(22px); }
.rps        { transform: translateZ(15px); }
.light      { transform: translateZ(30px); opacity: 1; }

/* ============================================================
   LCD SCREEN & TEXT
   ============================================================ */
.screen {
  position: absolute;
  top: 140px;
  left: 100px;
  width: 160px;
  height: 120px;
  border-radius: 10px;
  
  /* FIX: overflow hidden prevents "ghost" text from previous rounds showing */
  overflow: hidden; 
  
  transform: translateZ(18px);
  background: rgba(143, 164, 122, 0); 
  transition: filter 0.15s ease, opacity 0.3s ease;
  
  --shine-x: 50%;
  --shine-y: 50%;
  --shine-opacity: .2;
}

/* Glass glare overlay */
.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(255,255,255,0.18), rgba(255,255,255,0.06) 40%, transparent 65%),
    linear-gradient(to bottom, rgba(255,255,255,0.10), rgba(255,255,255,0.02) 40%, rgba(0,0,0,0.10));
  opacity: 0.7;
}

.screen-text {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 80%;
  
  /* FIX: Flexbox ensures dots and text are centered and don't overlap lines */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  
  text-align: center;
  font-family: monospace;
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 2px;
  color: #121e12;
  text-shadow: 1px 47 rgba(0,0,0,0.15);
  
  /* Prevents text from sticking to old positions */
  white-space: pre-wrap;
}

/* ============================================================
   INTERACTIVE BUTTONS (Hit-Areas)
   ============================================================ */
button {
  position: absolute;
  background: transparent;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  z-index: 100;
  transform: translateZ(40px);
}

/* Rock Button */
.btn-rock {
  width: 44px;
  height: 42px;
  top: 358px;
  left: 75px;
}

/* Paper Button */
.btn-paper {
  width: 44px;
  height: 42px;
  top: 394px;
  left: 159px;
}

/* Scissors Button */
.btn-scissors {
  width: 44px;
  height: 42px;
  top: 357px;
  left: 244px;
}

/* Start Button */
.btn-start {
  width: 60px;
  height: 45px;
  top: 290px;
  left: 110px;
}

/* Reset Button */
.btn-reset {
  width: 60px;
  height: 45px;
  top: 290px;
  left: 190px;
}

/* Visual Feedback */
button:active {
  filter: brightness(1.4);
}

/* ============================================================
   MOBILE RESPONSIVENESS
   ============================================================ */

/* Scale device down for narrow screens (iPhone SE, etc) */
@media (max-width: 380px) {
  .device-wrapper {
    transform: scale(0.85);
  }
}

/* Scale device down for short screens */
@media (max-height: 600px) {
  .device-wrapper {
    transform: scale(0.75);
  }
}