@font-face {
  font-family: 'CentaurMT';
  src: url('./assets/fonts/centaur-mt.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0f1222;
  --panel: rgba(6, 8, 20, 0.55);
  --text: #f2f5ff;
  --accent: #90ffe0;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: 'CentaurMT', Georgia, serif;
  color: var(--text);
  background: radial-gradient(circle at 30% 20%, #1b2153 0%, var(--bg) 50%, #080a15 100%);
}

#scene {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hud {
  position: fixed;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 14px max(8px, env(safe-area-inset-bottom));
  pointer-events: none;
}

.hud.top {
  top: 0;
}

.hud.bottom {
  bottom: 0;
  align-items: flex-end;
}

.title,
.instructions,
.chip,
.btn {
  background: var(--panel);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
}

.title {
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: clamp(0.9rem, 3.5vw, 1rem);
}

.instructions {
  max-width: 72vw;
  font-size: clamp(0.82rem, 3vw, 0.95rem);
  line-height: 1.35;
}

.chip {
  font-weight: 650;
  color: var(--accent);
  white-space: nowrap;
}

.btn {
  pointer-events: auto;
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}

.btn:active {
  transform: scale(0.98);
}

.win {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 8, 20, 0.45);
  backdrop-filter: blur(4px);
}

.win.hidden {
  display: none;
}

.card {
  width: min(92vw, 420px);
  border-radius: 0;
  padding: 20px 20px 18px;
  text-align: center;
  color: #3a2712;
  border: 2px solid #7c5a2a;
  background:
    linear-gradient(rgba(255, 242, 205, 0.18), rgba(95, 58, 24, 0.12)),
    url('./assets/ui/parchment.jpg') center / cover no-repeat;
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.45),
    inset 0 0 0 2px rgba(255, 236, 173, 0.35),
    inset 0 0 40px rgba(103, 66, 24, 0.2);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(94, 64, 27, 0.45);
  border-radius: 0;
  pointer-events: none;
}

.card h2 {
  margin: 0 0 10px;
  color: #6a4733;
  text-shadow: 0 1px 0 rgba(255, 232, 168, 0.75);
}

.card p {
  margin: 0 0 16px;
  opacity: 1;
  color: #6a4733;
}

.card a {
  color: #5a2f0b;
  font-weight: 800;
}

.aoe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 190px;
  height: 36px;
  padding: 0 22px;
  margin-top: 2px;
  text-decoration: none;
  color: #f8efe0 !important;
  font-family: 'CentaurMT', Georgia, serif;
  font-size: 1.15rem;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9);
  border: 1px solid #7a4b14;
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 227, 157, 0.42) 0%, rgba(255, 227, 157, 0.12) 14%, transparent 36%),
    linear-gradient(180deg, #8f0000 0%, #7b0000 44%, #670000 58%, #530000 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 235, 170, 0.7),
    inset 0 -1px 0 rgba(45, 0, 0, 0.9),
    inset 0 0 0 1px rgba(145, 70, 40, 0.5),
    0 0 0 1px rgba(241, 191, 92, 0.95),
    0 0 0 2px rgba(108, 66, 20, 0.95),
    0 2px 6px rgba(0, 0, 0, 0.35);
}

.aoe-btn:hover {
  filter: brightness(1.08);
}

.aoe-btn:active {
  transform: translateY(1px);
  filter: brightness(0.95);
}

.note-fly {
  transform-origin: center bottom;
  position: relative;
  z-index: 5;
}

.monk-orbit {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.monk {
  position: fixed;
  width: clamp(72px, 13vw, 124px);
  height: auto;
  will-change: transform;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.45));
  opacity: 0.95;
}

.win:not(.hidden) .note-fly {
  animation: flyOutGift 650ms cubic-bezier(0.2, 0.85, 0.2, 1);
}

@keyframes flyOutGift {
  0% {
    opacity: 0;
    transform: translateY(190px) scale(0.55) rotateX(18deg);
    filter: blur(4px);
  }
  65% {
    opacity: 1;
    transform: translateY(-8px) scale(1.04) rotateX(0deg);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}
