/* Collector's field guide: quiet graphite tools, mint as a useful mark, Sprite art as the color.
   Design adapted from Unslop by Damir Sokolovsky (@heydamir), https://heydamir.design/unslop, CC BY 4.0: https://creativecommons.org/licenses/by/4.0/. */
:root {
  color-scheme: dark;
  --bg: #171918;
  --bg-2: #1d201e;
  --panel: #202321;
  --panel-solid: #202321;
  --panel-2: #292d2a;
  --text: #eef0eb;
  --muted: #b3b9b1;
  --faint: #919990;
  --line: rgba(238, 240, 235, .12);
  --accent: #8bd8b0;
  --accent-2: #8bd8b0;
  --gold: #d6c58e;
  --good: #8bd8b0;
  --bad: #e38f8f;
  --warn: #d6b878;
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 32px rgba(0,0,0,.18);
}

html { background: var(--bg); }
body {
  color: var(--text);
  background: var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.app-shell { width: min(1440px, calc(100% - 48px)); padding: 28px 0 40px; }
.hero {
  min-height: 0;
  grid-template-columns: minmax(0,1fr) minmax(240px,300px);
  gap: 32px;
  align-items: center;
  padding: 28px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-solid);
  box-shadow: none;
}
.hero::after { content: none; }
.eyebrow, .workspace-eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .01em;
  text-transform: none;
}
h1 { max-width: 760px; font-size: clamp(32px,4.2vw,52px); line-height: 1.08; letter-spacing: -.035em; font-weight: 550; }
.lede { max-width: 620px; margin-top: 12px; font-size: 16px; line-height: 1.5; }
.hero-card, .control-panel, .tabs, .section-head, .sprite-card, .friend-block, .summary-card, .table-wrap, .empty-card {
  border-color: var(--line);
  background: var(--panel-solid);
  backdrop-filter: none;
  box-shadow: none;
}
.hero-card { padding: 18px; border-radius: 12px; }
.hero-card strong { font-size: 24px; font-weight: 550; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.hero-card #activeUserProgress { color: var(--accent); font-weight: 500; }
.save-status, .last-changed-status { font-weight: 400; }
.control-panel { margin-top: 16px; padding: 16px; border-radius: 12px; gap: 12px 16px; grid-template-areas: "profile palette actions" "hint hint hint"; grid-template-columns: minmax(0, 46%) minmax(200px, 240px) auto; }
.control-panel > .field-row { grid-area: profile; }
.control-panel > .palette-control { grid-area: palette; }
.control-panel > .profile-actions { grid-area: actions; }
.control-panel > #profileHint { grid-area: hint; margin: 0; }
.hero-profile { display: flex; flex-direction: column; gap: 12px; min-width: 0; position: relative; z-index: 1; }
.palette-control { display: flex; align-items: center; gap: 8px; margin-left: 0; font-size: 13px; color: var(--muted); }
.control-panel > .field-row label, .palette-control label { min-width: 104px; }
.control-panel > .field-row select, .palette-control select { flex: 1; min-width: 0; width: 100%; }
.palette-control select { min-height: 38px; padding: 0 32px 0 10px; }
.field-row, .profile-actions { gap: 8px; }
.field-row label, .field-stack { font-weight: 500; }
select, input[type="text"], input[type="password"], input[type="search"] {
  border-color: var(--line); border-radius: 8px; background: #191b1a; color: var(--text); padding-inline: 12px;
}
input::placeholder { color: var(--faint); }
button:focus-visible, input:focus-visible, select:focus-visible, .table-wrap:focus-visible, .workspace-family summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(139,216,176,.16); }
.profile-actions button, .dialog-actions button, .tab {
  min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); background: var(--panel-2); font-weight: 500;
}
.profile-actions button:first-child, .dialog-actions button[type="submit"]:not(.danger-button) {
  color: #14251c; background: var(--accent); border-color: var(--accent);
}
.danger-button, .profile-dialog-delete { color: #ffe8e8 !important; background: #633b3b !important; }
.danger-button:hover, .profile-dialog-delete:hover { background: #764646 !important; }
.ghost-button { color: var(--text) !important; background: var(--panel-2) !important; }
.profile-dialog { border-color: var(--line); border-radius: 14px; background: var(--panel-solid); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.profile-dialog::backdrop { background: rgba(7,9,8,.72); backdrop-filter: blur(2px); }
.profile-dialog-card { gap: 16px; padding: 24px; }
.tabs { top: 8px; gap: 4px; margin: 16px 0 20px; padding: 5px; border-radius: 10px; background: #1c1f1d; }
.tab { flex: 0 1 auto; min-width: 88px; border-color: transparent; background: transparent; }
.tab.active { color: #14251c; background: var(--accent); border-color: var(--accent); }
.tab:not(.active):hover { border-color: var(--line); background: var(--panel-2); color: var(--text); }
.workspace-layout { grid-template-columns: 224px minmax(0,1fr); gap: 24px; }
.workspace-nav { top: 76px; gap: 4px; padding: 16px; border-color: var(--line); border-radius: 12px; background: var(--panel-solid); }
.workspace-eyebrow { margin: 0 8px 8px; }
.workspace-nav button { min-height: 36px; padding: 8px 10px; border-radius: 7px; color: var(--muted); font-size: 14px; }
.workspace-nav button:hover { background: var(--panel-2); color: var(--text); }
.workspace-nav button[aria-pressed="true"] { color: #14251c; background: var(--accent); font-weight: 550; }
.workspace-nav p { margin: 16px 8px 8px; font-size: 13px; line-height: 1.5; }
.workspace-nav a { margin: 4px 8px; font-size: 13px; }
.archive-link-secondary { color: var(--accent); font-weight: 500; }
.workspace-intro { margin-bottom: 16px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-solid); }
.workspace-intro .eyebrow { color: var(--muted); }
.workspace-intro h2 { margin: 4px 0 6px; font-size: 24px; line-height: 1.25; letter-spacing: -.02em; font-weight: 550; }
.workspace-intro p { margin: 4px 0; font-size: 14px; }
.workspace-controls { margin-bottom: 20px; padding: 16px; border-color: var(--line); border-radius: 12px; background: var(--panel-solid); }
.workspace-filters { gap: 12px; }
.workspace-filters .pill-toggle, .pill-toggle { border-color: var(--line); border-radius: 8px; padding: 0 12px; color: var(--muted); font-size: 13px; }
.workspace-variants { gap: 6px; padding: 12px 1px 2px; }
.workspace-variants button, .compare-filter-actions button { border-color: var(--line); border-radius: 7px; background: var(--panel-2); color: var(--text); font-weight: 450; }
.workspace-variants button[aria-pressed="true"] { border-color: var(--accent); color: #14251c; background: var(--accent); }
.workspace-section-head, .workspace-queue-head { margin: 24px 0 12px; }
.workspace-section-head h2, .workspace-queue-head h3 { font-size: 20px; font-weight: 550; }
.workspace-families { gap: 8px; }
.workspace-family { border-color: var(--line); border-radius: 12px; background: var(--panel-solid); }
.workspace-family summary { gap: 12px; padding: 14px; }
.workspace-chevron { transition: transform 160ms cubic-bezier(.22,1,.36,1); }
.workspace-family-avatar { width: 44px; height: 44px; border-radius: 8px; background: var(--panel-2); }
.workspace-family-name strong { font-size: 15px; font-weight: 550; }
.workspace-family-name small { font-size: 12px; }
.workspace-strip { gap: 4px; }
.workspace-mini { width: 40px; }
.workspace-mini img { width: 36px; height: 36px; }
.workspace-mini small { font-size: 11px; }
.workspace-mini b { color: var(--accent); }
.workspace-family-progress { width: 64px; font-size: 11px; font-variant-numeric: tabular-nums; }
.workspace-family-progress i { height: 4px; background: #373c38; }
.workspace-family-progress i span { background: var(--accent); }
.workspace-family-body { padding: 0 14px 14px; }
.workspace-family-description { padding: 8px 3px; font-size: 13px; }
.workspace-family .sprite-option { margin: 6px 0; border-radius: 9px; padding: 10px; }
.workspace-pin { border-radius: 8px; background: var(--panel-2); color: var(--muted); font-size: 15px; }
.workspace-pin[aria-pressed="true"] { color: #14251c; background: var(--accent); border-color: var(--accent); }
.workspace-pinned { gap: 12px; }
.workspace-target { border-color: var(--line); border-radius: 12px; background: var(--panel-solid); padding: 16px; }
.workspace-target img { width: 80px; height: 80px; margin: 8px auto 12px; }
.workspace-target h3 { font-size: 15px; font-weight: 550; }
.workspace-target p { font-size: 13px; }
.workspace-target-actions label { border-color: var(--line); border-radius: 8px; font-size: 13px; }
.workspace-empty { border-color: var(--line); border-radius: 12px; padding: 24px; }
.section-head { padding: 20px 22px; margin-bottom: 16px; border-radius: 12px; }
h2 { font-size: clamp(24px,3vw,32px); line-height: 1.2; letter-spacing: -.025em; font-weight: 550; }
.section-head p { margin-top: 8px; }
.filters { gap: 12px; }
.search { gap: 6px; font-size: 13px; font-weight: 500; }
.pill-toggle input, .compare-user-checkbox, .sprite-option input { accent-color: #4e9c72; }
.collection-progress { margin-bottom: 16px; border-color: rgba(139,216,176,.25); border-radius: 8px; background: rgba(139,216,176,.08); text-align: left; font-weight: 500; }
.tracker-progress-summary { gap: 12px; }
.progress-stat { border-color: var(--line); border-radius: 10px; background: var(--panel-solid); padding: 16px; }
.progress-stat > span { font-size: 13px; font-weight: 450; }
.progress-stat > strong { margin-top: 4px; font-size: 24px; font-weight: 550; font-variant-numeric: tabular-nums; }
.progress-stat--mastery { border-color: rgba(214,197,142,.28); background: rgba(214,197,142,.05); }
.progress-stat--mastery .progress-bar span { background: var(--gold); }
.compare-filter { padding: 16px; border-color: var(--line); border-radius: 12px; background: var(--panel-solid); box-shadow: none; }
.compare-filter-head { margin-bottom: 12px; }
.compare-filter-head h3 { font-size: 18px; font-weight: 550; letter-spacing: -.01em; }
.compare-filter-head p { margin: 4px 0 0; color: var(--muted); }
.compare-user-list { gap: 8px; }
.compare-user-pill { border-color: var(--line); border-radius: 8px; background: var(--bg-2); }
.compare-user-pill:hover, .compare-user-pill:has(.compare-user-checkbox:checked) { border-color: rgba(139,216,176,.42); background: rgba(139,216,176,.09); }
.sprite-grid { gap: 12px; }
.sprite-card { border-radius: 12px; padding: 16px; }
.family-title { font-size: 18px; font-weight: 550; letter-spacing: -.01em; }
.family-progress { padding: 3px 8px; border-radius: 6px; color: var(--accent); background: rgba(139,216,176,.09); font-weight: 500; font-variant-numeric: tabular-nums; }
.family-progress.is-incomplete { color: var(--muted); background: var(--panel-2); }
.sprite-option { min-height: 58px; grid-template-columns: 34px 48px minmax(0,1fr) auto; gap: 10px; border-radius: 9px; background: #242725; transition: border-color 150ms cubic-bezier(.22,1,.36,1), background-color 150ms cubic-bezier(.22,1,.36,1); }
.sprite-option:hover, .sprite-collection-cell:hover { transform: none; border-color: rgba(139,216,176,.45); }
.sprite-option--mastered { border-color: rgba(214,197,142,.4); background: rgba(214,197,142,.07); box-shadow: none; }
.sprite-option--unreleased { opacity: .68; }
.collection-cell-grid { gap: 8px; }
.sprite-collection-cell { gap: 5px; padding: 8px 4px; border-radius: 8px; background: #242725; transition: border-color 150ms cubic-bezier(.22,1,.36,1), background-color 150ms cubic-bezier(.22,1,.36,1); }
.sprite-collection-cell--missing { border: 1px dashed rgba(214,184,120,.48); background: rgba(214,184,120,.04); box-shadow: none; }
.sprite-collection-cell--mastered { border-color: rgba(214,197,142,.48); background: rgba(214,197,142,.08); box-shadow: none; }
.collection-mastery-badge { color: var(--gold); filter: none; }
.sprite-collection-cell--missing::after { content: ""; top: 5px; right: 5px; width: 6px; height: 6px; border: 1px solid var(--warn); border-radius: 50%; background: transparent; }
.sprite-collection-cell .sprite-name { font-size: 12px; font-weight: 450; }
.sprite-image { background: #292d2a; border-color: rgba(238,240,235,.1); border-radius: 8px; }
.sprite-image--option { width: 48px; height: 48px; }
.mastery-button { border-color: rgba(214,197,142,.4); border-radius: 7px; color: var(--gold); background: rgba(214,197,142,.06); font-weight: 500; }
.mastery-button:hover, .mastery-button.is-mastered { color: #201c10; background: var(--gold); border-color: var(--gold); }
.sprite-name { font-weight: 550; }
.family-description, .sprite-description { font-size: 13px; line-height: 1.45; }
.sprite-meta { gap: 8px; font-size: 12px; }
.badge { border-radius: 5px; padding: 2px 6px; background: #303431; }
.badge.starter, .summon-cost, .rarity-Mythic, .rarity-Legendary, .rarity-Epic, .rarity-Rare { color: var(--muted); }
.badge.unreleased { color: var(--warn); background: rgba(214,184,120,.08); }
.progress-bar { height: 6px; border-radius: 3px; background: #373c38; }
.progress-bar span { border-radius: inherit; background: var(--accent); }
.friends-card-list { gap: 12px; }
.friend-block { border-radius: 12px; padding: 16px; }
.friend-block h3 { margin-bottom: 10px; font-size: 20px; font-weight: 550; letter-spacing: -.015em; }
.friend-sprite-row { gap: 12px; padding: 12px 0; }
.friend-sprite-name { font-weight: 550; }
.have-list strong { color: var(--good); }
.missing-list strong { color: var(--muted); }
.name-pill { border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; background: var(--panel-2); }
.summary-grid { gap: 12px; }
.summary-card { border-radius: 10px; padding: 16px; }
.summary-card strong { font-size: 24px; font-weight: 550; font-variant-numeric: tabular-nums; }
.table-wrap { border-radius: 12px; }
th, td { padding: 11px 14px; }
th { background: #292d2a; font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 500; }
th:first-child, td:first-child { background: #202321; }
th:first-child { background: #292d2a; }
tr.family-break td { border-top-color: rgba(139,216,176,.28); }
.check { color: var(--good); font-size: 18px; font-weight: 500; }
.mastery-check { color: var(--gold); font-size: 18px; font-weight: 500; filter: none; }
.table-sprite-name { font-weight: 550; }
.toast { border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--panel-2); font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.24); transition: opacity 160ms cubic-bezier(.22,1,.36,1), transform 160ms cubic-bezier(.22,1,.36,1); }

button, a, select, input { transition: color 140ms cubic-bezier(.22,1,.36,1), background-color 140ms cubic-bezier(.22,1,.36,1), border-color 140ms cubic-bezier(.22,1,.36,1); }
@media (max-width: 980px) {
  .app-shell { width: min(100% - 32px, 1440px); }
  .workspace-layout { grid-template-columns: 200px minmax(0,1fr); gap: 16px; }
}
@media (max-width: 760px) {
  .app-shell { width: calc(100% - 24px); padding-top: 12px; }
  .hero { grid-template-columns: 1fr; gap: 18px; padding: 22px; }
  .workspace-layout { display: block; }
  .workspace-nav { gap: 4px; padding: 8px; margin-bottom: 16px; }
  .workspace-nav button { min-height: 38px; }
  .workspace-intro { padding: 18px; }
  .workspace-controls { padding: 12px; }
  .workspace-family summary { padding: 12px; }
  .workspace-mini { width: 36px; }
  .workspace-mini img { width: 32px; height: 32px; }
  .workspace-section-head { gap: 8px; }
  .workspace-section-head .hint { text-align: right; }
  .app-footer { flex-direction: column; gap: 6px; padding-top: 20px; }
}
@media (max-width: 640px) {
  .app-shell { width: calc(100% - 20px); }
  .hero { border-radius: 12px; padding: 18px; }
  h1 { font-size: clamp(30px, 8vw, 40px); letter-spacing: -.03em; }
  .control-panel { padding: 12px; grid-template-columns: minmax(0,1fr); grid-template-areas: "profile" "palette" "actions" "hint"; }
  .palette-control { width: 100%; margin-left: 0; justify-content: flex-start; }
  .control-panel > .field-row, .palette-control { flex-direction: column; align-items: stretch; }
  .control-panel > .field-row label, .palette-control label { min-width: 0; }
  .palette-control select { min-width: 0; max-width: none; }
  .tabs { overflow-x: auto; }
  .tab { min-width: 76px; min-height: 38px; }
  .sprite-grid, .summary-grid, .tracker-progress-summary { grid-template-columns: 1fr; }
  .sprite-option { grid-template-columns: 32px 40px minmax(0,1fr); gap: 8px; }
  .sprite-image--option { width: 40px; height: 40px; }
  .workspace-pinned { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .workspace-target { padding: 12px; }
  .workspace-target-actions { flex-direction: column; align-items: stretch; }
  .workspace-target-actions label { justify-content: center; }
  .table-wrap { border-radius: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Family mini-sprite strips: fixed 3 slots (max variants per family) so rows
   with fewer variants leave trailing blanks and all columns align. */
.workspace-strip {
  display: grid;
  grid-template-columns: repeat(3, 40px);
  gap: 4px;
  justify-content: end;
}

/* --- Treasure Hunters key-art hero (appended last to win the cascade) --- */
.hero {
  background:
    linear-gradient(95deg, rgba(10, 12, 22, 0.88) 0%, rgba(10, 12, 22, 0.6) 52%, rgba(10, 12, 22, 0.24) 100%),
    linear-gradient(0deg, rgba(10, 12, 22, 0.45), rgba(10, 12, 22, 0.05)),
    url("assets/key-art-treasure-hunters-banner.webp") center 30% / cover no-repeat,
    var(--panel-solid);
}

.hero-copy { color: #f5f2ea; }
.hero .eyebrow { color: #ffd166; }
.hero h1 { color: #ffffff; text-shadow: 0 2px 18px rgba(8, 10, 18, 0.65); }
.hero .lede { color: rgba(245, 242, 234, 0.9); }

.hero-card {
  background: rgba(10, 12, 22, 0.74);
  border-color: rgba(245, 242, 234, 0.2);
  color: #f5f2ea;
}
.hero-card strong { color: #ffffff; }
.hero-card #activeUserProgress { color: #ffd166; }
.hero-card .hero-card-label,
.hero-card .save-status,
.hero-card .last-changed-status,
.hero-card span,
.hero-card small { color: rgba(245, 242, 234, 0.88); }
.hero-card .save-status[data-state="error"] { color: #ff9d9d; }
.hero-card .save-status[data-state="saved"] { color: #9fe8b8; }
.hero-card button {
  color: #ffd166;
  border-color: rgba(245, 242, 234, 0.4);
  background: rgba(10, 12, 22, 0.55);
}
.hero-card button:hover { background: rgba(10, 12, 22, 0.8); }


@media (max-width: 640px) {
  .workspace-strip { grid-template-columns: repeat(3, 36px); }
}
