/* Design tokens taken from lsft.ru */
:root {
  --bg: #000;
  --surface2: #111;
  --border: #222;
  --border2: #383838;
  --text: #f0f0ed;
  --text2: #8a8a86;
  --text3: #555552;
  --accent: #3b82f6;
  --accent-inv: #fff;
  --red: #dc2626;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); }
body {
  color: var(--text);
  font: 400 16px/1.4 Geologica, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}
body.center { display: grid; place-items: center; }
button { font: inherit; }
p { margin: 0; }

.h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.64px; line-height: 1.1; margin: 0; }
.title { font-size: 20px; font-weight: 800; letter-spacing: -0.2px; margin: 0 0 6px; }
.sub { font-size: 15px; font-weight: 800; margin: 34px 0 12px; }
.muted { color: var(--text2); font-size: 15px; }
.error { color: var(--red); font-size: 14px; font-weight: 500; }
.link { background: none; border: 0; padding: 8px 0; color: var(--text2); font-size: 15px; font-weight: 500;
  text-decoration: none; cursor: pointer; }
.link:hover { color: var(--text); }
.link.danger { color: var(--red); }

/* forms: no cards, content sits right on the background */
.form { width: 100%; max-width: 460px; padding: 18px 20px 28px; display: flex; flex-direction: column; gap: 12px; }
.inp { font: inherit; font-size: 15px; font-weight: 600; height: 48px; padding: 0 18px; width: 100%;
  background: var(--surface2); color: var(--text); border: 1.3px solid transparent; border-radius: 16px; outline: none; }
.inp::placeholder { color: var(--text3); }
.inp:focus { border-color: var(--accent); }
.inp.code { text-align: center; letter-spacing: .12em; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px;
  border-radius: 999px; border: 0.7px solid var(--border2); background: transparent; color: var(--text);
  font-size: 15px; font-weight: 500; text-decoration: none; cursor: pointer; user-select: none; width: 100%;
  transition: transform .08s ease, opacity .15s, background-color .15s; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-inv); font-weight: 700; }
.btn.pri:hover { background: #2f74e8; }
.btn.out:hover { background: var(--surface2); }
.btn.big { height: 50px; font-size: 16px; }

.foot { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 18px;
  color: var(--text2); font-size: 15px; font-weight: 800; }
.foot svg { width: 17px; height: 17px; }

/* ---------- admin ---------- */
.page { max-width: 460px; margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 20px 32px; }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.hint { text-align: center; margin-top: 10px; font-size: 14px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 14px; padding: 10px 0; cursor: pointer; }
.list li + li { border-top: 1px solid var(--border); }
.list img, .list .ph { width: 52px; height: 52px; border-radius: var(--radius); object-fit: cover; background: var(--surface2); flex: none; }
.list .meta { flex: 1; min-width: 0; }
.list .code { font-weight: 700; letter-spacing: .04em; }
.list .sub { font-size: 14px; color: var(--text2); margin: 0; font-weight: 400; }
.list .chev { color: var(--text3); font-size: 22px; }

.share { position: fixed; inset: 0; background: var(--bg); z-index: 10; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); }
.share[hidden] { display: none; }
.share-top { width: 100%; max-width: 460px; display: flex; justify-content: space-between; }
.qr { background: #fff; border-radius: 20px; padding: 6px; margin-top: 10px; width: min(86vw, 54vh, 420px); aspect-ratio: 1; }
.qr svg { width: 100%; height: 100%; display: block; shape-rendering: crispEdges; }
.short { margin-top: 16px; font-size: 18px; font-weight: 700; letter-spacing: -0.2px; text-align: center; word-break: break-all; }
.progress { width: 100%; max-width: 420px; margin-top: 14px; text-align: center; }
.progress .muted { font-size: 14px; }
.progress-bar { height: 4px; background: var(--surface2); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress.done .progress-bar { display: none; }
.thumbs { width: 100%; max-width: 460px; display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 6px; margin-top: 16px; }
.thumbs div { aspect-ratio: 1; border-radius: 10px; background: var(--surface2) center/cover no-repeat; }
.thumbs div.pending { opacity: .35; }
.thumbs div.fail { outline: 2px solid var(--red); }
.share-actions { width: 100%; max-width: 460px; display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px;
  margin-top: auto; padding-top: 20px; }

/* ---------- gallery ---------- */
.gallery { max-width: 1100px; }
.g-head { text-align: center; margin: 14px 0 22px; }
.g-head .muted { margin-top: 8px; }
.g-actions { max-width: 420px; margin: 0 auto 24px; display: flex; flex-direction: column; gap: 8px; }
.g-actions .hint { text-align: center; font-size: 13px; margin: 0; }
.v-bottom .btn { min-width: 130px; }
.waiting { text-align: center; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 10px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.tile { aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; background: var(--surface2);
  cursor: zoom-in; border: 0; padding: 0; display: block; width: 100%; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s; }
.tile img.loaded { opacity: 1; }
.tile .noprev { display: grid; place-items: center; height: 100%; color: var(--text2); font-size: 14px; }

.viewer { position: fixed; inset: 0; background: #000; z-index: 20; display: flex;
  align-items: center; justify-content: center; touch-action: pan-y; }
.viewer[hidden] { display: none; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; }
.v-close, .v-nav { background: rgba(255,255,255,.1); color: #fff; border: 0; width: 44px; height: 44px;
  border-radius: 50%; font-size: 18px; cursor: pointer; z-index: 2; }
.v-close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; }
.v-nav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 28px; line-height: 1; }
.v-prev { left: 12px; } .v-next { right: 12px; }
@media (hover: none) { .v-nav { display: none; } }
.v-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between;
  align-items: center; gap: 16px; padding: 16px 20px max(20px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.v-bottom .btn { width: auto; min-width: 150px; }
.v-pos { color: var(--text2); font-size: 15px; font-weight: 500; }

.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--surface2); color: var(--text); border: 0.7px solid var(--border2); padding: 12px 18px;
  border-radius: 999px; font-size: 15px; font-weight: 500; z-index: 50; max-width: calc(100% - 32px); text-align: center; }
