/* ===== Block Sky Drift — UI 스타일 (둥근 카드형, 블록 장난감 톤) ===== */

:root {
  --sky: #8fd0ff;
  --card-bg: rgba(255, 255, 255, 0.92);
  --accent: #ff8a3d;
  --accent-2: #ffd23f;
  --ok: #4cd07d;
  --ink: #2b3a4a;
  --shadow: 0 8px 24px rgba(40, 70, 110, 0.25);
  --radius: 18px;
  --font: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  background: var(--sky);
  user-select: none;
}

#game-root { position: fixed; inset: 0; }
#game-root canvas { display: block; }

.hidden { display: none !important; }

/* ===== HUD ===== */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

.hud-card {
  position: absolute;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  display: flex;
  gap: 18px;
  backdrop-filter: blur(4px);
  border: 3px solid #fff;
}

.hud-left { top: 16px; left: 16px; flex-direction: column; gap: 6px; }
.hud-right { top: 16px; right: 16px; flex-direction: column; gap: 6px; }

.stat { display: flex; align-items: baseline; gap: 6px; }
.stat-label { font-size: 12px; font-weight: bold; color: #7a8aa0; min-width: 48px; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--ink); min-width: 38px; text-align: right; }
.stat-value.compact { font-size: 17px; min-width: 64px; }
.stat-unit { font-size: 12px; color: #9aa7b8; }

.hud-bottom {
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: rgba(255, 80, 80, 0.95);
  color: #fff;
  font-weight: 800;
  border-color: #ffd0d0;
  animation: pulse 0.7s infinite alternate;
}

.hud-boost {
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  background: rgba(32, 230, 255, 0.92);
  color: #063945;
  border-color: #c7fbff;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  animation: boostPulse 0.25s infinite alternate;
}

.hud-message {
  left: 50%;
  top: 78px;
  transform: translateX(-50%);
  background: rgba(255, 210, 63, 0.96);
  color: #4d3510;
  border-color: #fff4b8;
  font-weight: 900;
  animation: pop 0.18s ease-out;
}

.hud-target {
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  align-items: center;
  gap: 10px;
  min-width: 180px;
  justify-content: center;
  font-weight: 900;
}

.target-arrow {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-2);
  color: #5a3900;
  transform-origin: 50% 50%;
}

#target-label {
  font-size: 13px;
  color: #7a8aa0;
}

#target-distance {
  min-width: 42px;
  text-align: right;
  font-size: 18px;
  color: var(--ink);
}

@keyframes boostPulse {
  from { transform: translateX(-50%) scale(1); }
  to { transform: translateX(-50%) scale(1.08); }
}
@keyframes pulse { from { opacity: 0.6; } to { opacity: 1; } }

/* ===== 조작법 안내 ===== */
#controls-help {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  border: 3px solid #fff;
  font-size: 13px;
  max-width: 280px;
}
#controls-help .help-title { font-weight: 800; margin-bottom: 6px; color: var(--accent); }
#controls-help ul { list-style: none; line-height: 1.7; }
#controls-help b {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  border-radius: 6px;
  padding: 0 6px;
  font-size: 12px;
}

/* ===== 리셋 버튼 ===== */
#reset-btn {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 10;
  background: var(--card-bg);
  border: 3px solid #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px 16px;
  font-weight: 800;
  font-family: var(--font);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
}
#reset-btn:hover { background: #fff; transform: translateY(-2px); }

/* ===== 오버레이 (시작/일시정지/추락/클리어) ===== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(120, 190, 255, 0.55), rgba(80, 140, 210, 0.6));
  backdrop-filter: blur(3px);
}

.card {
  background: var(--card-bg);
  border-radius: 26px;
  box-shadow: var(--shadow);
  border: 5px solid #fff;
  padding: 28px 34px;
  text-align: center;
  max-width: 560px;
  animation: pop 0.25s ease-out;
}
.big-card { max-width: 640px; }
@keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.card h1 { font-size: 40px; color: var(--accent); margin-bottom: 6px; letter-spacing: 1px; }
.card h2 { font-size: 30px; margin-bottom: 14px; color: var(--ink); }
.card h3 { font-size: 16px; color: var(--accent); margin-bottom: 6px; }
.subtitle { color: #5a6b7e; margin-bottom: 18px; font-size: 15px; }

.how-to { display: flex; gap: 22px; text-align: left; margin: 10px 0 20px; }
.how-col { flex: 1; background: #f3f8ff; border-radius: 14px; padding: 14px 16px; }
.how-col ul { list-style: none; line-height: 1.9; font-size: 14px; }
.how-col b {
  display: inline-block; background: var(--ink); color: #fff;
  border-radius: 6px; padding: 0 6px; font-size: 12px; margin-right: 4px;
}

.primary-btn {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 14px 30px;
  font-size: 18px;
  font-weight: 800;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: 0 4px 0 #d9701f;
  transition: transform 0.08s;
  margin: 4px;
}
.primary-btn:hover { transform: translateY(-2px); }
.primary-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #d9701f; }

.ghost-btn {
  background: #fff; color: var(--ink); border: 2px solid #d8e2f0;
  border-radius: 14px; padding: 12px 24px; font-size: 15px; font-weight: 700;
  font-family: var(--font); cursor: pointer; margin: 4px;
}
.ghost-btn:hover { background: #f3f8ff; }

.hint { margin-top: 14px; font-size: 13px; color: #7a8aa0; }

.result { display: flex; justify-content: center; gap: 40px; margin: 18px 0 22px; }
.result div { display: flex; flex-direction: column; }
.result-label { font-size: 13px; color: #7a8aa0; }
.result-value { font-size: 34px; font-weight: 800; color: var(--accent); }
.result-value.rank { font-size: 52px; line-height: 0.9; color: #20b8d4; text-shadow: 0 3px 0 #d8fbff; }
.new-best {
  display: inline-block;
  background: #20e6ff;
  color: #063945;
  border: 3px solid #c7fbff;
  border-radius: 12px;
  padding: 6px 14px;
  font-weight: 900;
  margin: 2px 0 8px;
  box-shadow: 0 4px 0 #10a7bd;
}

/* 모바일 대비 (조작은 추후 확장) */
@media (max-width: 640px) {
  .how-to { flex-direction: column; gap: 12px; }
  .card h1 { font-size: 30px; }
  #controls-help { display: none !important; }
  .hud-target { bottom: 72px; min-width: 150px; padding: 10px 12px; }
  .hud-left, .hud-right { max-width: calc(50vw - 20px); padding: 10px; }
  .stat { gap: 4px; }
  .stat-label { min-width: 38px; font-size: 11px; }
  .stat-value { font-size: 18px; min-width: 28px; }
  .stat-value.compact { font-size: 13px; min-width: 52px; }
  .result { flex-wrap: wrap; gap: 18px; }
}
