/* Társasláda: pixel fantasy ledger. One radius rule: everything square (radius 0). */
:root {
  --bg: #e6dcc3;
  --bg-2: #ddd0b2;
  --panel: #f3ebd8;
  --panel-2: #ece1c8;
  --line: #8f7b55;
  --ink: #24202c;
  --ink-2: #5b5262;
  --gold: #8f5f0c;
  --gold-hi: #b57c18;
  --on-gold: #fff8e8;
  --sky-a: #9fd0e6;
  --sky-b: #e8d6a8;
  --ground: #4f9a52;
  --ground-2: #2f6b3a;
  --shadow: #8f7b5566;
  --ok: #2f7d3a;
  --warn: #9a5b00;
  --info: #2a5d8f;
  --bad: #a3322a;
  --r-legend: #b06a00;
  --r-epic: #7347b0;
  --r-rare: #2a64a8;
  --r-common: #66707a;
  --r-worn: #84533a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #131821;
    --bg-2: #0f131a;
    --panel: #1e2532;
    --panel-2: #252e3e;
    --line: #3d4a63;
    --ink: #ede3cf;
    --ink-2: #a9b0bf;
    --gold: #e3b04b;
    --gold-hi: #f2c76a;
    --on-gold: #1b1408;
    --sky-a: #0d1424;
    --sky-b: #2a2440;
    --ground: #24502d;
    --ground-2: #173620;
    --shadow: #00000080;
    --ok: #6fcf7a;
    --warn: #f0b04a;
    --info: #7fb4ee;
    --bad: #f07a68;
    --r-legend: #f2a93b;
    --r-epic: #b893ef;
    --r-rare: #78aef0;
    --r-common: #a8b0b9;
    --r-worn: #c8957a;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #131821; --bg-2: #0f131a; --panel: #1e2532; --panel-2: #252e3e; --line: #3d4a63;
  --ink: #ede3cf; --ink-2: #a9b0bf; --gold: #e3b04b; --gold-hi: #f2c76a; --on-gold: #1b1408;
  --sky-a: #0d1424; --sky-b: #2a2440; --ground: #24502d; --ground-2: #173620; --shadow: #00000080;
  --ok: #6fcf7a; --warn: #f0b04a; --info: #7fb4ee; --bad: #f07a68;
  --r-legend: #f2a93b; --r-epic: #b893ef; --r-rare: #78aef0; --r-common: #a8b0b9; --r-worn: #c8957a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 'Pixelify Sans', system-ui, sans-serif;
  min-height: 100dvh;
}
h1, h2, h3, .px-title { font-family: 'Silkscreen', 'Pixelify Sans', monospace; font-weight: 400; letter-spacing: 0.02em; margin: 0; }
a { color: var(--gold); }
img { max-width: 100%; display: block; }
svg { display: block; }
[data-sprite] { display: inline-block; line-height: 0; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--ink-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- pixel frame (stepped corners via box-shadow) ---------- */
.frame {
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--shadow);
}

/* ---------- buttons & inputs ---------- */
.btn {
  font: inherit; font-size: 16px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 9px 14px; border: 3px solid var(--line); background: var(--panel-2); color: var(--ink);
  box-shadow: 3px 3px 0 var(--shadow); text-decoration: none;
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}
.btn:hover { background: var(--panel); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--shadow); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.btn.gold:hover { background: var(--gold-hi); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 9px; font-size: 14px; box-shadow: 2px 2px 0 var(--shadow); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, .switch input:focus-visible + span {
  outline: 3px solid var(--gold); outline-offset: 2px;
}
label { display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--bg);
  border: 3px solid var(--line); padding: 8px 10px; width: 100%; min-width: 0; border-radius: 0;
}
textarea { min-height: 80px; resize: vertical; }
input::placeholder { color: var(--ink-2); opacity: 0.85; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--ink); font-size: 15px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch input + span { width: 46px; height: 24px; border: 3px solid var(--line); background: var(--bg); position: relative; flex: none; }
.switch input + span::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: var(--ink-2);
  transition: transform 0.15s steps(3);
}
.switch input:checked + span { background: var(--ok); border-color: var(--ok); }
.switch input:checked + span::after { transform: translateX(22px); background: var(--on-gold); }

/* ---------- scene (hero band) ---------- */
.scene {
  position: relative; overflow: hidden; height: 250px;
  background: linear-gradient(var(--sky-a), var(--sky-b));
  border-bottom: 4px solid var(--ground-2);
}
.scene .content { position: relative; z-index: 3; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding-bottom: 52px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 { font-size: clamp(28px, 5vw, 46px); line-height: 1; color: #fff8e8; text-shadow: 3px 3px 0 #1a1423; }
.brand p { margin: 4px 0 0; color: #fff8e8; text-shadow: 2px 2px 0 #1a1423; font-size: 17px; }
.ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 44px; z-index: 2;
  background:
    linear-gradient(90deg, var(--ground) 50%, var(--ground-2) 50%) 0 0 / 16px 6px repeat-x,
    var(--ground);
  border-top: 4px solid var(--ground-2);
}
.scene .actor { position: absolute; bottom: 40px; z-index: 2; }
.sway { transform-origin: 50% 100%; animation: sway 4.5s steps(4) infinite alternate; }
.sway.slow { animation-duration: 6.5s; }
@keyframes sway { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }
.flicker svg:nth-child(2) { position: absolute; left: 0; top: 0; animation: blink 0.5s steps(1) infinite; }
.flicker { position: relative; }
@keyframes blink { 50% { opacity: 0; } }
.hopper { animation: walk 38s linear infinite; }
.hopper > * { animation: hop 0.7s steps(2) infinite; }
@keyframes walk { from { transform: translateX(-60px); } to { transform: translateX(calc(100vw + 60px)); } }
@keyframes hop { 50% { transform: translateY(-6px) scaleY(0.9); } }
.orb { position: absolute; width: 9px; height: 9px; background: #8fe3ff; opacity: 0.4; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.05; transform: scale(2.2); } }
.star, .fly { position: absolute; width: 3px; height: 3px; background: #fff3c4; z-index: 1; }
.star { animation: blink 3s steps(1) infinite; }
.fly { background: #ffe27a; animation: drift 7s ease-in-out infinite alternate; }
@keyframes drift { 33% { transform: translate(14px, -10px); opacity: 0.3; } 66% { transform: translate(-8px, -20px); } 100% { transform: translate(10px, 4px); opacity: 1; } }
@media (prefers-color-scheme: light) { :root:not([data-theme='dark']) .star { display: none; } }
:root[data-theme='light'] .star { display: none; }

/* ---------- topbar ---------- */
.topbar { position: absolute; top: 12px; right: 16px; z-index: 4; display: flex; gap: 8px; }

/* ---------- filters ---------- */
.filters {
  position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 3px solid var(--line);
  padding: 12px 0;
}
.filters .row { display: grid; gap: 10px; grid-template-columns: 1.6fr 5fr; align-items: end; }
.more summary { display: none; }
.more-in { display: grid; gap: 10px; grid-template-columns: repeat(5, 1fr) 1.3fr 1fr; align-items: end; }
.price-range { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.filters .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 15px; }
.search { position: relative; }
.search i { position: absolute; left: 10px; bottom: 11px; font-size: 20px; color: var(--ink-2); }
.search input { padding-left: 36px; }
@media (max-width: 1080px) { .filters .row { grid-template-columns: 1fr; } .more-in { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  .filters { position: static; }
  .more summary { display: inline-flex; list-style: none; }
  .more summary::-webkit-details-marker { display: none; }
  .more[open] summary { margin-bottom: 10px; }
  .more-in { grid-template-columns: 1fr 1fr; }
  .scene { height: 210px; }
  .scene .actor:nth-child(-n + 3), .scene .actor:nth-child(6) { display: none; }
  .brand h1 { font-size: 26px; }
  .brand p { font-size: 15px; max-width: 220px; }
}

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; padding: 26px 0 60px; }
.card {
  --rar: var(--r-common);
  display: flex; flex-direction: column; background: var(--panel); border: 3px solid var(--line);
  box-shadow: 5px 5px 0 var(--shadow); transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  animation: rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: calc(var(--i, 0) * 25ms);
}
.card:hover { transform: translateY(-4px); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.card[data-r='legend'] { --rar: var(--r-legend); }
.card[data-r='epic'] { --rar: var(--r-epic); }
.card[data-r='rare'] { --rar: var(--r-rare); }
.card[data-r='worn'] { --rar: var(--r-worn); }
.card .pic {
  position: relative; aspect-ratio: 4 / 3; background: var(--bg-2); border: 0; border-bottom: 3px solid var(--line);
  padding: 0; cursor: zoom-in; overflow: hidden; display: grid; place-items: center; width: 100%;
}
.card .pic img { width: 100%; height: 100%; object-fit: cover; }
.card .pic.empty {
  cursor: default;
  background: repeating-linear-gradient(45deg, var(--bg-2) 0 8px, var(--panel-2) 8px 16px);
}
.card.sold .pic img { filter: grayscale(1) contrast(0.9); opacity: 0.7; }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.rarity { font-family: 'Silkscreen', monospace; font-size: 12px; color: var(--rar); display: flex; align-items: center; gap: 6px; }
.rarity::before { content: ''; width: 8px; height: 8px; background: var(--rar); }
.card h3 { font-family: 'Pixelify Sans', sans-serif; font-weight: 600; font-size: 19px; line-height: 1.2; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 13px; padding: 2px 7px; border: 2px solid var(--line); color: var(--ink-2); background: var(--bg); }
.tag.oop { color: var(--gold); border-color: var(--gold); background: transparent; }
.status { font-size: 13px; padding: 2px 7px; border: 2px solid currentColor; }
.status.elerheto { color: var(--ok); }
.status.foglalt { color: var(--warn); }
.status.postazasra_var { color: var(--info); }
.status.elkelt { color: var(--bad); }
.price-row { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; }
.price { display: flex; align-items: center; gap: 8px; font-family: 'Silkscreen', monospace; font-size: 18px; color: var(--gold); white-space: nowrap; }
.card.sold .price { text-decoration: line-through; color: var(--ink-2); }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.links a { font-size: 14px; text-decoration: none; padding: 3px 7px; border: 2px solid var(--line); color: var(--ink); display: inline-flex; gap: 4px; align-items: center; }
.links a:hover { border-color: var(--gold); color: var(--gold); }
.coin { animation: spin 2.2s steps(6) infinite; }
@keyframes spin { 50% { transform: scaleX(0.2); } }

/* ---------- empty / skeleton ---------- */
.empty-state { text-align: center; padding: 70px 16px; display: grid; justify-items: center; gap: 14px; }
.skel { height: 340px; background: linear-gradient(90deg, var(--panel) 0 40%, var(--panel-2) 50%, var(--panel) 60%) 0 0 / 300% 100%; border: 3px solid var(--line); animation: shimmer 1.4s steps(10) infinite; }
@keyframes shimmer { to { background-position: -100% 0; } }

/* ---------- lightbox ---------- */
dialog { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: none; max-height: none; }
dialog::backdrop { background: #0b0d12e0; }
.lightbox { width: 100vw; height: 100dvh; display: grid; place-items: center; overflow: hidden; }
.lightbox img { max-width: 92vw; max-height: 84dvh; cursor: zoom-in; border: 4px solid var(--line); transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); touch-action: pinch-zoom; }
.lightbox.zoomed img { cursor: zoom-out; transform: scale(2.4); }
.lightbox .cap { position: fixed; bottom: 16px; left: 16px; right: 70px; color: #fff8e8; font-size: 18px; text-shadow: 2px 2px 0 #000; }
.lightbox .close { position: fixed; top: 14px; right: 14px; }

footer { border-top: 3px solid var(--line); padding: 22px 0; color: var(--ink-2); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
