:root {
  color-scheme: dark;
  --bg: #14161f;
  --surface: #1d2130;
  --surface-2: #262b3d;
  --line: #3a4059;
  --text: #eceef5;
  --muted: #a3aac2;
  --accent: #5cc8ff;
  --accent-ink: #06202e;
  --price: #ffc857;
  --danger: #ff6b7a;
  --ok: #6fe3a5;
  --radius: 10px;
  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Sora", "Source Sans 3", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1.0625rem/1.6 var(--font-body);
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; padding-block: 2rem 4rem; }
.wrap { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.05rem; font-weight: 500; margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: #9ddcff; }
:focus-visible { outline: 3px solid var(--price); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--price); color: #000; padding: .6rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; flex-wrap: wrap; padding-block: .4rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; font: 700 1.2rem var(--font-head); }
.bar nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.bar nav a:not(.btn) { color: var(--text); text-decoration: none; }
.bar nav a:not(.btn):hover { color: var(--accent); }
form.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
button.link:hover { color: var(--text); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 8px; padding: .65rem 1.2rem; font: 600 1rem var(--font-body); text-decoration: none; cursor: pointer; }
.btn:hover { background: #8bd9ff; color: var(--accent-ink); }
.btn.small { padding: .3rem .8rem; font-size: .92rem; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #2a0a0f; }

/* flashes */
.flashes { padding-top: 1rem; }
.flash { margin: 0 0 .5rem; padding: .7rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.flash.success { border-color: var(--ok); }
.flash.error { border-color: var(--danger); }

/* viewfinder frame – the signature element */
.frame { position: relative; display: block; aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; border-radius: 4px; }
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame::before, .frame::after { content: ""; position: absolute; width: 22px; height: 22px; border: 3px solid var(--accent); pointer-events: none; transition: width .18s, height .18s; }
.frame::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.frame::after { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }
a.frame:hover::before, a.frame:hover::after { width: 34px; height: 34px; }
.frame.big { border-radius: 6px; }
.frame.empty { display: grid; place-items: end start; border: 1px dashed var(--line); }
.hud { position: absolute; left: 0; right: 0; bottom: 0; padding: 2.5rem 1.1rem .9rem; background: linear-gradient(transparent, rgba(10, 12, 18, .88)); display: flex; flex-direction: column; font-size: .95rem; color: var(--muted); }
.hud strong { font: 700 1.1rem var(--font-head); color: var(--text); }
.tag { position: absolute; right: 12px; top: 12px; padding: .1rem .6rem; border-radius: 99px; font: 600 .9rem var(--font-body); background: rgba(10, 12, 18, .82); border: 1px solid var(--line); }
.tag.paid { color: var(--price); border-color: var(--price); }
.tag.free { color: var(--ok); }

/* hero */
.hero { display: grid; grid-template-columns: 1fr 1.15fr; gap: 3rem; align-items: center; padding-block: 1.5rem 3.5rem; }
.lead { color: var(--muted); font-size: 1.15rem; max-width: 46ch; }
.search { display: flex; gap: .5rem; margin: 1.5rem 0 1rem; max-width: 520px; }
.search input { flex: 1; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chips a { display: inline-flex; gap: .5rem; padding: .25rem .8rem; border: 1px solid var(--line); border-radius: 99px; color: var(--text); text-decoration: none; font-size: .95rem; }
.chips a:hover { border-color: var(--accent); }
.chips span { color: var(--muted); }

/* grid + cards */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.section-head h1, .section-head h2 { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.6rem 1.4rem; }
.card-body { padding-top: .7rem; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.game { margin: 0 0 .15rem; color: var(--muted); font-size: .95rem; }

/* forms */
input, select, textarea { width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; font: inherit; }
input[type="file"] { padding: .5rem; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { display: block; font-weight: 600; margin-bottom: .3rem; }
small { color: var(--muted); }
.field { margin-bottom: 1.1rem; min-width: 0; }
.field.grow { flex: 1 1 240px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.filters { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; margin: 1rem 0; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.filters .field { margin: 0; flex: 0 1 190px; }
.filters .field.grow { flex: 1 1 240px; }
.count { color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; }
.panel.narrow { max-width: 480px; margin: 1rem auto; }
.panel.form { max-width: 720px; }
.center { text-align: center; }
.code { font: 700 4rem var(--font-head); color: var(--accent); margin: 0; }
.note { color: var(--muted); font-size: .95rem; }
.empty-note { padding: 2rem; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.thumb { margin-top: .7rem; border-radius: 6px; border: 1px solid var(--line); object-fit: cover; max-width: 240px; height: auto; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1.2rem; margin-top: 2.5rem; }

/* detail */
.crumbs { color: var(--muted); margin-bottom: 1rem; font-size: .95rem; }
.detail { display: grid; grid-template-columns: 1.5fr 1fr; gap: 2.5rem; align-items: start; }
.desc { max-width: 60ch; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem 1.5rem; margin: 1.2rem 0; padding: 1rem 0; border-block: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; font-weight: 600; }
.facts div:first-child dd { color: var(--price); }
.actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.admin-actions { display: flex; gap: .6rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.total { font-size: 1.2rem; }
.total strong { color: var(--price); }

/* dashboard */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin: 0 0 1rem; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; }
.stats dt { color: var(--muted); font-size: .9rem; }
.stats dd { margin: 0; font: 700 1.6rem var(--font-head); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .92rem; background: var(--surface); }
tr:last-child td { border-bottom: 0; }
.mini { border-radius: 4px; object-fit: cover; }
.row-actions { display: flex; gap: .5rem; white-space: nowrap; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem; padding-block: 1.2rem; }
.site-footer p { margin: .2rem 0; }

@media (max-width: 860px) {
  .hero, .detail { grid-template-columns: 1fr; gap: 1.8rem; }
  .row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
