/* ================================
   Global Styles — Crypto City Pre-Alpha
   ================================ */

   :root {
    --bg: #0f1724;
    --card: #0b1220;
    --accent: #06b6d4;
    --muted: #94a3b8;
    --good: #10b981;
    --bad: #ef4444;
  }
  
  /* Basic layout */
  body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    background: linear-gradient(180deg, #071021 0%, #08142a 100%);
    color: #e6eef6;
    margin: 0;
    padding: 18px;
  }
  
  /* Cards / panels */
  .card {
    background: var(--card);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(2, 6, 23, .6);
  }
  
  button {
    background: var(--accent);
    color: #04202a;
    border: 0;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
  }
  button:hover { filter: brightness(1.1); }
  
  /* --- Modal --- */
  .modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
  }
  .modal-content {
    background: #0b1220;
    padding: 24px 32px;
    border-radius: 12px;
    max-width: 420px;
    color: #e6eef6;
    text-align: center;
    box-shadow: 0 0 18px rgba(0,0,0,0.6);
  }
  
  /* --- Feedback button --- */
  #suggestBtn {
    position: fixed;
    bottom: 18px;
    right: 18px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #06b6d4;
    color: #0b1220;
    border: none;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  }
  #suggestBtn:hover { background: #0ea5e9; }
  
  /* Tooltip look on hover for Pre-Alpha title */
  #gameTitle {
    cursor: help;
    color: var(--accent);
    display: inline-block;
    text-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
  }
  :root{--bg:#0f1724;--card:#0b1220;--accent:#06b6d4;--muted:#94a3b8;--good:#10b981;--bad:#ef4444}
  body{font-family:Inter,ui-sans-serif,system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; background:linear-gradient(180deg,#071021 0%, #08142a 100%); color:#e6eef6; margin:0; padding:18px}
  .wrap{max-width:1200px;margin:0 auto;display:grid;grid-template-columns:360px 1fr;gap:20px}
  .card{background:var(--card);padding:16px;border-radius:12px;box-shadow:0 6px 18px rgba(2,6,23,.6);}
  h1{margin:0 0 8px;font-size:20px}
  .small{color:var(--muted);font-size:13px}
  .balance{font-size:26px;margin:8px 0 2px}
  .sub{color:var(--muted);font-size:13px}
  button{background:var(--accent);color:#04202a;border:0;padding:8px 12px;border-radius:8px;cursor:pointer;font-weight:600}
  .muted-btn{background:transparent;border:1px solid rgba(255,255,255,0.06);color:var(--muted);padding:6px 10px;border-radius:8px}
  .row{display:flex;gap:8px;align-items:center}
  label{display:block;margin-top:8px;font-size:13px;color:var(--muted)}
  input[type=number]{width:100%;padding:8px;border-radius:8px;border:1px solid rgba(255,255,255,0.04);background:transparent;color:inherit}
  .market-list{display:grid;grid-template-columns:1fr;gap:10px;margin-top:10px}
  .item{display:flex;align-items:center;justify-content:space-between;padding:10px;background:linear-gradient(180deg, rgba(255,255,255,0.01), transparent);border-radius:8px}
  .hud{display:flex;flex-direction:column;gap:8px}
  .inventory{margin-top:10px}
  .log{height:120px;overflow:auto;background:rgba(255,255,255,0.02);padding:8px;border-radius:8px;font-size:13px}
  footer{margin-top:20px;color:var(--muted);font-size:13px;text-align:center}
  .grid-2{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .big-btn{padding:12px 14px;font-size:16px}
  .arena-canvas{background:#061320;border-radius:10px;display:block;margin:0 auto;}
  .center{display:flex;align-items:center;justify-content:center}
  .controls{font-size:13px;color:var(--muted);margin-top:8px}
  .toggle-row{display:flex;align-items:center;gap:8px;margin-top:8px}
  .ability-pill{display:inline-block;padding:6px 8px;border-radius:8px;background:rgba(255,255,255,0.02);font-size:12px;margin-left:6px}
  /* --- Modal (Intro) --- */
.modal {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.7);
display: flex;
justify-content: center;
align-items: center;
z-index: 999;
}
.modal-content {
background: #0b1220;
padding: 24px 32px;
border-radius: 12px;
width: 92%;
max-width: 420px;
max-height: 90vh;
overflow: auto;
box-sizing: border-box;
color: #e6eef6;
text-align: center;
box-shadow: 0 0 18px rgba(0,0,0,0.6);
}
/* Tighter padding on small screens so the auth/intro modal doesn't crowd. */
@media (max-width: 480px) {
  .modal-content { padding: 20px 16px; }
}
#suggestBtn {
position: fixed;
bottom: calc(18px + env(safe-area-inset-bottom));
right: calc(18px + env(safe-area-inset-right));
padding: 10px 14px;
border-radius: 8px;
background: #06b6d4;
color: #0b1220;
border: none;
cursor: pointer;
font-weight: 600;
box-shadow: 0 4px 10px rgba(0,0,0,0.3);
z-index: 50;
}
#suggestBtn:hover { background: #0ea5e9; }
/* Hide the floating feedback button while a match is on (set by arena.js). */
body.in-arena #suggestBtn { display: none !important; }

/* ── Header utility nav (Profile / Log / Leaderboard / Messages) ──
   Desktop: the original normal-size flex row (DOM order Profile, Log,
   Leaderboard, Messages). Phone: one row — Messages left, Profile centered,
   Log+Leaderboard right — with compact buttons. */
.hdr-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
/* Keep the original button size on desktop; only stop the flexbox from
   vertically stretching the buttons (align-self) and from wrapping a label. */
.hdr-nav .hb { white-space: nowrap; flex: 0 0 auto; align-self: center; }
@media (max-width: 768px) {
  .hdr-nav { flex-wrap: nowrap; gap: 6px; }
  .hdr-nav .hb { padding: 5px 8px; font-size: 0.72em; }
  .hdr-nav .hb.msg     { order: -1; }                              /* left  */
  .hdr-nav .hb.profile { order: 0; margin-left: auto; margin-right: auto; } /* centered */
  .hdr-nav .hb.nav-log { order: 1; }                              /* right */
  .hdr-nav .hb.leader  { order: 2; }                              /* right */
}
#gameTitle {
cursor: help;
color: var(--accent);
display: inline-block;
text-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
}
/* ================================
   Marketplace Item Tooltips
   ================================ */

/* Container that will show the tooltip */
.item-name {
  position: relative;
  cursor: help;
  color: var(--accent);
  text-shadow: 0 0 6px rgba(6,182,212,0.4);
}

/* Tooltip text box */
.item-name::after {
  content: attr(data-desc);
  position: absolute;
  left: 50%;
  top: 120%;
  transform: translateX(-50%);
  background: rgba(11,18,32,0.95);
  border: 1px solid rgba(6,182,212,0.3);
  color: #cfe9f3;
  font-size: 13px;
  line-height: 1.3;
  padding: 8px 10px;
  border-radius: 8px;
  width: max-content;
  max-width: 240px;
  white-space: normal;
  text-align: center;
  box-shadow: 0 0 12px rgba(6,182,212,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

/* Small glowing arrow under tooltip */
.item-name::before {
  content: "";
  position: absolute;
  top: 110%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(6,182,212,0.3) transparent transparent transparent;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Show on hover */
.item-name:hover::after,
.item-name:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(2px);
}

/* ================================
   Tooltip Fade / Rise Animation
   ================================ */

   @keyframes tooltipRise {
    0% {
      opacity: 0;
      transform: translate(-50%, 10px);
    }
    100% {
      opacity: 1;
      transform: translate(-50%, 0);
    }
  }
  
  .item-name::after {
    content: attr(data-desc);
    position: absolute;
    left: 50%;
    top: 120%;
    background: rgba(11,18,32,0.95);
    border: 1px solid rgba(6,182,212,0.3);
    color: #cfe9f3;
    font-size: 13px;
    line-height: 1.3;
    padding: 8px 10px;
    border-radius: 8px;
    width: max-content;
    max-width: 240px;
    white-space: normal;
    text-align: center;
    box-shadow: 0 0 12px rgba(6,182,212,0.4);
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    transform: translate(-50%, 10px);
    transition: opacity 0.2s ease;
  }
  
  /* small glowing arrow */
  .item-name::before {
    content: "";
    position: absolute;
    top: 110%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: rgba(6,182,212,0.3) transparent transparent transparent;
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  
  /* Hover = animate rise */
  .item-name:hover::after,
  .item-name:hover::before {
    opacity: 1;
    animation: tooltipRise 0.25s ease forwards;
  }
  



  /* ================================
   Mobile Controls
   ================================ */
#mobileControls {
  position: fixed;
  inset: 0;
  z-index: 110;
  pointer-events: none; /* container ignores clicks */
}

/* ✅ Let joystick and buttons be clickable */
#mobileControls > * {
  pointer-events: auto;
}


/* positions saved by JS; defaults: joystick left/bottom, actions right/bottom.
   Corner offsets respect the device safe-area (notch / home indicator). */
#moveStick {
  position: absolute;
  left: calc(20px + env(safe-area-inset-left));
  bottom: calc(24px + env(safe-area-inset-bottom));
  width: 120px; height: 120px;
  border-radius: 50%;
  border: 2px solid rgba(6,182,212,0.35);
  background: rgba(6,182,212,0.08);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  box-shadow: 0 4px 18px rgba(0,0,0,0.35);
  pointer-events: auto;
  touch-action: none;
}

#actionCluster {
  position: fixed;             /* full-screen overlay */
  inset: 0;                    /* take whole viewport */
  z-index: 111;
  pointer-events: none;        /* container itself ignores clicks */
}

/* Allow buttons inside to be interactive */
#actionCluster button.mobile-btn {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  visibility: visible;
}




.mobile-btn {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: rgba(6,182,212,0.14);
  color: var(--accent);
  border: 1px solid rgba(6,182,212,0.4);
  font-size: 19px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  box-shadow: 0 3px 12px rgba(0,0,0,0.3);
  transition: transform 0.05s ease, background 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.mobile-btn:active {
  transform: scale(0.92);
  background: rgba(6,182,212,0.34);
}

/* Caption under every touch control (R2) — "what does this button do" at a
   glance. Toggleable: settings → "Show names under buttons" adds .labels-off
   on #mobileControls. */
.mb-label {
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #7dd3fc;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  white-space: nowrap;
  pointer-events: none;
  line-height: 1;
}
#mobileControls.labels-off .mb-label { display: none; }

/* Visibility is driven by JS (shouldShowControls) so it works in forced
   landscape too; this stays as a sensible fallback for narrow screens. */
@media (max-width: 900px) {
  #mobileControls { display: block; }
}

/* drag “hint” when settings open */
.drag-outline {
  outline: 1px dashed rgba(6,182,212,0.4);
}


[data-edit-mode="false"] .joystick,
[data-edit-mode="false"] .mobile-btn {
  opacity: 1;
  pointer-events: auto;
}

[data-edit-mode="true"] .joystick,
[data-edit-mode="true"] .mobile-btn {
  cursor: move;
}


/* ================================
   Arena Canvas Fix (for mobile)
   ================================ */
/* ================================
   Arena Responsive Fix
   ================================ */
.arena-inner {
  width: 1200px;
  max-width: 95vw;
  height: 740px;
  max-height: 80vh;
  background: #071827;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  margin: 40px auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .arena-inner {
    width: 100vw;
    height: calc(100dvh - 80px);
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    border-radius: 0;
    padding: 6px;
  }

}

/* ===== Mobile polish (mobile audit) ===== */
@media (max-width: 768px) {
  body { padding: 8px; }
}

/* Ability bar: 6×56px slots overflow a 375px phone — let them wrap + cap width. */
@media (max-width: 480px) {
  #abilityBar {
    flex-wrap: wrap;
    max-width: 96vw;
    justify-content: center;
  }
}

/* ================================
   Supporter ranks (cosmetic)
   ================================ */
/* Applied to usernames/badges: tier 1 (Supporter) = gold, tier 2 (Patron) =
   animated gradient. Purely presentational — the server owns the entitlement. */
.vw-supporter-1 { color: #ffd700; }
.vw-supporter-2 { color: #e879f9; font-weight: 600; } /* fallback if clip-text unsupported */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .vw-supporter-2 {
    background: linear-gradient(90deg, #e879f9, #7dd3fc 45%, #c4b5fd 70%, #e879f9);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: vw-patron-shift 4s linear infinite;
  }
}
@keyframes vw-patron-shift { to { background-position: 200% center; } }

/* ── Offline Mode panel (js/offline/offline_ui.js) ─────────────────────────── */
.offline-panel { display: flex; flex-direction: column; gap: 10px; }
.offline-panel .ofl-head h3 { margin: 0; font-size: 1.05rem; }
.offline-panel .ofl-sub { color: #94a3b8; font-size: 0.8rem; }
.offline-panel .ofl-record { font-size: 0.85rem; color: #cbd5e1; }
.offline-panel .ofl-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .offline-panel .ofl-grid { grid-template-columns: 1fr; } }
.offline-panel .ofl-card { background: rgba(148,163,184,0.06); border: 1px solid #24263a; border-radius: 8px; padding: 10px; }
.offline-panel .ofl-card h4 { margin: 0 0 6px; font-size: 0.82rem; color: #7dd3fc; text-transform: uppercase; letter-spacing: 0.5px; }
.offline-panel .ofl-stat { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 2px 0; text-transform: capitalize; }
.offline-panel .ofl-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: #cbd5e1; }
.offline-panel .ofl-field select { padding: 6px; border-radius: 6px; background: #10121f; color: #e8eaf2; border: 1px solid #24263a; }
.offline-panel .ofl-toggles { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; font-size: 0.82rem; color: #cbd5e1; }
.offline-panel .ofl-toggles label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.offline-panel .ofl-play { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; font-size: 0.85rem; }
.offline-panel .ofl-play button { padding: 8px 14px; border-radius: 6px; cursor: pointer; background: #7c3aed; color: #fff; border: 1px solid #7c3aed; font-weight: bold; }
.offline-panel .ofl-play button:hover { background: #6d28d9; }
.offline-panel .ofl-reset { align-self: flex-start; padding: 5px 10px; border-radius: 6px; cursor: pointer; background: transparent; color: #94a3b8; border: 1px solid #334155; font-size: 0.78rem; }
