:root {
  --bg: #0a0908;
  --bg2: #100e0b;
  --card: #14110d;
  --card2: #1a1611;
  --ink: #f0ebe0;
  --muted: #a89e8c;
  --accent: #c9b380;
  --accent2: #e0cda0;
  --ok: #9aa86b;
  --bad: #c07b6b;
  --line: #2e2a22;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 550px at 85% -10%, rgba(201, 179, 128, 0.09) 0%, transparent 55%),
    radial-gradient(900px 600px at 8% 108%, rgba(201, 179, 128, 0.05) 0%, transparent 55%),
    radial-gradient(700px 700px at 50% 50%, rgba(80, 70, 50, 0.14) 0%, transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(201, 179, 128, 0.06) 1px, transparent 1.6px);
  background-size: 26px 26px;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url('/images/logo.webp') center 30%/min(620px, 80vw) no-repeat;
  opacity: 0.15;
}
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 28px; }
h1 { font-size: 2.1rem; line-height: 1.2; letter-spacing: -0.02em; margin: 0.6em 0 0.4em; font-family: 'Chakra Petch', system-ui, sans-serif; font-weight: 700; }
h2 { font-size: 1.45rem; letter-spacing: -0.01em; margin: 1.6em 0 0.5em; font-family: 'Chakra Petch', system-ui, sans-serif; font-weight: 600; }
h3 { font-size: 1.1rem; margin: 0.8em 0 0.3em; font-family: 'Chakra Petch', system-ui, sans-serif; font-weight: 600; }

/* ---------- header ---------- */
.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 10px 20px; background: rgba(10, 9, 8, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 14px; justify-self: start; }
.brand-center { justify-self: center; }
.topbar-right { display: flex; gap: 14px; align-items: center; justify-self: end; }
.brand { color: var(--ink); font-weight: 800; text-decoration: none; font-size: 1.15rem; letter-spacing: -0.01em; display: inline-flex; align-items: center; }
.brand span { color: var(--accent); }
.brand-logo { height: 68px; width: 68px; border-radius: 14px; object-fit: cover; border: 1px solid var(--line); }
.topbar a { color: var(--muted); text-decoration: none; transition: color .15s; }
.topbar a:hover { color: var(--ink); }
.topbar a.btn, .topbar a.btn:hover { color: #141009; }
.inline { display: inline; margin: 0; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 0; }
.linkbtn:hover { color: var(--ink); }
.hamb { background: var(--card); border: 1px solid var(--line); color: var(--ink); border-radius: 10px; font-size: 1.15rem; padding: 8px 13px; cursor: pointer; transition: all .15s; }
.hamb:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- drawer menu ---------- */
.drawer { position: fixed; top: 0; left: 0; height: 100%; width: 300px; max-width: 88vw; background: #100e0b; border-right: 1px solid var(--line); z-index: 50; transform: translateX(-105%); transition: transform .28s cubic-bezier(.2,.8,.3,1); display: flex; flex-direction: column; padding: 18px; box-shadow: 20px 0 60px rgba(0,0,0,.5); }
.drawer.open { transform: translateX(0); }
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.drawer-overlay.show { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-size: 1.1rem; }
.drawer-search input { width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-size: 1rem; margin-bottom: 10px; box-sizing: border-box; }
.drawer-search input:focus { outline: none; border-color: var(--accent); }
.drawer-nav { display: flex; flex-direction: column; overflow-y: auto; }
.drawer-nav a { color: var(--ink); text-decoration: none; padding: 10px; border-bottom: 1px solid #1e1a14; font-size: 1.05rem; border-radius: 10px; transition: background .12s; display: flex; align-items: center; gap: 14px; }
.drawer-nav a:hover { background: var(--card); color: var(--accent); }
.drawer-nav a img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); flex-shrink: 0; }
.drawer-emoji { width: 52px; height: 52px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; background: var(--card); border-radius: 10px; border: 1px solid var(--line); flex-shrink: 0; }
.nav-group { border-bottom: 1px solid #1e1a14; border-radius: 10px; }
.nav-group summary { color: var(--ink); padding: 10px; font-size: 1.05rem; border-radius: 10px; cursor: pointer; display: flex; align-items: center; gap: 14px; list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary:hover { background: var(--card); color: var(--accent); }
.nav-group summary img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); flex-shrink: 0; }
.nav-group summary::after { content: '▾'; margin-left: auto; color: var(--muted); font-size: 1.2rem; padding-right: 8px; }
.nav-group[open] summary::after { content: '▴'; }
.nav-sub { display: flex; flex-direction: column; padding: 4px 0 4px 76px; }
.nav-sub a { color: var(--ink); text-decoration: none; padding: 8px 10px; font-size: .95rem; border-radius: 8px; display: flex; align-items: center; gap: 12px; }
.nav-sub a:hover { background: var(--card); color: var(--accent); }
.nav-sub a img { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex-shrink: 0; }

/* ---------- type & buttons ---------- */
.lede { color: var(--muted); font-size: 1.12rem; max-width: 640px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.btn {
  display: inline-block; background: linear-gradient(135deg, var(--accent), #a08c5a);
  color: #141009; font-weight: 800; border: 0; border-radius: 12px;
  padding: 13px 26px; text-decoration: none; cursor: pointer; font-size: 1rem;
  font-family: 'Chakra Petch', system-ui, sans-serif;
  transition: transform .12s, box-shadow .12s; box-shadow: 0 4px 18px rgba(201,179,128,.25);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(201,179,128,.35); }
.btn.big { font-size: 1.12rem; padding: 15px 32px; }
.btn.small { padding: 9px 16px; font-size: .9rem; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid #4a4132; box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 1.6em 0; }

/* ---------- hero & cards ---------- */
.hero { padding: 3em 0 2.4em; display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero h1 { font-size: 2.9rem; max-width: 640px; }
.hero h1 .hl { color: var(--accent); }
.hero-visual img { width: 100%; border-radius: 20px; border: 1px solid var(--line); box-shadow: 0 24px 64px rgba(0,0,0,.5); display: block; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; gap: 24px; } }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin: 1.2em 0; }
.hbadge { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: .85rem; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.hbadge svg { flex-shrink: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin: 1.2em 0 2.2em; }
.card {
  background: linear-gradient(160deg, var(--card2), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.card.link { color: inherit; text-decoration: none; display: block; }
.card.link:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,.35); }
.card h3 { margin: .5em 0 .25em; font-size: 1.08rem; }
.card p { margin: .3em 0; font-size: .95rem; color: var(--muted); }
.card-num { display: inline-block; background: rgba(201,179,128,.14); color: var(--accent); font-weight: 800; border-radius: 9px; padding: 3px 11px; font-size: .85rem; }
.card .emoji { font-size: 1.7rem; }
.card-img { padding: 0; overflow: hidden; }
.card-img img { width: 100%; height: 170px; object-fit: cover; display: block; border-bottom: 1px solid var(--line); }
.card-img .card-body { padding: 18px 22px 22px; }
.card-img .card-body h3 { margin-top: 0; }

/* ---------- pricing ---------- */
.pricing { margin: 2.5em 0; }
.price-card {
  background: linear-gradient(160deg, #181410, #12100c);
  border: 1.5px solid var(--accent); border-radius: 18px; padding: 30px; max-width: 480px;
  box-shadow: 0 16px 48px rgba(201,179,128,.12);
}
.price { font-size: 2rem; font-weight: 800; margin-bottom: .3em; }
.price span { font-size: 1rem; color: var(--muted); font-weight: 400; }
.price-card ul { padding-left: 1.2em; }
.price-card li { margin-bottom: .45em; }

/* ---------- news ---------- */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin: 1.2em 0 2em; }
.news-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; transition: border-color .15s, transform .15s; }
.news-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.news-card .date { color: var(--accent); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.news-card h3 { margin: .4em 0 .3em; font-size: 1.02rem; line-height: 1.4; }
.news-card h3 a { color: var(--ink); text-decoration: none; }
.news-card h3 a:hover { color: var(--accent); }
.news-card p { color: var(--muted); font-size: .92rem; margin: .3em 0 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 2.5em; }
.section-head a { color: var(--accent); text-decoration: none; font-size: .92rem; }

/* ---------- forms ---------- */
.form { display: grid; gap: 14px; max-width: 440px; margin: 1em 0; }
.form label { display: grid; gap: 6px; font-weight: 600; }
.form input, .form select, .form textarea {
  padding: 13px 14px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--bg); color: var(--ink); font-size: 1rem; font-family: inherit;
  transition: border-color .15s;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--accent); }
.alert { background: #2a1a15; border: 1px solid var(--bad); color: #ffb3b3; padding: 13px 18px; border-radius: 12px; }
.ok { background: #1a2013; border: 1px solid var(--ok); color: #b9f0d4; padding: 13px 18px; border-radius: 12px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin: 1.6em 0; }
.badge { display: inline-block; border-radius: 999px; padding: 4px 13px; font-size: .85rem; font-weight: 700; }
.badge.on { background: #1a2013; color: #7be3a8; border: 1px solid var(--ok); }
.badge.off { background: #2a1a15; color: #ffb3b3; border: 1px solid var(--bad); }
/* ---------- locations (ranges & dealers) ---------- */
.danger { background: #2a1a15; border: 1px solid var(--bad); color: #ffb3b3; border-radius: 10px; padding: 11px 20px; cursor: pointer; font-size: .95rem; }
.loc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin: 1.4em 0 2em; }
.loc-card { background: linear-gradient(160deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.loc-card h3 { margin-top: 0; }
.loc-card p { margin: .4em 0; }
.loc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.map-btn { display: inline-block; background: var(--card); border: 1px solid var(--line); color: var(--ink); border-radius: 9px; padding: 8px 14px; font-size: .85rem; text-decoration: none; transition: border-color .15s, color .15s; }
.map-btn:hover { border-color: var(--accent); color: var(--accent); }
.map-btn.accent { background: linear-gradient(135deg, var(--accent), #a08c5a); color: #141009; font-weight: 700; border: 0; }

/* ---------- directory filters ---------- */
.filter-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.filter-label { font-weight: 700; font-size: .9rem; color: var(--muted); display: block; margin-bottom: 6px; }
.filter-row .filter-label { display: grid; gap: 6px; }
.filter-row select { padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); font-size: .95rem; }
.filter-group { margin: 12px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { background: var(--card); border: 1.5px solid var(--line); color: var(--muted); border-radius: 999px; padding: 8px 16px; font-size: .88rem; cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip.on { background: rgba(201,179,128,.16); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.filter-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--muted); font-size: .9rem; }

/* ---------- customizer ---------- */
.gun-opt { cursor: pointer; transition: border-color .15s, transform .15s; }
.gun-opt:hover { transform: translateY(-2px); }
.gun-opt.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(201,179,128,.35); }
.gun-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.gun-pick .gun-opt { padding: 10px; text-align: center; }
.gun-pick .gun-opt img { width: 100%; height: 70px; object-fit: contain; background: #0d0f14; border-radius: 8px; }
.gun-pick .gun-opt h3 { font-size: .9rem; margin: 8px 0 2px; }
.gun-pick .gun-opt small { display: block; font-size: .75rem; color: var(--muted); margin-top: 4px; line-height: 1.3; }
@media (max-width: 600px) {
  .gun-pick { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .gun-pick .gun-opt img { height: 60px; }
}
.att-opt img { pointer-events: none; }
.att-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.att-pick .att-opt { padding: 10px; text-align: center; }
.att-pick .att-opt img { width: 100%; height: 70px; object-fit: contain; background: #0d0f14; border-radius: 8px; }
@media (max-width: 600px) {
  .att-pick { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .att-pick .att-opt img { height: 60px; }
}

/* ---------- shopping guide ---------- */
.sg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.sg-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.sg-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.sg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sg-cal { font-size: .85rem; color: var(--khaki); white-space: nowrap; }
.sg-type { font-size: .8rem; color: var(--muted); margin-bottom: 10px; }
.limited-tag { font-size: .72rem; background: #6d4c00; color: #ffe082; border-radius: 20px; padding: 2px 8px; font-weight: 700; margin-left: 6px; white-space: nowrap; }
.limited-note { font-size: .85rem; background: rgba(255,224,130,.08); border: 1px solid #6d4c00; border-radius: 8px; padding: 8px 12px; color: #ffe082; }
.sg-prices { list-style: none; margin: 0; padding: 0; }
.sg-prices li { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.sg-prices a { display: flex; justify-content: space-between; width: 100%; color: inherit; text-decoration: none; gap: 8px; }
.sg-prices a:hover strong { color: var(--khaki); }
.sg-prices .best { font-size: .72rem; background: var(--khaki); color: #141009; border-radius: 20px; padding: 2px 8px; font-weight: 700; margin-left: 6px; white-space: nowrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.filters input, .filters select { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: inherit; font-size: .95rem; }
.filters input { flex: 1; min-width: 180px; }
.store-picker { margin: 0 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.store-picker summary { cursor: pointer; font-weight: 600; }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-top: 12px; }
.store-grid label { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
.sg-card img.sg-img { width: 100%; height: 140px; object-fit: contain; background: #0d0f14; border-radius: 8px; margin-bottom: 10px; }
.sg-browser { margin: 16px 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.sg-browser summary { cursor: pointer; font-size: 1.05rem; }
.sg-browser .filters { margin: 12px 0; }
#sgb-pick { max-height: 400px; overflow-y: auto; }
#build-recs { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
#build-recs h3 { font-size: .95rem; margin-bottom: 8px; }
#build-recs ul { list-style: none; padding: 0; margin: 0; }
#build-recs li { font-size: .88rem; padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
#build-recs button { font-size: .8rem; padding: 4px 10px; }
.sale-toggle { display: flex; align-items: center; gap: 8px; font-size: .95rem; cursor: pointer; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.sg-prices .was { text-decoration: line-through; color: var(--muted); font-size: .85rem; margin-right: 6px; }
.sg-prices .sale-tag { font-size: .72rem; background: #c62828; color: #fff; border-radius: 20px; padding: 2px 8px; font-weight: 700; margin-left: 6px; white-space: nowrap; }
.sg-best { margin: 8px 0; font-size: 1.05rem; }
.sg-best .was { text-decoration: line-through; color: var(--muted); font-size: .85rem; margin-right: 8px; }
.sg-best strong { color: #4caf50; font-size: 1.2rem; }
.sg-best .sale-tag { font-size: .72rem; background: #c62828; color: #fff; border-radius: 20px; padding: 2px 8px; font-weight: 700; margin-left: 6px; white-space: nowrap; }
.sg-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.7); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.sg-modal[hidden] { display: none; }
.sg-modal-box { background: var(--card); border: 1px solid var(--line); border-radius: 16px; max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 24px; position: relative; }
.sg-modal-close { position: absolute; top: 12px; right: 16px; font-size: 1.8rem; background: none; border: none; color: inherit; cursor: pointer; }
.sg-modal-box img.sg-detail-img { width: 100%; max-height: 250px; object-fit: contain; background: #0d0f14; border-radius: 12px; margin-bottom: 16px; }
.sg-store-rank { list-style: none; padding: 0; margin: 16px 0 0; }
.sg-store-rank li { display: flex; justify-content: space-between; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.sg-store-rank li.cheapest { border-color: #4caf50; background: rgba(76,175,80,.08); }
.sg-store-rank .rank { font-weight: 700; color: var(--muted); margin-right: 12px; min-width: 28px; }
.sg-store-rank a { display: flex; justify-content: space-between; align-items: center; width: 100%; text-decoration: none; color: inherit; }
.sg-card { cursor: pointer; }

/* ---------- gun builder ---------- */
.cust-layout { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.build-summary { position: sticky; top: 90px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.build-summary h2 { margin-top: 0; font-size: 1.2rem; }
.build-summary ul { list-style: none; margin: 0 0 12px; padding: 0; }
.build-summary li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.build-total { display: flex; justify-content: space-between; align-items: center; font-size: 1.25rem; padding-top: 12px; }
.build-total strong { color: var(--khaki); }
.gun-opt .price, .att-opt .price { display: block; color: var(--khaki); font-weight: 700; margin-top: 4px; }
@media (max-width: 900px) { .cust-layout { grid-template-columns: 1fr; } .build-summary { position: static; } }

/* ---------- oauth ---------- */
.btn.oauth { display: inline-flex; align-items: center; justify-content: center; gap: 12px; background: #fff; color: #1a1a1a; width: 100%; box-sizing: border-box; margin-bottom: 6px; }
.btn.oauth:hover { color: #1a1a1a; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 18px 0; font-size: .9rem; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.or span { padding: 0 4px; }
.ok { background: rgba(46, 125, 50, .15); border: 1px solid #2e7d32; color: #9ccc9c; border-radius: 10px; padding: 12px 16px; }

/* ---------- avatars ---------- */
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; margin-top: 12px; }
.avatar-pick { cursor: pointer; text-align: center; border: 2px solid var(--line); border-radius: 14px; padding: 10px 6px; transition: border-color .15s, transform .15s; background: var(--bg); }
.avatar-pick:hover { transform: translateY(-2px); }
.avatar-pick.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.avatar-pick input { display: none; }
.avatar-pick img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto 6px; border: 2px solid var(--line); }
.avatar-pick.selected img { border-color: var(--accent); }
.avatar-pick span { font-size: .78rem; color: var(--muted); }
.header-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); }

/* ---------- study / quiz ---------- */
.crumbs { margin-top: 1em; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.study h2 { margin-top: 2em; }
.study ul { padding-left: 1.3em; }
.study li { margin-bottom: .5em; }
.audio-row { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 1.4em 0; flex-wrap: wrap; }
.audio-row audio { flex: 1; min-width: 220px; }
.quiz { margin: 2.5em 0; border-top: 2px solid var(--line); padding-top: 1em; }
.q { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin: 0 0 14px; background: var(--card); }
.q legend { padding: 0 8px; font-size: 1.02rem; }
.opt { display: block; padding: 8px 10px; border-radius: 8px; cursor: pointer; margin: 4px 0; }
.opt:hover { background: var(--card2); }
.explain { background: #1a2438; border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 0 8px 8px 0; margin-top: 8px; }
.result { padding: 18px; border-radius: 12px; margin: 1em 0; font-size: 1.1rem; font-weight: 700; }
.pass { color: var(--ok); }
.tryagain { color: var(--accent2); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover td { background: #12100c; }

/* ---------- renewal / misc ---------- */
.renew-banner { border-radius: var(--radius); padding: 18px 22px; margin: 1.4em 0; border: 1.5px solid; }
.renew-banner.ok { background: #1a2013; border-color: var(--ok); }
.renew-banner.soon { background: #2a2416; border-color: var(--accent); }
.renew-banner.expired { background: #2a1a15; border-color: var(--bad); }
.renew-banner strong { font-size: 1.1rem; }
.renew-banner a { color: var(--ink); font-weight: 700; }
.tag { display: inline-block; background: rgba(201,179,128,.14); color: var(--accent); border-radius: 7px; padding: 3px 10px; font-size: .8rem; font-weight: 700; margin-right: 6px; }
.law-item { border-left: 3px solid var(--accent); padding: 6px 0 6px 16px; margin: 1.4em 0; }
.law-item .date { color: var(--muted); font-size: .85rem; }
.guide h2 { margin-top: 1.6em; }
.guide ul { padding-left: 1.3em; }
.guide li { margin-bottom: .5em; }
.result-group { margin: 1.8em 0; }
.result-group h2 { font-size: 1.05rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.result-item { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.result-item:hover h3 { color: var(--accent); }
.result-item h3 { margin: 0 0 .2em; font-size: 1rem; }
.result-item p { margin: 0; }
.foot { margin: 3em 0 2em; padding-top: 1.5em; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }

/* ---------- AI chat widget ---------- */
#ai-bubble {
  position: fixed; right: 22px; bottom: 22px; height: 64px; border-radius: 999px;
  border: 3px solid var(--accent); padding: 0 18px 0 0; cursor: pointer; z-index: 60;
  background: #0d0b09; color: var(--ink);
  display: flex; align-items: center; gap: 10px;
  font-family: 'Chakra Petch', system-ui, sans-serif; font-weight: 700; font-size: 0.95rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
  animation: ai-blink 2.6s ease-in-out infinite;
}
#ai-bubble .ai-bubble-avatar {
  width: 58px; height: 58px; border-radius: 50%; flex-shrink: 0;
  background: url('/images/muse-avatar.webp') center/cover no-repeat;
}
@keyframes ai-blink {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201,179,128,.55), 0 4px 20px rgba(0,0,0,.5); }
  50% { box-shadow: 0 0 0 12px rgba(201,179,128,0), 0 4px 20px rgba(0,0,0,.5); }
}
#ai-bubble:hover { animation-play-state: paused; transform: scale(1.07); }
#ai-panel { position: fixed; right: 22px; bottom: 98px; width: 370px; max-width: calc(100vw - 44px); height: 500px; max-height: calc(100vh - 130px); background: #100e0b; border: 1px solid var(--line); border-radius: 16px; z-index: 60; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 44px rgba(0,0,0,.55); }
#ai-panel[hidden] { display: none; }
#ai-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #1a2438, #121a2c); }
#ai-head .ai-title { display: flex; align-items: center; gap: 10px; }
#ai-head .ai-title img { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--accent); object-fit: cover; }
#ai-head .ai-title strong { letter-spacing: .06em; font-size: .95rem; }
#ai-head .ai-title span { color: var(--muted); font-size: .8rem; }
#ai-head button { background: none; border: 0; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
#ai-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { max-width: 86%; padding: 10px 14px; border-radius: 13px; font-size: .93rem; line-height: 1.5; white-space: pre-wrap; }
.ai-msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--accent), #a08c5a); color: #141009; }
.ai-msg.assistant { align-self: flex-start; background: #1a1611; color: var(--ink); border: 1px solid var(--line); }
.ai-msg.typing { opacity: .6; }
#ai-chips { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; border-top: 1px solid #1e1a14; }
#ai-chips button { flex-shrink: 0; background: #1a1611; border: 1px solid #4a4132; color: var(--ink); border-radius: 999px; padding: 7px 13px; font-size: .82rem; cursor: pointer; }
#ai-chips button:hover { border-color: var(--accent); color: var(--accent); }
#ai-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
#ai-form input { flex: 1; padding: 11px 13px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); font-size: .95rem; }
#ai-form input:focus { outline: none; border-color: var(--accent); }
#ai-form button { background: linear-gradient(135deg, var(--accent), #a08c5a); border: 0; border-radius: 10px; padding: 0 18px; font-size: 1.1rem; cursor: pointer; color: #141009; font-weight: 800; }

@media (max-width: 640px) {
  h1 { font-size: 1.7rem; }
  .hero h1 { font-size: 2rem; }
  .hero { padding: 2em 0 1.2em; }
  #ai-panel { right: 12px; bottom: 96px; }
  /* un-cramp the mobile topbar */
  .topbar { padding: 8px 12px; }
  .topbar-left, .topbar-right { gap: 8px; }
  .brand-logo { height: 48px; width: 48px; border-radius: 10px; }
  .header-avatar { display: none; }
  .topbar-right a, .topbar-right .linkbtn { font-size: 0.85rem; white-space: nowrap; }
  .hamb { padding: 7px 10px; font-size: 1rem; }
}
