/* ==========================================================================
   Ant Academy — design system + application styles
   --------------------------------------------------------------------------
   Structure
     1. Tokens (light + dark)
     2. Reset & primitives
     3. Layout shell
     4. Navigation  (mobile: bottom tabs · desktop: inline top nav, no sidebar)
     5. Components  (cards, stats, progress, segments, chips…)
     6. Screens     (hub, gallery, guilds, awards, profile)
     7. Overlays    (sheet, modal, toast)
     8. Responsive  (mobile → tablet → desktop → wide)

   Two rules this file holds to:
   · One accent, one radius scale, one shadow scale, one motion curve.
   · Desktop is not scaled-up mobile. Below 1000px the app is a phone-shaped
     column with bottom tabs; at 1000px it becomes a full-width layout with
     navigation folded into the header and no sidebar at all.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Inter:wght@400;500;600;700;800&display=swap");

/* ============================================================ 1. TOKENS === */

:root {
  /* neutrals — light */
  --bg:        #f4f3f0;
  --bg-2:      #eceae5;
  --card:      #ffffff;
  --card-2:    #f6f5f2;
  --ink:       #14161a;
  --ink-2:     #3f444d;
  --muted:     #767c87;
  --border:    rgba(20, 22, 26, .10);
  --line:      rgba(20, 22, 26, .07);

  /* accent — a single hue, used sparingly */
  --accent:      #2f6bff;
  --accent-ink:  #1d4fd8;
  --accent-soft: #e8efff;
  --on-accent:   #ffffff;

  /* semantic */
  --good:      #1c8a5a;
  --good-soft: #e2f4ec;
  --warn:      #b7791f;
  --warn-soft: #fbf0da;
  --bad:       #c0392f;
  --bad-soft:  #fbe6e4;
  --gold:      #d9a520;

  /* guilds */
  --guardian: #2f7d5b;
  --alpha:    #c0413f;
  --diamond:  #3b7fc4;
  --creative: #d99826;

  /* type */
  --font-display: "Fraunces", Georgia, serif;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* radius */
  --r-xs: 8px;
  --r-sm: 12px;
  --r:    16px;
  --r-lg: 22px;
  --r-pill: 999px;

  /* elevation — subtle, never glowing */
  --shadow-sm: 0 1px 2px rgba(16, 18, 22, .05);
  --shadow:    0 2px 8px rgba(16, 18, 22, .06), 0 1px 2px rgba(16, 18, 22, .04);
  --shadow-lg: 0 12px 32px rgba(16, 18, 22, .12);

  /* motion — fast and quiet */
  --ease: cubic-bezier(.22, .8, .3, 1);
  --t-fast: .14s;
  --t: .22s;

  /* metrics */
  --app-w: 460px;      /* phone column width on small screens */
  --nav-h: 68px;
  --gutter: 16px;
  --page-max: 1240px;
}

[data-theme="dark"] {
  --bg:      #0d0f13;
  --bg-2:    #090a0d;
  --card:    #16191f;
  --card-2:  #1d212a;
  --ink:     #f0f1f4;
  --ink-2:   #c3c8d2;
  --muted:   #878e9c;
  --border:  rgba(255, 255, 255, .11);
  --line:    rgba(255, 255, 255, .07);

  --accent:      #5b8cff;
  --accent-ink:  #7ea4ff;
  --accent-soft: rgba(91, 140, 255, .14);

  --good:      #4ac490;
  --good-soft: rgba(74, 196, 144, .14);
  --warn:      #e0ad4a;
  --warn-soft: rgba(224, 173, 74, .14);
  --bad:       #ef6f63;
  --bad-soft:  rgba(239, 111, 99, .14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow:    0 2px 10px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
}

/* Follow the OS unless the user has explicitly chosen in-app. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f13; --bg-2: #090a0d; --card: #16191f; --card-2: #1d212a;
    --ink: #f0f1f4; --ink-2: #c3c8d2; --muted: #878e9c;
    --border: rgba(255,255,255,.11); --line: rgba(255,255,255,.07);
    --accent: #5b8cff; --accent-ink: #7ea4ff; --accent-soft: rgba(91,140,255,.14);
    --good: #4ac490; --good-soft: rgba(74,196,144,.14);
    --warn: #e0ad4a; --warn-soft: rgba(224,173,74,.14);
    --bad: #ef6f63;  --bad-soft: rgba(239,111,99,.14);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 2px 10px rgba(0,0,0,.45);
    --shadow-lg: 0 16px 40px rgba(0,0,0,.55);
  }
}

/* ================================================= 2. RESET & PRIMITIVES === */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

.subtle { color: var(--muted); font-size: 13px; font-weight: 600; }
.section-title { font-size: 18px; font-weight: 600; margin: 26px 2px 12px; letter-spacing: -.015em; }
.section-title:first-child { margin-top: 8px; }

/* ==================================================== 3. LAYOUT SHELL ===== */

.app {
  position: relative;
  max-width: var(--app-w);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t) var(--ease);
}
.topbar.scrolled { border-bottom-color: var(--border); }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-badge {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 10px; background: var(--card-2);
  display: grid; place-items: center; font-size: 18px; line-height: 1;
  border: 1px solid var(--border);
}
.brand-text { min-width: 0; }
.brand-title {
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
  letter-spacing: -.015em; white-space: nowrap;
}
.brand-sub {
  font-size: 10px; font-weight: 700; color: var(--muted);
  letter-spacing: .08em; text-transform: uppercase; margin-top: 1px;
}

/* Screens: only one is mounted at a time; transition is a short lift. */
.screen { display: none; padding: 4px var(--gutter) 24px; }
.screen.active { display: block; animation: screen-in var(--t) var(--ease); }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ===================================================== 4. NAVIGATION ====== */

/* -- mobile: fixed bottom tab bar ---------------------------------------- */
.tabbar {
  position: fixed; left: 50%; bottom: 0; z-index: 40;
  transform: translateX(-50%);
  width: 100%; max-width: var(--app-w);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
}
.tabbar-brand { display: none; }

.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 700;
  transition: color var(--t-fast) var(--ease);
}
.tab-icon {
  width: 40px; height: 30px; border-radius: 10px;
  display: grid; place-items: center;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.tab svg { width: 21px; height: 21px; }
.tab.active { color: var(--accent); }
.tab.active .tab-icon { background: var(--accent-soft); }
.tab:active .tab-icon { transform: scale(.94); }

/* ===================================================== 5. COMPONENTS ====== */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.pad { padding: 16px 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: var(--r-sm);
  background: var(--card); border: 1px solid var(--border);
  font-size: 13.5px; font-weight: 700; color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:hover { background: var(--card-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-connect {
  padding: 10px 18px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent);
  font-size: 13.5px; font-weight: 700;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn-connect:hover { background: var(--accent-ink); }
.btn-connect:active { transform: translateY(1px); }
.btn-connect:disabled { opacity: .6; cursor: progress; }

.theme-toggle {
  width: 36px; height: 36px; border-radius: var(--r-pill);
  display: grid; place-items: center; font-size: 15px;
  background: var(--card); border: 1px solid var(--border);
  transition: background var(--t-fast) var(--ease);
}
.theme-toggle:hover { background: var(--card-2); }

.profile-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px; border-radius: var(--r-pill);
  background: var(--card); border: 1px solid var(--border);
  font-size: 13px; font-weight: 700; max-width: 190px;
  transition: background var(--t-fast) var(--ease);
}
.profile-chip:hover { background: var(--card-2); }
.profile-chip > span:nth-child(2) {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pc-avatar {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: var(--r-pill);
  overflow: hidden; background: var(--card-2);
  display: grid; place-items: center; font-size: 12px;
}
.pc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chev { color: var(--muted); font-size: 10px; }

/* -- segmented control --------------------------------------------------- */
.segment {
  display: inline-flex; gap: 2px; padding: 3px; max-width: 100%;
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: var(--r-pill); overflow-x: auto; scrollbar-width: none;
}
.segment::-webkit-scrollbar { display: none; }
.seg-btn {
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 8px 14px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 700; color: var(--muted);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg-btn .dot { width: 7px; height: 7px; border-radius: var(--r-pill); }
.seg-count {
  padding: 1px 7px; border-radius: var(--r-pill);
  background: var(--bg-2); font-size: 11px; font-weight: 700;
}
.seg-btn.active .seg-count { background: var(--accent-soft); color: var(--accent); }

/* -- stats --------------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  padding: 14px 12px; text-align: center;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.stat .n { font-family: var(--font-display); font-weight: 600; font-size: 21px; line-height: 1.1; }
.stat .l {
  margin-top: 4px; font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.gstat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }

/* -- progress ------------------------------------------------------------ */
.prog + .prog { margin-top: 16px; }
.prog-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.prog-name { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 700; }
.prog-frac { font-size: 12.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.prog-track { height: 6px; border-radius: var(--r-pill); background: var(--bg-2); overflow: hidden; }
.prog-fill {
  height: 100%; border-radius: var(--r-pill); background: var(--accent);
  transition: width .5s var(--ease);
}
.prog-fill.done { background: var(--good); }

.req-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-top: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
}
.req-row:first-of-type { border-top: none; }
.req-check {
  width: 18px; height: 18px; flex-shrink: 0; border-radius: var(--r-pill);
  display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff;
}
.req-check.yes { background: var(--good); }
.req-check.no  { background: var(--bg-2); color: var(--muted); }

/* -- chips / tags -------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: var(--r-pill);
  background: var(--card-2); color: var(--ink-2);
  font-size: 11px; font-weight: 700;
}
.chip.guild { color: #fff; }
.guild-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: var(--r-pill);
  color: #fff; font-size: 12px; font-weight: 700;
}
.guild-badge { width: 16px; height: 16px; object-fit: contain; }

.rule-note {
  padding: 10px 13px; border-radius: var(--r-sm); margin-bottom: 12px;
  background: var(--warn-soft); color: var(--warn);
  font-size: 11.5px; font-weight: 700;
}

.pill-select {
  padding: 9px 14px; border-radius: var(--r-pill);
  background: var(--card); border: 1px solid var(--border);
  font-size: 12.5px; font-weight: 700;
}
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.count-note { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--ink-2); }

/* -- NFT cards ----------------------------------------------------------- */
.nft-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.nft-grid.mini { grid-template-columns: repeat(3, 1fr); gap: 10px; }

.nft-card {
  overflow: hidden; text-align: left;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t) var(--ease);
}
.nft-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.nft-card:active { transform: translateY(0); }

.art {
  position: relative; aspect-ratio: 1;   /* fixed ratio = no layout jump */
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 22px; color: #fff;
  background: var(--card-2);
}
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.art .flag {
  position: absolute; top: 7px; left: 7px; z-index: 2;
  padding: 3px 7px; border-radius: var(--r-xs);
  background: rgba(0, 0, 0, .55); color: #fff;
  font-family: var(--font); font-size: 9.5px; font-weight: 700;
  backdrop-filter: blur(3px);
}
.art .flag.right { left: auto; right: 7px; }
.art .art-emoji { position: absolute; right: 7px; bottom: 7px; z-index: 2; font-size: 14px; }
.art .sel {
  position: absolute; right: 7px; bottom: 7px; z-index: 3;
  width: 22px; height: 22px; border-radius: var(--r-xs);
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .5); border: 1.5px solid rgba(255, 255, 255, .8);
  color: #fff; font-size: 11px;
  transition: background var(--t-fast) var(--ease);
}
.art .sel.on { background: var(--accent); border-color: var(--accent); }

.nft-info { padding: 9px 11px 11px; }
.nft-id { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; }
.nft-sub { margin-top: 1px; font-size: 11.5px; font-weight: 700; }

/* -- badges (distinct from NFT cards: seal-led, centred, collectible) ----- */
.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.badge {
  position: relative; padding: 18px 14px; text-align: center;
  min-height: 168px;                      /* uniform height = no ragged grid */
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.badge:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.badge.earned { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.badge.locked { opacity: .72; }
.badge-seal {
  width: 54px; height: 54px; margin-bottom: 10px; border-radius: var(--r-pill);
  display: grid; place-items: center; font-size: 24px;
  background: var(--card-2);
}
.badge.earned .badge-seal {
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.badge.locked .badge-seal { filter: grayscale(1); opacity: .5; }
.badge-name { font-family: var(--font-display); font-weight: 600; font-size: 13.5px; line-height: 1.25; }
.badge-tier {
  margin-top: 3px; font-size: 9.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em;
}
.badge-frac { margin-top: 8px; font-size: 11.5px; font-weight: 700; color: var(--accent); }
.badge.locked .badge-frac { color: var(--muted); }
.badge-lock { position: absolute; top: 10px; right: 11px; font-size: 11px; opacity: .45; }

/* -- pairings (row-led, distinct from badges) ---------------------------- */
.pair-block + .pair-block { margin-top: 12px; }
.pair-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pair-title { display: flex; align-items: center; gap: 7px; font-family: var(--font-display); font-weight: 600; font-size: 15.5px; }
.pair-tag { margin: 3px 0 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.pair-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-top: 1px solid var(--line);
  min-height: 66px;                       /* consistent row height */
}
.pair-row:first-of-type { border-top: none; }
.pair-thumb {
  position: relative; width: 42px; height: 42px; flex-shrink: 0;
  border-radius: var(--r-xs); overflow: hidden;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.pair-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pair-plus { color: var(--muted); font-weight: 700; }
.pair-name { margin-left: 2px; font-size: 12.5px; font-weight: 700; }
.pair-status {
  margin-left: auto; white-space: nowrap;
  padding: 6px 11px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700;
}
.pair-status.done { background: var(--good-soft); color: var(--good); }
.pair-status.half { background: var(--warn-soft); color: var(--warn); }
.pair-status.none { background: var(--card-2); color: var(--muted); }

/* -- register ------------------------------------------------------------ */
.reg-set {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.reg-set:first-of-type { border-top: none; }
.reg-num {
  width: 38px; height: 38px; border-radius: var(--r-xs);
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.reg-num.own  { background: var(--accent); color: var(--on-accent); }
.reg-num.miss { background: var(--card-2); color: var(--muted); }
.reg-flag { margin-left: auto; padding: 6px 11px; border-radius: var(--r-pill); font-size: 11px; font-weight: 700; }

/* -- guild picker -------------------------------------------------------- */
.choose-box { margin-top: 14px; }
.cb-head { font-size: 13.5px; font-weight: 700; }
.cb-sub { margin: 3px 0 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.choose-token {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.choose-token:first-of-type { border-top: none; }
.choose-thumb {
  position: relative; width: 40px; height: 40px; flex-shrink: 0;
  border-radius: var(--r-xs); overflow: hidden;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff;
}
.choose-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.choose-opts { margin-left: auto; display: flex; gap: 6px; }
.choose-opts .co {
  padding: 7px 12px; border-radius: var(--r-pill);
  background: var(--card-2); color: var(--muted);
  font-size: 11.5px; font-weight: 700;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.choose-opts .co.on { color: #fff; }

/* ======================================================== 6. SCREENS ====== */

/* -- banners ------------------------------------------------------------- */
.hero-banner, .profile-banner, .guild-banner {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg);
  height: 150px; margin-top: 6px;
  background: var(--card-2);
}
.hero-banner img, .profile-banner img { width: 100%; height: 100%; object-fit: cover; }
.hb-emojis { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-around; font-size: 38px; opacity: .3; }
.hb-title {
  position: absolute; left: 18px; bottom: 14px;
  font-family: var(--font-display); font-weight: 600; font-size: 22px; color: #fff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .35);
}
.banner-tagline {
  position: absolute; left: 18px; bottom: 14px; max-width: 70%;
  font-size: 14px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .4);
}
.banner-cycle {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .4); color: #fff; backdrop-filter: blur(4px);
}

.guild-banner { height: auto; padding: 22px 20px; color: #fff; }
.guild-banner h2 { font-size: 26px; color: #fff; }
.gb-emoji { position: absolute; top: 8px; right: 14px; font-size: 62px; opacity: .22; }
.gb-motto { margin-top: 4px; font-size: 13px; font-weight: 600; opacity: .92; }

/* -- profile identity: hexagon PFP --------------------------------------- */
.profile-hex-wrap {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: -44px; z-index: 3;
}
.profile-hex {
  --hex: polygon(50% 0%, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%);
  width: 92px; height: 92px;
  clip-path: var(--hex);
  background: var(--card);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 22px;
}
/* The ring is a slightly larger hexagon behind the image, so the border
   follows the six sides exactly instead of boxing the corners. */
.profile-hex-wrap::before {
  content: ""; position: absolute; inset: -3px;
  clip-path: polygon(50% 0%, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%);
  background: var(--bg);
}
.profile-hex img { width: 100%; height: 100%; object-fit: cover; }

.profile-card { position: relative; margin-top: 52px; }
.pcard-top { display: flex; align-items: center; gap: 14px; }
.pcard-avatar {
  width: 68px; height: 68px; flex-shrink: 0;
  border-radius: var(--r); overflow: hidden;
  background: var(--card-2); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 19px;
}
.pcard-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pcard-name { font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: -.015em; }
.pcard-handle { margin-top: 1px; font-size: 12.5px; font-weight: 600; color: var(--muted); }

.profile-id { text-align: center; margin-top: 8px; }
.profile-id-main { font-family: var(--font-display); font-weight: 600; font-size: 23px; letter-spacing: -.015em; }
.profile-bio { margin: 8px auto 0; max-width: 46ch; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.profile-quick-row { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.profile-edit-btn {
  padding: 8px 14px; border-radius: var(--r-pill);
  background: var(--card); border: 1px solid var(--border);
  font-size: 12.5px; font-weight: 700;
}
.profile-edit-btn:hover { background: var(--card-2); }

.social-row { display: flex; align-items: center; gap: 8px; }
.social-btn, .qr-icon-btn, .link-btn {
  width: 36px; height: 36px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--border);
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.social-btn:hover, .qr-icon-btn:hover, .link-btn:hover { background: var(--card-2); transform: translateY(-1px); }
.social-btn img, .qr-icon-btn img { width: 16px; height: 16px; }
.qr-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 6px; border-radius: var(--r-pill);
  background: var(--card); border: 1px solid var(--border);
  font-size: 12.5px; font-weight: 700;
}

.rank-strip {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; padding: 12px 14px;
  background: var(--card-2); border-radius: var(--r-sm);
}
.rk-name { font-size: 13.5px; font-weight: 700; }
.rk-diamonds { display: flex; align-items: center; gap: 6px; font-weight: 700; }

/* -- achievements list --------------------------------------------------- */
.achv-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 0; border-top: 1px solid var(--line);
}
.achv-row:first-of-type { border-top: none; }
.achv-seal {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--r-pill);
  display: grid; place-items: center; font-size: 17px; background: var(--card-2);
}
.achv-label { font-size: 13px; font-weight: 700; }
.achv { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--muted); }

/* -- guild mini grid ----------------------------------------------------- */
.guild-mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.guild-mini {
  padding: 12px 8px; text-align: center; border-radius: var(--r-sm);
  background: var(--card); border: 1px solid var(--border);
}

/* -- canvases (student card + grid maker) -------------------------------- */
.canvas-wrap {
  border-radius: var(--r); overflow: hidden;
  background: var(--card-2); border: 1px solid var(--border);
}
.canvas-wrap canvas { width: 100%; display: block; }

.avatar-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.avatar-opt {
  position: relative; aspect-ratio: 1; overflow: hidden;
  border-radius: var(--r-xs); border: 2px solid transparent;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px;
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.avatar-opt img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-opt:hover { transform: translateY(-2px); }
.avatar-opt.on { border-color: var(--accent); }

.cover-swatch-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.cover-swatch { aspect-ratio: 1; border-radius: var(--r-xs); border: 2px solid transparent; }
.cover-swatch.on { border-color: var(--accent); }

/* -- about / preview / list ---------------------------------------------- */
.about-card { margin-top: 12px; }
.preview-banner { position: relative; height: 130px; border-radius: var(--r-lg); overflow: hidden; }
.preview-cta { padding: 18px; text-align: center; }
.pcta-title { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.pcta-copy { margin: 6px auto 14px; max-width: 40ch; font-size: 13px; font-weight: 600; color: var(--muted); }

.list-link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 15px 18px; text-align: left;
  font-size: 13.5px; font-weight: 700;
  transition: background var(--t-fast) var(--ease);
}
.list-link:hover { background: var(--card-2); }
.list-link + .list-link { border-top: 1px solid var(--line); }
.ll-l { display: flex; align-items: center; gap: 11px; }

.trait {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
}
.trait:first-of-type { border-top: none; }
.trait .k { color: var(--muted); }
.trait .v { font-weight: 700; text-align: right; }

.sheet-opensea { display: flex; align-items: center; justify-content: center; gap: 8px; }

/* Trait list inside the detail sheet. */
.sheet-traits { margin-top: 4px; }

/* Hexagon utility — same six-sided mask used by the profile PFP, so any
   avatar rendered elsewhere (pickers, previews) matches exactly. */
.hex {
  clip-path: polygon(50% 0%, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%);
  aspect-ratio: 1;
  object-fit: cover;
}

/* Icon-only variant of the theme toggle used in the top bar. */
.theme-toggle-icon { font-size: 15px; line-height: 1; }

/* ======================================================== 7. OVERLAYS ===== */

.sheet-scrim, .modal-scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8, 10, 14, .55);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t) var(--ease);
}
.sheet-scrim.open, .modal-scrim.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 51;
  width: 100%; max-width: var(--app-w);
  transform: translateX(-50%) translateY(100%);
  background: var(--card);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-lg);
  max-height: 92vh; overflow-y: auto;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  transition: transform var(--t) var(--ease);
}
.sheet.open { transform: translateX(-50%) translateY(0); }
.sheet-grab { width: 38px; height: 4px; margin: 10px auto 4px; border-radius: var(--r-pill); background: var(--border); }
.sheet-art {
  position: relative; aspect-ratio: 1; margin: 6px 16px 0;
  border-radius: var(--r); overflow: hidden;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 44px; color: #fff;
}
.sheet-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sheet-body { padding: 16px 18px 4px; }
.sheet-title { font-family: var(--font-display); font-weight: 600; font-size: 21px; letter-spacing: -.015em; }
.sheet-sub { margin-top: 2px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.sheet-actions { display: flex; gap: 10px; margin: 14px 0 4px; }

.modal {
  position: fixed; left: 50%; top: 50%; z-index: 51;
  transform: translate(-50%, -48%) scale(.97);
  width: calc(100% - 32px); max-width: 420px;
  max-height: 88vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.modal.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  background: var(--card);
}
.modal-head h3 { font-size: 16px; }
.modal-close { width: 30px; height: 30px; border-radius: var(--r-pill); color: var(--muted); }
.modal-close:hover { background: var(--card-2); }
.modal-body { padding: 16px 18px; }
.modal-actions { display: flex; gap: 10px; padding: 0 18px 18px; }

.field-label {
  margin: 14px 0 6px; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.field-label:first-child { margin-top: 0; }
.field-input {
  width: 100%; padding: 11px 13px;
  background: var(--card-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; resize: vertical;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.field-input:focus { outline: none; border-color: var(--accent); background: var(--card); }
.field-social-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.field-social-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px); z-index: 80;
  transform: translateX(-50%) translateY(12px);
  max-width: min(88%, 400px); text-align: center;
  padding: 11px 18px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--bg);
  font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ====================================================== 8. RESPONSIVE ===== */

/* -- small phones -------------------------------------------------------- */
@media (max-width: 400px) {
  :root { --app-w: 100%; --gutter: 14px; }
  .nft-grid.mini { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat .n { font-size: 19px; }
}

/* -- large phones / small tablets ---------------------------------------- */
@media (min-width: 620px) and (max-width: 999px) {
  :root { --app-w: 600px; }
  .nft-grid { grid-template-columns: repeat(3, 1fr); }
  .nft-grid.mini { grid-template-columns: repeat(4, 1fr); }
  .badge-grid { grid-template-columns: repeat(3, 1fr); }
  .hero-banner, .profile-banner { height: 200px; }
}

/* ========================================================================
   DESKTOP ≥1000px — a different layout, not a stretched phone.
   · bottom tab bar becomes inline top navigation (no sidebar anywhere)
   · content uses the real page width
   · overlays stop pretending to be phone sheets
   ====================================================================== */
@media (min-width: 1000px) {
  :root { --gutter: 32px; }

  body { background: var(--bg); }

  .app {
    max-width: none; margin: 0;
    padding-bottom: 64px;
    background: transparent;
  }

  /* -- header holds the navigation -------------------------------------- */
  .topbar {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    gap: 24px; padding: 14px max(var(--gutter), calc((100vw - var(--page-max)) / 2));
    border-bottom: 1px solid var(--border);
  }
  .topbar .brand { justify-self: start; }
  .topbar-right { justify-self: end; }

  .tabbar {
    position: static; transform: none;
    justify-self: center;
    width: auto; max-width: none; height: auto; padding: 4px;
    display: flex; gap: 2px;
    background: var(--card-2); border: 1px solid var(--border);
    border-top: 1px solid var(--border);
    border-radius: var(--r-pill);
    backdrop-filter: none;
  }
  .tabbar-brand { display: none; }

  .tab {
    flex-direction: row; gap: 8px;
    padding: 8px 16px; border-radius: var(--r-pill);
    font-size: 13.5px;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  }
  .tab:hover:not(.active) { background: var(--card); color: var(--ink); }
  .tab .tab-icon { width: auto; height: auto; background: none; }
  .tab svg { width: 17px; height: 17px; }
  .tab.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
  .tab.active .tab-icon { background: none; color: var(--accent); }

  /* -- content ----------------------------------------------------------- */
  .screen { max-width: var(--page-max); margin: 0 auto; padding: 20px var(--gutter) 60px; }

  .section-title { font-size: 21px; margin: 34px 2px 16px; }

  /* denser grids on real width */
  .nft-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .nft-grid.mini { grid-template-columns: repeat(6, 1fr); gap: 12px; }
  .badge-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .stat-grid { grid-template-columns: repeat(6, 1fr); gap: 12px; }
  .gstat-row { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .avatar-strip { grid-template-columns: repeat(8, 1fr); gap: 10px; }
  .guild-mini-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }

  /* -- immersive cover: full-bleed, identity overlaps it ----------------- */
  .hero-banner, .profile-banner {
    height: 320px; margin-top: 0;
    margin-left: calc(var(--gutter) * -1); margin-right: calc(var(--gutter) * -1);
    width: calc(100% + var(--gutter) * 2);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
  }
  .hb-title { left: 40px; bottom: 30px; font-size: 32px; }
  .hb-emojis { font-size: 60px; }
  .banner-tagline { left: 40px; bottom: 30px; font-size: 17px; max-width: 55%; }
  .banner-cycle { top: 22px; right: 40px; width: 36px; height: 36px; }

  .profile-hex-wrap { left: 44px; transform: none; bottom: -50px; }
  .profile-hex { width: 128px; height: 128px; font-size: 30px; }

  /* Identity sits beside the hexagon rather than under it. */
  .profile-card { margin-top: 0; padding-left: 200px; min-height: 96px; }
  .profile-id { text-align: left; margin-top: 14px; padding-left: 200px; min-height: 84px; }
  .profile-id-main { font-size: 30px; }
  .profile-bio { margin-left: 0; max-width: 60ch; }
  .profile-quick-row { justify-content: flex-start; }

  .guild-banner { padding: 32px 30px; }
  .guild-banner h2 { font-size: 34px; }
  .gb-emoji { font-size: 88px; right: 26px; }

  /* -- two-column reading layouts ---------------------------------------- */
  .pair-block { padding: 22px 24px; }
  .pair-row { min-height: 72px; }
  .pair-thumb { width: 48px; height: 48px; }

  /* -- overlays behave like desktop dialogs ------------------------------ */
  .sheet {
    left: 50%; top: 50%; bottom: auto;
    transform: translate(-50%, -48%) scale(.98);
    width: min(880px, calc(100vw - 64px)); max-width: none;
    max-height: 86vh; border-radius: var(--r-lg);
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start; column-gap: 4px;
    opacity: 0;
    padding-bottom: 0;
  }
  .sheet.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .sheet-grab { display: none; }
  .sheet-art { grid-row: span 2; margin: 20px 0 20px 20px; }
  .sheet-body { padding: 24px 24px 24px 20px; }
  .sheet-title { font-size: 25px; }

  .modal { max-width: 520px; }

  .toast { bottom: 28px; }

  /* pointer affordances only where a pointer exists */
  .nft-card, .badge, .stat, .list-link { cursor: pointer; }
}

/* -- wide desktop -------------------------------------------------------- */
@media (min-width: 1500px) {
  :root { --page-max: 1400px; }
  .nft-grid { grid-template-columns: repeat(5, 1fr); }
  .nft-grid.mini { grid-template-columns: repeat(8, 1fr); }
  .hero-banner, .profile-banner { height: 380px; }
}

/* -- print / reduced data ------------------------------------------------ */
@media print {
  .tabbar, .topbar, .toast, .sheet, .modal { display: none !important; }
}