/* Benchmark: dark-first, dense, Moxfield-like. */
:root, [data-theme="dark"] {
  --bg: #15171c; --bg2: #1b1e24; --panel: #20242c; --panel2: #262b34; --hover: #2c323d;
  --line: #313845; --line2: #3b4352;
  --text: #e7e9ee; --muted: #9aa3b2; --faint: #6e7787;
  --accent: #4b8cf7; --accent2: #3a78e0; --accent-soft: rgba(75, 140, 247, .14);
  --ok: #34c77b; --ok-soft: rgba(52, 199, 123, .14);
  --bad: #f26363; --bad-soft: rgba(242, 99, 99, .14);
  --warn: #f1b33c; --warn-soft: rgba(241, 179, 60, .15);
  --info: #6aa8ff; --info-soft: rgba(106, 168, 255, .14);
  --p: #e06a4b; --t: #4b8cf7; --e: #e8b931;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --radius: 8px; --radius-sm: 6px;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f4f5f8; --bg2: #eceef2; --panel: #ffffff; --panel2: #f6f7f9; --hover: #eef1f6;
  --line: #e1e4ea; --line2: #d2d7df;
  --text: #1b1f27; --muted: #5d6676; --faint: #8b93a1;
  --accent: #2f6fe0; --accent2: #2560c8; --accent-soft: rgba(47, 111, 224, .1);
  --ok: #17924f; --ok-soft: rgba(23, 146, 79, .1);
  --bad: #d43b3b; --bad-soft: rgba(212, 59, 59, .09);
  --warn: #b97800; --warn-soft: rgba(185, 120, 0, .11);
  --info: #2f6fe0; --info-soft: rgba(47, 111, 224, .1);
  --shadow: 0 10px 30px rgba(20, 30, 50, .14);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
#root { display: contents; }
main { flex: 1; outline: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 26px; } h2 { font-size: 18px; } h3 { font-size: 14px; } h4 { font-size: 13px; }
p { margin: 0 0 .8em; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 20px; }
.page { padding-top: 24px; padding-bottom: 48px; }
.page.narrow, .narrow { max-width: 560px; }
.narrow-wide { max-width: 1100px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grow { flex: 1; }
.hide-sm { }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { flex: none; vertical-align: -3px; }
.lead { font-size: 15px; color: var(--muted); max-width: 70ch; }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-end { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.wrap-row { flex-wrap: wrap; }
.ok-text { color: var(--ok); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); border-color: var(--faint); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); border-color: var(--accent2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.liked { color: #ff6b8a; border-color: #ff6b8a; }
.btn.small { height: 28px; padding: 0 9px; font-size: 12px; }
.btn.big { height: 42px; padding: 0 18px; font-size: 14px; }
.btn.block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: inherit; display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--bad); }
.mini { width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.mini:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--text); cursor: pointer; font-weight: 600; font-size: 12px; }

/* ---------- forms ---------- */
input[type=text], input[type=email], input[type=password], input[type=date], input:not([type]), select, textarea {
  background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--radius-sm); padding: 7px 10px; min-height: 34px; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; line-height: 1.45; }
select { cursor: pointer; width: auto; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span, .field legend { font-size: 12px; font-weight: 600; color: var(--muted); }
.field select { width: 100%; }
.field.compact { margin: 10px 0 6px; }
.field.choice { border: 0; padding: 0; margin: 0 0 12px; }
.field.choice label { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.field-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field-row .field { flex: 1; min-width: 120px; }
.check-field { display: flex; gap: 8px; align-items: center; margin: 6px 0 4px; cursor: pointer; }
.form-error { color: var(--bad); font-size: 13px; }
.search-field { position: relative; display: flex; align-items: center; min-width: 220px; }
.search-field .icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.search-field input { padding-left: 32px; }
.search-field.grow { flex: 1; }
.select-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.select-inline select { min-height: 30px; padding: 4px 8px; font-size: 12px; color: var(--text); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 18px; height: 56px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; color: var(--text); letter-spacing: -.02em; text-decoration: none !important; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect x='6' y='17' width='20' height='4' rx='1' fill='white'/%3E%3Crect x='8' y='21' width='3' height='6' fill='white'/%3E%3Crect x='21' y='21' width='3' height='6' fill='white'/%3E%3Crect x='7' y='9' width='18' height='5' rx='1' fill='white'/%3E%3C/svg%3E") center/100% no-repeat; }
.nav { display: flex; gap: 2px; }
.nav a { color: var(--muted); font-weight: 600; padding: 7px 10px; border-radius: var(--radius-sm); text-decoration: none; font-size: 13px; }
.nav a:hover { color: var(--text); background: var(--hover); }
.nav a.active { color: var(--text); background: var(--panel2); }
.nav-toggle { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.account-btn { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 4px; border-radius: 99px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; font-weight: 600; font-size: 13px; }
.account-btn:hover { background: var(--hover); }
.gsearch { position: relative; flex: 1; max-width: 420px; display: flex; align-items: center; }
.gsearch > .icon { position: absolute; left: 10px; color: var(--muted); }
.gsearch input { padding-left: 32px; background: var(--panel); height: 34px; }
.gsearch-pop, .add-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; z-index: 50; max-height: 70vh; overflow-y: auto; }
.gsearch-item, .add-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; border: 0; background: none; text-align: left; cursor: pointer; color: var(--text); }
.gsearch-item img, .add-item img, .thumb-ph { width: 30px; height: 42px; object-fit: cover; border-radius: 3px; flex: none; background: var(--panel2); }
.gsearch-item span, .add-item-text { display: flex; flex-direction: column; min-width: 0; }
.gsearch-item small, .add-item small { color: var(--muted); font-size: 11px; }
.gsearch-item.active, .gsearch-item:hover, .add-item.active { background: var(--hover); }
.gsearch-item.decks { padding: 9px 12px; gap: 8px; color: var(--muted); border-top: 1px solid var(--line); flex-direction: row; }

/* ---------- menus ---------- */
.menu-wrap { position: relative; }
.menu { position: fixed; min-width: 210px; max-height: 70vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 5px; z-index: 120; }
.menu.right { right: 0; } .menu.left { left: 0; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 5px; cursor: pointer; color: var(--text); font-size: 13px; text-align: left; text-decoration: none !important; }
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: var(--bad); }
.segmented { display: inline-flex; background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--radius-sm); padding: 2px; gap: 2px; flex-wrap: wrap; max-width: 100%; }
.segmented button { border: 0; background: none; color: var(--muted); height: 28px; padding: 0 10px; border-radius: 4px; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--panel2); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.segmented b { font-weight: 700; color: var(--faint); }
.segmented .on b { color: var(--accent); }

/* ---------- tags / badges ---------- */
.tag { display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 6px; border-radius: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; background: var(--panel2); color: var(--muted); border: 1px solid var(--line2); white-space: nowrap; text-decoration: none !important; }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.tag.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.fmt-badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(4px); }
.fmt-badge.standard { background: #2a62c9; } .fmt-badge.expanded { background: #7a4bc4; } .fmt-badge.unlimited { background: #5b6472; }
.fmt-badge.legal { background: #1f8f59; } .fmt-badge.illegal { background: #c23f3f; }
.fmt-badge.private { background: #3b4352; } .fmt-badge.featured { background: #b8860b; }

/* ---------- avatars ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; flex: none; }
.avatar.art { background-size: 220%; background-position: 50% 22%; background-color: var(--panel2); border: 1px solid var(--line2); }
.author { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; }

/* ---------- loading / empty ---------- */
.spinner-wrap { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty h2, .empty h3 { color: var(--text); margin: 4px 0 0; }
.empty.error .icon { color: var(--bad); }

/* ---------- toasts / modal ---------- */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; pointer-events: none; }
.toast { background: var(--panel2); border: 1px solid var(--line2); color: var(--text); padding: 9px 14px; border-radius: var(--radius); box-shadow: var(--shadow); font-weight: 600; font-size: 13px; animation: rise .18s ease-out; }
.toast.ok { border-color: var(--ok); } .toast.bad { border-color: var(--bad); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
body.modal-open { overflow: hidden; }
.modal-back { position: fixed; inset: 0; background: rgba(5, 8, 14, .66); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow: hidden; overscroll-behavior: contain; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--shadow); width: 100%; max-width: 480px; display: flex; flex-direction: column; max-height: 88vh; animation: rise .16s ease-out; }
.modal.wide { max-width: 760px; } .modal.xl { max-width: 1040px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px 18px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; min-height: 0; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.notice { display: flex; gap: 8px; align-items: flex-start; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; margin: 10px 0; }
.notice .icon { margin-top: 1px; }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.info { background: var(--info-soft); color: var(--info); }

/* ---------- hover preview ---------- */
.hover-preview { position: fixed; z-index: 150; width: 250px; pointer-events: none; filter: drop-shadow(0 12px 28px rgba(0,0,0,.55)); }
.hover-preview img { width: 100%; border-radius: 12px; display: block; }

/* ---------- card images ---------- */
.card-img { display: block; width: 100%; aspect-ratio: 63 / 88; object-fit: cover; border-radius: 4.5% / 3.3%; background: var(--panel2); }
.card-img.placeholder { display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; color: var(--muted); font-size: 12px; border: 1px dashed var(--line2); }

/* ---------- deck tiles ---------- */
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.deck-tile { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--text); text-decoration: none !important; transition: border-color .12s, transform .12s; }
.deck-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.deck-tile-art { position: relative; height: 118px; background: linear-gradient(135deg, #2a3140, #1c2029) center 18% / cover no-repeat; display: flex; align-items: flex-start; gap: 4px; padding: 8px; flex-wrap: wrap; }
.deck-tile-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,.45)); }
.deck-tile-art > * { position: relative; z-index: 1; }
.deck-tile-body { padding: 10px 12px 11px; display: flex; flex-direction: column; gap: 6px; }
.deck-tile-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-tile-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.deck-tile-stats { display: flex; gap: 12px; font-size: 12px; color: var(--muted); align-items: center; }
.deck-tile-stats span { display: inline-flex; align-items: center; gap: 4px; }
.deck-tile-stats .price { margin-left: auto; color: var(--text); font-weight: 700; }

/* ---------- home ---------- */
.hero { background: radial-gradient(1200px 400px at 20% -10%, var(--accent-soft), transparent), var(--bg2); border-bottom: 1px solid var(--line); }
.hero-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; padding: 44px 20px 40px; align-items: center; }
.hero h1 { font-size: 34px; line-height: 1.12; letter-spacing: -.025em; max-width: 18ch; }
.hero .lead { margin: 12px 0 20px; }
.hero-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.hero-card h3 { display: flex; gap: 8px; align-items: center; font-size: 15px; }
.hero-card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0; font-size: 13px; }
.hero-card dt { color: var(--muted); }
.hero-card dd { margin: 0; }
.home-section { margin-bottom: 34px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-head h2 { display: flex; gap: 8px; align-items: center; margin: 0; }
.section-title { margin-top: 28px; }
.changes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.changes li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.chg { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px; border-radius: 4px; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.chg.ban { background: var(--bad-soft); color: var(--bad); } .chg.unban, .chg.set_legal { background: var(--ok-soft); color: var(--ok); }
.chg.rotation, .chg.rotation_announced { background: var(--warn-soft); color: var(--warn); } .chg.set_added { background: var(--info-soft); color: var(--info); }

/* ---------- page heads / filters ---------- */
.page-head { display: flex; align-items: baseline; gap: 14px; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 22px; }

/* ---------- deck page ---------- */
.deck-hero { position: relative; background: var(--bg2); border-bottom: 1px solid var(--line); overflow: hidden; }
.deck-hero::before { content: ""; position: absolute; inset: -20px; background: var(--cover, none) center 22% / cover no-repeat; filter: blur(2px) saturate(1.1); opacity: .5; transform: scale(1.04); }
.deck-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--bg2) 15%, color-mix(in srgb, var(--bg2) 70%, transparent) 55%, color-mix(in srgb, var(--bg2) 35%, transparent)), linear-gradient(to top, var(--bg2), transparent 60%); }
.deck-hero-inner { position: relative; z-index: 1; display: flex; gap: 20px; align-items: flex-end; justify-content: space-between; padding-top: 34px; padding-bottom: 20px; min-height: 210px; flex-wrap: wrap; }
.deck-hero-text { min-width: 0; flex: 1; }
.deck-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.deck-title { font-size: 32px; margin: 0 0 8px; letter-spacing: -.025em; overflow-wrap: anywhere; }
.deck-title-input { font-size: 30px !important; font-weight: 800; letter-spacing: -.025em; background: rgba(0,0,0,.25) !important; border-color: transparent !important; padding: 2px 8px !important; margin: 0 0 8px -8px; max-width: 760px; }
.deck-title-input:hover, .deck-title-input:focus { border-color: var(--line2) !important; }
.deck-byline { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.deck-byline .stat { display: inline-flex; gap: 4px; align-items: center; }
.deck-desc { margin: 10px 0 0; color: var(--muted); max-width: 80ch; }
.deck-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.deck-tabs-bar { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; }
.tabs button { border: 0; background: none; color: var(--muted); font-weight: 600; padding: 12px 12px; border-bottom: 2px solid transparent; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count, .count { font-size: 11px; color: var(--faint); font-weight: 700; }
.save-state { font-size: 12px; color: var(--muted); }
.save-state.bad { color: var(--bad); }
.deck-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; padding-top: 16px; padding-bottom: 48px; align-items: start; }
.deck-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 72px; }
.deck-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.editor-bar { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 14px; flex-wrap: wrap; }
.add-card { position: relative; flex: 1; min-width: 260px; }
.add-input { position: relative; display: flex; align-items: center; }
.add-input > .icon { position: absolute; left: 10px; color: var(--accent); }
.add-input input { padding-left: 32px; padding-right: 92px; height: 40px; background: var(--panel); text-overflow: ellipsis; }
.legal-toggle { position: absolute; right: 6px; height: 26px; padding: 0 9px; border-radius: 99px; border: 1px solid var(--line2); background: var(--panel2); font: 600 11px/1 inherit; color: var(--muted); cursor: pointer; white-space: nowrap; }
.legal-toggle.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.add-qty { margin-left: auto; color: var(--accent); font-weight: 700; font-size: 12px; }

/* text view: groups flow in columns like Moxfield */
.text-view { columns: 280px 3; column-gap: 22px; }
.group { break-inside: avoid; margin-bottom: 16px; }
.group-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; padding: 0 4px 5px; margin: 0 0 3px; border-bottom: 1px solid var(--line); }
.group-head .count { font-size: 12px; color: var(--muted); }
.group-price { margin-left: auto; color: var(--faint); font-size: 11px; font-weight: 600; }
.text-view ul { list-style: none; margin: 0; padding: 0; }
.row { position: relative; display: flex; align-items: center; border-radius: 4px; }
.row:hover { background: var(--hover); }
.row.hl, .visual-card.hl, .stack-card.hl, tr.hl { background: var(--warn-soft); outline: 1px solid var(--warn); }
.row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; padding: 3px 5px; border: 0; background: none; text-align: left; cursor: pointer; color: var(--text); font-size: 13px; }
.row .qty { width: 18px; text-align: right; color: var(--muted); font-weight: 700; flex: none; }
.row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-tags { display: inline-flex; gap: 3px; flex: none; }
.row .set-code { margin-left: auto; color: var(--faint); font-size: 11px; white-space: nowrap; }
.row .price { width: 54px; text-align: right; color: var(--muted); font-size: 12px; flex: none; font-variant-numeric: tabular-nums; }
.qty-ctl { display: none; gap: 3px; padding-right: 4px; }
.row:hover .qty-ctl, .row:focus-within .qty-ctl { display: inline-flex; }
@media (hover: none) { .qty-ctl { display: inline-flex; } }

.visual-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.visual-card { position: relative; border-radius: 6px; }
.visual-card > button { position: relative; display: block; width: 100%; border: 0; padding: 0; background: none; cursor: pointer; }
.visual-card > button:hover .card-img { box-shadow: 0 0 0 2px var(--accent); }
.qty-badge { position: absolute; top: 6px; left: 6px; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 5px; background: rgba(0,0,0,.78); color: #fff; font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.visual-tags { position: absolute; bottom: 6px; left: 6px; }
.visual-card .qty-ctl { position: absolute; top: 6px; right: 6px; display: none; }
.visual-card:hover .qty-ctl { display: inline-flex; }
.visual-view .group { margin-bottom: 20px; }

.stacks-view { display: flex; gap: 14px; overflow-x: auto; overscroll-behavior-x: contain; padding-bottom: 10px; align-items: flex-start; }
.stack-col { width: 156px; flex: none; }
.stack { display: flex; flex-direction: column; }
.stack-card { position: relative; border: 0; padding: 0; background: none; cursor: pointer; margin-bottom: -112%; transition: transform .12s; border-radius: 6px; }
.stack-card:last-child { margin-bottom: 0; }
.stack-card:hover { transform: translateY(-8px); z-index: 2; }
.stack-card .card-img { box-shadow: 0 -1px 0 rgba(0,0,0,.3), 0 2px 8px rgba(0,0,0,.35); }
.stack-card .qty-badge { top: 4px; left: auto; right: 6px; }

.table-view { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 7px 8px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-view tbody tr:not(.table-group) { cursor: pointer; }
.table-view tbody tr:not(.table-group):hover, .print-table tr:hover { background: var(--hover); }
.table-group td { font-weight: 700; color: var(--muted); font-size: 12px; background: var(--bg2); }
.table-view td.name { font-weight: 600; }
.table-view .qty-ctl { display: inline-flex; }

/* sidebar panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.deck-side .panel { margin: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-head h2, .panel-head h3 { margin: 0; }
.panel-foot { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.big-price { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.check { display: flex; gap: 8px; font-size: 13px; }
.check > .icon { margin-top: 1px; }
.check.ok > .icon { color: var(--ok); } .check.bad > .icon { color: var(--bad); } .check.warn > .icon { color: var(--warn); } .check.info > .icon { color: var(--muted); }
.check.bad .check-msg { color: var(--bad); font-weight: 600; }
.check-detail { color: var(--muted); font-size: 12px; margin-top: 2px; }
.price-top { list-style: none; padding: 0; margin: 10px 0 0; font-size: 12px; }
.price-top li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed var(--line); color: var(--muted); }
.price-top li span:last-child { color: var(--text); font-variant-numeric: tabular-nums; }
.bar-stack { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--bg2); }
.seg.p, .dot.p { background: var(--p); } .seg.t, .dot.t { background: var(--t); } .seg.e, .dot.e { background: var(--e); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 0; margin: 8px 0; font-size: 12px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 5px; } .legend b { color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.mini-stats { list-style: none; padding: 0; margin: 6px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; font-size: 12px; color: var(--muted); }
.mini-stats li { display: flex; justify-content: space-between; } .mini-stats b { color: var(--text); }
.types-row { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.type-chip { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 99px; background: color-mix(in srgb, var(--c) 18%, transparent); color: color-mix(in srgb, var(--c) 75%, var(--text)); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.odds { display: flex; flex-direction: column; gap: 4px; font-size: 12px; margin-top: 8px; }
.odds div { display: flex; justify-content: space-between; color: var(--muted); } .odds b { color: var(--text); font-variant-numeric: tabular-nums; }
.hand { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 6px 0 8px; }

/* card modal */
.card-modal { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; }
.card-modal-art { display: flex; flex-direction: column; gap: 10px; }
.card-modal-art .card-img { border-radius: 14px; box-shadow: var(--shadow); }
.legal-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.legal-badge { display: inline-flex; overflow: hidden; border-radius: 5px; font-size: 11.5px; font-weight: 700; border: 1px solid var(--line2); }
.legal-badge b { padding: 3px 8px; background: var(--panel2); color: var(--muted); }
.legal-badge { padding-right: 8px; gap: 8px; align-items: center; }
.legal-badge.ok { color: var(--ok); } .legal-badge.bad { color: var(--bad); } .legal-badge.warn { color: var(--warn); }
.card-text { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 8px 0 14px; font-size: 13px; }
.card-type { font-weight: 700; margin-bottom: 8px; }
.ability b { color: #e0576b; } [data-theme=light] .ability b { color: #c0324b; }
.ability, .attack { margin-bottom: 8px; }
.ability p, .attack p, .effect { margin: 3px 0 0; color: var(--muted); }
.attack-head { display: flex; align-items: center; gap: 8px; }
.attack-head .dmg { margin-left: auto; font-weight: 800; }
.cost { display: inline-flex; gap: 2px; }
.e { width: 14px; height: 14px; border-radius: 50%; display: inline-block; background: #bdb7a9; border: 1px solid rgba(0,0,0,.3); }
.e-grass { background: #4caf50; } .e-fire { background: #ef5b3a; } .e-water { background: #3d8ee6; } .e-lightning { background: #f5c518; } .e-psychic { background: #a35ad6; }
.e-fighting { background: #c0703a; } .e-darkness { background: #3b5560; } .e-metal { background: #8c99a6; } .e-dragon { background: #c29b2a; } .e-fairy { background: #ea7bb5; }
.wrr { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 8px; }
.card-meta { font-size: 12px; margin-top: 8px; }
.buy-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; flex-wrap: wrap; }
.edit-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.edit-row select { min-height: 28px; padding: 3px 8px; font-size: 12px; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper .qty { min-width: 22px; text-align: center; font-weight: 800; font-size: 15px; }
.printings-head { display: flex; align-items: baseline; justify-content: space-between; }
.print-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; padding: 2px; }
.print { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; }
.print-pick { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 6px; }
.print-pick:disabled { cursor: default; }
.print.current .print-pick .card-img { box-shadow: 0 0 0 2px var(--accent); }
.print-pick:not(:disabled):hover .card-img { box-shadow: 0 0 0 2px var(--line2); }
.print.illegal .card-img { opacity: .55; }
.print-info { display: flex; flex-direction: column; gap: 1px; }
.print-set { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.print-foot { display: flex; align-items: center; justify-content: space-between; }
.print-foot .link-btn { margin: 0; }

/* import */
.import-text textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; margin-top: 12px; }
.import-link { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.import-link p { grid-column: 1 / -1; margin: 0; }
.source-line { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 10px 0; }
.desc pre { white-space: pre-wrap; font-size: 12px; max-height: 220px; overflow-y: auto; background: var(--bg2); padding: 10px; border-radius: 6px; }
.resolve-table { margin-top: 12px; max-height: 52vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.resolve-table table th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.resolve-table .raw { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; margin-right: 6px; }
.resolve-table tr.unmatched { background: var(--warn-soft); }
.matched { display: flex; align-items: center; gap: 8px; }
.matched .card-img { width: 26px; border-radius: 2px; }
.pick-card input { min-height: 28px; padding: 3px 8px; font-size: 12px; }
.pick-hits { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.pick-hits button { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line2); background: var(--panel2); border-radius: 4px; padding: 2px 6px 2px 2px; font-size: 11.5px; cursor: pointer; }
.pick-hits button:hover { border-color: var(--accent); }
.pick-hits img { width: 18px; height: 25px; object-fit: cover; border-radius: 2px; }
.export-text { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; margin-top: 12px; }

/* primer / markdown / comments */
.md { line-height: 1.6; }
.md h2, .md h3, .md h4 { margin: 1.1em 0 .4em; }
.md ul, .md ol { padding-left: 1.3em; margin: 0 0 .8em; }
.md blockquote { margin: 0 0 .8em; padding: 4px 12px; border-left: 3px solid var(--line2); color: var(--muted); }
.md code { background: var(--bg2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.md pre { background: var(--bg2); padding: 10px 12px; border-radius: 6px; overflow-x: auto; }
.md.compact p { margin: 0 0 .4em; }
.card-ref { font-weight: 600; border-bottom: 1px dotted var(--accent); }
.primer { max-width: 80ch; }
.primer-edit textarea { min-height: 360px; }
.comments { max-width: 80ch; display: flex; flex-direction: column; gap: 14px; }
.comment { display: flex; gap: 10px; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 3px; flex-wrap: wrap; }
.comment-head a { color: var(--text); }
.comment-form textarea { margin-top: 6px; }

/* profile / users / my decks */
.profile-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; }
.profile-info { flex: 1; min-width: 240px; }
.profile-info h1 { margin: 0 0 6px; }
.profile-stats { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.profile-stats b { color: var(--text); }
.profile-stats .link-btn { margin: 0; color: var(--muted); }
.user-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.user-list li a { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 6px; color: var(--text); font-weight: 600; text-decoration: none; }
.user-list li a:hover { background: var(--hover); }
.user-list.big span { display: flex; flex-direction: column; }
.mydecks { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.folder-list { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 72px; }
.folder-list > button, .folder-row > button:first-child { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 600; text-align: left; }
.folder-list > button:hover, .folder-row > button:first-child:hover { background: var(--hover); color: var(--text); }
.folder-list > button.on, .folder-row.on > button:first-child { background: var(--panel2); color: var(--text); }
.folder-list .count { margin-left: auto; }
.folder-row { display: flex; align-items: center; }
.folder-row .icon-btn { width: 26px; height: 26px; opacity: 0; }
.folder-row:hover .icon-btn { opacity: 1; }
.new-folder { color: var(--accent) !important; }

/* cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.card-tile { display: flex; flex-direction: column; gap: 4px; color: var(--text); text-decoration: none !important; }
.card-tile:hover .card-img { box-shadow: 0 0 0 2px var(--accent); }
.card-tile-name { font-weight: 600; font-size: 13px; margin-top: 2px; }
.card-page { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 28px; }
.card-page-art .card-img { border-radius: 16px; box-shadow: var(--shadow); }
.buy-box { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.finish-prices { display: flex; gap: 8px; flex-wrap: wrap; }
.finish { display: flex; flex-direction: column; align-items: flex-start; padding: 8px 12px; border: 1px solid var(--line2); background: var(--panel); border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; color: var(--muted); }
.finish b { color: var(--text); font-size: 15px; }
.finish.on { border-color: var(--accent); background: var(--accent-soft); }
.print-table { overflow-x: auto; }
.print-table tr.current td { background: var(--accent-soft); }

/* rules / admin */
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ban-list { list-style: none; padding: 0; margin: 0; font-size: 13px; columns: 2 220px; column-gap: 18px; }
.ban-list li { break-inside: avoid; padding: 3px 0; }
.runs { font-size: 12px; margin-top: 10px; }
.runs input[type=date] { min-height: 28px; padding: 2px 6px; font-size: 12px; }

/* auth / settings */
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 26px; margin-top: 20px; }
.auth-alt { margin-top: 14px; font-size: 13px; color: var(--muted); }
.avatar-pick { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 10px; }
.avatar-hits { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-hits button { padding: 0; border: 2px solid transparent; border-radius: 5px; background: none; cursor: pointer; width: 48px; }
.avatar-hits button.on { border-color: var(--accent); }
.avatar-hits img { display: block; width: 100%; border-radius: 3px; }

/* footer */
.foot { border-top: 1px solid var(--line); background: var(--bg2); margin-top: auto; }
.foot-inner { padding: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .deck-layout { grid-template-columns: minmax(0, 1fr); }
  .deck-side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
  .hero-inner { grid-template-columns: 1fr; }
  .rules-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav { display: none; position: absolute; top: 56px; left: 0; right: 0; background: var(--panel); border-bottom: 1px solid var(--line); flex-direction: column; padding: 8px; }
  .nav.open { display: flex; }
  .nav a { padding: 10px 12px; }
  .gsearch { max-width: none; }
  .card-modal, .card-page { grid-template-columns: 1fr; }
  .card-modal-art { max-width: 280px; margin: 0 auto; }
  .card-page-art { max-width: 320px; }
  .mydecks { grid-template-columns: 1fr; }
  .folder-list { position: static; flex-direction: row; flex-wrap: wrap; }
  .folder-list > button, .folder-row { width: auto; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .hide-sm { display: none; }
  .topbar-inner { gap: 8px; }
  .brand span:last-child { display: none; }
  .hero h1 { font-size: 26px; }
  .deck-title { font-size: 25px; }
  .deck-title-input { font-size: 22px !important; }
  .deck-hero-inner { min-height: 170px; padding-top: 22px; }
  .text-view { columns: 1; }
  .deck-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .deck-tile-art { height: 90px; }
  .visual-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .row .set-code { display: none; }
  .row .price { margin-left: auto; }
  .deck-hero-inner { flex-direction: column; align-items: stretch; gap: 14px; }
  .deck-hero-text { flex: none; }
  .deck-byline { gap: 10px; }
  .deck-actions .btn { flex: 1; }
  .deck-toolbar { align-items: stretch; }
  .toolbar-right { width: 100%; justify-content: space-between; }
  .changes li { grid-template-columns: 1fr; gap: 3px; }
  .modal-back { padding: 0; }
  /* dvh = the screen actually visible between the browser's toolbars */
  .modal { max-height: 100vh; max-height: 100dvh; height: 100dvh; min-height: 0; border-radius: 0; border: 0; }
  /* Stacks wrap instead of scrolling sideways, so vertical swipes always scroll the page */
  .stacks-view { flex-wrap: wrap; overflow-x: visible; }
  .stack-col { width: calc(50% - 7px); }
  .to-top { display: flex; }
  .add-card { min-width: 100%; }
  .import-link { grid-template-columns: 1fr; }
}

/* Default printings */
.pref-star { font-size: 15px; line-height: 1; color: var(--muted, #8a8f98); }
.pref-star.on { color: #f5c542; }
.pref-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.pref-list li { display: flex; align-items: center; gap: 10px; }
.pref-list img { width: 36px; border-radius: 3px; }
.pref-list .grow { flex: 1; min-width: 0; }

/* Sign-in */
.auth-quick { display: grid; gap: 10px; margin: 18px 0 6px; }
.auth-google { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--faint); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line, rgba(127,127,127,.25)); }
.passkey-nudge { position: fixed; z-index: 60; right: 16px; bottom: 16px; max-width: 380px; display: grid; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--panel, #1c2029); border: 1px solid var(--line, rgba(127,127,127,.25)); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.passkey-nudge > div:first-child { display: grid; gap: 4px; }
@media (max-width: 520px) { .passkey-nudge { left: 16px; right: 16px; max-width: none; } }

/* Back to top (phones) */
.to-top { display: none; position: fixed; right: 14px; bottom: 18px; z-index: 45; width: 44px; height: 44px; border-radius: 50%; align-items: center; justify-content: center; background: var(--panel2); color: var(--text); border: 1px solid var(--line2); box-shadow: var(--shadow); }

/* Phones: iOS Safari zooms the whole page when a text box under 16px gets focus, and stays zoomed.
   16px text in form fields on touch screens prevents that. */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }
  .gsearch input, .add-input input { font-size: 16px !important; }
}
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }

/* Very narrow screens, including phones with enlarged text */
.gsearch { min-width: 0; }
@media (max-width: 440px) {
  .topbar-inner { gap: 6px; }
  .theme-btn { display: none; } /* still in Settings → Appearance */
  .account-btn > .icon { display: none; }
  .account-btn { padding: 0 3px; }
  .tabs { flex-wrap: wrap; gap: 0; }
  .tabs button { padding: 10px 8px; }
  .panel { min-width: 0; }
}

.export-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
@media (max-width: 640px) { .export-actions .btn { flex: 1 1 100%; justify-content: center; } }

/* Menus on phones: a sheet along the bottom with big touch targets */
.menu.sheet { position: fixed; left: 8px; right: 8px; bottom: 8px; top: auto; max-height: 75vh; padding: 8px; border-radius: 14px; animation: rise .16s ease-out; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.menu.sheet .menu-item { padding: 14px 12px; font-size: 16px; }
.menu-scrim { position: fixed; inset: 0; z-index: 119; background: rgba(5, 8, 14, .5); }
.deck-actions .menu-wrap { flex: none; }

/* Admin: users */
.admin-users { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.admin-users li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 4px; border-top: 1px solid var(--line); }
.admin-users li:first-child { border-top: 0; }
.admin-users .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.au-name { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-weight: 700; }
.au-email { overflow-wrap: anywhere; }
.au-decks { display: grid; justify-items: end; text-align: right; flex: none; }
.au-decks b { font-size: 18px; }

/* Tournaments */
.lede { margin: -4px 0 16px; }
.credit { margin-top: 18px; }
.crumbs { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.meta-panel { margin-bottom: 22px; }
.meta-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 12px; }
.meta-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; align-items: baseline; }
.meta-name { font-size: 15px; }
.meta-stats { color: var(--muted); font-size: 13px; }
.meta-bar { height: 6px; border-radius: 99px; background: var(--bg2); margin: 5px 0 3px; overflow: hidden; }
.meta-bar span { display: block; height: 100%; max-width: 100%; background: var(--accent); border-radius: 99px; }
.events-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 6px 0 10px; }
.events-head h2 { margin: 0; }
.event-list, .standings { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.event-row, .st-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none !important; }
a.event-row:hover, a.st-row:hover { border-color: var(--accent); }
.event-row .grow, .st-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.event-name { font-weight: 700; font-size: 15px; }
.event-side { display: grid; justify-items: end; gap: 4px; flex: none; text-align: right; }
.st-place { flex: none; width: 3.2em; font-weight: 800; color: var(--muted); }
.st-side { flex: none; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.st-side .icon { transform: rotate(-90deg); color: var(--muted); }
.st-row.off { opacity: .7; }
@media (max-width: 440px) { .st-place { width: 2.6em; } }
