:root {
  color-scheme: dark;
  font-family: "Pretendard", "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background-color: #020617;
  color: #f8fafc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 4vw, 2rem) clamp(0.5rem, 3vw, 1.5rem);
  background: radial-gradient(circle at top, #0f172a, #020617 70%);
}

.game-wrapper,
.result-wrapper {
  width: min(960px, 100vw);
  background: rgba(15, 23, 42, 0.95);
  border-radius: 24px;
  padding: clamp(1.25rem, 4vw, 2rem);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35);
}

.game-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.game-header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.score-panel {
  min-width: 220px;
  background: rgba(30, 41, 59, 0.8);
  padding: 1rem;
  border-radius: 16px;
}

.score-line {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.score-line strong {
  font-size: 1.5rem;
}

.flag-banner {
  background: linear-gradient(90deg, #06b6d4, #d946ef);
  padding: 1rem 1.5rem;
  border-radius: 16px;
  text-align: center;
  font-weight: bold;
  margin-bottom: 1.5rem;
  color: #0f172a;
}

.hidden {
  display: none !important;
}

.status-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(30, 41, 59, 0.65);
  border-radius: 18px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.label {
  font-size: 0.85rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.next-fruit {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.next-fruit span:first-child {
  font-size: 2rem;
}

.next-fruit.ghost {
  opacity: 0.75;
  font-weight: 500;
}

.status-text {
  font-size: 1rem;
  flex: 1;
  text-align: right;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: min(560px, 95vw);
  margin: 0 auto 1.5rem;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.4), rgba(15, 23, 42, 0.9));
  border-radius: 24px;
  padding: clamp(0.5rem, 2vw, 1rem);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  display: block;
  background: linear-gradient(180deg, #1e293b 0%, #020617 90%);
  border-radius: 18px;
  border: 1px solid rgba(248, 250, 252, 0.08);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.45);
}

.ceiling-line {
  position: absolute;
  top: calc(1rem + 60px);
  left: 1.5rem;
  right: 1.5rem;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    rgba(248, 250, 252, 0.6),
    rgba(248, 250, 252, 0.6) 10px,
    transparent 10px,
    transparent 20px
  );
}

.controls {
  margin-bottom: 1.5rem;
}

button,
.primary-button,
.secondary-button,
.boost-button {
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.25rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
}

.button-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: 100%;
}

.hint-text {
  margin-top: 0.75rem;
  color: #94a3b8;
  font-size: 0.95rem;
}

.secondary-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(180deg, #38bdf8, #0ea5e9);
  color: #02101f;
  box-shadow: 0 10px 20px rgba(14, 165, 233, 0.25);
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary-button {
  background: rgba(248, 250, 252, 0.1);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.primary-button {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #02130d;
  margin-top: 1rem;
}

.instructions h2 {
  margin-top: 0;
}

.instructions ul {
  padding-left: 1.25rem;
  line-height: 1.6;
  color: #cbd5f5;
}

.intro-wrapper .instructions {
  text-align: center;
}

.boost-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.boost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border-radius: 16px;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  text-decoration: none;
  color: #02101f;
  font-weight: 700;
  box-shadow: 0 15px 25px rgba(99, 102, 241, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.boost-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 30px rgba(99, 102, 241, 0.35);
}

.result-wrapper {
  text-align: center;
}

.result-score {
  font-size: 1.25rem;
}

.button-group .primary-button,
.button-group .secondary-button {
  flex: 1 1 200px;
  text-align: center;
}

@media (max-width: 768px) {
  body {
    align-items: flex-start;
  }

  .game-wrapper {
    width: 100%;
  }

  .game-header {
    flex-direction: column;
  }

  .score-panel {
    width: 100%;
  }

  .status-panel {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .game-wrapper {
    border-radius: 0;
    min-height: 100vh;
  }

  canvas {
    border-radius: 12px;
  }
}
