/* Sky Courier — sunset UI theme */

:root {
  --sun: #ffb347;
  --sun-hot: #ff7847;
  --dusk: #2b1a3d;
  --dusk-deep: #170f26;
  --cream: #fff3e0;
  --rose: #ff5e78;
  --teal: #4de8c2;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--dusk-deep);
  font-family: "Segoe UI", "Trebuchet MS", Verdana, system-ui, sans-serif;
  color: var(--cream);
}

#app {
  position: fixed;
  inset: 0;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hidden {
  display: none !important;
}

/* ---------- HUD ---------- */

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

#fragment-counter {
  position: absolute;
  top: clamp(12px, 2.5vh, 28px);
  left: clamp(12px, 2.5vw, 28px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px 10px 14px;
  font-size: clamp(20px, 2.6vw, 30px);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--cream);
  background: rgba(23, 15, 38, 0.62);
  border: 2px solid rgba(255, 179, 71, 0.55);
  border-radius: 14px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.gem {
  display: inline-block;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #8affde 0%, var(--teal) 45%, #1ba889 100%);
  transform: rotate(45deg);
  border-radius: 4px;
  box-shadow: 0 0 12px rgba(77, 232, 194, 0.9), inset 0 0 6px rgba(255, 255, 255, 0.6);
}

.gem.small {
  width: 14px;
  height: 14px;
  margin-right: 4px;
}

.hazard-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff9aa8, var(--rose) 60%, #a3132f);
  box-shadow: 0 0 10px rgba(255, 94, 120, 0.9);
}

#toast {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 28px;
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--dusk-deep);
  background: linear-gradient(135deg, var(--sun) 0%, var(--sun-hot) 100%);
  border-radius: 999px;
  box-shadow: 0 6px 30px rgba(255, 120, 71, 0.55);
  text-align: center;
  animation: toast-pop 0.35s ease-out;
  white-space: nowrap;
}

@keyframes toast-pop {
  from {
    transform: translateX(-50%) scale(0.6);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
}

#controls-hint {
  position: absolute;
  bottom: clamp(10px, 2vh, 22px);
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(12px, 1.4vw, 15px);
  letter-spacing: 0.08em;
  color: rgba(255, 243, 224, 0.85);
  background: rgba(23, 15, 38, 0.5);
  padding: 7px 16px;
  border-radius: 999px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

/* ---------- Overlay screens ---------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(255, 120, 71, 0.35), transparent 60%),
    linear-gradient(180deg, rgba(23, 15, 38, 0.88) 0%, rgba(43, 26, 61, 0.82) 100%);
  padding: 24px;
}

.panel {
  max-width: 620px;
  width: 100%;
  text-align: center;
  padding: clamp(24px, 5vh, 52px) clamp(20px, 4vw, 48px);
  background: rgba(23, 15, 38, 0.72);
  border: 2px solid rgba(255, 179, 71, 0.4);
  border-radius: 24px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 243, 224, 0.12);
  backdrop-filter: blur(6px);
}

.title {
  font-size: clamp(38px, 7vw, 72px);
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1.05;
  background: linear-gradient(180deg, var(--cream) 20%, var(--sun) 60%, var(--sun-hot) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 4px 24px rgba(255, 120, 71, 0.35);
  margin-bottom: 14px;
}

.title.win {
  /* background-image only: the `background` shorthand would reset
     background-clip:text back to border-box and paint a solid block. */
  background-image: linear-gradient(180deg, #d8fff2 15%, var(--teal) 60%, #1ba889 100%);
  text-shadow: 0 4px 24px rgba(77, 232, 194, 0.35);
}

.tagline {
  font-size: clamp(15px, 1.8vw, 19px);
  line-height: 1.5;
  color: rgba(255, 243, 224, 0.9);
  margin-bottom: 26px;
}

.controls-list {
  list-style: none;
  text-align: left;
  display: inline-block;
  margin: 0 auto 30px;
  font-size: clamp(14px, 1.7vw, 17px);
  line-height: 2.2;
  color: rgba(255, 243, 224, 0.95);
}

.controls-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}

kbd {
  display: inline-block;
  min-width: 30px;
  padding: 3px 8px;
  text-align: center;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85em;
  color: var(--dusk-deep);
  background: linear-gradient(180deg, var(--cream), #e8cfae);
  border-radius: 6px;
  box-shadow: 0 3px 0 #a98c62;
}

.stats {
  font-size: clamp(15px, 1.8vw, 19px);
  color: var(--sun);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 28px;
}

.btn {
  pointer-events: auto;
  cursor: pointer;
  font-family: inherit;
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--dusk-deep);
  padding: 15px 46px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--sun) 0%, var(--sun-hot) 100%);
  box-shadow: 0 8px 30px rgba(255, 120, 71, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 40px rgba(255, 120, 71, 0.7), inset 0 2px 0 rgba(255, 255, 255, 0.4);
  outline: none;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

@media (max-width: 560px) {
  .controls-list {
    line-height: 2;
  }
}
