:root {
  --bg: #07070d;
  --bg-2: #0d0d18;
  --fg: #f5f7ff;
  --muted: #8b8fa3;
  --line: #1d1d2e;
  --card: #11111c;
  --accent: #c0392b;
  --radius: 12px;
  --maxw: 1040px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark {
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #fff 0 22%, var(--fg) 24% 50%, var(--fg) 50% 100%);
  border: 1px solid var(--fg);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 1.5px; background: var(--fg); transform: translateY(-50%);
}
.brand-name { font-size: 16px; color: var(--fg); }

.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  position: relative;
  padding: 8px 12px; border-radius: 8px;
  color: var(--muted); font-size: 14px;
}
.nav a:hover { color: var(--fg); background: rgba(255,255,255,.04); }
.nav a.active,
.nav a[data-route="feed"].active,
.nav a[data-route="events"].active,
.nav a[data-route="trades"].active,
.nav a[data-route="decks"].active,
.nav a[data-route="browse"].active {
  color: var(--fg);
  background: rgba(255,255,255,.06);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.count {
  display: inline-block; min-width: 18px; padding: 0 6px;
  margin-left: 4px; font-size: 11px; line-height: 18px;
  text-align: center; border-radius: 999px;
  background: rgba(255,255,255,.12); color: var(--fg);
  font-weight: 600;
}

.view {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.center { text-align: center; }
.hidden { display: none !important; }

.input {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  padding: 10px 14px;
  border-radius: var(--radius);
  width: min(320px, 100%);
  outline: none;
}
.input:focus { border-color: var(--fg); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.card {
  display: flex; flex-direction: column; align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 12px 14px;
  cursor: pointer;
}
.card:hover { border-color: color-mix(in srgb, var(--fg) 40%, var(--line)); }
.card img { width: 96px; height: 96px; object-fit: contain; image-rendering: pixelated; }
.card .num { color: var(--muted); font-size: 11px; font-family: ui-monospace, monospace; margin-top: 4px; }
.card .name { font-weight: 500; text-transform: capitalize; margin-top: 2px; font-size: 14px; }

.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.card-search-wrap { position: relative; width: min(420px, 100%); }
.card-search-wrap .card-search-input { width: 100%; }
.card-search-input { width: min(420px, 100%); }

.recent-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px -12px rgba(0,0,0,.4);
  overflow: hidden;
}
.recent-dropdown-head {
  padding: 8px 14px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.recent-dropdown-list { display: flex; flex-direction: column; }
.recent-item-row {
  display: flex;
  align-items: stretch;
}
.recent-item-row:hover { background: color-mix(in srgb, var(--fg) 8%, transparent); }
.recent-item {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: var(--fg);
  font: inherit;
}
.recent-item-icon {
  flex: 0 0 auto;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.recent-item-icon svg { display: block; }
.recent-item-text {
  flex: 1;
  min-width: 0;
  display: flex;
}
.recent-item-name {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-item-remove {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0 14px;
  font-size: 20px;
  line-height: 1;
}
.recent-item-remove:hover { color: var(--fg); }
.recent-dropdown-clear {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-align: center;
}
.recent-dropdown-clear:hover {
  color: var(--fg);
  background: color-mix(in srgb, var(--fg) 6%, transparent);
}
.link-btn {
  background: transparent; border: 0; cursor: pointer;
  padding: 0; color: var(--muted); font-size: 13px;
}
.link-btn:hover { color: var(--fg); }
.set-card {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px 14px;
  cursor: pointer;
}
.set-card:hover {
  border-color: color-mix(in srgb, var(--fg) 40%, var(--line));
}
.set-card-logo {
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  overflow: hidden;
}
.set-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.set-card-fallback {
  font-weight: 600; font-size: 14px; text-align: center;
}
.set-card-info { display: flex; flex-direction: column; gap: 2px; }
.set-card-name { font-weight: 500; font-size: 14px; letter-spacing: -0.01em; }

.set-header {
  display: flex; gap: 20px; align-items: center;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.set-logo {
  width: 140px; height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.set-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.set-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.set-info .h1 { margin: 0; }
@media (max-width: 560px) {
  .set-header { flex-direction: column; align-items: flex-start; }
  .set-logo { width: 100%; height: 80px; }
}

.detail {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 720px) {
  .detail { grid-template-columns: 1fr; }
}
.detail-art {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  padding: 24px;
}
.detail-art img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.detail-info { display: flex; flex-direction: column; gap: 16px; }
.detail-info .h1 { text-transform: capitalize; }

.types { display: flex; gap: 6px; flex-wrap: wrap; }
.type {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--line); color: var(--fg); text-transform: capitalize;
}

.meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0; }
@media (max-width: 480px) { .meta { grid-template-columns: 1fr 1fr; } }
.meta div { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--card); }
.meta dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 4px; }
.meta dd { margin: 0; font-size: 14px; text-transform: capitalize; }

.stats { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.stats li { display: grid; grid-template-columns: 110px 1fr 36px; gap: 10px; align-items: center; }
.stats .label { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.stats .bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.stats .bar > span { display: block; height: 100%; background: var(--fg); }
.stats .val { font-size: 12px; font-family: ui-monospace, monospace; text-align: right; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.btn {
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: var(--fg);
  padding: 9px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.btn:hover { background: rgba(255,255,255,.14); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.ghost:hover { border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.04); }
.btn.active { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); color: var(--fg); }

.back { color: var(--muted); font-size: 14px; }
.back:hover { color: var(--fg); }

.foot { padding: 24px; color: var(--muted); font-size: 12px; text-align: center; border-top: 1px solid var(--line); }

.h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }

.cards-section {
  margin-top: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 14px;
}

.tcg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.lazy-sentinel { height: 1px; width: 100%; pointer-events: none; }
.tcg-card {
  position: relative;
  border-radius: 12px;
  aspect-ratio: 245 / 342;
}
.tcg-card:hover { box-shadow: 0 12px 28px -12px rgba(0,0,0,.4); }
.tcg-img {
  all: unset;
  display: block;
  width: 100%; height: 100%;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
}
.tcg-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 12px;
}
.tcg-img:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.tcg-qty-badge {
  position: absolute;
  top: 8px; right: 8px;
  min-width: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.02em;
  backdrop-filter: blur(6px);
  text-align: center;
  pointer-events: none;
}

.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 24px;
}
.modal.hidden { display: none; }
.modal-close {
  position: absolute; top: 16px; right: 20px;
  background: transparent; border: 0;
  color: #fff; font-size: 32px; line-height: 1;
  cursor: pointer; padding: 4px 12px;
}
.modal-inner {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 320px);
  gap: 28px;
  background: var(--card);
  color: var(--fg);
  padding: 24px;
  border-radius: 14px;
  max-height: calc(100vh - 48px);
  overflow: auto;
}
@media (max-width: 720px) {
  .modal-inner { grid-template-columns: 1fr; max-width: 100%; }
}
.modal-inner img { width: 100%; height: auto; border-radius: 10px; }
.modal-info { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.modal-info .meta { grid-template-columns: 1fr 1fr; width: 100%; }
.modal-actions {
  display: flex; gap: 12px; flex-wrap: wrap;
  width: 100%;
}
.qty-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 140px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
}
.qty-control.has-items { border-color: rgba(255,255,255,.3); }
.qty-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.qty-stepper {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  background: var(--bg);
}

/* ---- Feed feature ---- */
.topbar { gap: 12px; flex-wrap: wrap; }
.nav-profile {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--muted);
  padding: 6px 10px; border-radius: 8px;
}
.nav-profile:hover, .nav-profile.active { color: var(--fg); background: var(--line); }

.tabs {
  display: inline-flex; gap: 2px;
  background: var(--line);
  padding: 3px;
  border-radius: 999px;
}
.tab {
  background: transparent; border: 0; cursor: pointer;
  padding: 6px 14px; border-radius: 999px;
  font-size: 13px; color: var(--muted);
}
.tab:hover { color: var(--fg); }
.tab.active { background: var(--card); color: var(--fg); }

.profile-stack { max-width: 640px; }
.profile-form, .new-group-form {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.field-hint { font-size: 11px; }
.field .input, .new-group-form textarea.input, .profile-form textarea.input { width: 100%; }
.new-group-form textarea.input, .profile-form textarea.input { min-height: 80px; resize: vertical; font-family: inherit; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; line-height: 1.45; font-size: 14px; }
.check input { margin-top: 4px; }

.avatar {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--fg); color: var(--bg);
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
  text-transform: uppercase;
}
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }

/* ---- Profile page ---- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0 4px;
}
.profile-avatar-preview .avatar-lg {
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.profile-header-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile-header-text .h1 { margin: 0; }
.profile-header-text .muted { font-size: 13px; word-break: break-word; }

.profile-flash {
  background: rgba(34, 197, 94, .12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, .35);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin: 0;
}
.profile-flash-error {
  background: rgba(239, 68, 68, .12);
  color: #f87171;
  border-color: rgba(239, 68, 68, .35);
}

.profile-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.profile-card[open] { box-shadow: 0 6px 18px -10px rgba(0,0,0,.4); }
.profile-card-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  user-select: none;
}
.profile-card-summary::-webkit-details-marker { display: none; }
.profile-card-summary::after {
  content: "›";
  margin-left: auto;
  font-size: 20px;
  color: var(--muted);
  transition: transform 150ms ease;
}
.profile-card[open] > .profile-card-summary::after { transform: rotate(90deg); }
.profile-card-summary:hover { background: rgba(255,255,255,.03); }
.profile-card-title { font-weight: 600; font-size: 15px; }
.profile-card-sub { font-size: 12px; }
.profile-card .profile-form {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 16px 18px 20px;
}
.profile-card-danger[open] { border-color: rgba(239, 68, 68, .35); }
.profile-account-actions {
  flex-direction: row !important;
  flex-wrap: wrap;
}
.btn.danger {
  background: rgba(239, 68, 68, .15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, .35);
}
.btn.danger:hover { background: rgba(239, 68, 68, .25); }

.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  background: var(--bg-2, #1a1a26);
  position: relative;
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.selected { border-color: var(--fg); box-shadow: 0 0 0 2px var(--bg); outline: 2px solid var(--fg); outline-offset: -1px; }
.color-swatch-default {
  background:
    linear-gradient(135deg, transparent 47%, var(--muted) 48%, var(--muted) 52%, transparent 53%),
    var(--card);
  border: 1px dashed var(--muted);
}

/* ---- Email confirmation link modal ---- */
.email-link-popup {
  width: min(420px, 100%);
  background: #fff;
  color: #1f1f1f;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.4);
}
.email-link-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e5e7eb;
  font-size: 12px;
  color: #6b7280;
}
.email-link-from { font-family: ui-monospace, monospace; }
.email-link-body {
  padding: 22px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.email-link-h { margin: 0; font-size: 18px; font-weight: 600; color: #1f1f1f; }
.email-link-text { margin: 0; color: #4b5563; font-size: 14px; line-height: 1.5; }
.email-link-code {
  width: 100%;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 22px;
  letter-spacing: 0.4em;
  padding: 12px 14px;
  background: #f8f9fa;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  border-radius: 10px;
}
.email-link-code:focus {
  outline: 2px solid #1a73e8;
  outline-offset: 1px;
  border-color: #1a73e8;
}
.email-link-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.email-link-btn {
  background: #1a73e8;
  color: #fff;
  border: 0;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.email-link-btn:hover { background: #1664c1; }
.email-link-btn:disabled { background: #9aa7c3; cursor: not-allowed; }
.email-link-resend {
  background: transparent;
  border: 0;
  color: #1a73e8;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
}
.email-link-resend:hover { text-decoration: underline; }
.email-link-resend:disabled { color: #9aa7c3; cursor: not-allowed; }
.email-link-fine { font-size: 11px; color: #9ca3af; margin: 4px 0 0; }

.compose {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.compose-head { display: flex; align-items: center; gap: 10px; }
.compose-text {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
}
.compose-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.compose-select {
  padding: 7px 10px;
  font-size: 13px;
  width: auto;
  background-image: none;
}
.compose-row .btn { margin-left: auto; }
.compose-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 13px;
}
.compose-card img { width: 36px; height: 50px; object-fit: cover; border-radius: 4px; }
.icon-btn {
  background: transparent; border: 0; cursor: pointer;
  font-size: 18px; color: var(--muted);
  padding: 4px 8px; margin-left: auto;
  line-height: 1;
}
.icon-btn:hover { color: var(--fg); }

.feed-list { display: flex; flex-direction: column; gap: 12px; }
.post {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.post-head { display: flex; gap: 10px; align-items: center; }
.post-meta { display: flex; flex-direction: column; gap: 2px; }
.post-name-row { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.post-sub { font-size: 11px; }
.post-body { margin: 0; white-space: pre-wrap; line-height: 1.55; font-size: 14px; }
.post-card {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--bg);
}
.post-card img { width: 50px; height: 70px; object-fit: cover; border-radius: 4px; }
.post-actions { display: flex; gap: 8px; padding-top: 4px; border-top: 1px solid var(--line); }
.post-like {
  background: transparent; border: 0; cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  display: inline-flex; align-items: center; gap: 6px;
}
.post-like:hover:not(:disabled) { background: var(--line); color: var(--fg); }
.post-like.active { color: var(--accent); }
.post-like .heart { font-size: 15px; line-height: 1; }
.post-like:disabled { opacity: 0.6; cursor: not-allowed; }
.post-action-link {
  background: transparent; border: 0; cursor: pointer;
  color: var(--muted); font-size: 13px;
  padding: 6px 10px; border-radius: 6px;
}
.post-action-link:hover { background: var(--line); color: var(--fg); }
.post-edit-form { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.post-edit-form textarea {
  width: 100%; min-height: 80px; resize: vertical; font-family: inherit;
}
.post-edit-host:empty, .post-editors-host:empty { display: none; }
.post-editors-host { margin-top: 10px; }

.groups-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.group-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.group-card:hover {
  border-color: color-mix(in srgb, var(--fg) 40%, var(--line));
}
.group-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.group-title { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.group-sub { font-size: 11px; }
.group-desc { margin: 0; font-size: 14px; color: var(--fg); line-height: 1.5; }
.group-foot { font-size: 12px; margin-top: 4px; }
.joined-badge {
  font-size: 10px; padding: 2px 8px;
  border-radius: 999px; background: #16a34a; color: #fff;
  font-weight: 600; letter-spacing: 0.02em;
  text-transform: uppercase;
}

.link { color: var(--fg); text-decoration: underline; text-underline-offset: 2px; }
.link:hover { color: var(--accent); }

/* ---- Events ---- */
.events-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.event-card {
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.event-card:hover {
  border-color: color-mix(in srgb, var(--fg) 40%, var(--line));
}
.event-card-pending { opacity: 0.85; }
.event-card-thumb {
  width: 100%; aspect-ratio: 16 / 9;
  background: var(--line);
  overflow: hidden;
}
.event-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.event-card-body { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.event-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.event-title { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.event-sub { font-size: 11px; }
.event-card-desc {
  margin: 0;
  font-size: 14px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.event-foot {
  font-size: 12px; margin-top: auto; padding-top: 4px;
  display: flex; flex-wrap: wrap; gap: 6px;
}

.event-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
}

.creator-chip {
  display: inline-block;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, var(--card));
  color: var(--fg);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line));
}
.group-chip {
  display: inline-block;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--fg);
  border: 1px solid var(--line);
}
a.group-chip:hover { border-color: color-mix(in srgb, var(--fg) 40%, var(--line)); }

.editor-chip {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: #16a34a; color: #fff;
}

.editors-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.editors-card .h2 { margin: 0; font-size: 16px; }
.editors-card p { margin: 0; }
.editors-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.editor-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.editor-name { display: flex; align-items: center; }

.group-events-section { display: flex; flex-direction: column; gap: 10px; }
.group-events-section .h2 { font-size: 17px; margin: 0; }

.event-status {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.event-status.verified { background: #16a34a; color: #fff; }
.event-status.pending { background: #f59e0b; color: #fff; }

.event-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.event-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.event-photos img {
  width: 100%; aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: block;
}

.event-desc { margin: 0; line-height: 1.6; white-space: pre-wrap; }

.event-attendance { display: flex; align-items: center; gap: 12px; }
.event-attendance-bar {
  flex: 1;
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.event-attendance-bar > span {
  display: block; height: 100%;
  background: var(--fg);
}

.new-event-form {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.new-event-form textarea.input {
  width: 100%; min-height: 90px; resize: vertical; font-family: inherit;
}
.photo-input {
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
}
.photo-preview {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.photo-preview img {
  width: 80px; height: 80px; object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.instant-verify { color: #16a34a; font-weight: 500; }

.verify-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 16px;
  background: color-mix(in srgb, #f59e0b 12%, var(--card));
  border: 1px solid color-mix(in srgb, #f59e0b 40%, var(--line));
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.verify-card p { margin: 0; font-size: 14px; }

/* ---- Trades ---- */
.trades-section {
  display: flex; flex-direction: column; gap: 12px;
  padding-top: 8px;
}

.badge-local {
  display: inline-block;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: #16a34a; color: #fff;
  vertical-align: 1px;
}

.active-trades-list { display: flex; flex-direction: column; gap: 10px; }
.trade-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "cards info status";
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.trade-row:hover {
  border-color: color-mix(in srgb, var(--fg) 35%, var(--line));
}
.trade-row-cards { grid-area: cards; display: flex; align-items: center; gap: 6px; }
.trade-row-info { grid-area: info; }
.trade-row .trade-status { grid-area: status; }
@media (max-width: 560px) {
  .trade-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "info status"
      "cards cards";
    row-gap: 10px;
  }
  .trade-row-cards { justify-content: flex-start; }
}
.trade-row-thumb {
  width: 44px; height: 60px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--line);
  flex-shrink: 0;
}
.trade-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.trade-row-arrow { font-size: 16px; color: var(--muted); }
.trade-row-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trade-row-info > * { min-width: 0; }
.trade-row-info strong { font-size: 14px; }
.trade-row-detail { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.trade-status {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  flex-shrink: 0;
}
.trade-status.status-proposed { background: #f59e0b; color: #fff; }
.trade-status.status-accepted { background: #16a34a; color: #fff; }
.trade-status.status-declined { background: var(--muted); color: var(--bg); }

.matches-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.match-card {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.match-card:hover {
  border-color: color-mix(in srgb, var(--fg) 35%, var(--line));
}
.match-local {
  border-color: color-mix(in srgb, #16a34a 50%, var(--line));
  background: color-mix(in srgb, #16a34a 4%, var(--card));
}
.match-head { display: flex; align-items: center; gap: 12px; }
.match-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.match-name-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.match-name-row strong { font-size: 16px; }

.match-sides { display: flex; flex-direction: column; gap: 10px; }
.match-side { display: flex; flex-direction: column; gap: 6px; }
.match-side-title { font-size: 11px; }
.match-side-cards { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.match-tile {
  width: 48px; height: 67px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--line);
  flex-shrink: 0;
}
.match-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.match-tile-more {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--line);
  font-size: 11px;
}

.match-foot { display: flex; justify-content: flex-end; }
.match-foot .btn { width: 100%; text-align: center; }

/* ---- Propose / edit form ---- */
.trade-form {
  display: flex; flex-direction: column; gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.trade-fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 14px;
  margin: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.trade-fieldset legend {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0 6px;
}
.trade-fieldset > p { margin: 0; font-size: 13px; }

.trade-card-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.trade-card-option {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: var(--bg);
}
.trade-card-option:hover { border-color: color-mix(in srgb, var(--fg) 30%, var(--line)); }
.trade-card-option:has(input:checked) {
  border-color: var(--fg);
  background: color-mix(in srgb, var(--fg) 4%, var(--card));
}
.trade-card-option input { margin: 0; flex-shrink: 0; }
.trade-card-thumb {
  width: 40px; height: 56px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--line);
  flex-shrink: 0;
}
.trade-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.trade-card-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trade-card-info strong { font-size: 14px; }

/* ---- Trade detail ---- */
.trade-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .trade-cards { grid-template-columns: 1fr; }
}
.trade-side {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.trade-side-head {
  font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.trade-side-art {
  width: 100%; aspect-ratio: 245 / 342;
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}
.trade-side-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.trade-side-info { display: flex; flex-direction: column; gap: 2px; }
.trade-side-info strong { font-size: 16px; }

.trade-actions {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.trade-actions p { margin: 0; }

.edit-locked {
  margin: 0;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: 13px;
}

.trade-edit {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 14px 16px;
}
.trade-edit summary {
  cursor: pointer;
  font-size: 14px;
  list-style: none;
}
.trade-edit summary::-webkit-details-marker { display: none; }
.trade-edit summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: var(--muted);
}
.trade-edit[open] summary::before { transform: rotate(90deg); }
.trade-edit > p { margin: 10px 0 14px; font-size: 13px; }
.trade-edit .trade-form { padding: 0; border: 0; background: transparent; }

.trade-messages-section {
  display: flex; flex-direction: column; gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.trade-messages {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding: 8px 0;
}
.trade-messages > p { margin: 0; font-size: 13px; }
.message {
  display: flex; flex-direction: column; gap: 3px;
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
}
.message-mine {
  align-self: flex-end;
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.message-mine .muted { color: color-mix(in srgb, var(--bg) 70%, var(--fg)); }
.message-theirs { align-self: flex-start; }
.message-head { font-size: 10px; }
.message-body { font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }

.trade-msg-form {
  display: flex; gap: 8px;
}
.trade-msg-form .input { flex: 1; width: auto; }

/* ---- Decks ---- */
.decks-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.deck-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.deck-card:hover {
  border-color: color-mix(in srgb, var(--fg) 40%, var(--line));
}
.deck-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.deck-title { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.deck-sub { font-size: 11px; }
.deck-card-desc {
  margin: 0;
  font-size: 14px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.deck-thumbs { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.deck-thumb {
  width: 40px; height: 56px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--line);
  flex-shrink: 0;
}
.deck-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.new-deck-form {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.new-deck-form textarea.input {
  width: 100%; min-height: 80px; resize: vertical; font-family: inherit;
}

.deck-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.deck-desc { margin: 0; line-height: 1.6; white-space: pre-wrap; }
.deck-desc.hidden { display: none; }

.deck-section {
  display: flex; flex-direction: column; gap: 12px;
  padding-top: 8px;
}

.deck-cards-list, .deck-pool {
  display: flex; flex-direction: column; gap: 8px;
}
.deck-card-row, .deck-pool-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.deck-card-row .deck-card-thumb,
.deck-pool-row .deck-card-thumb {
  width: 40px; height: 56px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--line);
  flex-shrink: 0;
}
.deck-card-row .deck-card-thumb img,
.deck-pool-row .deck-card-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.deck-card-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.deck-card-info strong { font-size: 14px; }
.deck-card-info .muted { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.deck-qty {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  background: var(--bg);
}
.qty-btn {
  width: 26px; height: 26px;
  border: 0;
  background: transparent;
  color: var(--fg);
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: grid; place-items: center;
}
.qty-btn:hover:not(:disabled) { background: var(--line); }
.qty-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.qty-val {
  min-width: 18px; text-align: center;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
}
.deck-qty-static { font-size: 13px; }

.deck-pool-row .btn { padding: 6px 12px; font-size: 13px; }

/* ---- Card surfaces get a subtle neon edge ---- */
.set-card, .group-card, .deck-card, .event-card,
.match-card, .trade-row, .post, .meta div,
.profile-form, .new-group-form, .new-event-form, .new-deck-form,
.compose, .trade-form, .trade-side, .trade-edit,
.set-header, .detail-art {
  background: var(--card);
  border-color: var(--line);
}
.set-card:hover, .group-card:hover, .deck-card:hover,
.event-card:hover, .match-card:hover, .trade-row:hover {
  border-color: rgba(255,255,255,.3);
}

.input {
  background: var(--bg-2);
  color: var(--fg);
  border-color: var(--line);
}
.input:focus {
  border-color: rgba(255,255,255,.4);
}

.tabs { background: var(--bg-2); border: 1px solid var(--line); }
.tab.active { background: rgba(255,255,255,.08); color: var(--fg); }

.avatar {
  background: rgba(255,255,255,.12);
  color: var(--fg);
  font-weight: 600;
}

.tcg-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.4); }

.foot { color: var(--muted); border-top-color: var(--line); }

/* ---- Auth (login + signup) ---- */
html.auth-mode .topbar,
html.auth-mode .foot,
body.auth-mode .topbar,
body.auth-mode .foot {
  display: none !important;
}
html.auth-mode .view,
body.auth-mode .view {
  max-width: 100%;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}
html.auth-mode body,
body.auth-mode {
  background: radial-gradient(circle at 50% 0%, #14141f 0%, var(--bg) 60%);
}

.nav-signout {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-left: 8px;
}
.nav-signout:hover { color: var(--fg); border-color: rgba(255,255,255,.3); }

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 24px 60px -32px rgba(0,0,0,.6);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
}
.auth-brand .brand-name { font-size: 18px; font-weight: 600; }
.auth-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  text-align: center;
}
.auth-sub {
  color: var(--muted);
  margin: 0;
  text-align: center;
  font-size: 14px;
}
.auth-providers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 44px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: background 120ms ease, border-color 120ms ease;
}
.btn-provider:active { transform: translateY(1px); }
.btn-google {
  background: #fff;
  color: #1f1f1f;
  border-color: #dadce0;
}
.btn-google:hover { background: #f8f9fa; border-color: #c2c5ca; }
.btn-apple {
  background: #000;
  color: #fff;
  border-color: #000;
}
.btn-apple:hover { background: #1a1a1a; }
.provider-icon { width: 18px; height: 18px; flex-shrink: 0; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-form .field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.auth-show-pw {
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.auth-form .input { width: 100%; }
.auth-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line));
  color: #ffd0c8;
  font-size: 13px;
}
.auth-submit {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 2px;
}
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-foot {
  text-align: center;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.auth-foot .link { color: var(--fg); font-weight: 600; }
.auth-foot .link:hover { text-decoration: underline; }
.link {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- OAuth simulator modals ---- */
.oauth-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.oauth-modal.hidden { display: none; }
.oauth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
}
.oauth-popup {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,.6);
  animation: oauthIn 200ms ease-out;
}
@keyframes oauthIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.oauth-google {
  background: #fff;
  color: #202124;
  font-family: "Google Sans", Roboto, ui-sans-serif, system-ui, sans-serif;
  display: flex;
  flex-direction: column;
}
.oauth-google-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 0;
}
.oauth-google-logo { height: 22px; }
.oauth-close {
  background: transparent;
  border: 0;
  color: #5f6368;
  font-size: 24px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}
.oauth-close:hover { background: #f1f3f4; }
.oauth-google-body { padding: 16px 28px 28px; }
.oauth-google-h {
  font-size: 22px;
  font-weight: 400;
  margin: 8px 0 4px;
  color: #202124;
}
.oauth-google-sub {
  margin: 0 0 18px;
  color: #202124;
  font-size: 14px;
}
.oauth-google-sub strong { font-weight: 500; }
.oauth-account-list {
  display: flex;
  flex-direction: column;
  border: 1px solid #dadce0;
  border-radius: 8px;
  overflow: hidden;
}
.oauth-account {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #dadce0;
  cursor: pointer;
  text-align: left;
  color: #202124;
  font-size: 14px;
}
.oauth-account:last-child { border-bottom: 0; }
.oauth-account:hover { background: #f8f9fa; }
.oauth-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}
.oauth-avatar-add {
  background: #f1f3f4 !important;
  color: #5f6368;
}
.oauth-account-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.oauth-account-name { color: #202124; }
.oauth-account-email { color: #5f6368; font-size: 13px; }
.oauth-google-legal {
  margin: 18px 0 0;
  font-size: 12px;
  color: #5f6368;
  line-height: 1.5;
}
.oauth-custom {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.oauth-custom .input {
  width: 100%;
  background: #fff;
  color: #202124;
  border: 1px solid #dadce0;
  border-radius: 4px;
  padding: 10px 12px;
}
.oauth-custom .input:focus { border-color: #1a73e8; outline: 2px solid rgba(26,115,232,.25); }
.oauth-custom .field-label { color: #5f6368; }
.oauth-custom .btn {
  background: #1a73e8;
  color: #fff;
  border: 0;
  border-radius: 4px;
}
.oauth-custom .btn:hover { background: #1765cc; }
.oauth-custom .btn.ghost {
  background: transparent;
  color: #1a73e8;
  border: 0;
}
.oauth-custom .btn.ghost:hover { background: rgba(26,115,232,.08); }

.oauth-apple {
  background: #fff;
  color: #1d1d1f;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}
.oauth-apple-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #d2d2d7;
}
.oauth-apple-logo { height: 22px; color: #1d1d1f; }
.oauth-apple-body { padding: 28px 32px 32px; }
.oauth-apple-h {
  font-size: 17px;
  font-weight: 500;
  text-align: center;
  margin: 0 0 24px;
  line-height: 1.4;
}
.oauth-apple #oauth-apple-form { display: flex; flex-direction: column; gap: 16px; }
.oauth-apple .field-label { color: #6e6e73; font-size: 11px; }
.oauth-apple .input {
  width: 100%;
  background: #fff;
  color: #1d1d1f;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  padding: 10px 12px;
}
.oauth-apple .input:focus { border-color: #0071e3; outline: 2px solid rgba(0,113,227,.2); }
.oauth-apple .check { color: #1d1d1f; font-size: 13px; }
.oauth-apple .check .muted { color: #6e6e73; }
.btn-apple-continue {
  background: #000;
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 500;
  font-size: 15px;
  margin-top: 4px;
}
.btn-apple-continue:hover { background: #1a1a1a; }

.oauth-loading {
  background: #fff;
  color: #5f6368;
  padding: 60px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  border-radius: 12px;
  text-align: center;
  font-family: "Google Sans", Roboto, ui-sans-serif, system-ui, sans-serif;
}
.oauth-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #dadce0;
  border-top-color: #1a73e8;
  border-radius: 50%;
  animation: oauthSpin 800ms linear infinite;
}
@keyframes oauthSpin { to { transform: rotate(360deg); } }
.oauth-loading p { margin: 0; font-size: 14px; }

@media (max-width: 480px) {
  .auth-card { padding: 28px 22px; }
  .oauth-google-body { padding: 16px 20px 24px; }
  .oauth-apple-body { padding: 24px 22px 28px; }
}

.modal-inner { background: var(--card); box-shadow: 0 16px 40px rgba(0,0,0,.6); }
