/* ============================================
   Muscle Shooter - MuscleLove
   Dark theme, neon pink/cyan
   ============================================ */

:root {
  --pink: #ff2d78;
  --cyan: #00e5ff;
  --dark: #0a0a14;
  --darker: #06060c;
  --card: #14142a;
  --gold: #ffd700;
  --white: #f0f0f0;
  --bad: #ff3333;
  --green: #00ff88;
}

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

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--dark);
  color: var(--white);
  min-height: 100vh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* SCREENS */
.screen {
  display: none;
  position: fixed;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.screen.active {
  display: flex;
}

/* ========================
   TITLE SCREEN
   ======================== */
.title-container {
  text-align: center;
  padding: 20px;
  max-width: 480px;
  width: 100%;
}

.brand {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  color: var(--cyan);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.game-title {
  margin-bottom: 16px;
}
.title-jp {
  display: block;
  font-size: clamp(28px, 7vw, 42px);
  font-weight: 900;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.title-en {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(16px, 4vw, 22px);
  color: var(--cyan);
  letter-spacing: 3px;
  margin-top: 4px;
}

.subtitle {
  font-size: 14px;
  color: #aaa;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* How to play */
.how-to-play {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 28px;
}
.how-step {
  background: var(--card);
  border: 1px solid #333;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.how-step.bad {
  border-color: var(--bad);
  color: var(--bad);
}
.step-icon { font-size: 18px; }
.bad-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  background: var(--bad);
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
  margin-left: 4px;
}

/* Buttons */
.btn-main {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(135deg, var(--pink), #ff6b9d);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 16px 60px;
  font-family: 'Orbitron', sans-serif;
  font-size: 24px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 30px rgba(255, 45, 120, 0.4);
  margin-bottom: 16px;
}
.btn-main:hover {
  transform: scale(1.05);
  box-shadow: 0 0 50px rgba(255, 45, 120, 0.6);
}
.btn-main:active { transform: scale(0.97); }
.btn-sub {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 11px;
  font-weight: 400;
  opacity: 0.8;
  margin-top: 2px;
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 30px rgba(255, 45, 120, 0.4); }
  50% { box-shadow: 0 0 50px rgba(255, 45, 120, 0.7); }
}

.patreon-link {
  display: inline-block;
  color: var(--pink);
  text-decoration: none;
  font-size: 13px;
  margin-top: 8px;
  transition: opacity 0.2s;
}
.patreon-link:hover { opacity: 0.7; }

/* ========================
   GAME SCREEN
   ======================== */
.game-hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  padding: 10px 16px;
  background: rgba(10, 10, 20, 0.9);
  border-bottom: 2px solid var(--pink);
  z-index: 20;
}
.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hud-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  color: var(--cyan);
  letter-spacing: 2px;
}
.hud-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 24px;
  font-weight: 900;
  color: var(--white);
}
#hud-time.warning { color: var(--bad); animation: timePulse 0.5s ease-in-out infinite; }
@keyframes timePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
#hud-combo.active {
  color: var(--gold);
  text-shadow: 0 0 10px var(--gold);
}

/* Background image */
.game-bg {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.15;
  transition: background-image 0.5s ease;
  z-index: 0;
}

/* Grid */
.grid-container {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 10px;
  width: min(90vw, 360px);
  height: min(80vh, 520px);
  margin-top: 60px;
  padding: 10px;
  z-index: 5;
}

.slot {
  position: relative;
  background: var(--card);
  border: 2px solid #222;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
}
.slot::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 4px;
  background: #1a1a2e;
  border-radius: 50%;
}

/* Target (emoji inside slot) */
.target {
  font-size: clamp(32px, 8vw, 48px);
  opacity: 0;
  transform: translateY(100%) scale(0.3);
  transition: none;
  pointer-events: none;
}
.target.pop-in {
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  pointer-events: auto;
}
.target.pop-out {
  animation: popOut 0.2s ease-in forwards;
  pointer-events: none;
}
.target.hit-effect {
  animation: hitBurst 0.3s ease-out forwards;
  pointer-events: none;
}

@keyframes popIn {
  0% { opacity: 0; transform: translateY(80%) scale(0.3); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes popOut {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(80%) scale(0.3); }
}
@keyframes hitBurst {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.5); }
  100% { opacity: 0; transform: scale(0.2); }
}

/* Slot flash on hit */
.slot.flash-good {
  animation: flashGood 0.3s ease-out;
}
.slot.flash-bad {
  animation: flashBad 0.3s ease-out;
}
.slot.flash-miss {
  animation: flashMiss 0.3s ease-out;
}
@keyframes flashGood {
  0% { border-color: var(--green); box-shadow: inset 0 0 30px rgba(0, 255, 136, 0.4); }
  100% { border-color: #222; box-shadow: none; }
}
@keyframes flashBad {
  0% { border-color: var(--bad); box-shadow: inset 0 0 30px rgba(255, 51, 51, 0.4); }
  100% { border-color: #222; box-shadow: none; }
}
@keyframes flashMiss {
  0% { border-color: #666; box-shadow: inset 0 0 20px rgba(100, 100, 100, 0.3); }
  100% { border-color: #222; box-shadow: none; }
}

/* Score popups */
#score-popups {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}
.score-popup {
  position: absolute;
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 900;
  animation: floatUp 0.8s ease-out forwards;
  text-shadow: 0 0 10px currentColor;
}
.score-popup.good { color: var(--green); }
.score-popup.great { color: var(--cyan); }
.score-popup.perfect { color: var(--gold); }
.score-popup.bad { color: var(--bad); }
.score-popup.combo {
  font-size: 16px;
  color: var(--gold);
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-60px) scale(1.3); }
}

/* ========================
   RESULT SCREEN
   ======================== */
.result-container {
  text-align: center;
  padding: 20px;
  max-width: 480px;
  width: 100%;
  max-height: 100vh;
  overflow-y: auto;
}

.result-title {
  margin: 12px 0 16px;
}
.result-jp {
  display: block;
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.result-en {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  color: var(--cyan);
  letter-spacing: 3px;
}

.result-img-wrap {
  width: 180px;
  height: 180px;
  margin: 0 auto 20px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--pink);
  box-shadow: 0 0 30px rgba(255, 45, 120, 0.4);
}
.result-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-stats {
  background: var(--card);
  border: 1px solid #333;
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #222;
}
.stat-row:last-child { border-bottom: none; }
.stat-label {
  font-size: 13px;
  color: #aaa;
}
.stat-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--cyan);
}
.stat-value.rank {
  font-size: 28px;
  background: linear-gradient(135deg, var(--gold), #ffaa00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #000;
  color: #fff;
  border: 2px solid #333;
  border-radius: 50px;
  padding: 12px 32px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s;
}
.btn-share:hover { border-color: var(--cyan); }

.patreon-btn-big {
  display: inline-block;
  background: linear-gradient(135deg, #ff424d, #ff2d78);
  color: #fff;
  text-decoration: none;
  border-radius: 50px;
  padding: 14px 36px;
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 20px rgba(255, 45, 120, 0.3);
}
.patreon-btn-big:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(255, 45, 120, 0.5);
}

/* ========================
   RESPONSIVE
   ======================== */
@media (max-height: 680px) {
  .grid-container {
    height: min(75vh, 440px);
    margin-top: 55px;
    gap: 6px;
  }
  .target { font-size: clamp(28px, 7vw, 40px); }
  .hud-value { font-size: 20px; }
}

@media (min-width: 600px) {
  .grid-container {
    width: 400px;
    height: 540px;
  }
}
