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

html, body {
  height: 100%;
  overflow: hidden;
  background: #0d1117;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: #f2f4f6;
}

body { display: flex; align-items: center; justify-content: center; }

#app {
  position: relative;
  width: 1280px;
  height: 720px;
  flex: 0 0 auto;
  transform-origin: center center;
}

canvas#game { display: block; width: 100%; height: 100%; background: #bcd7ea; }

.hidden { display: none !important; }

button {
  font-family: inherit;
  font-weight: 700;
  letter-spacing: .08em;
  color: #10151b;
  background: #e8ecf1;
  border: none;
  border-radius: 8px;
  padding: 12px 22px;
  font-size: 15px;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
button:hover { transform: translateY(-2px); filter: brightness(1.06); }
button.primary { background: #ffc93c; box-shadow: 0 4px 0 #b98a10; }
button.danger { background: #ff7a6e; }

#hud { position: absolute; inset: 0; pointer-events: none; }
#hud button { pointer-events: auto; position: absolute; top: 14px; width: 42px; height: 42px; padding: 0; font-size: 17px; border-radius: 10px; }
#btn-pause { right: 66px; }
#btn-mute { right: 14px; }

.hud-top { position: absolute; top: 14px; left: 14px; right: 120px; display: flex; gap: 10px; align-items: flex-start; }
.chip {
  background: rgba(13, 19, 26, .78);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chip span { display: block; }
#hud-name { font-weight: 800; font-size: 16px; letter-spacing: .04em; }
#hud-floor { font-size: 12px; opacity: .75; letter-spacing: .12em; }
.chip-score { min-width: 130px; }
#hud-score { font-size: 24px; font-weight: 900; line-height: 1; }
#hud-best { font-size: 11px; opacity: .65; letter-spacing: .12em; }
.chip-right { align-items: flex-end; }
#hud-combo { font-size: 15px; font-weight: 800; color: #ffd94d; min-height: 18px; }
#hud-hearts { font-size: 17px; letter-spacing: 2px; }
#hud-hearts .hp { color: #ff5d52; }
#hud-hearts .hp.off { color: #4a5560; }

.chip-wind {
  position: absolute; top: 76px; left: 14px;
  flex-direction: row; gap: 8px; align-items: baseline;
  font-weight: 800; font-size: 14px; letter-spacing: .06em;
}
.chip-wind .wv { font-size: 12px; opacity: .8; }
.chip-wind.calm { color: #9fe3a1; }
.chip-wind.breezy { color: #ffd94d; }
.chip-wind.gusty { color: #ff9d7a; }

.plan-box {
  position: absolute; left: 14px; bottom: 46px;
  background: rgba(13, 19, 26, .78);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  padding: 8px 12px 10px;
}
.plan-label { font-size: 10px; letter-spacing: .22em; opacity: .6; margin-bottom: 6px; }
#hud-plan { display: flex; gap: 5px; align-items: flex-end; }
.pchip {
  position: relative;
  height: 20px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,.35);
  opacity: .95;
}
.pchip.cur { outline: 2px solid #fff; outline-offset: 1.5px; animation: pulse 1s infinite; }
.pchip.done { opacity: .32; }
.pchip.done::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 12px; text-shadow: 0 1px 2px #000; }
@keyframes pulse { 50% { outline-color: rgba(255,255,255,.25); } }

#hud-hint {
  position: absolute; bottom: 10px; left: 0; right: 0;
  text-align: center;
  font-size: 13px;
  letter-spacing: .06em;
  color: rgba(20,28,36,.85);
  font-weight: 600;
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
}

#banner {
  position: absolute; top: 34%; left: 0; right: 0;
  text-align: center;
  font-family: "Arial Black", "Segoe UI", sans-serif;
  font-size: 54px;
  font-weight: 900;
  letter-spacing: .06em;
  color: #fff;
  -webkit-text-stroke: 2px #14202c;
  text-shadow: 0 6px 0 rgba(16, 26, 38, .45);
  opacity: 0;
  pointer-events: none;
}
#banner.show { animation: bannerPop 1.5s ease forwards; }
@keyframes bannerPop {
  0% { opacity: 0; transform: scale(.6); }
  18% { opacity: 1; transform: scale(1.08); }
  30% { transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-26px); }
}

.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(7, 11, 16, .68);
  backdrop-filter: blur(5px);
}

.card {
  background: #171e27;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 26px 30px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.card.small { min-width: 340px; text-align: center; }
.card h2 { font-size: 30px; letter-spacing: .05em; margin-bottom: 8px; }
.card .sub { opacity: .75; margin-bottom: 18px; font-size: 15px; }
.col-btns { display: flex; flex-direction: column; gap: 10px; }
.row-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.fail-card h2 { color: #ff8377; }

.done-card { display: flex; gap: 22px; max-width: 900px; align-items: stretch; }
.done-card img { width: 380px; object-fit: cover; border-radius: 10px; border: 1px solid rgba(255,255,255,.15); }
.done-info { display: flex; flex-direction: column; gap: 12px; min-width: 330px; }
.done-info h2 { color: #7ee787; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stats div { background: rgba(255,255,255,.05); border-radius: 10px; padding: 10px 6px; text-align: center; }
.stats b { display: block; font-size: 21px; }
.stats span { font-size: 10px; letter-spacing: .18em; opacity: .6; }
.compare { font-size: 13px; opacity: .8; }

.menu-wrap { width: 1060px; max-width: 94%; max-height: 94%; overflow: auto; }
.hazard {
  text-align: center;
  padding: 22px 10px 18px;
  border-top: 10px solid;
  border-image: repeating-linear-gradient(45deg, #ffc93c 0 16px, #141a22 16px 32px) 10;
  margin-bottom: 18px;
}
.hazard h1 {
  font-family: "Arial Black", sans-serif;
  font-size: 52px;
  letter-spacing: .04em;
  color: #ffc93c;
  text-shadow: 0 4px 0 #201409, 0 8px 18px rgba(0,0,0,.5);
}
.hazard .tag { margin-top: 6px; opacity: .8; font-size: 15px; letter-spacing: .05em; }

#menu-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.bcard {
  background: #171e27;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease;
  position: relative;
}
.bcard:hover { transform: translateY(-5px); border-color: #ffc93c; }
.bcard img { width: 100%; height: 190px; object-fit: cover; display: block; border-bottom: 3px solid #ffc93c; }
.bcard .binfo { padding: 13px 15px 15px; }
.bcard h3 { font-size: 19px; letter-spacing: .03em; }
.bcard p { font-size: 13px; opacity: .72; margin-top: 5px; line-height: 1.35; min-height: 36px; }
.bcard .bmeta { margin-top: 10px; display: flex; justify-content: space-between; font-size: 12px; letter-spacing: .08em; opacity: .85; }
.bcard .diff { color: #ffc93c; font-weight: 800; }
.bcard.locked img { filter: grayscale(.95) brightness(.55); }
.bcard.locked .binfo { opacity: .6; }
.bcard .lockbadge {
  position: absolute; top: 10px; right: 10px;
  background: rgba(10,14,20,.85); border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 800; letter-spacing: .1em;
}
.bcard .builtbadge {
  position: absolute; top: 10px; left: 10px;
  background: #2ea043; border-radius: 8px; padding: 4px 10px;
  font-size: 12px; font-weight: 800; letter-spacing: .1em; color: #fff;
}
.bcard.deny { animation: deny .3s ease; }
@keyframes deny { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

.menu-foot {
  display: flex; gap: 26px; justify-content: center; flex-wrap: wrap;
  margin-top: 18px; font-size: 13px; opacity: .75; letter-spacing: .04em;
}
.menu-foot a { color: #ffc93c; cursor: pointer; text-decoration: underline; }

@media (pointer: coarse) {
  .menu-foot .kb { display: none; }
}
