/* ============================================================
   Monero Tier List — styles
   Tokens: dark utility surfaces (coinbase-system structure) +
   Monero brand orange accent (#ff6600, as used by OrangeFren).
   ============================================================ */

:root {
  --bg: #0b0c0e;
  --surface: #121316;
  --surface-2: #191b1f;
  --surface-3: #212429;
  --fg: #f2f3f5;
  --muted: #9aa1ab;
  --faint: #6b7280;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);

  --accent: #ff6600;
  --accent-ink: #1a0f04;
  --accent-soft: rgba(255, 102, 0, 0.14);
  --accent-line: rgba(255, 102, 0, 0.45);

  --tier-S: #ff5c5c;
  --tier-A: #ff9f43;
  --tier-B: #ffd43b;
  --tier-C: #51cf66;
  --tier-D: #4dabf7;
  --tier-F: #8b939c;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-lift: 0 14px 34px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(1100px 500px at 50% -180px, rgba(255, 102, 0, 0.07), transparent 65%),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: auto, 44px 44px, 44px 44px;
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 2000;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; text-decoration: none;
  transform: translateY(-200%);
  transition: transform 150ms ease;
}
.skip-link:focus-visible { transform: translateY(0); }

a { color: inherit; }

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

/* ---------- header ---------- */

.site-header {
  padding: clamp(28px, 5vw, 56px) 20px 18px;
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.logo {
  width: 44px; height: 44px;
  color: var(--accent);
  flex-shrink: 0;
}
#siteTitle {
  margin: 0;
  font-size: clamp(30px, 5.4vw, 52px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.02;
  word-break: break-word;
}
.custom-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.reset-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 32px;
}
.reset-btn:hover { color: var(--fg); border-color: var(--fg); }
#hideAllBtn {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
#hideAllBtn:hover { color: var(--fg); border-color: var(--accent); }
.tagline {
  margin: 12px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 15px;
}
.tagline a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-line);
}
.tagline a:hover { border-bottom-color: var(--accent); }

/* ---------- controls ---------- */

.controls {
  position: sticky;
  top: 0;
  z-index: 500;
  background: rgba(11, 12, 14, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
}
.filter-row {
  max-width: 1680px;
  margin: 0 auto;
}
.filter-row + .filter-row {
  margin-top: 12px;
}
.chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.chip:hover { border-color: var(--fg); color: var(--fg); }
.chip[aria-pressed="true"] {
  background: var(--fg);
  border-color: var(--fg);
  color: #101114;
}
.chip .chip-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}
.chip[aria-pressed="true"] .chip-count { background: rgba(0, 0, 0, 0.12); }

.utility-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 6px;
}

.xmr-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  min-height: 40px;
  user-select: none;
  -webkit-user-select: none;
}
.xmr-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
}
.toggle-track {
  width: 42px; height: 24px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  position: relative;
  transition: background 150ms ease, border-color 150ms ease;
  flex-shrink: 0;
}
.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 150ms ease, background 150ms ease;
}
.xmr-toggle input:checked + .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}
.xmr-toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
  background: var(--accent-ink);
}
.xmr-toggle input:focus-visible + .toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.toggle-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}
.xmr-toggle:hover .toggle-label { color: var(--fg); }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
  max-width: 340px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--faint);
}
.search-box:focus-within {
  border-color: var(--accent-line);
  color: var(--accent);
}
.search-box svg { width: 16px; height: 16px; flex-shrink: 0; }
.search-box input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 14px;
}
.search-box input::placeholder { color: var(--faint); }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }

.showing {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}
.clear-btn {
  min-height: 36px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.clear-btn:hover { color: var(--fg); border-color: var(--fg); }

/* ---------- board ---------- */

.board {
  max-width: 1680px;
  margin: 0 auto;
  padding: 22px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tier {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: stretch;
}

.tier-label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 92px;
  border-radius: var(--radius);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--tier-fallback, var(--fg));
}
.tier-label .letter {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
}
.tier-label .blurb {
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}
.tier-label::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--tier-color, transparent);
  opacity: 0.14;
  border-radius: inherit;
}

.drop-area {
  min-height: 92px;
  padding: 10px;
  border: 1.5px dashed transparent;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.015);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  transition: border-color 120ms ease, background 120ms ease;
}
.drop-area.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.drop-area.drag-over .tier-placeholder { color: var(--accent); }

.tier-placeholder {
  align-self: center;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 10px;
}

/* ---------- hidden row (gray) ---------- */
.tier-hidden .drop-area {
  border-style: dashed;
  background: rgba(127, 140, 153, 0.05);
}
.tier-hidden .drop-area.drag-over {
  border-color: var(--muted);
  background: rgba(127, 140, 153, 0.12);
}
.tier-hidden .drop-area.drag-over .tier-placeholder { color: var(--muted); }
.tier-hidden .card {
  opacity: 0.6;
  filter: grayscale(0.75);
}
.tier-hidden .card:hover,
.tier-hidden .card:focus-visible {
  opacity: 1;
  filter: grayscale(0);
}

/* ---------- right-click context menu ---------- */
.ctx-menu {
  position: fixed;
  z-index: 60;
  min-width: 200px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  display: none;
  flex-direction: column;
  gap: 2px;
}
.ctx-menu.is-open { display: flex; }
.ctx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.ctx-item:hover,
.ctx-item:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}
.ctx-item:disabled {
  opacity: 0.45;
  cursor: default;
}
.ctx-item:disabled:hover { background: transparent; color: var(--fg); }
.ctx-arrow { color: var(--faint); }
.ctx-item:hover .ctx-arrow,
.ctx-item:focus-visible .ctx-arrow { color: var(--accent); }
.ctx-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}
.ctx-subwrap { position: relative; }
.ctx-sub {
  position: absolute;
  top: -6px;
  left: calc(100% + 8px);
  display: none;
  min-width: 170px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
}
.ctx-open-left .ctx-sub {
  left: auto;
  right: calc(100% + 8px);
}
.ctx-subwrap:hover .ctx-sub,
.ctx-subwrap:focus-within .ctx-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ---------- cards ---------- */

.card {
  flex: 1 1 165px;
  max-width: 280px; /* room for one-line category tags (GIFT CARDS & PREPAID) */
  min-width: min-content; /* cards grow to fit their tag/name — the arrow always stays inside */
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  text-decoration: none;
  cursor: grab;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-y;
}
.card:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
  transform: translateY(-1px);
}
.card:active { cursor: grabbing; }

.card .card-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card .card-name-row svg {
  width: 13px; height: 13px;
  color: var(--faint);
  flex-shrink: 0;
}
.card:hover .card-name-row svg { color: var(--accent); }

.card-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
}
.card-logo-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}
.card-name-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  flex: 1;
  min-width: min-content; /* never narrower than the tag's one-line width */
}
.card .card-name {
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  word-break: normal;
  overflow-wrap: normal;
}
.card-name-block .badge-cat {
  font-size: 10px;
  padding: 2px 8px;
}

/* in the filtered strip the category is already shown in the row label —
   drop the per-card tag so the 8 cards keep fitting on one row */
.tier-single .drop-area .card .badge-cat {
  display: none;
}
.tier-single .tier-label .letter {
  font-size: 20px;
  letter-spacing: -0.01em;
}
.tier-single .tier-label .blurb {
  max-width: 64px;
  overflow-wrap: break-word;
  line-height: 1.35;
  text-align: center;
}
/* fade at the right edge only when the strip actually overflows */
.tier-single .drop-area.can-scroll {
  mask-image: linear-gradient(to right, black calc(100% - 36px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 36px), transparent 100%);
}

/* ---------- logo-only mode ---------- */
body.logo-only .card {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex: 0 0 78px;
  width: 78px;
  max-width: 78px;
  min-width: 78px;
  min-height: 78px;
  padding: 9px;
}
body.logo-only .card .card-name-block,
body.logo-only .card .card-badges,
body.logo-only .card .card-meta,
body.logo-only .card .card-name-row svg {
  display: none;
}
body.logo-only .card .card-name-row {
  justify-content: center;
}
body.logo-only .card-logo-tile {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 0;
  background: var(--accent-soft);
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2.5px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-xmr {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}
.badge-xmr::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.badge-noxmr {
  color: var(--faint);
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--border-strong);
}
.badge-cat {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  white-space: nowrap; /* the category tag always fits on one line */
}

.card-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

/* dragging states */
.card.is-dragging {
  position: fixed;
  z-index: 1000;
  margin: 0;
  pointer-events: none;
  cursor: grabbing;
  transform: rotate(-2.5deg) scale(1.05);
  box-shadow: var(--shadow-lift);
  border-color: var(--accent-line);
  background: var(--surface-3);
  transition: none;
}
html.drag-lock { overflow: hidden; }

.card.ghost-src {
  opacity: 0.35;
  border-style: dashed;
}

/* ---------- empty states ---------- */

.board-empty {
  max-width: 1680px;
  margin: 0 auto;
  padding: 60px 20px 80px;
  text-align: center;
}
.empty-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
}
.empty-sub {
  color: var(--muted);
  margin: 0 0 18px;
}
.btn {
  min-height: 44px;
  padding: 8px 22px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 120ms ease;
}
.btn:hover { filter: brightness(1.08); }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 20px 40px;
}
.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--faint);
  font-size: 13px;
}
.footer-inner a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-inner a:hover { color: var(--fg); }
.footer-note { margin: 0; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(8px);
  z-index: 1500;
  max-width: min(92vw, 480px);
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-3);
  color: var(--fg);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .tier { grid-template-columns: 52px 1fr; gap: 8px; }
  .tier-label { min-height: 78px; }
  .tier-label .letter { font-size: 26px; }
  .tier-label .blurb { display: none; }
  .drop-area { min-height: 78px; padding: 7px; gap: 7px; }
  .card { flex-basis: calc(50% - 8px); max-width: none; min-width: min-content; }
  .controls { padding: 8px 12px; }
  .board { padding: 14px 12px 32px; }
  .site-header { padding: 22px 12px 14px; }
  .utility-row { gap: 8px; }
  .search-box { flex-basis: 100%; max-width: none; order: 3; }
  .showing { order: 4; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .card:hover { transform: none; }
}
