/* 3 Lights 게임 스타일시트 */

:root {
  --bg-dark: #070913;
  --card-bg: rgba(22, 28, 45, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  
  /* 네온 색상 코드 */
  --neon-red: #ff2a5f;
  --neon-green: #05ffc5;
  --neon-blue: #00d2ff;
  --neon-yellow: #ffe600;
  --neon-cyan: #00ffff;
  --neon-magenta: #f600ff;
  --neon-white: #ffffff;

  /* 네온 그림자 정의 */
  --glow-red: 0 0 10px rgba(255, 42, 95, 0.6), 0 0 20px rgba(255, 42, 95, 0.3);
  --glow-green: 0 0 10px rgba(5, 255, 197, 0.6), 0 0 20px rgba(5, 255, 197, 0.3);
  --glow-blue: 0 0 10px rgba(0, 210, 255, 0.6), 0 0 20px rgba(0, 210, 255, 0.3);
  --glow-yellow: 0 0 10px rgba(255, 230, 0, 0.6), 0 0 20px rgba(255, 230, 0, 0.3);
  --glow-cyan: 0 0 10px rgba(0, 255, 255, 0.6), 0 0 20px rgba(0, 255, 255, 0.3);
  --glow-magenta: 0 0 10px rgba(246, 0, 255, 0.6), 0 0 20px rgba(246, 0, 255, 0.3);
  --glow-white: 0 0 10px rgba(255, 255, 255, 0.6), 0 0 20px rgba(255, 255, 255, 0.3);
  
  --font-title: 'Outfit', 'Noto Sans KR', sans-serif;
  --font-body: 'Noto Sans KR', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

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

/* 앰비언트 글로우 데코레이션 */
.bg-glow {
  position: absolute;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
  transition: all 1s ease;
}
.bg-glow-left {
  background-color: var(--neon-red);
  top: -10%;
  left: -10%;
}
.bg-glow-right {
  background-color: var(--neon-blue);
  bottom: -10%;
  right: -10%;
}

/* 기본 레이아웃 구성 */
.game-wrapper {
  position: relative;
  width: 100%;
  max-width: 500px;
  height: 100%;
  max-height: 850px;
  background: rgba(10, 12, 22, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 210, 255, 0.05);
  display: flex;
  flex-direction: column;
  z-index: 1;
}

/* 화면 공통 스타일 */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  display: flex;
  flex-direction: column;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  z-index: 2;
}

.screen.active {
  opacity: 1;
  visibility: visible;
}

/* ---------------- MENU SCREEN ---------------- */
#menu-screen {
  padding: 40px 24px;
  overflow-y: auto;
  align-items: center;
}

.title-container {
  text-align: center;
  margin-bottom: 24px;
  margin-top: 10px;
}

.game-logo {
  font-family: var(--font-title);
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--neon-white);
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.game-logo .highlight {
  background: linear-gradient(90deg, var(--neon-red), var(--neon-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 5px rgba(0, 210, 255, 0.3));
}

.tagline {
  font-size: 0.95rem;
  color: #94a3b8;
  letter-spacing: 1.5px;
  margin-top: 4px;
}

.best-score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 10px 24px;
  border-radius: 50px;
  margin-bottom: 28px;
}
.best-score-badge .label {
  font-size: 0.75rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.best-score-badge .value {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--neon-yellow);
  text-shadow: 0 0 8px rgba(255, 230, 0, 0.4);
}

.menu-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.difficulty-group h3, .tutorial-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
  padding-left: 4px;
  color: #cbd5e1;
  border-left: 3px solid var(--neon-blue);
  line-height: 1;
}

.difficulty-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.diff-card {
  position: relative;
  width: 100%;
  padding: 18px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
}

.diff-card .card-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  transition: width 0.3s ease;
}

.diff-card.easy .card-glow { background: var(--neon-green); }
.diff-card.normal .card-glow { background: var(--neon-blue); }
.diff-card.hard .card-glow { background: var(--neon-red); }

.diff-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}

.diff-card.easy:hover { box-shadow: 0 8px 24px rgba(5, 255, 197, 0.15); }
.diff-card.normal:hover { box-shadow: 0 8px 24px rgba(0, 210, 255, 0.15); }
.diff-card.hard:hover { box-shadow: 0 8px 24px rgba(255, 42, 95, 0.15); }

.diff-title {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.diff-card.easy .diff-title { color: var(--neon-green); }
.diff-card.normal .diff-title { color: var(--neon-blue); }
.diff-card.hard .diff-title { color: var(--neon-red); }

.diff-desc {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.4;
}

/* 튜토리얼 색상 가이드 */
.tutorial-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(8px);
}

.blend-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.blend-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}

.blend-item.span-2 {
  grid-column: span 2;
  flex-direction: row;
  justify-content: flex-start;
  padding: 8px 12px;
  gap: 10px;
}

.blend-item.span-3 {
  grid-column: span 3;
  flex-direction: row;
  justify-content: center;
  padding: 8px 12px;
  gap: 12px;
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.color-dot.red { background-color: var(--neon-red); box-shadow: var(--glow-red); }
.color-dot.green { background-color: var(--neon-green); box-shadow: var(--glow-green); }
.color-dot.blue { background-color: var(--neon-blue); box-shadow: var(--glow-blue); }
.color-dot.yellow { background-color: var(--neon-yellow); box-shadow: var(--glow-yellow); }
.color-dot.cyan { background-color: var(--neon-cyan); box-shadow: var(--glow-cyan); }
.color-dot.magenta { background-color: var(--neon-magenta); box-shadow: var(--glow-magenta); }
.color-dot.white { background-color: var(--neon-white); box-shadow: var(--glow-white); }

.plus {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: bold;
}
.combo-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}
.arrow {
  color: #64748b;
  font-size: 0.8rem;
}
.color-label {
  font-size: 0.75rem;
  color: #cbd5e1;
  font-weight: 600;
}

/* ---------------- GAME SCREEN ---------------- */
#game-screen {
  justify-content: space-between;
  padding: 16px;
}

/* HUD 스타일 */
.hud {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 16px;
  backdrop-filter: blur(10px);
  z-index: 10;
}

.hud-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hud-label {
  font-family: var(--font-title);
  font-size: 0.65rem;
  color: #64748b;
  letter-spacing: 1px;
  font-weight: bold;
}

.hud-value {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 800;
  color: #f8fafc;
}

.score-container .hud-value {
  color: var(--neon-white);
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}

.combo-container {
  align-items: center;
}
.combo-count-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.1s ease;
}
.combo-count-wrapper.pop {
  transform: scale(1.3);
}
.combo-container .hud-value {
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
  line-height: 1;
}
.combo-label {
  font-family: var(--font-title);
  font-size: 0.55rem;
  color: #00ffff;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.lives-container {
  align-items: flex-end;
}
.lives-hearts {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.heart-icon {
  width: 16px;
  height: 16px;
  color: var(--neon-red);
  filter: drop-shadow(0 0 2px var(--neon-red));
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.heart-icon.lost {
  opacity: 0.2;
  transform: scale(0.7);
  filter: none;
}

/* 캔버스 영역 */
.canvas-container {
  position: relative;
  flex-grow: 1;
  margin: 16px 0;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6);
}

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

/* 판정 텍스트 팝업 */
.judgment-text {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 2px;
  pointer-events: none;
  opacity: 0;
  text-align: center;
  transition: transform 0.1s ease-out, opacity 0.1s ease-out;
}

.judgment-text.animate {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.2);
}

.judgment-text.perfect { color: var(--neon-cyan); text-shadow: var(--glow-cyan); }
.judgment-text.good { color: var(--neon-green); text-shadow: var(--glow-green); }
.judgment-text.miss { color: var(--neon-red); text-shadow: var(--glow-red); }
.judgment-text.ready { color: var(--neon-yellow); text-shadow: var(--glow-yellow); }

/* 모바일 전용 컨트롤 가상 패드 */
.mobile-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 8px;
  z-index: 10;
}

.control-pad {
  height: 60px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.15s ease;
  backdrop-filter: blur(5px);
}

.control-pad::after {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle, transparent 20%, rgba(0, 0, 0, 0.4) 100%);
  opacity: 0.5;
}

.pad-key {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}
.pad-label {
  font-size: 0.65rem;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
}

.control-pad.red { border-bottom: 4px solid var(--neon-red); }
.control-pad.green { border-bottom: 4px solid var(--neon-green); }
.control-pad.blue { border-bottom: 4px solid var(--neon-blue); }

.control-pad.red.active, .control-pad.red:active {
  background: rgba(255, 42, 95, 0.2);
  border-color: var(--neon-red);
  box-shadow: 0 0 15px rgba(255, 42, 95, 0.4);
  transform: translateY(2px);
}
.control-pad.green.active, .control-pad.green:active {
  background: rgba(5, 255, 197, 0.2);
  border-color: var(--neon-green);
  box-shadow: 0 0 15px rgba(5, 255, 197, 0.4);
  transform: translateY(2px);
}
.control-pad.blue.active, .control-pad.blue:active {
  background: rgba(0, 210, 255, 0.2);
  border-color: var(--neon-blue);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
  transform: translateY(2px);
}

.pause-button {
  position: absolute;
  top: 28px;
  right: 28px;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: all 0.2s ease;
}
.pause-button svg { width: 14px; height: 14px; }
.pause-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: scale(1.05);
}

/* ---------------- OVERLAYS (Pause & Gameover) ---------------- */
.overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(7, 9, 19, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 50;
  padding: 24px;
}
.overlay.active {
  opacity: 1;
  visibility: visible;
}

.overlay-card, .gameover-card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.overlay-card h2 {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}
.overlay-card p {
  color: #94a3b8;
  font-size: 0.95rem;
}

.overlay-buttons {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 12px;
  margin-top: 10px;
}

/* ---------------- GAMEOVER SCREEN ---------------- */
#gameover-screen {
  align-items: center;
  justify-content: center;
  background: rgba(7, 9, 19, 0.9);
  padding: 24px;
  z-index: 30;
}

.gameover-title {
  font-family: var(--font-title);
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -1px;
}
.gameover-title .danger {
  color: var(--neon-red);
  text-shadow: var(--glow-red);
}

.new-record-banner {
  background: linear-gradient(90deg, #ff007f, #7f00ff);
  color: #fff;
  padding: 6px 16px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 2px;
  animation: pulse 1.5s infinite;
}

.result-stats {
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.stat-label {
  color: #64748b;
  font-size: 0.9rem;
}
.stat-value {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
}
.stat-value.highlight {
  color: var(--neon-yellow);
  text-shadow: var(--glow-yellow);
  font-size: 1.6rem;
}

.result-buttons {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 12px;
}

/* 공통 버튼 스타일 */
.btn {
  width: 100%;
  padding: 14px 20px;
  border-radius: 12px;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-magenta));
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 210, 255, 0.25);
}
.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 210, 255, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-danger {
  background: var(--neon-red);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 42, 95, 0.25);
}
.btn-danger:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 42, 95, 0.35);
}

/* 화면 흔들림 효과 (실패 시) */
.shake {
  animation: shake 0.35s ease-in-out;
}

/* 애니메이션 모음 */
@keyframes shake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  15%, 45%, 75% { transform: translate3d(-6px, 0, 0); }
  30%, 60%, 90% { transform: translate3d(6px, 0, 0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.95; }
}

/* 스크롤바 디자인 */
#menu-screen::-webkit-scrollbar {
  width: 4px;
}
#menu-screen::-webkit-scrollbar-track {
  background: transparent;
}
#menu-screen::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

/* 미디어 쿼리 - 아주 작은 화면(모바일 가로 등) 지원 */
@media (max-height: 700px) {
  .game-logo { font-size: 2.8rem; }
  .best-score-badge { margin-bottom: 16px; padding: 6px 18px; }
  .menu-content { gap: 16px; }
  .diff-card { padding: 12px 16px; }
}
