/* ============================================================ Baghound — web theme
 *
 * Same charcoal + loot-gold palette as the desktop app, same Silkscreen +
 * VT323 fonts, with a touch more breathing room and modern motion than the
 * Swing version. Three core surfaces: BG (deepest, page), BG1 (raised
 * cards), BG2 (interactive chips / inputs).
 *
 * Layout is mobile-first; the .container helpers cap to readable widths.
 * Nothing depends on a framework — vanilla CSS, no preprocessor.
 * ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=VT323&family=Silkscreen:wght@400;700&display=swap');

:root {
  --bg:        #14121B;
  --bg1:       #1C1925;
  --bg2:       #262232;
  --bg3:       #322D40;
  --line:      #0A0810;
  --line-hi:   #3D3650;
  --ink:       #EFE6D2;
  --ink-dim:   #8A8295;
  --ink-faint: #5A546A;
  --gold:      #FFCC33;
  --gold-2:    #FFE066;
  --gold-d:    #B8861F;
  --red:       #D8423C;
  --blue:      #4AA8E8;
  --green:     #5FD16A;
  --purple:    #B86FDC;

  --font-pixel: 'Silkscreen', 'Courier New', monospace;
  --font-body:  'VT323', 'Courier New', monospace;
  --shadow-lift: 0 6px 24px rgba(0,0,0,.45);
  --shadow-hover: 0 8px 28px rgba(255,204,51,.08);
  --radius: 0; /* the whole design is square-edged on purpose */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 600px at 50% -200px, rgba(255,204,51,.06), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.45;
  min-height: 100vh;
}
body { display: flex; flex-direction: column; }

.hidden { display: none !important; }
.muted  { color: var(--ink-dim); }
.accent { color: var(--gold); }

a { color: var(--blue); text-decoration: none; transition: color .12s ease; }
a:hover { color: var(--gold-2); }

/* ============================================================ Top bar */

#topbar {
  position: sticky; top: 0; z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: rgba(28, 25, 37, .85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  height: 36px;
  cursor: pointer;
}
.brand svg { display: block; }
.brand:hover { opacity: 0.85; }

.search {
  position: relative;
  max-width: 420px;
  width: 100%;
  justify-self: center;
}
#searchInput {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--line-hi);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 8px 12px;
  outline: none;
  transition: border-color .12s ease;
}
#searchInput:focus { border-color: var(--gold); }
#searchInput::placeholder { color: var(--ink-faint); }

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg1);
  border: 1px solid var(--line-hi);
  max-height: 360px;
  overflow-y: auto;
  box-shadow: var(--shadow-lift);
}
.search-result {
  display: block;
  padding: 8px 14px;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: 16px;
  transition: background .08s ease;
}
.search-result:hover, .search-result.active {
  background: var(--bg2);
  color: var(--gold);
}
.search-empty {
  padding: 10px 14px;
  color: var(--ink-faint);
  font-size: 14px;
}

.topbar-right { justify-self: end; display: flex; align-items: center; gap: 12px; }
.topbar-right .display-name {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--ink);
}

/* ============================================================ Buttons */

.btn {
  display: inline-block;
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 12px 18px;
  border: 1px solid var(--line-hi);
  border-bottom-width: 2px;
  border-right-width: 2px;
  background: var(--bg2);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform .08s ease, background .12s ease, color .12s ease;
}
.btn:hover:not(:disabled) {
  background: var(--bg3);
  color: var(--gold);
  transform: translateY(-1px);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.primary {
  background: var(--gold);
  color: #000;
  border-color: var(--gold-d);
}
.btn.primary:hover:not(:disabled) {
  background: var(--gold-2);
  color: #000;
}

.btn.default {}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-dim);
}
.btn.ghost:hover:not(:disabled) {
  background: var(--bg2);
  color: var(--ink);
  border-color: var(--line-hi);
}

/* ============================================================ Main + views */

main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px 64px;
}

.view-card {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

.card {
  width: 100%;
  max-width: 460px;
  padding: 28px 28px 24px;
  background: var(--bg1);
  border: 1px solid var(--line-hi);
  box-shadow: var(--shadow-lift);
}

h1, h2, h3 {
  font-family: var(--font-pixel);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0 0 16px;
  color: var(--ink);
}
h1 { font-size: 20px; }
h2 { font-size: 16px; color: var(--gold); margin-bottom: 24px; }
h3 { font-size: 12px; color: var(--ink); }

label {
  display: block;
  font-size: 13px;
  color: var(--ink-dim);
  margin: 12px 0 4px;
}

input[type="text"],
input[type="email"],
input[type="search"],
input[inputmode="numeric"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 18px;
  background: var(--bg2);
  color: var(--ink);
  border: 1px solid var(--line-hi);
  padding: 10px 12px;
  outline: none;
  transition: border-color .12s ease;
}
input:focus { border-color: var(--gold); }

input[inputmode="numeric"] {
  font-size: 28px;
  letter-spacing: 8px;
  font-family: 'Courier New', monospace;
  text-align: center;
}

.row {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center; margin-top: 18px;
}
form .btn.primary { margin-top: 18px; }

.error {
  color: var(--red);
  min-height: 22px;
  margin: 14px 0 0;
  font-size: 16px;
}

/* ============================================================ Home — hero */

.hero {
  padding: 80px 0 60px;
  text-align: center;
}
.hero-mark { display: inline-block; margin-bottom: 32px; }
.hero-tagline {
  font-family: var(--font-pixel);
  font-size: 22px;
  line-height: 1.5;
  margin: 0 auto 18px;
  max-width: 720px;
  letter-spacing: 0.5px;
  text-transform: none;
  color: var(--ink);
}
.hero-sub {
  max-width: 580px;
  margin: 0 auto 32px;
  color: var(--ink-dim);
  font-size: 18px;
}
.hero-cta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* ============================================================ Home — features */

.features { margin-top: 24px; }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.feature {
  background: var(--bg1);
  border: 1px solid var(--line);
  padding: 24px;
  transition: transform .12s ease, box-shadow .15s ease, border-color .12s ease;
}
.feature:hover {
  transform: translateY(-3px);
  border-color: var(--line-hi);
  box-shadow: var(--shadow-hover);
}
.feature-icon {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 12px;
}
.feature h3 { margin: 0 0 8px; font-size: 13px; }
.feature p  { margin: 0; color: var(--ink-dim); font-size: 17px; line-height: 1.5; }

/* ============================================================ Home — CTA band */

.cta-band {
  margin-top: 64px;
  padding: 48px 24px;
  background: linear-gradient(180deg, var(--bg1), var(--bg));
  border: 1px solid var(--line-hi);
  text-align: center;
}
.cta-band h2 { color: var(--ink); }
.cta-band p { margin: 16px 0 0; font-size: 16px; }

/* ============================================================ Profile */

.profile-header { padding: 56px 0 12px; }
.profile-header h1 {
  font-size: 28px;
  color: var(--gold);
  margin-bottom: 4px;
}
.profile-header .muted { font-size: 16px; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line-hi);
  margin: 24px 0 24px;
}
.tab {
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 12px 18px;
  background: transparent;
  border: 0;
  color: var(--ink-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s ease, border-color .12s ease;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.profile-body { min-height: 280px; }

.placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 24px;
  color: var(--ink-dim);
  text-align: center;
  background: var(--bg1);
  border: 1px dashed var(--line-hi);
}
.placeholder .ph-icon {
  font-size: 36px;
  margin-bottom: 14px;
}

/* ============================================================ Armory panel
 *
 * WoW-armory inspired layout for the profile page. Character chooser
 * dropdown sits above; below, the active character renders with its
 * 4 equipped slots flanking a central class label + stats grid.
 * ========================================================================= */

.armory {
  background: var(--bg1);
  border: 1px solid var(--line-hi);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lift);
}

.armory-chooser {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.armory-select {
  flex: 1;
  min-width: 220px;
  background: var(--bg2);
  border: 1px solid var(--line-hi);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
  transition: border-color .12s ease;
}
.armory-select:focus { border-color: var(--gold); }
.armory-set-main { flex: 0 0 auto; }

.armory-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 0 20px;
  border-bottom: 1px solid var(--line);
}
.armory-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.armory-centre {
  text-align: center;
  padding: 0 20px;
  min-width: 200px;
}
.armory-class {
  font-family: var(--font-pixel);
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--gold);
  margin-bottom: 6px;
}
.armory-level {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 12px;
}
.armory-pet {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink-dim);
  margin-bottom: 4px;
}
.armory-seen { font-size: 13px; }

.armory-slot {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Left side: label-on-left, sprite-on-right (mirrored), so the sprites
   face the central class block. Right side keeps the natural order. */
.armory-side:first-child .armory-slot { flex-direction: row-reverse; }
/* Width/height/background-size are set inline by BhData.spriteStyle so
   the same sprite atlas can render at multiple scales (24px collection
   tile vs 48px armory slot). Only chrome — background colour, border,
   crisp upscaling — lives in the CSS here. */
.armory-sprite {
  width: 48px;
  height: 48px;
  background-color: var(--bg2);
  border: 1px solid var(--line-hi);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex: 0 0 48px;
}
.armory-sprite.empty {
  background-image:
    linear-gradient(45deg, transparent 47%, var(--line-hi) 47%, var(--line-hi) 53%, transparent 53%),
    linear-gradient(-45deg, transparent 47%, var(--line-hi) 47%, var(--line-hi) 53%, transparent 53%);
}
/* Bucket-colour borders on equipment sprites mirror the collection
   tile palette so eg. UT_LEGENDARY items glow the same shade. */
.armory-sprite.b-UT_LEGENDARY     { border-color: var(--gold);    }
.armory-sprite.b-UT_HIGH_RARE     { border-color: #FF8C3A;        }
.armory-sprite.b-UT_MEDIUM        { border-color: var(--blue);    }
.armory-sprite.b-UT_LOW           { border-color: var(--green);   }
.armory-sprite.b-ST               { border-color: var(--purple);  }
.armory-sprite.b-T14_WEAPON_ARMOR { border-color: #E6D14A;        }
.armory-sprite.b-T7_RING_ABILITY  { border-color: #6FC9DC;        }
.armory-slot-label {
  font-family: var(--font-pixel);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.armory-stats {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  padding-top: 16px;
}
.stat-cell {
  background: var(--bg2);
  border: 1px solid var(--line);
  padding: 8px 6px;
  text-align: center;
}
.stat-label {
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--ink-faint);
  margin-bottom: 2px;
}
.stat-val {
  font-family: var(--font-body);
  font-size: 20px;
  color: var(--ink);
}

@media (max-width: 720px) {
  .armory-body { grid-template-columns: 1fr; }
  .armory-side { flex-direction: row; }
  .armory-side .armory-slot { flex-direction: row !important; }
  .armory-stats { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================ Collection grid */

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.collection-tile {
  position: relative;
  background: var(--bg1);
  border: 1px solid var(--line);
  border-left-width: 3px;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .12s ease, transform .08s ease, box-shadow .15s ease;
}
.collection-tile:hover {
  border-color: var(--line-hi);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}

/* Sprite + name row at the top of every tile. */
.collection-tile .tile-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
}
.collection-tile .sprite-slot {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  background-color: var(--bg2);
  border: 1px solid var(--line);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-repeat: no-repeat;
}
.collection-tile .tile-name-box { flex: 1; min-width: 0; }
.collection-tile .tile-name {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--ink);
  line-height: 1.15;
  word-break: break-word;
}
.collection-tile .tile-tier {
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--ink-faint);
  margin-top: 2px;
}
.collection-tile .counts {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--ink);
}
.collection-tile .live { font-size: 14px; color: var(--ink-dim); }
.collection-tile .live.none { color: var(--ink-faint); }

/* Bucket colours — mirror the desktop app's loot palette. */
.collection-tile.b-UT_LEGENDARY     { border-left-color: var(--gold);    }
.collection-tile.b-UT_HIGH_RARE     { border-left-color: #FF8C3A;        }
.collection-tile.b-UT_MEDIUM        { border-left-color: var(--blue);    }
.collection-tile.b-UT_LOW           { border-left-color: var(--green);   }
.collection-tile.b-ST               { border-left-color: var(--purple);  }
.collection-tile.b-T14_WEAPON_ARMOR { border-left-color: #E6D14A;        }
.collection-tile.b-T7_RING_ABILITY  { border-left-color: #6FC9DC;        }
.collection-tile.b-CHARACTER_SKIN   { border-left-color: #FF7AB6;        }
.collection-tile.b-PET_SKIN         { border-left-color: #FF7AB6;        }
.collection-tile.shiny::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255,204,51,.45);
}

/* ============================================================ Footer */

.footer {
  border-top: 1px solid var(--line);
  background: var(--bg1);
  padding: 24px 28px;
}
.footer-inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  flex-wrap: wrap;
}
.footer-brand { display: flex; align-items: center; gap: 14px; font-size: 15px; }
.footer-links { display: flex; gap: 18px; }
.footer-links a { color: var(--ink-dim); font-size: 15px; }
.footer-links a:hover { color: var(--gold); }

/* ============================================================ Small screens */

@media (max-width: 720px) {
  #topbar { grid-template-columns: auto 1fr; gap: 12px; padding: 12px 16px; }
  .search { grid-column: 1 / -1; order: 3; max-width: none; }
  main { padding: 0 16px 48px; }
  .hero { padding-top: 48px; }
  .hero-tagline { font-size: 18px; }
}
