/* Netdex — interface sobre : aplats, bordures fines, chiffres en mono, les cartes sont des fenêtres de navigateur. */
:root {
  --bg: #111110;
  --surface: #191918;
  --surface-2: #222120;
  --line: #2e2d2b;
  --line-2: #3b3a37;
  --text: #ecebe6;
  --muted: #8d8b84;
  --accent: #ff5b1f;
  --accent-ink: #160803;
  --good: #57b26a;
  --bad: #e5484d;
  --warn: #d9a21b;
  --r-common: #8f8c84;
  --r-uncommon: #57b26a;
  --r-rare: #3d8ee6;
  --r-epic: #9b5de5;
  --r-legendary: #e0a100;
  --r-mythic: #e5484d;
  --radius: 4px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar: 58px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f2ed;
  --surface: #ffffff;
  --surface-2: #f7f6f2;
  --line: #dedcd4;
  --line-2: #cbc9c0;
  --text: #171716;
  --muted: #6c6a63;
  --accent: #e8480c;
  --accent-ink: #fff;
  --r-common: #7a776f;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
img { display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }

/* ---------- Coquille ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; font: 700 18px/1 var(--mono); letter-spacing: -.03em; }
.logo img { width: 26px; height: 26px; border-radius: 5px; }
.logo span::after { content: "_"; color: var(--accent); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--radius); font: 600 14px var(--mono); text-decoration: none; white-space: nowrap; }
.pill .coin { width: 9px; height: 9px; background: var(--accent); }
.icon-btn { position: relative; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius); background: transparent; cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }
.dot { position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 3px; background: var(--accent); color: var(--accent-ink); font: 700 11px/17px var(--mono); text-align: center; }
main { max-width: 1080px; margin: 0 auto; padding: 18px 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 28px); }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(6, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg); border-top: 1px solid var(--line);
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; }
.tabbar a svg { width: 21px; height: 21px; }
.tabbar a.active { color: var(--text); }
.tabbar a.active::after { content: ""; position: absolute; top: -1px; left: 25%; right: 25%; height: 2px; background: var(--accent); }
.tabbar .dot { top: 5px; right: calc(50% - 22px); }
@media (min-width: 900px) {
  .tabbar { top: 0; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); width: 640px; height: 57px; padding: 0; border: 0; background: transparent; z-index: 21; }
  .tabbar a { flex-direction: row; font-size: 13.5px; gap: 6px; }
  .tabbar a svg { width: 16px; height: 16px; }
  .tabbar a.active::after { top: auto; bottom: 0; left: 18%; right: 18%; }
  .tabbar .dot { top: 9px; right: 6px; }
  main { padding-bottom: 48px; }
}

h1 { font-size: 24px; margin: 2px 0 14px; letter-spacing: -.02em; }
h2 { font-size: 13px; margin: 26px 0 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.page-head .row { margin-left: auto; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel + .panel { margin-top: 10px; }
.grid-2 { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.violet { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.big { padding: 13px 22px; font-size: 16px; }

input[type=text], input[type=password], input[type=number], input[type=search], select {
  width: 100%; padding: 9px 11px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--bg); outline: none;
}
input:focus, select:focus { border-color: var(--text); }
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
input[type=checkbox] { accent-color: var(--accent); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 5px 10px; border-radius: var(--radius); border: 1px solid var(--line); background: transparent; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); }
.chip::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--c, transparent); vertical-align: 0; }
.chip:not([class*="r-"])::before { display: none; }
.chip.on { color: var(--text); border-color: var(--text); }

.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button, .tabs a { padding: 8px 0 10px; border: 0; background: none; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; position: relative; text-decoration: none; }
.tabs .on { color: var(--text); }
.tabs .on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.tabs .dot { position: static; display: inline-block; margin-left: 5px; vertical-align: 1px; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* ---------- Cartes : une fenêtre de navigateur par site ---------- */
.r-0 { --c: var(--r-common); }
.r-1 { --c: var(--r-uncommon); }
.r-2 { --c: var(--r-rare); }
.r-3 { --c: var(--r-epic); }
.r-4 { --c: var(--r-legendary); }
.r-5 { --c: var(--r-mythic); }
.rtext { color: var(--c); font-weight: 700; }

.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
@media (max-width: 440px) { .cards { grid-template-columns: repeat(3, 1fr); gap: 7px; } }
.card {
  position: relative; aspect-ratio: 5 / 7; display: flex; flex-direction: column; overflow: hidden; cursor: pointer; user-select: none;
  background: var(--surface); border: 1px solid var(--c); border-radius: 6px; container-type: inline-size;
}
.card:hover { outline: 1px solid var(--c); }
.card .c-bar { display: flex; align-items: center; gap: 3.5cqw; padding: 3.5cqw 5cqw; background: var(--c); color: #111; font: 700 max(8.5px, 7.5cqw)/1 var(--mono); }
.card .c-bar i { width: 4cqw; height: 4cqw; border-radius: 50%; background: rgba(0, 0, 0, .28); flex: none; }
.card .c-bar .rk { margin-left: auto; }
.card .c-url { margin: 4cqw 5cqw 0; padding: 2.5cqw 4cqw; border: 1px solid var(--line); border-radius: 3px; background: var(--bg); font: max(8.5px, 7.6cqw)/1.2 var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .c-art { flex: 1; min-height: 0; display: grid; place-items: center; }
.card .c-art img, .card .c-art .letter { width: 40%; aspect-ratio: 1; object-fit: contain; border-radius: 12%; }
.letter { display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--c, var(--text)); font: 700 18cqw/1 var(--mono); text-transform: uppercase; }
.card .c-name { padding: 0 5cqw; font-weight: 700; font-size: max(11px, 10.5cqw); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: capitalize; }
.card .c-foot { display: flex; justify-content: space-between; align-items: center; padding: 2.5cqw 5cqw 4cqw; font: 600 max(8.5px, 7.3cqw)/1 var(--mono); color: var(--muted); }
.card .c-foot .rar { color: var(--c); text-transform: uppercase; letter-spacing: .03em; }
.card .count, .card .badge-new, .card .badge-lock {
  position: absolute; top: calc(14cqw + 24px); font: 700 11px/1 var(--mono); padding: 3px 5px; border-radius: 2px;
}
.card .count { right: 5cqw; background: var(--text); color: var(--bg); }
.card .badge-new { left: 5cqw; background: var(--accent); color: var(--accent-ink); }
.card .badge-lock { left: 5cqw; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.card.holo .c-bar .rk::before { content: "HOLO "; }
.card.holo::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light; opacity: .6;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .55) 45%, rgba(120, 200, 255, .4) 55%, transparent 70%);
  background-size: 300% 300%; animation: sheen 4s linear infinite;
}
@keyframes sheen { from { background-position: 100% 100%; } to { background-position: 0 0; } }
.card.r-5 .c-bar { background: repeating-linear-gradient(-45deg, var(--r-mythic) 0 6px, #c23a3e 6px 12px); background-size: 34px 34px; animation: stripes 1.6s linear infinite; }
@keyframes stripes { to { background-position: 34px 0; } }
.card.unknown { --c: var(--line-2); cursor: default; }
.card.unknown .c-art { color: var(--line-2); font: 700 26cqw var(--mono); }
.card.unknown .c-name, .card.unknown .c-url { color: var(--muted); }
.card.missing { opacity: .45; }
.card.missing:hover { opacity: .8; }
.card.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.card.selected::before { content: "✓"; position: absolute; z-index: 2; bottom: 6px; right: 6px; width: 20px; height: 20px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 12px; border-radius: 2px; }

/* ---------- Boosters ---------- */
.hero { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: center; padding: 22px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-align: center; }
@media (min-width: 760px) { .hero { grid-template-columns: 200px 1fr; text-align: left; padding: 28px; } .hero .stock-bar, .hero .hero-actions { justify-content: flex-start !important; } }
.pack-visual {
  position: relative; width: 150px; height: 206px; margin: 0 auto; cursor: pointer; border-radius: 5px;
  background: var(--accent); color: var(--accent-ink); display: flex; flex-direction: column; justify-content: space-between; padding: 14px 12px;
  font-family: var(--mono); text-align: left; box-shadow: 6px 6px 0 var(--line-2);
}
.pack-visual::before { content: ""; position: absolute; left: 0; right: 0; top: 34px; border-top: 2px dashed rgba(0, 0, 0, .35); }
.pack-visual .pv-top { font: 700 12px var(--mono); letter-spacing: .1em; }
.pack-visual .pv-logo { font: 800 30px/1 var(--mono); letter-spacing: -.04em; }
.pack-visual .pv-label { font: 600 11px/1.4 var(--mono); opacity: .8; }
.pack-visual .pv-count { position: absolute; top: -9px; right: -9px; min-width: 32px; height: 32px; padding: 0 6px; background: var(--text); color: var(--bg); font: 800 16px/32px var(--mono); text-align: center; border-radius: 3px; }
.pack-visual.premium { background: var(--text); color: var(--bg); }
.pack-visual.empty { background: var(--surface-2); color: var(--muted); box-shadow: none; border: 1px dashed var(--line-2); cursor: default; }
.timer { font: 700 40px/1.1 var(--mono); letter-spacing: -.04em; }
.stock-bar { display: flex; gap: 3px; justify-content: center; margin: 10px 0 14px; }
.stock-bar i { width: 16px; height: 8px; background: var(--line); }
.stock-bar i.on { background: var(--accent); }
.progress { height: 6px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--c, var(--accent)); }
.tier-row { display: grid; grid-template-columns: 104px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.tier-row .muted { font: 12px var(--mono); }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.quick { padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
.quick b { font: 700 21px var(--mono); }
.quick span { font-size: 12px; color: var(--muted); }

/* ---------- Ouverture ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 16px); background: rgba(10, 10, 9, .96); animation: fade .15s; }
.reveal { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 900px; width: 100%; perspective: 1200px; }
.flip { width: min(30vw, 160px); aspect-ratio: 5 / 7; position: relative; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.2, .8, .2, 1); cursor: pointer; }
.flip.open { transform: rotateY(180deg); }
.flip > * { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip .back { border-radius: 6px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font: 800 16px var(--mono); letter-spacing: -.02em; }
.flip .back::after { content: "netdex_"; }
.flip .back.hint { outline: 3px solid var(--c); outline-offset: 3px; }
.flip .card { transform: rotateY(180deg); width: 100%; height: 100%; }
.reveal-summary { margin-top: 20px; text-align: center; min-height: 90px; color: #ecebe6; font-size: 14px; }
.reveal-summary .row { justify-content: center; margin-top: 12px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- Modales & toasts ---------- */
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end; justify-content: center; }
.modal { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px 6px 0 0; padding: 16px 16px calc(env(safe-area-inset-bottom) + 18px); }
@media (min-width: 640px) { .modal-back { align-items: center; } .modal { border-radius: 6px; } }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.site-hero { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: start; }
@media (max-width: 420px) { .site-hero { grid-template-columns: 118px 1fr; gap: 12px; } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font: 600 13.5px var(--mono); }
.list { display: flex; flex-direction: column; }
.list > * { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.list > *:last-child { border-bottom: 0; }
.avatar { width: 38px; height: 38px; flex: none; border: 1px solid var(--line-2); border-radius: var(--radius); display: grid; place-items: center; overflow: hidden; font: 700 15px var(--mono); background: var(--surface-2); text-transform: uppercase; }
.avatar img { width: 66%; height: 66%; object-fit: contain; }
.avatar.lg { width: 72px; height: 72px; font-size: 28px; }
.online { width: 7px; height: 7px; border-radius: 50%; background: var(--good); display: inline-block; vertical-align: 3px; }
.toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 10px); display: flex; flex-direction: column; gap: 6px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 10px 14px; background: var(--text); color: var(--bg); border-radius: var(--radius); font-weight: 600; font-size: 14px; pointer-events: auto; }
.toast.err { background: var(--bad); color: #fff; }

/* ---------- Marché, échanges ---------- */
.auctions { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
@media (max-width: 400px) { .auctions { grid-template-columns: 1fr; } }
.auction { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.auction .price { font: 700 20px var(--mono); }
.auction .meta { font-size: 12.5px; color: var(--muted); }
.tag { display: inline-block; padding: 2px 6px; border: 1px solid var(--line-2); border-radius: 2px; font: 600 11px var(--mono); color: var(--muted); text-transform: uppercase; }
.tag.good { color: var(--good); border-color: var(--good); }
.tag.bad { color: var(--bad); border-color: var(--bad); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.tag.accent { color: var(--accent); border-color: var(--accent); }
.mini-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.mini-cards .card .c-foot, .mini-cards .card .c-url { display: none; }
.trade { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; }
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0; }
.trade-cols h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.builder-tray { position: sticky; top: 60px; z-index: 5; }
.picker { max-height: 46vh; overflow: auto; padding: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.data td { padding: 8px; border-bottom: 1px solid var(--line); }
table.data td.num { font-family: var(--mono); text-align: right; }

/* ---------- Connexion ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-hero { margin-bottom: 18px; }
.auth-hero h1 { font: 800 34px/1 var(--mono); letter-spacing: -.05em; margin: 0 0 8px; }
.auth-hero h1::after { content: "_"; color: var(--accent); }
.auth-hero p { color: var(--muted); margin: 0; }
.fan { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 18px 0; }
.fan .card { pointer-events: none; }

.skeleton { aspect-ratio: 5 / 7; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.spinner { width: 22px; height: 22px; margin: 40px auto; border: 2px solid var(--line); border-top-color: var(--text); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Graphiques ---------- */
.chart { width: 100%; touch-action: pan-y; }
.chart svg { display: block; overflow: visible; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-axis { fill: var(--muted); font: 11px var(--mono); }
.c-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-area { fill: var(--accent); opacity: .08; }
.c-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.c-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip { position: absolute; top: 0; width: 120px; padding: 6px 8px; background: var(--text); color: var(--bg); border-radius: var(--radius); font-size: 12px; pointer-events: none; display: flex; flex-direction: column; }
.chart-tip b { font: 700 14px var(--mono); }
.big-value { font: 700 36px/1.1 var(--mono); letter-spacing: -.03em; }
.delta { font: 600 13px var(--mono); padding: 2px 6px; border: 1px solid currentColor; border-radius: 2px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.bar-row { display: grid; grid-template-columns: 96px 1fr 120px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13.5px; }
.bar-row .track { height: 14px; background: var(--surface-2); }
.bar-row .track i { display: block; height: 100%; min-width: 2px; background: var(--c); border-radius: 0 3px 3px 0; }
.bar-row .num { text-align: right; font-family: var(--mono); font-size: 12.5px; }

/* ---------- Options fun ---------- */
.card .badge-fav { position: absolute; right: 5cqw; bottom: calc(14cqw + 14px); color: var(--r-legendary); font-size: 14px; line-height: 1; text-shadow: 0 0 3px var(--bg); }
.card .badge-price { position: absolute; left: 5cqw; bottom: calc(14cqw + 12px); font: 700 10px/1 var(--mono); padding: 2px 4px; border-radius: 2px; background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.btn.on-fav { border-color: var(--r-legendary); color: var(--r-legendary); }
:root[data-grid="small"] .cards:not(.mini-cards) { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
:root[data-grid="large"] .cards:not(.mini-cards) { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
@media (max-width: 440px) {
  :root[data-grid="small"] .cards:not(.mini-cards) { grid-template-columns: repeat(4, 1fr); }
  :root[data-grid="large"] .cards:not(.mini-cards) { grid-template-columns: repeat(2, 1fr); }
}

.event-banner { margin-bottom: 12px; padding: 10px 14px; border: 1px solid var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); font-size: 14px; }
.event-banner b { color: var(--accent); margin-right: 6px; }
.level-strip { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; }
.lvl-badge { width: 44px; height: 44px; flex: none; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font: 800 20px var(--mono); border-radius: var(--radius); }
.lvl-badge.sm { width: 30px; height: 30px; font-size: 14px; }
.pity { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); max-width: 320px; }
.hero .pity { margin-left: auto; margin-right: auto; }
@media (min-width: 760px) { .hero .pity { margin-left: 0; } }
.pity-note { margin-bottom: 14px; padding: 6px 12px; background: var(--r-epic); color: #fff; font-weight: 700; border-radius: var(--radius); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 12px; }
.cal div { padding: 5px 0; text-align: center; border: 1px solid var(--line); border-radius: 3px; display: flex; flex-direction: column; font: 10.5px/1.3 var(--mono); color: var(--muted); }
.cal b { color: var(--text); font-size: 11px; }
.cal .got { background: var(--surface-2); border-color: var(--line-2); }
.cal .got b::after { content: " ✓"; color: var(--good); }
.cal .today { border-color: var(--accent); color: var(--accent); }

.daily-grid, .games-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.daily-tile, .game-tile { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--text); font: inherit; }
.daily-tile:disabled { cursor: default; opacity: .55; }
.daily-tile.ready { border-color: var(--accent); }
.daily-tile span { font-size: 12.5px; color: var(--muted); }
.daily-tile .dt-ico { font: 700 22px/1 var(--mono); color: var(--accent); }
.daily-tile.cotd { cursor: default; }
.game-tile:hover, .daily-tile.ready:hover { border-color: var(--text); }
.game-tile span { font-size: 12.5px; color: var(--muted); }
.ach-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.ach { padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: var(--radius); display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 12.5px; }
.ach b { font-size: 14px; }
.ach.done { border: 1px solid var(--good); background: var(--surface); color: var(--muted); }
.ach.done b { color: var(--good); }

/* Roue, ticket, plus-ou-moins, devinette, duel, mémo */
.wheel-wrap { position: relative; width: min(78vw, 320px); margin: 6px auto 10px; }
.wheel { width: 100%; display: block; transition: transform 4s cubic-bezier(.12, .7, .1, 1); }
.wheel-ptr { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); width: 0; height: 0; border: 11px solid transparent; border-top: 18px solid var(--text); z-index: 2; }
.wheel-txt { font: 700 8.5px var(--mono); fill: var(--text); }
.wheel-txt.jack { fill: var(--accent-ink); }
.scratch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 300px; margin: 10px auto; touch-action: none; user-select: none; }
.sc-cell { position: relative; aspect-ratio: 1; border: 1px solid var(--line-2); border-radius: var(--radius); display: grid; place-items: center; font-size: 34px; background: var(--bg); overflow: hidden; cursor: crosshair; }
.sc-cover { position: absolute; inset: 0; background: repeating-linear-gradient(45deg, #a8a7a1 0 6px, #94938d 6px 12px); transition: opacity .25s, transform .25s; }
.sc-cell.open .sc-cover { opacity: 0; transform: scale(1.2); }
.scratch.won .win { color: var(--accent); animation: pulse .8s ease-in-out 3; }
@keyframes pulse { 50% { transform: scale(1.25); } }
.hl { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.hl-opt { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 8px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; font: inherit; color: var(--text); min-width: 0; }
.hl-opt b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.hl-opt img, .hl-opt .letter { width: 48px; height: 48px; border-radius: 8px; }
.hl-opt.good { border-color: var(--good); }
.hl-opt.bad { border-color: var(--bad); opacity: .7; }
.hl-rank { font: 700 16px var(--mono); min-height: 20px; }
.hl-opt.good .hl-rank { color: var(--good); }
.hl-vs { font: 700 13px var(--mono); color: var(--muted); text-transform: uppercase; }
.hl-streak { grid-column: 1 / -1; text-align: center; font-size: 13px; color: var(--muted); }
.guess-img { display: grid; place-items: center; margin: 8px 0 14px; }
.guess-img img { width: 96px; height: 96px; object-fit: contain; padding: 10px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.guess-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.guess-opts .btn { white-space: normal; word-break: break-all; }
.duel { display: flex; flex-direction: column; gap: 10px; }
.duel-round { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; opacity: 0; animation: duelIn .4s forwards; }
.duel-round > div { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 120px; justify-self: center; width: 100%; }
.duel-round .won b { color: var(--good); }
.duel-round .lost { opacity: .5; }
.duel-res { opacity: 0; animation: duelIn .4s forwards; font-size: 16px; }
@keyframes duelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.memo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-width: 360px; margin: 0 auto; }
.memo-c { aspect-ratio: 1; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--accent); cursor: pointer; display: grid; place-items: center; padding: 0; }
.memo-c img, .memo-c .letter { width: 52%; height: 52%; opacity: 0; transition: opacity .15s; border-radius: 6px; }
.memo-c.open { background: var(--surface-2); }
.memo-c.open img, .memo-c.open .letter { opacity: 1; }
.memo-c.done { border-color: var(--good); }

/* Messages */
.chat { display: flex; flex-direction: column; gap: 6px; min-height: 40vh; max-height: calc(100vh - 300px); overflow: auto; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.msg { align-self: flex-start; max-width: 78%; display: flex; flex-direction: column; gap: 2px; }
.msg span { padding: 8px 11px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px 10px 10px 2px; word-wrap: break-word; }
.msg small { font-size: 10.5px; color: var(--muted); padding: 0 4px; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.me span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); border-radius: 10px 10px 2px 10px; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; }
.chat-form input { flex: 1; }

/* Profil */
.profile-card { border-top: 4px solid var(--pc, var(--line)); }
.ptitle { display: inline-block; margin: 4px 0; padding: 2px 8px; font: 700 12px var(--mono); color: var(--pc, var(--accent)); border: 1px solid var(--pc, var(--accent)); border-radius: 2px; text-transform: uppercase; letter-spacing: .05em; }
.pbio { margin: 6px 0 0; font-size: 14px; }
.rbadge { padding: 3px 8px; font: 700 11px var(--mono); border: 1px solid var(--c); color: var(--c); border-radius: 2px; text-transform: uppercase; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg) inset; }
.albums { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.album { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-left: 3px solid var(--c); border-radius: var(--radius); background: var(--surface); text-decoration: none; }
.album img, .album .letter { width: 32px; height: 32px; border-radius: 6px; }

/* Effets de révélation */
.fx-flash { position: fixed; inset: 0; z-index: 150; pointer-events: none; background: radial-gradient(circle, var(--fx) 0%, transparent 70%); animation: flash .7s ease-out forwards; }
@keyframes flash { from { opacity: .85; } to { opacity: 0; } }
.fx-shake .reveal, .fx-shake .modal { animation: shake .5s; }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
.fx-confetti { position: fixed; inset: 0; z-index: 160; pointer-events: none; overflow: hidden; }
.fx-confetti i { position: absolute; top: -12px; width: 8px; height: 12px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 105vh) rotate(var(--rot)); opacity: .8; } }
.pop-in { animation: popIn .35s backwards; }
@keyframes popIn { from { opacity: 0; transform: scale(.85); } }
.overlay .cards { padding-bottom: 20px; }

/* Inspection 3D */
.inspect { cursor: zoom-out; }
.insp-stage { perspective: 900px; }
.insp-card { position: relative; width: min(72vw, 300px); transition: transform .08s; transform-style: preserve-3d; }
.insp-card .card { width: 100%; cursor: zoom-out; box-shadow: 0 30px 60px rgba(0, 0, 0, .5); }
.insp-glare { position: absolute; inset: 0; border-radius: 6px; pointer-events: none; background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .35), transparent 55%); mix-blend-mode: overlay; }
.inspect p { color: #8d8b84; margin-top: 22px; }

/* Dos des boosters */
:root[data-pack="grille"] .pack-visual:not(.empty), :root[data-pack="grille"] .flip .back { background-image: linear-gradient(rgba(0,0,0,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,.18) 1px, transparent 1px); background-size: 12px 12px; }
:root[data-pack="code"] .pack-visual:not(.empty), :root[data-pack="code"] .flip .back { background-color: #0d0d0c; color: var(--accent); background-image: repeating-linear-gradient(0deg, transparent 0 13px, rgba(255,255,255,.05) 13px 14px); border: 1px solid var(--accent); }
:root[data-pack="minuit"] .pack-visual:not(.empty), :root[data-pack="minuit"] .flip .back { background: linear-gradient(160deg, #1d2b64, #0b0f24 60%, #3a1c71); color: #f8f8ff; }
:root[data-pack="minuit"] .pack-visual:not(.empty)::after { content: "✦  ·  ✧"; position: absolute; right: 12px; bottom: 54px; font-size: 13px; opacity: .8; letter-spacing: 4px; }

/* Mode rétro CRT */
:root.crt body::after { content: ""; position: fixed; inset: 0; z-index: 300; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, .45) 100%); }
:root.crt body { text-shadow: 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }
:root.crt .card, :root.crt .panel { box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 18%, transparent); }
@media (max-width: 380px) { .tabbar a { font-size: 10px; } }
.overlay > * { flex: none; }
.all-reveal { padding-bottom: 24px; }
.duel-round .card { width: 100%; }
