/* style.css - Animal Tetris 네온 레트로 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #07090f;
  color: #ddeeff;
  font-family: 'Courier New', monospace;
  overflow: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* CRT 스캔라인 */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0,0,0,0.06) 2px, rgba(0,0,0,0.06) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ─── 게임 컨테이너 ──────────────────── */
#game-container {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
}

/* ─── 패널 공통 ──────────────────────── */
.panel-title {
  font-size: 10px;
  letter-spacing: 3px;
  color: #88aacc;
  text-shadow: 0 0 6px #88aacc;
  margin-bottom: 6px;
  text-align: center;
}

.info-box {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(136,170,204,0.2);
  border-radius: 4px;
  padding: 8px 10px;
  text-align: center;
}

.info-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: #6688aa;
  text-shadow: 0 0 4px #6688aa;
  margin-bottom: 3px;
}

.info-value {
  font-size: 15px;
  color: #fff;
  text-shadow: 0 0 8px #88ccff;
}

/* ─── HOLD 패널 ──────────────────────── */
#hold-panel { width: 120px; text-align: center; }

#hold-canvas {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(136,170,204,0.25);
  border-radius: 4px;
  display: block;
  margin: 0 auto;
}

/* ─── 보드 ───────────────────────────── */
#board-wrapper { position: relative; }

#game-canvas {
  display: block;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(68,238,136,0.25);
  box-shadow: 0 0 12px rgba(68,238,136,0.1);
  border-radius: 2px;
}

#effects-canvas {
  position: absolute;
  pointer-events: none;
}

/* ─── 사이드 패널 ────────────────────── */
#side-panel {
  width: 160px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#combo-display { color: #FFE044; text-shadow: 0 0 8px #FFE044; }

.fever-glow { border-color: #FF6644 !important; box-shadow: 0 0 14px rgba(255,102,68,0.4); }

/* Next 미리보기 */
#next-panel { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.next-canvas {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(136,170,204,0.12);
  border-radius: 4px;
}

/* 랭킹 */
#ranking-list {
  list-style: none;
  font-size: 10px;
  color: #8899aa;
  max-height: 160px;
  overflow-y: auto;
}
#ranking-list li {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  border-bottom: 1px solid rgba(136,170,204,0.06);
}
.rank-name { color: #aabbcc; max-width: 70px; overflow: hidden; text-overflow: ellipsis; }
.rank-score { color: #88ccff; text-shadow: 0 0 4px #88ccff; }
#ranking-list li:first-child .rank-score { color: #FFE044; text-shadow: 0 0 6px #FFE044; }

/* ─── 일시정지 오버레이 ──────────────── */
#pause-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(7,9,15,0.75);
  display: flex; justify-content: center; align-items: center;
  border-radius: 2px;
  z-index: 100;
}
#pause-overlay.hidden { display: none; }
#pause-text {
  font-size: 16px;
  color: #88ccff;
  text-shadow: 0 0 12px #88ccff;
  letter-spacing: 4px;
}

/* ─── 모달 ───────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(7,9,15,0.93);
  display: flex; justify-content: center; align-items: center;
  z-index: 500;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: #0d1020;
  border: 1px solid rgba(136,170,204,0.3);
  border-radius: 8px;
  padding: 28px 36px;
  text-align: center;
  min-width: 340px;
  max-width: 420px;
  box-shadow: 0 0 30px rgba(50,100,200,0.12);
}

.modal-title {
  font-size: 18px;
  color: #88ccff;
  text-shadow: 0 0 12px #88ccff;
  margin-bottom: 20px;
  letter-spacing: 3px;
}

.modal-subtitle-main {
  font-size: 11px;
  color: #88aacc;
  letter-spacing: 2px;
  margin-top: -12px;
  margin-bottom: 16px;
  text-shadow: 0 0 6px #88aacc;
}

.modal-subtitle {
  font-size: 11px;
  color: #6688aa;
  margin-bottom: 10px;
}

.modal-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(136,170,204,0.3);
  border-radius: 4px;
  padding: 8px 14px;
  color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  text-align: center;
  width: 200px;
  outline: none;
  margin-bottom: 16px;
}
.modal-input:focus {
  border-color: #88ccff;
  box-shadow: 0 0 8px rgba(136,204,255,0.2);
}

/* 난이도 버튼 */
.diff-buttons { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.diff-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(136,170,204,0.3);
  border-radius: 4px;
  padding: 6px 14px;
  color: #88aacc;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.diff-btn:hover { border-color: #88ccff; color: #fff; }
.diff-btn.selected {
  border-color: #88ccff;
  background: rgba(136,204,255,0.15);
  color: #fff;
  text-shadow: 0 0 6px #88ccff;
}

/* 조작법 탭 */
.controls-section { margin: 14px 0; text-align: left; }
.controls-tabs { display: flex; gap: 6px; margin-bottom: 8px; justify-content: center; }
.ctrl-tab {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(136,170,204,0.2);
  border-radius: 3px;
  padding: 4px 12px;
  color: #6688aa;
  font-size: 10px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
}
.ctrl-tab.active {
  border-color: #88ccff;
  color: #fff;
  background: rgba(136,204,255,0.1);
}
.ctrl-content { display: none; }
.ctrl-content.active { display: block; }
.ctrl-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 8px;
  font-size: 10px;
  color: #8899aa;
}
.ctrl-key { color: #88ccff; text-shadow: 0 0 4px #88ccff; }

/* 시작/재시작 버튼 */
.btn-main {
  background: rgba(136,204,255,0.1);
  border: 1px solid #88ccff;
  border-radius: 4px;
  padding: 10px 28px;
  color: #88ccff;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  letter-spacing: 2px;
  text-shadow: 0 0 8px #88ccff;
  transition: all 0.15s;
}
.btn-main:hover {
  background: rgba(136,204,255,0.2);
  box-shadow: 0 0 12px rgba(136,204,255,0.3);
}

/* 게임오버 */
.go-score {
  font-size: 22px;
  color: #FFE044;
  text-shadow: 0 0 12px #FFE044;
  margin: 12px 0;
}
.go-info { font-size: 11px; color: #8899aa; margin-bottom: 6px; }
.go-rank { font-size: 13px; color: #88ccff; text-shadow: 0 0 6px #88ccff; margin: 10px 0 16px; }

/* ─── 모바일 게임보이 컨트롤러 ───────── */
#mobile-controls {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #1a1a24;
  border-top: 1px solid rgba(136,170,204,0.15);
  padding: 8px 16px 12px;
  z-index: 200;
}

.ctrl-top-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 8px;
}

.ctrl-small-btn {
  background: #2a2a3a;
  border: none;
  border-radius: 8px;
  padding: 4px 14px;
  color: #8899aa;
  font-size: 9px;
  letter-spacing: 1px;
  font-family: 'Courier New', monospace;
  -webkit-tap-highlight-color: transparent;
}

.ctrl-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
}

/* D-PAD */
.dpad {
  position: relative;
  width: 110px;
  height: 110px;
}
.dpad-btn {
  position: absolute;
  width: 36px;
  height: 36px;
  background: #2a2a3a;
  border: 1px solid rgba(136,170,204,0.15);
  color: #8899aa;
  font-size: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.dpad-btn:active { background: #3a3a4a; }
.dpad-up    { top: 0;   left: 37px; border-radius: 6px 6px 0 0; }
.dpad-down  { bottom: 0; left: 37px; border-radius: 0 0 6px 6px; }
.dpad-left  { top: 37px; left: 0;   border-radius: 6px 0 0 6px; }
.dpad-right { top: 37px; right: 0;  border-radius: 0 6px 6px 0; }
.dpad-center {
  position: absolute;
  top: 37px; left: 37px;
  width: 36px; height: 36px;
  background: #252535;
  border: 1px solid rgba(136,170,204,0.1);
}

/* A/B 버튼 */
.ab-buttons {
  display: flex;
  gap: 14px;
  align-items: center;
}
.ab-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid;
  font-size: 14px;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.ab-btn:active { filter: brightness(1.3); }
.btn-a {
  background: rgba(68,238,136,0.15);
  border-color: #44EE88;
  color: #44EE88;
  text-shadow: 0 0 6px #44EE88;
}
.btn-b {
  background: rgba(255,102,68,0.15);
  border-color: #FF6644;
  color: #FF6644;
  text-shadow: 0 0 6px #FF6644;
}

.ab-labels {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 2px;
}
.ab-label {
  width: 50px;
  text-align: center;
  font-size: 8px;
  color: #556677;
  letter-spacing: 1px;
}

/* ─── 모바일 전용 패널 (데스크탑에서 숨김) ── */
#mobile-left-panel { display: none; }
#mobile-right-panel { display: none; }

/* ─── 반응형: 모바일 ─────────────────── */
@media (max-width: 768px) {
  body {
    align-items: flex-start;
    justify-content: flex-start;
    overflow: hidden;
    height: 100vh;
  }

  /* 게임 컨테이너: 가로 배치 (좌패널 + 보드 + 우패널) */
  #game-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 2px;
    width: 100%;
    height: calc(100vh - var(--joystick-h, 170px));
    padding: 2px 0;
  }

  /* 데스크탑 전용 패널 숨김 */
  #hold-panel { display: none; }
  #side-panel { display: none; }

  /* ── 모바일 패널 공통 ── */
  .mp-label {
    font-size: 8px;
    letter-spacing: 1px;
    color: #6688aa;
    text-shadow: 0 0 4px #6688aa;
    text-align: center;
    margin-bottom: 1px;
  }
  .mp-value {
    font-size: 11px;
    color: #fff;
    text-shadow: 0 0 6px #88ccff;
    text-align: center;
  }
  .mp-box {
    text-align: center;
    margin-bottom: 4px;
  }
  #mobile-combo-box .mp-value {
    color: #FFE044;
    text-shadow: 0 0 8px #FFE044;
  }

  /* ── 모바일 좌측 패널 (60px) ── */
  #mobile-left-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    padding-top: 4px;
    gap: 2px;
    flex-shrink: 0;
  }
  #mobile-hold-canvas {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(136,170,204,0.25);
    border-radius: 3px;
    display: block;
  }

  /* ── 보드 래퍼 ── */
  #board-wrapper {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
  }

  /* ── 모바일 우측 패널 (60px) ── */
  #mobile-right-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    padding-top: 4px;
    gap: 3px;
    flex-shrink: 0;
  }
  .m-next-canvas {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(136,170,204,0.12);
    border-radius: 3px;
    display: block;
  }
  #mobile-ranking-list {
    list-style: none;
    font-size: 7px;
    color: #8899aa;
    width: 100%;
    padding: 0 2px;
  }
  #mobile-ranking-list li {
    display: flex;
    justify-content: space-between;
    padding: 1px 0;
    border-bottom: 1px solid rgba(136,170,204,0.06);
  }
  #mobile-ranking-list .rank-name {
    color: #aabbcc;
    max-width: 30px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #mobile-ranking-list .rank-score {
    color: #88ccff;
    text-shadow: 0 0 4px #88ccff;
  }
  #mobile-ranking-list li:first-child .rank-score {
    color: #FFE044;
    text-shadow: 0 0 6px #FFE044;
  }

  /* ── 조이패드 ── */
  #mobile-controls {
    display: block;
    background: rgba(0,0,0,0.9);
    padding: 6px 16px 10px;
  }
  .dpad {
    width: 132px;
    height: 132px;
  }
  .dpad-btn {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }
  .dpad-up    { top: 0;   left: 44px; }
  .dpad-down  { bottom: 0; left: 44px; }
  .dpad-left  { top: 44px; left: 0; }
  .dpad-right { top: 44px; right: 0; }
  .dpad-center {
    top: 44px; left: 44px;
    width: 44px; height: 44px;
  }
  .ab-btn {
    width: 50px;
    height: 50px;
    font-size: 15px;
  }
  .ab-buttons { gap: 14px; }
  .ab-label { width: 50px; font-size: 8px; }
  .ab-labels { gap: 14px; }
}

/* ─── 점수 펄스 애니메이션 ───────────── */
@keyframes scorePulse {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.25); color: #FFE044; text-shadow: 0 0 14px #FFE044; }
  100% { transform: scale(1); }
}
.score-pulse {
  animation: scorePulse 0.4s ease-out;
}

/* ─── 재시작 버튼 펄스 ──────────────── */
@keyframes retryPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(136,204,255,0.2); }
  50% { box-shadow: 0 0 20px rgba(136,204,255,0.5); }
}
#retry-btn {
  animation: retryPulse 2s ease-in-out infinite;
}

/* 스크롤바 */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(136,170,204,0.15); border-radius: 2px; }
