/* ============================================================
   黄金矿工 · 产品级设计系统 v2
   ============================================================ */
:root {
  /* Color */
  --bg-deep: #050403;
  --bg-base: #0a0907;
  --bg-raised: #12100c;
  --surface: rgba(26, 22, 16, 0.72);
  --surface-2: rgba(36, 30, 20, 0.82);
  --surface-solid: #1a1610;
  --line: rgba(212, 160, 23, 0.18);
  --line-strong: rgba(240, 193, 75, 0.42);
  --gold-50: #fff6d6;
  --gold-100: #ffe08a;
  --gold-200: #f0c14b;
  --gold-300: #d4a017;
  --gold-400: #a67c12;
  --gold-500: #6b5010;
  --text: #f4ecd9;
  --text-2: #c9bba0;
  --text-3: #8c7f68;
  --ok: #45b86c;
  --ok-bg: rgba(40, 100, 60, 0.25);
  --danger: #e07070;
  --danger-bg: rgba(90, 28, 28, 0.55);
  --warn: #e8b84a;
  --warn-bg: rgba(120, 80, 20, 0.35);

  /* Type */
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --fs-xs: 0.72rem;
  --fs-sm: 0.84rem;
  --fs-md: 0.95rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.4rem;
  --fs-2xl: clamp(1.6rem, 4vw, 2.15rem);
  --fs-3xl: clamp(1.9rem, 5vw, 2.6rem);

  /* Space / radius / shadow */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
  --r-sm: 8px; --r-md: 14px; --r-lg: 20px; --r-full: 999px;
  --shadow-sm: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-md: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(212,160,23,0.08);
  --shadow-glow: 0 0 32px rgba(212,160,23,0.22);
  --max: 1080px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: var(--fs-md);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  background-color: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
}

/* —— Background layers —— */
.bg-layers {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.bg-layers .bg-img {
  position: absolute; inset: 0;
  background:
    /* optional file — ignored if missing via layered fallbacks */
    linear-gradient(180deg, rgba(5,4,3,0.55), rgba(5,4,3,0.88)),
    radial-gradient(ellipse 100% 70% at 50% -20%, rgba(120,80,20,0.35), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(60,40,10,0.35), transparent 50%),
    radial-gradient(ellipse 40% 35% at 100% 80%, rgba(90,60,15,0.25), transparent 45%),
    var(--bg-base);
  background-size: cover;
  background-position: center;
}
/* If assets exist, browsers load; missing file still ok with multi-bg */
.bg-layers .bg-img.has-asset,
body.has-bg-asset .bg-layers .bg-img {
  background-image:
    linear-gradient(180deg, rgba(5,4,3,0.72), rgba(5,4,3,0.92)),
    url("assets/gold-mine-bg.jpg"),
    url("assets/gold-mine-bg.png"),
    radial-gradient(ellipse 100% 70% at 50% -20%, rgba(120,80,20,0.35), transparent 55%);
  background-size: cover, cover, cover, auto;
  background-position: center;
}
.bg-layers .particles {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 10% 20%, rgba(240,193,75,0.35), transparent),
    radial-gradient(1px 1px at 30% 70%, rgba(240,193,75,0.25), transparent),
    radial-gradient(1.5px 1.5px at 70% 30%, rgba(255,224,138,0.3), transparent),
    radial-gradient(1px 1px at 85% 60%, rgba(212,160,23,0.28), transparent),
    radial-gradient(1px 1px at 50% 50%, rgba(240,193,75,0.2), transparent),
    radial-gradient(1.5px 1.5px at 20% 90%, rgba(212,160,23,0.22), transparent);
  background-size: 100% 100%;
  opacity: 0.7;
  animation: drift 28s linear infinite;
}
@keyframes drift {
  from { transform: translateY(0); }
  to { transform: translateY(-20px); }
}
.bg-layers .vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.55) 100%);
}
.bg-noise {
  position: absolute; inset: 0; opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  position: relative; z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-4) var(--sp-7);
}

a { color: var(--gold-200); text-decoration: none; transition: color .15s; }
a:hover { color: var(--gold-100); }

/* —— Topbar —— */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3);
  justify-content: space-between;
  padding: 10px 14px;
  margin-bottom: var(--sp-5);
  background: rgba(12, 10, 8, 0.78);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  position: sticky; top: 10px; z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: var(--fs-lg);
  color: var(--gold-200); letter-spacing: 0.08em;
  text-decoration: none;
}
.brand:hover { color: var(--gold-100); text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; flex-shrink: 0;
  filter: drop-shadow(0 0 10px rgba(240,193,75,0.4));
}
.brand .sub {
  display: block; font-size: var(--fs-xs); font-weight: 400;
  color: var(--text-3); letter-spacing: 0.02em; margin-top: 1px;
}
.nav-links { display: flex; flex-wrap: wrap; gap: 2px; }
.nav-links a {
  color: var(--text-3); font-size: var(--fs-sm);
  padding: 8px 12px; border-radius: var(--r-sm);
  text-decoration: none; transition: .15s;
}
.nav-links a:hover { color: var(--gold-100); background: rgba(212,160,23,0.08); }
.nav-links a.active {
  color: var(--bg-deep); font-weight: 650;
  background: linear-gradient(180deg, var(--gold-100), var(--gold-300));
  box-shadow: 0 2px 14px rgba(212,160,23,0.35);
}
.topbar-actions {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
}
#wallet-bar { display: contents; } /* children flow into topbar-actions */
.wallet-status {
  font-size: var(--fs-xs); color: var(--text-3); max-width: 200px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wallet-status.connected { color: var(--ok); }

/* —— Typography helpers —— */
.page-title {
  font-size: var(--fs-2xl); font-weight: 700; letter-spacing: 0.06em;
  background: linear-gradient(180deg, var(--gold-50), var(--gold-200) 55%, var(--gold-300));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: var(--sp-2);
}
.page-desc { color: var(--text-3); font-size: var(--fs-sm); margin-bottom: var(--sp-5); max-width: 520px; }
.section-title {
  font-size: var(--fs-lg); font-weight: 650; color: var(--gold-200);
  letter-spacing: 0.04em; margin-bottom: var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
}

/* —— Cards / glass —— */
.card {
  background: var(--surface);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-md);
  position: relative; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; top: 0; left: 10%; right: 10%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240,193,75,0.5), transparent);
}
.card-caution {
  border-color: rgba(232,184,74,0.35);
  background: linear-gradient(160deg, rgba(60,40,12,0.65), rgba(20,16,10,0.8));
}
.card-caution::after {
  content: none;
  position: absolute; top: 12px; right: 16px;
  font-size: var(--fs-xs); color: var(--warn);
  letter-spacing: 0.06em;
}
.glass {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
}

/* —— Buttons —— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: var(--r-sm);
  padding: 11px 20px;
  font-family: inherit; font-size: var(--fs-sm); font-weight: 650;
  cursor: pointer; letter-spacing: 0.02em;
  transition: transform .12s, filter .15s, box-shadow .2s, opacity .15s, background .15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-lg { padding: 14px 28px; font-size: var(--fs-md); border-radius: 12px; }
.btn-sm { padding: 7px 12px; font-size: var(--fs-xs); }
.btn-primary, .btn-gold {
  background: linear-gradient(180deg, #f5d076 0%, var(--gold-200) 40%, var(--gold-300) 100%);
  color: #1a1205;
  box-shadow: 0 4px 20px rgba(212,160,23,0.38), inset 0 1px 0 rgba(255,255,255,0.35);
}
.btn-primary:hover:not(:disabled), .btn-gold:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 6px 28px rgba(240,193,75,0.5), inset 0 1px 0 rgba(255,255,255,0.4);
}
.btn-secondary, .btn-outline {
  background: rgba(212,160,23,0.07);
  border: 1px solid var(--line-strong);
  color: var(--gold-200);
}
.btn-secondary:hover:not(:disabled), .btn-outline:hover:not(:disabled) {
  background: rgba(212,160,23,0.14); box-shadow: var(--shadow-glow);
}
.btn-danger {
  background: var(--danger-bg); color: #ffb8b8;
  border: 1px solid rgba(180,60,60,0.5);
}
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-4); align-items: center; }
.btn-row a.btn { text-decoration: none; }

/* —— Badges —— */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 650;
  border: 1px solid var(--line); background: rgba(212,160,23,0.1); color: var(--gold-300);
}
.badge-lv1 { color: var(--gold-300); }
.badge-lv2 {
  color: #d4b0ff; border-color: rgba(180,120,220,0.4);
  background: rgba(120,60,160,0.22);
}
.badge-lv3 {
  color: var(--gold-100); border-color: var(--gold-300);
  background: rgba(212,160,23,0.22);
  box-shadow: 0 0 12px rgba(240,193,75,0.25);
}
.mock-tag {
  font-size: 0.62rem; font-weight: 500; color: var(--gold-400);
  border: 1px dashed rgba(138,106,26,0.55);
  padding: 2px 7px; border-radius: 5px; letter-spacing: 0.05em;
}

/* —— Form (reserved) —— */
.field { margin-bottom: var(--sp-3); }
.field label {
  display: block; font-size: var(--fs-xs); color: var(--text-3);
  margin-bottom: 6px; letter-spacing: 0.04em;
}
.field input, .field select {
  width: 100%; padding: 10px 12px;
  background: rgba(0,0,0,0.35); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--text); font-family: inherit; font-size: var(--fs-sm);
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(212,160,23,0.15);
}

/* —— Empty state —— */
.empty {
  text-align: center; padding: var(--sp-6) var(--sp-4);
  color: var(--text-3);
}
.empty-icon {
  width: 64px; height: 64px; margin: 0 auto var(--sp-3);
  opacity: 0.7;
}
.empty h3 { color: var(--text-2); font-size: var(--fs-lg); margin-bottom: var(--sp-2); font-weight: 600; }
.empty p { font-size: var(--fs-sm); margin-bottom: var(--sp-4); }

/* —— Hero (home) —— */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--sp-5);
  align-items: center;
  margin-bottom: var(--sp-5);
}
.hero-copy h1 {
  font-size: var(--fs-3xl); font-weight: 750; letter-spacing: 0.1em;
  background: linear-gradient(180deg, #fff8e0, var(--gold-200) 50%, var(--gold-300));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: var(--sp-3);
  line-height: 1.2;
}
.hero-copy .lead {
  color: var(--text-2); font-size: var(--fs-md); margin-bottom: var(--sp-4);
  max-width: 420px;
}
.hero-visual {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(20,16,10,0.6);
  min-height: 220px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
}
.hero-visual .hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 60%, rgba(212,160,23,0.25), transparent 55%),
    linear-gradient(180deg, #1a140c, #0a0806);
}
body.has-hero-asset .hero-visual .hero-bg {
  background:
    linear-gradient(180deg, rgba(5,4,3,0.35), rgba(5,4,3,0.75)),
    url("assets/gold-mine-hero.jpg") center/cover no-repeat,
    url("assets/gold-mine-hero.png") center/cover no-repeat;
}
.hero-visual svg.mine-art {
  position: relative; z-index: 1;
  width: min(100%, 380px); height: auto;
}

.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.pillar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  backdrop-filter: blur(12px);
  transition: border-color .2s, box-shadow .2s;
}
.pillar:hover { border-color: var(--line-strong); box-shadow: var(--shadow-glow); }
.pillar .num {
  font-size: var(--fs-xs); color: var(--gold-300); letter-spacing: 0.12em;
  margin-bottom: var(--sp-2); font-weight: 650;
}
.pillar h3 { font-size: var(--fs-md); color: var(--gold-100); margin-bottom: 6px; font-weight: 650; }
.pillar p { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.5; }

/* —— Progress / ring —— */
.progress-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-5);
  align-items: center;
}
.ring-wrap {
  position: relative; width: 140px; height: 140px; flex-shrink: 0;
}
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 9; }
.ring-fg {
  fill: none; stroke: url(#ringGold); stroke-width: 9; stroke-linecap: round;
  stroke-dasharray: 339.3; stroke-dashoffset: 339.3;
  transition: stroke-dashoffset 0.65s cubic-bezier(.22,1,.36,1);
  filter: drop-shadow(0 0 8px rgba(240,193,75,0.5));
}
.ring-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
}
.ring-label .pct {
  font-size: 1.35rem; font-weight: 750; color: var(--gold-200);
  font-variant-numeric: tabular-nums;
}
.ring-label .tiny { font-size: var(--fs-xs); color: var(--text-3); }
.progress-meta {
  display: flex; justify-content: space-between; font-size: var(--fs-sm);
  color: var(--text-3); margin-bottom: var(--sp-3);
}
.progress-meta strong { color: var(--gold-200); }
.bar {
  height: 14px; background: rgba(0,0,0,0.45);
  border-radius: var(--r-full); border: 1px solid var(--line);
  overflow: hidden; box-shadow: inset 0 2px 6px rgba(0,0,0,0.45);
}
.bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-300) 45%, var(--gold-200));
  border-radius: inherit;
  transition: width .55s cubic-bezier(.22,1,.36,1);
  box-shadow: 0 0 14px rgba(240,193,75,0.45);
  position: relative;
}
.bar-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.3), transparent 55%);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}
.stat {
  background: linear-gradient(160deg, rgba(50,40,22,0.65), rgba(18,14,10,0.85));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  transition: border-color .2s, box-shadow .2s;
}
.stat:hover { border-color: var(--line-strong); box-shadow: var(--shadow-glow); }
.stat .label { font-size: var(--fs-xs); color: var(--text-3); letter-spacing: 0.04em; }
.stat .value {
  font-size: 1.25rem; color: var(--gold-200); font-weight: 700;
  margin-top: 4px; font-variant-numeric: tabular-nums;
}
.stat .value.sm { font-size: 1rem; }

/* —— Worker cards —— */
.worker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.worker-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  transition: border-color .2s, transform .15s, box-shadow .2s;
}
.worker-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.worker-card .head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: var(--sp-3);
}
.worker-card .id {
  font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-2);
}
.worker-card .eff {
  font-size: var(--fs-xl); font-weight: 700; color: var(--gold-200);
  margin: var(--sp-2) 0;
}
.worker-card .meta { font-size: var(--fs-xs); color: var(--text-3); margin-bottom: var(--sp-3); }

/* —— Pool dashboard —— */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.dash-metric {
  background: linear-gradient(145deg, rgba(45,36,18,0.7), rgba(16,12,8,0.9));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
}
.dash-metric .label { font-size: var(--fs-xs); color: var(--text-3); letter-spacing: 0.06em; }
.dash-metric .value {
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  font-weight: 750; color: var(--gold-200);
  margin-top: 6px; font-variant-numeric: tabular-nums;
}
.dash-metric.accent {
  grid-column: span 2;
  border-color: var(--line-strong);
  box-shadow: var(--shadow-glow);
}

/* —— Table —— */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th, td {
  text-align: left; padding: 12px 10px;
  border-bottom: 1px solid rgba(212,160,23,0.1);
}
th {
  color: var(--text-3); font-weight: 500; font-size: var(--fs-xs);
  letter-spacing: 0.08em; text-transform: uppercase;
}
tr:hover td { background: rgba(212,160,23,0.04); }
td.num {
  font-variant-numeric: tabular-nums; color: var(--gold-200);
  font-family: var(--mono); font-size: var(--fs-sm);
}
.rank-1 td:first-child { color: var(--gold-100); font-weight: 700; }
.rank-2 td:first-child { color: var(--gold-200); }
.rank-3 td:first-child { color: var(--gold-300); }

/* —— Rules —— */
.rules ol { padding-left: 1.25em; color: var(--text-2); font-size: var(--fs-sm); }
.rules li { margin-bottom: 8px; }
.rules strong { color: var(--text); font-weight: 650; }
.hint { color: var(--text-3); font-size: var(--fs-sm); margin-top: var(--sp-3); line-height: 1.5; }

/* —— Toast / Footer —— */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(22,18,12,0.94); backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong); color: var(--text);
  padding: 12px 20px; border-radius: 10px;
  font-size: var(--fs-sm); z-index: 99;
  display: none; opacity: 0;
  box-shadow: var(--shadow-md), var(--shadow-glow);
  max-width: min(90vw, 420px); text-align: center;
  transition: opacity .2s, transform .2s;
}
.toast.show { display: block; opacity: 1; transform: translateX(-50%) translateY(0); }

.footer {
  margin-top: var(--sp-6); padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
  text-align: center; font-size: var(--fs-xs); color: var(--text-3);
  letter-spacing: 0.04em;
}
.footer .gold-line {
  display: block; width: 56px; height: 2px; margin: 0 auto 12px;
  background: linear-gradient(90deg, transparent, var(--gold-300), transparent);
}

/* admin page removed */

/* —— Responsive —— */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .pillars { grid-template-columns: 1fr; }
  .progress-panel { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .progress-meta { flex-direction: column; gap: 4px; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-metric.accent { grid-column: span 1; }
}
@media (max-width: 640px) {
  .wrap { padding: 12px 12px 48px; }
  .topbar { position: relative; top: 0; padding: 10px; }
  .nav-links { width: 100%; order: 3; }
  .brand .sub { display: none; }
  .btn-lg { width: 100%; }
  .btn-row .btn, .btn-row a.btn { flex: 1 1 auto; }
  .card-caution::after { position: static; display: block; margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}


/* —— Character portraits / 角色立绘 —— */
.portrait {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(212,160,23,0.12), inset 0 0 40px rgba(0,0,0,0.25);
  background: linear-gradient(180deg, #1a140c, #0a0806);
}
.portrait img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
  display: block;
  transition: transform 0.35s ease;
}
.worker-card:hover .portrait img,
.codex-card:hover .portrait img { transform: scale(1.03); }
.portrait-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  box-shadow: 0 2px 10px rgba(0,0,0,0.45);
}
.portrait-frame::after {
  content: "";
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(180deg, transparent 55%, rgba(5,4,3,0.72) 100%);
  border-radius: inherit;
}

.worker-card .portrait { margin-bottom: var(--sp-3); }
.worker-card { padding: var(--sp-3); }

.codex {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}
.codex-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  transition: border-color .2s, box-shadow .2s;
}
.codex-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-glow); }
.codex-card h4 {
  margin: var(--sp-3) 0 4px;
  font-size: var(--fs-md); color: var(--gold-100); font-weight: 650;
}
.codex-card .eff-line {
  font-size: var(--fs-sm); color: var(--gold-200); font-weight: 700;
  margin-bottom: 4px;
}
.codex-card .desc { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.45; }

.hire-preview {
  display: flex; align-items: center; gap: var(--sp-4);
  margin-top: var(--sp-4);
  padding: var(--sp-3);
  background: rgba(20,16,10,0.55);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.hire-preview .portrait {
  width: 96px; flex-shrink: 0;
  aspect-ratio: 3 / 4;
}
.hire-preview .preview-copy { font-size: var(--fs-sm); color: var(--text-2); }
.hire-preview .preview-copy strong { color: var(--gold-200); }

@media (max-width: 860px) {
  .codex { grid-template-columns: 1fr; max-width: 320px; margin-left: auto; margin-right: auto; }
}
@media (max-width: 640px) {
  .hire-preview { flex-direction: column; align-items: flex-start; }
  .hire-preview .portrait { width: 120px; }
}


/* Agent mint prompt — always visible, high contrast */
.agent-prompt-card {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  scroll-margin-top: 88px;
  border: 1px solid rgba(212,160,23,0.55) !important;
  box-shadow: 0 0 0 1px rgba(212,160,23,0.15), 0 12px 40px rgba(0,0,0,0.45), 0 0 48px rgba(212,160,23,0.12) !important;
  background: linear-gradient(180deg, rgba(40,30,12,0.92), rgba(18,14,8,0.95)) !important;
  margin-top: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.agent-prompt-card .section-title {
  font-size: var(--fs-xl);
  color: var(--gold-100, #f5e6b8);
}
.agent-prompt-card #agent-prompt-text {
  display: block !important;
  max-height: 360px;
  overflow: auto;
}



/* Hero right: slot hire order (fills empty visual) */
.hero-slots-panel {
  min-height: 280px;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}
.hero-slots-panel .hero-bg {
  opacity: 0.85;
}
.hero-slots-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hero-slots-title {
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold-100, #f5e6b8);
  border-bottom: 1px solid rgba(212,160,23,0.3);
  padding-bottom: 8px;
}
.hero-slots-ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hero-slots-ol li {
  display: grid;
  grid-template-columns: 3.2em 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(12,10,7,0.55);
  border: 1px solid rgba(212,160,23,0.2);
}
.hero-slots-ol .hs-n {
  grid-row: 1 / span 2;
  align-self: center;
  font-weight: 750;
  color: var(--gold-200, #e8c86a);
  font-size: var(--fs-sm);
}
.hero-slots-ol .hs-p {
  font-weight: 700;
  color: #fff8e0;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.hero-slots-ol .hs-p.free { color: #7ddea0; }
.hero-slots-ol .hs-d {
  grid-column: 2;
  font-size: 11px;
  color: var(--text-3, #a89878);
  line-height: 1.35;
}
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
}


.hero-slots-fill {
  margin: 4px 0 0;
  padding: 12px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(212,160,23,0.35);
  background: rgba(12,10,7,0.45);
  color: var(--text-2, #d4c4a0);
  font-size: 13px;
  line-height: 1.55;
  flex: 1;
}
.hero-slots-ol .hs-p {
  font-size: var(--fs-md);
  letter-spacing: 0.04em;
}


/* Leaderboard: levels + mined */
.lb-table th:nth-child(3),
.lb-table td:nth-child(3) { white-space: nowrap; }
.lb-unit {
  font-size: 11px;
  color: var(--text-3, #a89878);
  font-weight: 500;
}
.lb-levels {
  line-height: 1.8;
}
.lv-pill {
  display: inline-block;
  padding: 1px 7px;
  margin: 1px 2px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(212,160,23,0.35);
  background: rgba(20,16,10,0.7);
  color: #e8d9b0;
}
.lv-pill.lv-1 { border-color: rgba(180,160,120,0.4); color: #d4c4a0; }
.lv-pill.lv-2 { border-color: rgba(212,160,23,0.55); color: #f0c14b; background: rgba(212,160,23,0.12); }
.lv-pill.lv-3 { border-color: rgba(255,200,80,0.7); color: #ffe08a; background: rgba(255,200,80,0.16); box-shadow: 0 0 10px rgba(212,160,23,0.2); }
.lb-mined { color: var(--gold-100, #f5e6b8); font-weight: 700; }
.lb-addr { font-variant-numeric: tabular-nums; }


.lb-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.lb-filter {
  appearance: none;
  border: 1px solid rgba(212,160,23,0.3);
  background: rgba(20,16,10,0.65);
  color: var(--text-2, #d4c4a0);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.lb-filter:hover {
  border-color: rgba(212,160,23,0.55);
  color: #f5e6b8;
}
.lb-filter.active {
  background: rgba(212,160,23,0.2);
  border-color: rgba(212,160,23,0.7);
  color: #ffe08a;
  box-shadow: 0 0 12px rgba(212,160,23,0.15);
}


/* Five fixed character-position avatar slots — uses assets/miner-lv{1,2,3}.jpg */
.slots-rack {
  display: grid;
  grid-template-columns: repeat(5, 52px);
  gap: 8px;
  align-items: stretch;
  width: max-content;
  max-width: 100%;
}
.slots-rack .slot-cell {
  width: 52px;
  height: 70px;
  aspect-ratio: auto;
}
.slots-rack-inline {
  display: grid;
  grid-template-columns: repeat(5, 36px);
  gap: 4px;
  align-items: stretch;
  width: max-content;
  max-width: 200px;
  min-width: 0;
}
.slot-cell {
  position: relative;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(212,160,23,0.28);
  background: rgba(12,10,7,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}
.slots-rack-inline .slot-cell {
  width: 36px;
  height: 48px;
  aspect-ratio: auto;
}
.slot-cell.filled {
  border-color: rgba(212,160,23,0.5);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.slot-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.slot-lv {
  position: absolute;
  left: 2px;
  bottom: 2px;
  font-size: 8px !important;
  padding: 0 3px !important;
  line-height: 1.3 !important;
}
.slots-rack .slot-lv {
  font-size: 10px !important;
  padding: 1px 5px !important;
}
.slot-cell.empty {
  border-style: dashed;
  opacity: 0.75;
  flex-direction: column;
  gap: 2px;
}
.slot-empty-mark {
  font-size: 9px;
  color: var(--text-3, #a89878);
  letter-spacing: 0.06em;
}
.slots-rack .slot-empty-mark { font-size: 12px; }
.slot-idx {
  font-size: 8px;
  color: rgba(212,160,23,0.55);
}
.lb-table td.lb-levels {
  vertical-align: middle;
  min-width: 0;
  width: 1%;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .slots-rack { max-width: 100%; }
  .slots-rack-inline {
    grid-template-columns: repeat(5, 30px);
    max-width: 170px;
  }
  .slots-rack-inline .slot-cell {
    width: 30px;
    height: 40px;
  }
}
