/* Glowcade shared styles — neon arcade design system */

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #0b0e24;
  color: #eef2ff;
  font-family: "Trebuchet MS", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
}

#gc-stage { position: fixed; inset: 0; display: flex; flex-direction: column; }
#gc-frame { position: relative; flex: 1; min-height: 0; }
#gc-frame canvas { position: absolute; inset: 0; display: block; }

/* ---------- topbar ---------- */
.gc-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: max(6px, env(safe-area-inset-top)) 10px 6px;
  background: linear-gradient(180deg, #141a3d, #0e1330);
  border-bottom: 1px solid #2a3475;
  user-select: none; -webkit-user-select: none;
  position: relative; z-index: 30;
}
.gc-back {
  color: #8fa3ff; text-decoration: none; font-size: 22px; line-height: 1;
  padding: 4px 10px; border-radius: 10px; border: 1px solid #2a3475;
}
.gc-back:active { background: #222c5e; }
.gc-gamename {
  font-weight: bold; font-size: 17px; letter-spacing: 1px; flex: 1;
  background: linear-gradient(90deg, #ffd54d, #ff5d8f, #4dd2ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gc-topbtns { display: flex; gap: 8px; }
.gc-iconbtn {
  font-size: 17px; background: #1a2148; color: #eef2ff;
  border: 1px solid #2a3475; border-radius: 10px; padding: 5px 12px; cursor: pointer;
}
.gc-iconbtn:active { background: #222c5e; }

/* ---------- HUD ---------- */
#gc-hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; gap: 8px; padding: 8px 10px; pointer-events: none;
  font-weight: bold; font-size: 15px;
  flex-wrap: wrap;
}
.gc-pill {
  background: rgba(16, 21, 52, 0.82); border: 1px solid #2a3475;
  border-radius: 999px; padding: 4px 12px; white-space: nowrap;
}
/* the HUD strip ignores taps so gameplay shows through underneath — but its
   BUTTONS (speed pills, undo, next-wave, tool toggles) must opt back in */
#gc-hud button {
  pointer-events: auto; cursor: pointer;
  font: inherit; color: inherit;
}
#gc-hud button:active { background: #222c5e; }
.gc-pill b { color: #ffd54d; }
.gc-pill.right { margin-left: auto; }

/* ---------- overlay panels ---------- */
#gc-overlay { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; pointer-events: none; }
#gc-overlay.dim { background: rgba(7, 9, 26, 0.78); backdrop-filter: blur(3px); pointer-events: auto; }
.gc-panel {
  max-width: min(480px, 92vw); max-height: 86%; overflow-y: auto;
  background: linear-gradient(160deg, #171e46, #10143a);
  border: 1px solid #3a49a8; border-radius: 22px;
  padding: 22px 24px; text-align: center;
  box-shadow: 0 0 40px rgba(77, 210, 255, 0.18), 0 18px 50px rgba(0, 0, 0, 0.5);
  animation: gcPop 0.28s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes gcPop { from { transform: scale(0.82); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.gc-logo {
  font-size: clamp(30px, 7vw, 44px); font-weight: 900; letter-spacing: 2px; margin: 4px 0 6px;
  background: linear-gradient(90deg, #ffd54d, #ff5d8f 40%, #4dd2ff 80%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 93, 143, 0.4));
}
.gc-tagline { color: #aab6e8; margin-bottom: 10px; font-size: 15px; }
.gc-best { color: #ffd54d; margin: 4px 0; }
.gc-cheer { font-size: 19px; color: #ffd54d; margin: 4px 0 8px; }
.gc-score { font-size: 17px; margin: 6px 0; }
.gc-score b { color: #7be86e; font-size: 22px; }
.gc-newbest { color: #ff5d8f; font-weight: 900; font-size: 18px; margin: 6px 0; }
.gc-sub { color: #aab6e8; font-size: 13px; margin: 8px 0; }

.gc-btnrow { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 14px 0 6px; }
.gc-btnrow.col { flex-direction: column; align-items: center; }
.gc-btn {
  font: inherit; font-weight: bold; font-size: 16px;
  color: #eef2ff; background: #1a2148;
  border: 1px solid #3a49a8; border-radius: 14px;
  padding: 10px 20px; cursor: pointer; min-width: 130px;
  transition: transform 0.08s;
}
.gc-btn:active { transform: scale(0.95); }
.gc-btn.primary {
  background: linear-gradient(135deg, #ff5d8f, #ff9f45);
  border-color: #ff9f45; color: #fff;
  box-shadow: 0 0 18px rgba(255, 93, 143, 0.45);
}
.gc-btn.big { font-size: 19px; padding: 13px 30px; }

.gc-howto { text-align: left; background: rgba(10, 13, 34, 0.6); border-radius: 14px; padding: 12px 16px; margin: 12px 0; }
.gc-howto h3 { font-size: 14px; color: #4dd2ff; margin-bottom: 6px; }
.gc-howto ul { list-style: none; }
.gc-howto li { font-size: 13.5px; color: #c6cff2; padding: 3px 0; }

.gc-scheme { display: flex; gap: 6px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 10px 0 2px; }
.gc-scheme-label { color: #8fa3ff; font-size: 13px; }
.gc-chip {
  font: inherit; font-size: 13px; color: #c6cff2;
  background: #131842; border: 1px solid #2a3475; border-radius: 999px;
  padding: 5px 13px; cursor: pointer;
}
.gc-chip.on { background: #2b3a8f; border-color: #4dd2ff; color: #fff; }
.gc-backlink { display: inline-block; margin-top: 12px; color: #8fa3ff; font-size: 14px; text-decoration: none; }

/* ---------- stars ---------- */
.gc-stars { font-size: 40px; margin: 8px 0; letter-spacing: 6px; }
.gc-star { color: #39406e; display: inline-block; }
.gc-star.lit { color: #ffd54d; filter: drop-shadow(0 0 10px rgba(255, 213, 77, 0.7)); animation: gcStar 0.5s cubic-bezier(0.2, 1.8, 0.4, 1) backwards; }
@keyframes gcStar { from { transform: scale(0) rotate(-120deg); } to { transform: scale(1) rotate(0); } }
.gc-bounce { animation: gcBounce 0.9s ease infinite alternate; }
@keyframes gcBounce { from { transform: translateY(0); } to { transform: translateY(-7px); } }

/* ---------- level select ---------- */
.gc-levels h2, .gc-pause h2, .gc-win h2, .gc-lose h2, .gc-board h2 { margin-bottom: 12px; font-size: 24px; }
.gc-levelgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px; width: min(420px, 80vw); margin: 0 auto 14px;
}
.gc-level {
  font: inherit; color: #eef2ff; background: #1a2148;
  border: 1px solid #3a49a8; border-radius: 12px;
  padding: 7px 2px 5px; cursor: pointer; display: flex; flex-direction: column; align-items: center;
}
.gc-level .num { font-size: 17px; font-weight: bold; }
.gc-level .st { font-size: 11px; color: #ffd54d; letter-spacing: 1px; }
.gc-level.locked { opacity: 0.45; cursor: default; }
.gc-level:not(.locked):active { transform: scale(0.93); }

/* ---------- leaderboard ---------- */
.gc-namerow { display: flex; gap: 8px; align-items: center; justify-content: center; margin-bottom: 10px; font-size: 14px; color: #aab6e8; }
.gc-input {
  font: inherit; font-size: 15px; color: #fff; background: #0d1130;
  border: 1px solid #3a49a8; border-radius: 10px; padding: 6px 10px; width: 170px; text-align: center;
}
.gc-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.gc-scorelist { min-height: 120px; text-align: left; }
.gc-scorerow {
  display: flex; gap: 10px; align-items: center;
  padding: 6px 10px; border-radius: 10px; font-size: 15px;
}
.gc-scorerow:nth-child(odd) { background: rgba(26, 33, 72, 0.55); }
.gc-scorerow.first { background: linear-gradient(90deg, rgba(255, 213, 77, 0.16), transparent); }
.gc-scorerow .rank { width: 30px; text-align: center; }
.gc-scorerow .pname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-scorerow .pscore { font-weight: bold; color: #7be86e; }

/* ---------- performance banners (tiered rewards) ---------- */
.gc-banner {
  position: fixed; left: 50%; top: 26%; transform: translate(-50%, -50%);
  text-align: center; z-index: 80; pointer-events: none;
  animation: gcBannerIn 0.35s cubic-bezier(0.2, 1.9, 0.4, 1);
}
.gc-banner.out { animation: gcBannerOut 0.45s ease forwards; }
.gc-banner-main {
  font-weight: 900; letter-spacing: 2px;
  background: linear-gradient(90deg, #ffd54d, #ff5d8f 50%, #4dd2ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.35)) drop-shadow(0 0 18px rgba(255,93,143,0.6));
}
.gc-banner.t2 .gc-banner-main { font-size: clamp(26px, 6vw, 40px); }
.gc-banner.t3 .gc-banner-main {
  font-size: clamp(38px, 9vw, 64px);
  animation: gcBannerPulse 0.5s ease 2 alternate;
}
.gc-banner-sub { font-size: 15px; color: #ffd54d; font-weight: bold; margin-top: 2px; }
.gc-banner-emoji {
  background: none; -webkit-background-clip: initial; background-clip: initial;
  -webkit-text-fill-color: #fff; color: #fff;
}
@keyframes gcBannerIn { from { transform: translate(-50%, -50%) scale(0.2) rotate(-6deg); opacity: 0; } }
@keyframes gcBannerOut { to { transform: translate(-50%, -80%) scale(0.7); opacity: 0; } }
@keyframes gcBannerPulse { from { transform: scale(1); } to { transform: scale(1.08); } }

/* ---------- countdown / toast ---------- */
.gc-count {
  font-size: 90px; font-weight: 900; color: #ffd54d;
  filter: drop-shadow(0 0 24px rgba(255, 213, 77, 0.8));
  pointer-events: none;
}
.gc-count.zoom { animation: gcZoom 0.6s ease-out; }
@keyframes gcZoom { from { transform: scale(2.2); opacity: 0; } 30% { transform: scale(1); opacity: 1; } to { opacity: 0.9; } }
.gc-toast {
  position: fixed; left: 50%; bottom: 60px; transform: translate(-50%, 24px);
  background: #171e46; border: 1px solid #4dd2ff; color: #fff;
  padding: 10px 22px; border-radius: 999px; font-weight: bold;
  opacity: 0; transition: all 0.3s; z-index: 90; pointer-events: none;
  box-shadow: 0 0 24px rgba(77, 210, 255, 0.35);
}
.gc-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- touch buttons (games may show these) ---------- */
.gc-touchrow {
  position: absolute; bottom: max(10px, env(safe-area-inset-bottom)); left: 0; right: 0;
  display: flex; justify-content: center; gap: 12px; z-index: 12;
}
.gc-touchbtn {
  font: inherit; font-size: 24px; font-weight: bold; color: #eef2ff;
  width: 62px; height: 62px; border-radius: 50%;
  background: rgba(26, 33, 72, 0.8); border: 1px solid #3a49a8;
  cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none;
}
.gc-touchbtn:active { background: #2b3a8f; }
body.gc-kbm .gc-touchrow { display: none; }
