:root {
  /* ciemny werniks, welin, lapis z płaszcza Maryi, złoto tylko na aureolę */
  --bg: #17120e;
  --panel: #201912;
  --panel-2: #2a2119;
  --line: #3d3127;
  --text: #efe6d2;
  --muted: #a8998a;
  --gold: #c6a052;
  --gold-2: #e0c07a;
  --lapis: #2f5597;
  --lapis-hi: #3d67b3;
  --lapis-lt: #9db8ea;
  --oxblood: #a3402f;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 500 17px/1.5 'Alegreya Sans', system-ui, sans-serif; min-height: 100dvh; }
a { color: var(--lapis-lt); text-decoration: none; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--lapis-lt); outline-offset: 2px; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* jedyna nawigacja: trzy kropki w prawym górnym rogu */
.more { position: fixed; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); z-index: 20; }
.more summary { list-style: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; color: rgba(239, 230, 210, .75); background: rgba(23, 18, 14, .35); }
.more summary::-webkit-details-marker { display: none; }
.more summary:hover, .more[open] summary { color: var(--text); background: rgba(23, 18, 14, .75); }
.sheet { position: absolute; right: 0; top: 46px; width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 12px 30px rgba(0, 0, 0, .5); overflow: hidden; }
.thumbs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.thumbs .vote { display: grid; place-items: center; height: 64px; background: none; border: 0; color: var(--text); cursor: pointer; }
.thumbs .vote + .vote { border-left: 1px solid var(--line); }
.thumbs .vote:hover { background: var(--panel-2); }
.thumbs .vote.down.on { background: var(--oxblood); color: #fff; }
.thumbs .vote.up.on { background: var(--lapis); color: #fff; }
.sheet nav { display: grid; padding: 6px 0; }
.sheet nav > a, .sheet nav > button { display: block; width: 100%; text-align: left; background: none; border: 0; cursor: pointer; color: var(--text); padding: 9px 16px; font-weight: 700; font-size: 17px; }
.sheet nav > a:hover, .sheet nav > button:hover { background: var(--panel-2); }
.sort { display: flex; gap: 4px; padding: 4px 12px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.sort a { flex: 1; text-align: center; color: var(--muted); font-weight: 700; padding: 5px 0; border-bottom: 2px solid transparent; }
.sort a:hover { color: var(--text); }
.sort a.on { color: var(--text); border-bottom-color: var(--gold); }

/* feed – sam obraz na cały ekran, przewijany jak rolki */
body.is-feed { overflow: hidden; }
.feed { height: 100dvh; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; }
.feed::-webkit-scrollbar { display: none; }
.slide { position: relative; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; display: grid; place-items: center; }
.slide .bg { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(40px) saturate(1.2); opacity: .35; pointer-events: none; }
.slide .full { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.slide.empty p { color: var(--muted); }

.toast { position: fixed; left: 50%; top: 60px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 3px; z-index: 50; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); max-width: calc(100% - 32px); text-align: center; }

/* przyciski ogólne */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 16px; border-radius: 3px; font: 700 16px 'Alegreya Sans', sans-serif; cursor: pointer; white-space: nowrap; }
.btn-quiet { background: transparent; color: var(--text); border: 1.5px solid var(--line); }
.btn-quiet:hover { border-color: var(--muted); color: var(--text); }
.btn-quiet.danger { color: #e08a7c; }
.btn-main { background: var(--lapis); color: #fff; border: 1.5px solid var(--lapis); }
.btn-main:hover { background: var(--lapis-hi); border-color: var(--lapis-hi); }
.btn-main:disabled { opacity: .5; cursor: wait; }

/* generator */
.maker, .admin, .notfound { max-width: 1100px; margin: 0 auto; padding: 60px 16px 48px; }
.maker h1 { font: 700 20px Cinzel, serif; color: var(--text); margin: 0; }
.pick { margin-bottom: 24px; }
.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
/* pasek obrazów: całe płótna w naturalnych proporcjach, przewijane w bok */
.pick-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x proximity; scrollbar-color: var(--line) transparent; }
.pick-strip button { flex: 0 0 auto; height: 150px; padding: 0; border: 0; background: none; cursor: pointer; scroll-snap-align: center; opacity: .62; transition: opacity .15s; }
.pick-strip button img { height: 100%; width: auto; display: block; border-radius: 2px; }
.pick-strip button:hover { opacity: 1; }
.pick-strip button.on { opacity: 1; outline: 3px solid var(--gold); outline-offset: 3px; }
.edit { display: grid; grid-template-columns: 340px 1fr; gap: 28px; align-items: start; }
.controls { display: grid; gap: 14px; }
.controls input { width: 100%; background: var(--panel); color: var(--text); border: 1.5px solid var(--line); border-radius: 3px; padding: 11px 13px; font: 500 17px 'Alegreya Sans', sans-serif; }
.controls input:focus { outline: none; border-color: var(--lapis-lt); }
#gen-boxes { display: grid; gap: 8px; }
.box-row { display: flex; gap: 6px; }
.box-row input { flex: 1; }
.box-row button { width: 44px; background: none; border: 1.5px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 20px; cursor: pointer; }
.box-row button:hover { color: #e08a7c; border-color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row .btn { flex: 1; }
.hint { margin: -4px 0 0; color: var(--muted); font-size: 15px; }
.actions { margin-top: 8px; }
.err { color: #e08a7c; margin: 0; }
.canvas-wrap { display: flex; justify-content: center; }
.canvas-wrap canvas { max-width: 100%; max-height: 78vh; width: auto; height: auto; display: block; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
canvas.draggable { cursor: grab; touch-action: none; }
canvas.draggable:active { cursor: grabbing; }

/* moderacja */
.admin h1, .notfound h1 { font: 700 26px Cinzel, serif; color: var(--text); }
.notfound { text-align: center; }
.mod-list { display: grid; gap: 10px; margin-bottom: 20px; }
.mod { display: grid; grid-template-columns: 110px 1fr; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 10px; align-items: center; }
.mod.rejected { opacity: .5; }
.mod img { width: 110px; height: 110px; object-fit: cover; border-radius: 2px; display: block; }
.mod small { display: block; color: var(--muted); margin: 2px 0 8px; }

@media (max-width: 760px) {
  .pick-strip button { height: 120px; }
  .edit { grid-template-columns: 1fr; }
  .canvas-wrap { order: -1; }
}

@media (prefers-reduced-motion: reduce) {
  .feed, .pick-strip { scroll-behavior: auto; }
}

/* admin */
.tabs { display: flex; gap: 20px; margin-bottom: 20px; }
.tabs a { color: var(--muted); font-weight: 700; font-size: 18px; border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--text); border-bottom-color: var(--gold); }
.add-mb { display: grid; gap: 12px; max-width: 640px; margin-bottom: 28px; }
.add-mb h1 { margin: 0; }
.add-mb .hint { margin: 0; }
.add-mb textarea { width: 100%; background: var(--panel); color: var(--text); border: 1.5px solid var(--line); border-radius: 3px; padding: 11px 13px; font: 500 16px 'Alegreya Sans', sans-serif; }
.add-mb .btn { justify-self: start; }
.log { margin: 0; padding-left: 20px; color: var(--muted); font-size: 15px; }
.log .bad { color: #e08a7c; }
.log .good { color: var(--text); font-weight: 700; }
.mb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.mb-card { margin: 0; display: grid; gap: 6px; }
.mb-card.rejected { opacity: .45; }
.mb-card img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; border-radius: 2px; }
.mb-card figcaption { color: var(--muted); font-size: 14px; display: flex; gap: 8px; }
.mb-card .btn { height: 34px; padding: 0 8px; font-size: 14px; }
