/* ————— The Climb ————— */
#gameHost { position: fixed; inset: 0; z-index: 80; background: #0b1220; color: #fffdfa; font-family: var(--sans); overscroll-behavior: none; }
#gameHost[hidden] { display: none !important; }
#gameHost * { -webkit-tap-highlight-color: transparent; }
#gameHost canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.gm-layer { position: absolute; inset: 0; pointer-events: none; }
.gm-layer > * { pointer-events: auto; }

/* shared */
.gm-x {
  position: absolute; top: max(14px, env(safe-area-inset-top)); left: 14px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(11,18,32,.55); color: #fff; font-size: 16px; display: grid; place-items: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.14);
}
.gm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 13px 26px; font-weight: 800; font-size: 15px; letter-spacing: -0.01em;
  background: var(--red); color: #fff; box-shadow: 0 10px 30px -10px rgba(224,69,47,.7);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.gm-btn:hover { background: var(--red-deep); }
.gm-btn:active { transform: scale(.96); }
.gm-btn:disabled { opacity: .45; box-shadow: none; }
.gm-btn.quiet { background: rgba(255,255,255,.1); color: #fff; box-shadow: none; border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.gm-btn.quiet:hover { background: rgba(255,255,255,.16); }
.gm-btn.sm { padding: 9px 16px; font-size: 13px; }
.gm-btn.ghost { background: none; color: rgba(255,255,255,.7); box-shadow: none; }

/* ----- lobby ----- */
.gm-lobby {
  position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, rgba(11,18,32,.15) 0%, rgba(11,18,32,.72) 55%, rgba(11,18,32,.96) 100%);
}
.gm-lobby-in { max-width: 560px; margin: 0 auto; padding: max(72px, calc(env(safe-area-inset-top) + 58px)) 20px calc(40px + env(safe-area-inset-bottom)); }
.gm-kicker { font-size: 11px; font-weight: 800; letter-spacing: .22em; color: #ffb3a6; text-transform: uppercase; }
.gm-title { margin-top: 8px; font-size: clamp(54px, 13vw, 96px); line-height: .9; font-weight: 900; letter-spacing: -0.04em; }
.gm-title em { font-family: var(--serif); font-style: italic; font-weight: 500; color: var(--red); letter-spacing: -0.01em; }
.gm-lede { margin-top: 18px; font-size: 15px; line-height: 1.55; color: rgba(255,253,250,.78); max-width: 46ch; }
.gm-lede b { color: #fff; }
.gm-card { margin-top: 26px; background: rgba(255,253,250,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 22px; padding: 18px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.gm-card h3 { font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: rgba(255,255,255,.6); }
.gm-card textarea {
  margin-top: 12px; width: 100%; min-height: 150px; resize: vertical; border-radius: 14px; padding: 14px;
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.12); color: #fff; font-size: 16px; line-height: 1.45; outline: none;
}
.gm-card textarea:focus { border-color: rgba(255,255,255,.4); }
.gm-row { margin-top: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.gm-row .spacer { flex: 1; }
.gm-hint { font-size: 12.5px; color: rgba(255,255,255,.55); }
.gm-list { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow: auto; }
.gm-lead { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(0,0,0,.22); border-radius: 12px; font-size: 13.5px; }
.gm-lead .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: rgba(255,255,255,.12); flex: none; }
.gm-lead .who { flex: 1; min-width: 0; }
.gm-lead .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-lead .who span { color: rgba(255,255,255,.55); font-size: 12px; }
.gm-lead .ph { font-variant-numeric: tabular-nums; color: rgba(255,255,255,.75); font-size: 12.5px; }
.gm-lead .del { color: rgba(255,255,255,.4); padding: 4px 6px; }
.gm-lead .del:hover { color: #fff; }
.gm-board { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.gm-climber { display: flex; align-items: center; gap: 12px; }
.gm-climber .bar { flex: 1; height: 8px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; }
.gm-climber .bar i { display: block; height: 100%; background: linear-gradient(90deg, #6f8fd6, #fff); border-radius: 999px; }
.gm-climber .nm { width: 96px; font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-climber .alt { width: 74px; text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; color: rgba(255,255,255,.7); }
.gm-climber.me .nm { color: #ffb3a6; }
.gm-rules { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gm-rule { background: rgba(0,0,0,.22); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; line-height: 1.4; color: rgba(255,255,255,.75); }
.gm-rule b { display: block; color: #fff; font-size: 13px; margin-bottom: 2px; }
.gm-err { margin-top: 10px; color: #ffb3a6; font-size: 13px; }

/* ----- arena ----- */
.gm-hud-top { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 66px; right: 14px; display: flex; align-items: center; gap: 10px; }
.gm-stat { background: rgba(11,18,32,.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.gm-stat .big { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.gm-stat .streak i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.2); margin-left: 3px; }
.gm-stat .streak i.on { background: #ffd36e; box-shadow: 0 0 8px #ffd36e; }
.gm-hud-top .spacer { flex: 1; }
.gm-mute { width: 36px; height: 36px; border-radius: 50%; background: rgba(11,18,32,.5); border: 1px solid rgba(255,255,255,.12); display: grid; place-items: center; font-size: 14px; }

.gm-call {
  position: absolute; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  background: rgba(11,18,32,.62); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,.12); border-radius: 22px; padding: 14px 16px;
  animation: gm-up .4s cubic-bezier(.2,.8,.25,1) both;
}
@keyframes gm-up { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.gm-call .top { display: flex; align-items: center; gap: 12px; }
.gm-call .who { flex: 1; min-width: 0; }
.gm-call .who b { display: block; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-call .who span { font-size: 12.5px; color: rgba(255,255,255,.6); }
.gm-call .state { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.1); white-space: nowrap; }
.gm-call .state.live { background: var(--green); color: #fff; }
.gm-call .state.ring { background: #4f76c9; color: #fff; animation: gm-pulse 1.1s ease-in-out infinite; }
.gm-call .state.wait { background: #a97812; color: #fff; }
@keyframes gm-pulse { 50% { opacity: .55; } }
.gm-call .timer { font-family: var(--serif); font-size: 26px; font-variant-numeric: tabular-nums; min-width: 66px; text-align: right; }
.gm-call .acts { margin-top: 12px; display: flex; gap: 8px; }
.gm-call .acts .gm-btn { flex: 1; }
.gm-count { margin-top: 10px; font-size: 13px; color: rgba(255,255,255,.7); text-align: center; }
.gm-count b { color: #fff; }
.gm-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.1); }
.gm-prog i { display: block; height: 100%; background: var(--red); transition: width .4s ease; }

/* speech bubbles */
.gm-bubble {
  position: absolute; max-width: min(78vw, 360px); transform: translate(-50%, -100%);
  background: #fffdfa; color: #17130f; border-radius: 18px; padding: 12px 16px; font-size: 15px; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em;
  box-shadow: 0 16px 40px -14px rgba(0,0,0,.6); animation: gm-pop .28s cubic-bezier(.2,.9,.3,1.3) both;
}
.gm-bubble::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 18px; height: 18px; background: #fffdfa; transform: translateX(-50%) rotate(45deg); border-radius: 3px; }
.gm-bubble.roast { background: #17130f; color: #fffdfa; } .gm-bubble.roast::after { background: #17130f; }
.gm-bubble.hype { background: var(--red); color: #fff; } .gm-bubble.hype::after { background: var(--red); }
.gm-bubble.question { background: #fff4d6; color: #17130f; } .gm-bubble.question::after { background: #fff4d6; }
.gm-bubble .more { display: block; margin-top: 6px; font-size: 11px; font-weight: 700; opacity: .5; letter-spacing: .06em; text-transform: uppercase; }
@keyframes gm-pop { from { transform: translate(-50%, -100%) scale(.7); opacity: 0; } to { transform: translate(-50%, -100%) scale(1); opacity: 1; } }

/* score toast in the middle */
.gm-score {
  position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); text-align: center; pointer-events: none;
  animation: gm-score 2.4s cubic-bezier(.2,.8,.25,1) both;
}
.gm-score .n { font-family: var(--serif); font-size: clamp(56px, 14vw, 110px); font-weight: 600; letter-spacing: -0.03em; line-height: 1; text-shadow: 0 10px 40px rgba(0,0,0,.5); }
.gm-score .n.up { color: #b8ffd0; } .gm-score .n.down { color: #ffb3a6; }
.gm-score .l { margin-top: 6px; font-size: 14px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; text-shadow: 0 4px 20px rgba(0,0,0,.6); }
@keyframes gm-score { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.8); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70%); } }

/* ghost markers at the screen edge */
.gm-mark { position: absolute; transform: translate(-50%, -50%); font-size: 12px; font-weight: 800; background: rgba(11,18,32,.6); border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: 5px 11px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); white-space: nowrap; }

/* summit + results */
.gm-summit { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; background: radial-gradient(60rem 40rem at 50% 40%, rgba(255,211,110,.35), transparent 60%); animation: gm-fade .6s both; }
.gm-summit h2 { font-size: clamp(48px, 12vw, 96px); font-weight: 900; letter-spacing: -0.04em; line-height: .95; text-shadow: 0 20px 60px rgba(0,0,0,.5); }
.gm-summit h2 em { font-family: var(--serif); font-style: italic; font-weight: 500; color: #ffd36e; }
.gm-summit p { margin-top: 14px; font-size: 16px; color: rgba(255,255,255,.85); }
@keyframes gm-fade { from { opacity: 0; } }
.gm-results { position: absolute; inset: 0; overflow-y: auto; background: linear-gradient(180deg, rgba(11,18,32,.3), rgba(11,18,32,.95) 60%); }
.gm-results-in { max-width: 520px; margin: 0 auto; padding: max(80px, calc(env(safe-area-inset-top) + 66px)) 20px 60px; text-align: center; }
.gm-results h2 { font-size: clamp(44px, 11vw, 80px); font-weight: 900; letter-spacing: -0.04em; line-height: .95; }
.gm-results h2 em { font-family: var(--serif); font-style: italic; font-weight: 500; color: var(--red); }
.gm-grid { margin-top: 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gm-grid div { background: rgba(255,253,250,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 16px; padding: 14px 8px; }
.gm-grid .v { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.gm-grid .k { margin-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.55); }

.gm-pause { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(11,18,32,.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.gm-pause .in { text-align: center; }
.gm-pause h2 { font-size: 40px; font-weight: 900; letter-spacing: -0.03em; }
.gm-pause p { margin-top: 8px; color: rgba(255,255,255,.7); }
.gm-pause .row { margin-top: 20px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.gm-loading { position: absolute; inset: 0; display: grid; place-items: center; background: #0b1220; color: rgba(255,255,255,.7); font-size: 14px; }
.gm-loading .lockup { font-size: 44px; color: #fff; margin-bottom: 14px; }
.gm-loading .bar { width: 180px; height: 3px; background: rgba(255,255,255,.12); border-radius: 999px; overflow: hidden; margin-top: 14px; }
.gm-loading .bar i { display: block; width: 40%; height: 100%; background: var(--red); animation: gm-load 1.1s ease-in-out infinite; }
@keyframes gm-load { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

@media (max-width: 640px) {
  .gm-hud-top { left: 62px; gap: 6px; }
  .gm-stat { padding: 7px 11px; font-size: 12px; }
  .gm-stat .big { font-size: 16px; }
  .gm-call .who b { font-size: 15px; }
  .gm-call .timer { font-size: 22px; }
  .gm-rules { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .gm-bubble, .gm-call, .gm-score { animation: none; }
}

/* somebody else on the mountain just moved */
.gm-notice {
  position: absolute; left: 50%; top: calc(max(14px, env(safe-area-inset-top)) + 52px); transform: translateX(-50%);
  background: rgba(11,18,32,.72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 700; white-space: nowrap;
  animation: gm-pop-in .35s cubic-bezier(.2,.9,.3,1.2) both;
}
.gm-notice.good { border-color: rgba(184,255,208,.45); color: #b8ffd0; }
.gm-notice.bad { border-color: rgba(255,179,166,.45); color: #ffb3a6; }
@keyframes gm-pop-in { from { transform: translateX(-50%) translateY(-8px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.gm-mark.live i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #5ee38f; margin-right: 6px; box-shadow: 0 0 8px #5ee38f; animation: gm-pulse 1.2s ease-in-out infinite; }

/* what we know about the number he's about to dial */
.gm-call .info { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; line-height: 1.4; }
.gm-call .info .note { color: #ffd36e; font-weight: 600; }
.gm-call .info .hist { color: rgba(255,255,255,.7); }
.gm-call .info .hist b { color: #fff; text-transform: capitalize; }
.gm-call .info .tldr { color: rgba(255,255,255,.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* a verdict arriving while he's already on the next call */
.gm-verdict {
  position: absolute; left: 12px; right: 12px; bottom: calc(150px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px;
  background: rgba(11,18,32,.7); border: 1px solid rgba(255,255,255,.14); font-size: 13px;
  animation: gm-up .35s cubic-bezier(.2,.8,.25,1) both;
}
.gm-verdict b { font-size: 14px; }
.gm-verdict span { color: rgba(255,255,255,.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-verdict .cap { margin-left: auto; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.12); white-space: nowrap; }
.gm-verdict.up .cap { background: var(--green); } .gm-verdict.down .cap { background: var(--red); }
/* the screen bleeds at the edges when the creature lands one */
.gm-blood { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(70% 70% at 50% 50%, transparent 55%, rgba(150,10,25,.85) 100%); animation: gm-bleed .55s ease-out both; }
@keyframes gm-bleed { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }
.gm-wait { margin-top: 10px; font-size: 13px; color: rgba(255,255,255,.7); text-align: center; }
/* phones: blur over a canvas that repaints every frame is the single most expensive thing on screen */
@media (pointer: coarse) {
  .gm-x, .gm-btn.quiet, .gm-card, .gm-stat, .gm-mute, .gm-call, .gm-notice, .gm-mark, .gm-verdict { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .gm-call { background: rgba(11,18,32,.86); }
  .gm-stat, .gm-mark, .gm-notice, .gm-verdict { background: rgba(11,18,32,.78); }
  .gm-card { background: rgba(20,28,44,.9); }
}
