/* The Node Runner — HUD & overlay styling.
   Palette: orange #f7931a, black/greys, white.

   Layout strategy:
   - Desktop: fixed-ish 960x540 stage, centred, with a hint line below.
   - Mobile (small screens): the stage fills the whole viewport and the
     canvas view adapts to the screen aspect (see Game.resize in main.js).
*/

:root {
  --btc-orange: #f7931a;
  --bg-dark: #0d0f12;
  --panel: #191c21;
  --grey: #8b929c;
  --white: #f2f2f2;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--white);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

#game-wrap {
  position: relative;
  /* Fit inside the window while keeping 16:9, up to the 960px design size. */
  width: min(960px, 100vw, calc(100dvh * 1.7778));
  aspect-ratio: 16 / 9;
  box-shadow: 0 0 40px rgba(247, 147, 26, 0.15);
  border: 2px solid #2a2e35;
  border-radius: 6px;
  overflow: hidden;
  touch-action: none;            /* the game owns all touches on the stage */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #14161a;
  touch-action: none;
}

#controls-hint {
  color: var(--grey);
  font-size: 13px;
  margin-top: 10px;
}

.hidden { display: none !important; }

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

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none; /* HUD never blocks gameplay input */
  font-size: 13px;
}

#xp-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: rgba(0, 0, 0, 0.6);
}
#xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f7931a, #ffc46b);
  transition: width 0.15s linear;
}

#top-left { position: absolute; top: 16px; left: 12px; }

#hp-bar {
  position: relative;
  width: 200px; height: 18px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid #333;
  border-radius: 4px;
  overflow: hidden;
}
#hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #d9482b, #f7931a);
}
#hp-text {
  position: absolute;
  inset: 0;
  text-align: center;
  line-height: 18px;
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 1px 2px #000;
}

#stats-line { margin-top: 6px; display: flex; gap: 12px; text-shadow: 0 1px 3px #000; }
#stats-line span { background: rgba(0,0,0,0.5); padding: 2px 8px; border-radius: 4px; }
#wave-text { color: var(--btc-orange); font-weight: 700; }
#sats-text { color: #ffc46b; }

#loadout {
  position: absolute;
  left: 12px; bottom: 10px;
  display: flex;
  gap: 18px;
  text-shadow: 0 1px 3px #000;
}
.loadout-title { color: var(--grey); font-size: 10px; letter-spacing: 1px; margin-bottom: 2px; }
#loadout ul { list-style: none; margin: 0; padding: 0; }
#loadout li { background: rgba(0,0,0,0.5); border-radius: 3px; padding: 1px 6px; margin-bottom: 2px; }
#loadout .lv { color: var(--btc-orange); font-weight: 700; }

/* ---------- Pause button ---------- */

#pause-btn {
  position: absolute;
  top: 14px; right: 12px;
  z-index: 5;
  width: 42px; height: 42px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--white);
  border: 1px solid #3a3f46;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  touch-action: manipulation;
}
#pause-btn:hover { border-color: var(--btc-orange); }

/* ---------- Touch joystick ---------- */

#joy-base, #joy-knob {
  position: fixed;            /* placed at the raw touch coordinates */
  z-index: 20;
  pointer-events: none;       /* never steals the touch it visualises */
  transform: translate(-50%, -50%);
  border-radius: 50%;
}
#joy-base {
  width: 110px; height: 110px;
  border: 2px solid rgba(247, 147, 26, 0.45);
  background: rgba(0, 0, 0, 0.25);
}
#joy-knob {
  width: 46px; height: 46px;
  background: rgba(247, 147, 26, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.4);
}

/* ---------- Overlays ---------- */

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 11, 14, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 10;
  overflow-y: auto;
}
.overlay.hidden { display: none; }
.overlay h2 { font-size: 34px; margin: 0 0 4px; letter-spacing: 2px; }
.overlay .subtitle { color: var(--grey); margin: 0 0 22px; }
.accent { color: var(--btc-orange); }

#cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  padding: 0 10px;
}

.card {
  width: 180px;
  background: var(--panel);
  border: 2px solid #333;
  border-radius: 10px;
  padding: 16px 12px;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--btc-orange);
  box-shadow: 0 6px 18px rgba(247, 147, 26, 0.25);
}
.card .icon { font-size: 34px; }
.card h3 { font-size: 15px; margin: 8px 0 4px; }
.card .badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 8px;
  margin-bottom: 8px;
}
.card .badge.new { background: var(--btc-orange); color: #000; }
.card .badge.up { background: #2f3540; color: var(--white); }
.card p { font-size: 12px; color: var(--grey); margin: 0; line-height: 1.4; }

#go-stats { color: var(--grey); margin-bottom: 24px; line-height: 1.8; }
#go-stats b { color: var(--white); }

/* Title screen: lighter dim so the arena background reads through. */
#title { background: rgba(10, 11, 14, 0.45); }
#title h2 { font-size: 44px; text-shadow: 0 2px 12px #000; }
#title .subtitle { text-shadow: 0 1px 6px #000; margin-bottom: 30px; }

#start-btn {
  background: var(--btc-orange);
  color: #000;
  border: none;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 14px 44px;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}
#start-btn:hover:not(:disabled) { background: #ffa940; }
#start-btn:disabled {
  background: #3a3f46;
  color: var(--grey);
  cursor: default;
}

#restart-btn {
  background: var(--btc-orange);
  color: #000;
  border: none;
  font-size: 15px;
  font-weight: 700;
  padding: 14px 26px;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}
#restart-btn:hover { background: #ffa940; }

/* ---------- THE BITCOIN ALMANAC ---------- */
/* Ancient-library-meets-cyberpunk: dark parchment panel, orange rubric,
   monospace glitch for the not-yet-earned knowledge. */

#almanac-btn {
  position: absolute;
  top: 62px; right: 12px;
  z-index: 5;
  width: 42px; height: 42px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid #3a3f46;
  font-size: 18px;
  cursor: pointer;
  touch-action: manipulation;
}
#almanac-btn:hover { border-color: var(--btc-orange); }

#almanac { background: rgba(8, 9, 12, 0.92); z-index: 15; padding: 14px; }

#almanac-panel {
  width: min(680px, 100%);
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #16181d, #101216);
  border: 1px solid #3a3f46;
  border-radius: 12px;
  overflow: hidden;
  text-align: left;
  box-shadow: 0 0 60px rgba(247, 147, 26, 0.12);
}

#almanac-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #2a2e35;
}
#almanac-header h2 { font-size: 18px; margin: 0; letter-spacing: 3px; }
#almanac-close {
  background: none;
  border: 1px solid #3a3f46;
  color: var(--white);
  width: 32px; height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
#almanac-close:hover { border-color: var(--btc-orange); color: var(--btc-orange); }

#almanac-tabs { display: flex; border-bottom: 1px solid #2a2e35; }
#almanac-tabs button {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--grey);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 10px 4px;
  cursor: pointer;
}
#almanac-tabs button.active { color: var(--btc-orange); border-bottom-color: var(--btc-orange); }

#almanac-list, #almanac-detail { overflow-y: auto; flex: 1; padding: 8px 14px 14px; }

.alm-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 6px;
  border-bottom: 1px solid #22252b;
  cursor: pointer;
}
.alm-row:hover:not(.locked) { background: rgba(247, 147, 26, 0.06); }
.alm-row.locked { opacity: 0.55; cursor: default; }

.alm-icon {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  background: #1c1f26;
  border: 1px solid #2a2e35;
  border-radius: 8px;
  flex-shrink: 0;
}
.alm-main { flex: 1; min-width: 0; }
.alm-name { font-size: 14px; font-weight: 700; }
.alm-sub { font-size: 11px; color: var(--grey); margin: 2px 0 4px; }
.alm-status { font-size: 11px; color: var(--btc-orange); font-weight: 700; white-space: nowrap; }

.alm-bar {
  height: 5px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 3px;
  overflow: hidden;
}
.alm-bar-fill { height: 100%; background: linear-gradient(90deg, #f7931a, #ffc46b); }

#almanac-back {
  background: none;
  border: none;
  color: var(--btc-orange);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0 10px;
}

.alm-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 10px; }
.alm-portrait {
  width: 72px; height: 72px;
  object-fit: contain;
  background: #1c1f26;
  border: 1px solid #2a2e35;
  border-radius: 10px;
  flex-shrink: 0;
}
.alm-detail-name { font-size: 18px; font-weight: 700; }
.alm-detail-sub { font-size: 12px; color: var(--grey); font-style: italic; margin: 2px 0 6px; }
.alm-detail-status, .alm-detail-counters { font-size: 12px; color: var(--grey); margin-top: 2px; }
.alm-detail-status b, .alm-detail-counters b { color: var(--btc-orange); }

.alm-progress-line { font-size: 12px; color: var(--grey); margin: 10px 0 4px; }
.alm-progress-line.complete { color: var(--btc-orange); font-weight: 700; }

.lore-p {
  margin: 10px 0;
  padding: 10px 12px;
  background: #1a1d23;
  border-left: 3px solid var(--btc-orange);
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  line-height: 1.55;
}
.lore-p.meme { border-left-color: #6b7280; }
.lore-p.locked { border-left-color: #33363c; }

.lore-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 1px 7px;
  border-radius: 6px;
  margin-right: 7px;
  vertical-align: 1px;
}
.badge-fact { background: #2f3540; color: #ffc46b; }
.badge-meme { background: #2a2d33; color: #b9c0ca; }

.lore-locked {
  color: #565b64;
  font-family: monospace;
  letter-spacing: 3px;
  user-select: none;
  animation: alm-glitch 1.8s infinite;
  display: inline-block;
}
@keyframes alm-glitch {
  0%, 100% { opacity: 0.6; transform: translateX(0); }
  25%      { opacity: 0.35; transform: translateX(1px); }
  50%      { opacity: 0.55; transform: translateX(0); }
  75%      { opacity: 0.3; transform: translateX(-1px); }
}
.lore-req { font-size: 10px; color: #565b64; margin-top: 6px; }

/* Unlock toasts — quiet, bottom-right, never block play */
#toasts {
  position: absolute;
  right: 10px;
  bottom: 54px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 8;
  pointer-events: none;
  align-items: flex-end;
}
.toast {
  background: rgba(20, 22, 27, 0.94);
  border: 1px solid var(--btc-orange);
  color: var(--white);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  animation: toast-out 0.5s ease 3.4s forwards;
  max-width: 320px;
}
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Mobile: fill the whole screen ---------- */

@media (max-width: 700px), (max-height: 520px) {
  body { display: block; overflow: hidden; }

  #game-wrap {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    aspect-ratio: auto;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  #controls-hint { display: none; }

  /* Respect notches / rounded corners. */
  #top-left {
    top: calc(12px + env(safe-area-inset-top));
    left: calc(10px + env(safe-area-inset-left));
  }
  #pause-btn {
    top: calc(10px + env(safe-area-inset-top));
    right: calc(10px + env(safe-area-inset-right));
  }
  #almanac-btn {
    top: calc(58px + env(safe-area-inset-top));
    right: calc(10px + env(safe-area-inset-right));
  }
  #almanac { padding: 8px; }
  #loadout {
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: calc(10px + env(safe-area-inset-left));
    font-size: 11px;
    gap: 10px;
  }
  #hp-bar { width: 150px; }

  .overlay h2 { font-size: 24px; }
  #title h2 { font-size: 30px; }
  .overlay .subtitle { margin-bottom: 14px; }
  .card { width: 150px; padding: 12px 10px; }
  .card .icon { font-size: 28px; }
}

/* ============================================================
   ONLINE LAYER — account, leaderboard, my-stats, game-over save
   ============================================================ */

.ghost-btn {
  background: transparent;
  color: var(--btc-orange);
  border: 1px solid var(--btc-orange);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  margin-top: 10px;
}
.ghost-btn:hover { background: rgba(247,147,26,0.12); }

/* ---- account area (title screen) ---- */
#account-area { margin-top: 16px; width: min(360px, 88vw); }
.acct-btn {
  background: var(--btc-orange); color: #000; border: none;
  font-size: 14px; font-weight: 700; padding: 10px 18px; border-radius: 8px;
  cursor: pointer; touch-action: manipulation; width: 100%;
}
.acct-btn:hover:not(:disabled) { background: #ffa940; }
.acct-btn:disabled { background: #3a3f46; color: var(--grey); cursor: default; }
.acct-btn-sm {
  background: #2a2e35; color: var(--white); border: 1px solid #3a3f46;
  font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 6px; cursor: pointer;
}
.acct-btn-sm:hover { border-color: var(--btc-orange); }
.acct-note { font-size: 11px; color: var(--grey); margin-top: 6px; line-height: 1.4; }
.acct-note.ok { color: #7bc47f; }
.acct-note.dim { color: #6a707a; }
.acct-chip {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  background: rgba(0,0,0,0.4); border: 1px solid #2a2e35; border-radius: 10px; padding: 6px 10px;
}
.acct-pic { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.acct-pic-ph { display: inline-flex; align-items: center; justify-content: center; background: #2a2e35; }
.acct-name { font-weight: 700; font-size: 13px; flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-manual { margin-top: 10px; text-align: left; }
.acct-manual summary { font-size: 12px; color: var(--grey); cursor: pointer; }
.acct-manual-row { display: flex; gap: 6px; margin-top: 6px; }
.acct-manual-row input {
  flex: 1; background: #14161a; border: 1px solid #2a2e35; border-radius: 6px;
  color: var(--white); font-size: 12px; padding: 6px 8px;
}

/* ---- leaderboard panel ---- */
#leaderboard { background: rgba(8,9,12,0.92); z-index: 15; padding: 14px; }
#lb-panel {
  width: min(760px, 100%); height: 100%; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #16181d, #101216);
  border: 1px solid #3a3f46; border-radius: 12px; overflow: hidden; text-align: left;
}
#lb-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #2a2e35; }
#lb-header h2 { font-size: 18px; margin: 0; letter-spacing: 2px; }
#lb-header > div { display: flex; gap: 8px; align-items: center; }
#lb-close { background: none; border: 1px solid #3a3f46; color: var(--white); width: 32px; height: 32px; border-radius: 6px; cursor: pointer; }
#lb-close:hover { border-color: var(--btc-orange); color: var(--btc-orange); }

#lb-mystats { padding: 12px 16px; border-bottom: 1px solid #2a2e35; }
.lb-mystats-anon { font-size: 12px; color: var(--grey); }
.lb-mystats-head { font-size: 12px; color: var(--btc-orange); font-weight: 700; letter-spacing: 1px; margin-bottom: 8px; }
.lb-mystats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lb-mystats-grid > div { background: #1a1d23; border-radius: 6px; padding: 6px 8px; }
.lb-mystats-grid span { display: block; font-size: 10px; color: var(--grey); }
.lb-mystats-grid b { font-size: 14px; color: var(--white); }
.lb-mystats-bd { margin-top: 10px; display: grid; grid-template-columns: repeat(2,1fr); gap: 2px 16px; }

#lb-list { flex: 1; overflow-y: auto; padding: 6px 10px; }
.lb-row { display: grid; grid-template-columns: 32px 1.6fr 1.1fr 48px 0.9fr 0.9fr 1fr; gap: 6px; align-items: center; padding: 8px 6px; border-bottom: 1px solid #22252b; font-size: 12px; }
.lb-row.lb-head { color: var(--grey); font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase; position: sticky; top: 0; background: #14161a; }
.lb-rank { color: var(--btc-orange); font-weight: 700; }
.lb-name { display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-pic { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.lb-sats { color: #ffc46b; font-weight: 700; }
.lb-clickable { cursor: pointer; color: var(--btc-orange); }
.lb-clickable:hover { text-decoration: underline; }
.lb-breakdown { background: #14161a; border-left: 2px solid var(--btc-orange); margin: 0 0 4px 32px; padding: 6px 10px; }
.lb-breakdown.hidden { display: none; }
.lb-bd-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--grey); padding: 1px 0; }
.lb-bd-empty { font-size: 11px; color: #565b64; }
.lb-empty { text-align: center; color: var(--grey); padding: 30px 10px; font-size: 13px; }
.lb-disclaimer { font-size: 10px; color: #565b64; text-align: center; padding: 8px; margin: 0; border-top: 1px solid #2a2e35; }

/* ---- game-over save block ---- */
#go-account { margin: 4px 0 16px; min-height: 20px; width: min(420px, 90vw); }
.go-save { background: rgba(0,0,0,0.35); border: 1px solid #2a2e35; border-radius: 10px; padding: 12px; }
.go-save.ok { border-color: #3f7a44; }
.go-save.flagged { border-color: #7a3f3f; }
.go-save.anon { border-color: #3a3f46; }
.go-save-sats { font-weight: 700; color: var(--white); margin-bottom: 4px; }
.go-save-msg { font-size: 12px; color: var(--grey); margin-bottom: 10px; }
.go-save .acct-btn { width: auto; padding: 8px 16px; }
.go-buttons { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.go-buttons .ghost-btn { margin-top: 0; }

@media (max-width: 700px), (max-height: 520px) {
  .lb-row { grid-template-columns: 26px 1.4fr 1fr 36px 0.8fr; font-size: 11px; }
  .lb-best, .lb-date, .lb-head .lb-best, .lb-head .lb-date { display: none; }
  .lb-mystats-grid { grid-template-columns: repeat(2, 1fr); }
  #account-area { width: 88vw; }
}

/* ============================================================
   POWER-UP TIERS — the equipped weapon/supply rows level up their
   own look: Lv3-4 = "hot" (bigger + glow), Lv5 = "max" (epic shimmer).
   Uses em so it scales on both desktop and mobile loadout sizes.
   ============================================================ */
#loadout li.pu-hot {
  font-size: 1.06em;
  background: rgba(247, 147, 26, 0.18);
  border: 1px solid rgba(247, 147, 26, 0.55);
  box-shadow: 0 0 7px rgba(247, 147, 26, 0.35);
  padding: 2px 7px;
}
#loadout li.pu-hot .lv { color: #ffc46b; }

#loadout li.pu-max {
  font-size: 1.14em;
  font-weight: 700;
  padding: 2px 9px 2px 8px;
  color: #fff;
  background: linear-gradient(90deg,
    rgba(247, 147, 26, 0.30), rgba(255, 214, 140, 0.55),
    rgba(247, 147, 26, 0.30));
  background-size: 220% 100%;
  border: 1px solid #ffd98a;
  border-radius: 4px;
  box-shadow: 0 0 12px rgba(247, 147, 26, 0.7), inset 0 0 6px rgba(255, 217, 138, 0.4);
  text-shadow: 0 0 6px rgba(255, 196, 107, 0.85);
  animation: pu-shimmer 2.4s linear infinite;
}
#loadout li.pu-max::after { content: ' \2726'; color: #ffe8be; } /* ✦ */
#loadout li.pu-max .lv {
  color: #241a06;
  background: #ffd98a;
  padding: 0 5px;
  margin-left: 2px;
  border-radius: 6px;
  font-size: 0.82em;
  letter-spacing: 0.5px;
  text-shadow: none;
}
@keyframes pu-shimmer {
  0%   { background-position: 220% 0; }
  100% { background-position: -220% 0; }
}
@media (prefers-reduced-motion: reduce) {
  #loadout li.pu-max { animation: none; }
}

/* ============================================================
   CONNECT-WITH-NOSTR MODAL (extension or mobile signer / NIP-46)
   ============================================================ */
#connect-modal { background: rgba(8, 9, 12, 0.92); z-index: 30; padding: 14px; }
#connect-panel {
  width: min(430px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: linear-gradient(180deg, #16181d, #101216);
  border: 1px solid #3a3f46;
  border-radius: 12px;
  text-align: left;
}
#connect-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #2a2e35; }
#connect-header h2 { font-size: 17px; margin: 0; letter-spacing: 2px; }
#connect-close { background: none; border: 1px solid #3a3f46; color: var(--white); width: 32px; height: 32px; border-radius: 6px; cursor: pointer; }
#connect-close:hover { border-color: var(--btc-orange); color: var(--btc-orange); }
#connect-body { padding: 14px 16px 18px; }

.cn-lead { font-size: 12.5px; color: var(--grey); line-height: 1.5; margin: 0 0 12px; }
.cn-options { display: flex; flex-direction: column; gap: 10px; }
.cn-option {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: #1a1d23; border: 1px solid #2a2e35; border-radius: 10px;
  color: var(--white); padding: 12px; cursor: pointer; text-align: left;
}
.cn-option:hover { border-color: var(--btc-orange); }
.cn-option.cn-dim { opacity: 0.55; }
.cn-opt-icon { font-size: 24px; }
.cn-opt-main b { display: block; font-size: 14px; }
.cn-opt-main small { color: var(--grey); font-size: 11px; }

.cn-back { background: none; border: none; color: var(--btc-orange); font-weight: 700; font-size: 13px; cursor: pointer; padding: 0 0 10px; }
.cn-qr { background: #fff; border-radius: 10px; padding: 8px; width: fit-content; margin: 0 auto 12px; line-height: 0; }
.cn-qr svg { display: block; width: 200px; height: 200px; }
.cn-qr-fail { color: #333; font-size: 12px; padding: 20px; }
.cn-actions { display: flex; gap: 8px; align-items: center; justify-content: center; margin-bottom: 12px; flex-wrap: wrap; }
.cn-deeplink { text-decoration: none; text-align: center; width: auto; display: inline-block; }
.cn-status { font-size: 12px; color: var(--grey); text-align: center; min-height: 18px; margin-bottom: 10px; }
.cn-spin {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid #3a3f46; border-top-color: var(--btc-orange);
  animation: cn-rot 0.9s linear infinite; vertical-align: -1px; margin-right: 4px;
}
@keyframes cn-rot { to { transform: rotate(360deg); } }
.cn-bunker summary { font-size: 12px; color: var(--grey); cursor: pointer; }
.cn-bunker-row { display: flex; gap: 6px; margin-top: 8px; }
.cn-bunker-row input {
  flex: 1; background: #14161a; border: 1px solid #2a2e35; border-radius: 6px;
  color: var(--white); font-size: 12px; padding: 7px 8px;
}

/* ---------- Creator credit ---------- */
.creator-credit { font-size: 11px; color: #6a707a; margin: 6px 0 0; }
.creator-credit a { color: var(--btc-orange); text-decoration: none; }
.creator-credit a:hover { text-decoration: underline; }
#title-credit { margin-top: 10px; text-shadow: 0 1px 4px #000; pointer-events: auto; }

/* ---------- Audio settings (🔊 button + popover) ---------- */
#audio-btn {
  position: absolute;
  top: 110px; right: 12px;
  z-index: 5;
  width: 42px; height: 42px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid #3a3f46;
  font-size: 17px;
  cursor: pointer;
  touch-action: manipulation;
}
#audio-btn:hover { border-color: var(--btc-orange); }

#audio-panel {
  position: absolute;
  top: 110px; right: 60px;
  z-index: 8;
  width: 190px;
  background: linear-gradient(180deg, #16181d, #101216);
  border: 1px solid #3a3f46;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
}
.ap-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: var(--grey); }
.ap-row input[type="range"] { flex: 1; accent-color: var(--btc-orange); min-width: 0; }
.ap-test { width: 100%; }

@media (max-width: 700px), (max-height: 520px) {
  #audio-btn { top: calc(106px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); }
  #audio-panel { top: calc(106px + env(safe-area-inset-top)); right: calc(58px + env(safe-area-inset-right)); }
}
