:root {
  --bg: #0d0f14;
  --bg2: #12151c;
  --panel: #171b24;
  --panel2: #1e2330;
  --line: #2a3142;
  --text: #e8eaf0;
  --muted: #9aa3b5;
  --accent: #8b7cf6;
  --accent2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(1200px 600px at 10% -10%, #1d1840 0%, transparent 60%), radial-gradient(900px 500px at 110% 10%, #0f2a33 0%, transparent 55%), var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); letter-spacing: -.02em; }
h2 { font-size: 1.45rem; margin-top: 1.8em; }
h3 { font-size: 1.1rem; }
code { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: .1em .4em; font-size: .9em; word-break: break-all; }
img { max-width: 100%; }

.wrap { width: min(1140px, 100% - 40px); margin: 0 auto; }
main.wrap { flex: 1; padding: 36px 0 64px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.narrow { max-width: 720px; }

/* Header and footer */
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(13, 15, 20, .82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 66px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 700; font-size: 1.08rem; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #0b0d12; font-weight: 900; letter-spacing: -.04em; }
.site-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.site-nav a, .link-button { color: var(--muted); padding: 8px 12px; border-radius: 8px; font: inherit; font-size: .95rem; }
.site-nav a:hover, .site-nav a.is-active, .link-button:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.link-button { background: none; border: 0; cursor: pointer; }
.inline-form { display: inline; margin: 0; }
.site-footer { border-top: 1px solid var(--line); background: var(--bg2); color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 0; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }

/* Common blocks */
.hero { padding: 34px 0 10px; max-width: 780px; }
.small-hero { padding-bottom: 0; }
.lead { font-size: 1.2rem; color: var(--muted); margin: 0 0 1em; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 2em 0 1em; }
.section-head h1, .section-head h2 { margin: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
.note { margin: 24px 0; padding: 14px 18px; border-left: 4px solid var(--warn); background: rgba(251, 191, 36, .08); border-radius: 0 10px 10px 0; color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); color: var(--muted); font-size: .8rem; font-weight: 600; vertical-align: middle; }
.chip.accent { color: #d6d0ff; border-color: rgba(139, 124, 246, .5); background: rgba(139, 124, 246, .15); }
.chip.ok { color: #a7f3d0; border-color: rgba(52, 211, 153, .45); background: rgba(52, 211, 153, .12); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.button:hover { border-color: var(--accent); text-decoration: none; }
.button.primary { background: linear-gradient(135deg, var(--accent), #6d5ce8); border-color: transparent; color: #fff; }
.button.primary:hover { filter: brightness(1.1); }
.button.danger { color: #fecaca; border-color: rgba(248, 113, 113, .5); background: rgba(248, 113, 113, .1); }
.button.big { padding: 14px 26px; font-size: 1.08rem; }
.button.small { padding: 6px 12px; font-size: .85rem; }
.button.disabled, .button:disabled { opacity: .5; cursor: not-allowed; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 4px 0; }

/* App grid */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.app-card { display: flex; gap: 16px; padding: 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); color: var(--text); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.app-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 12px 30px rgba(0, 0, 0, .35); text-decoration: none; }
.app-card h3 { margin: 0 0 4px; }
.app-card p { margin: 0 0 12px; color: var(--muted); font-size: .95rem; }
.app-icon { flex: 0 0 auto; border-radius: 16px; object-fit: cover; background: var(--panel2); border: 1px solid var(--line); }
.app-icon.md { width: 64px; height: 64px; }
.app-icon.lg { width: 112px; height: 112px; border-radius: 24px; }
.app-icon.placeholder { display: grid; place-items: center; font-weight: 800; font-size: 1.6rem; color: var(--accent); }
.app-icon.lg.placeholder { font-size: 2.8rem; }

/* App page */
.app-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; padding: 26px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; }
.app-hero h1 { margin: 0 0 4px; }
.app-hero .lead { margin-bottom: 12px; }
.download-box { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.shot { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); color: var(--muted); font: inherit; font-size: .85rem; cursor: zoom-in; text-align: left; }
.shot img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top center; background: #000; }
.shot span { padding: 0 10px 8px; }
.shot:hover { border-color: var(--accent); }
.columns { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.side-col { padding-top: 2.4em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .25em 0; }
.changelog { display: grid; gap: 14px; }
.release { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; }
.release header { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.release h3 { margin: 0; }
.release header a { margin-left: auto; }
.release .prose > :last-child { margin-bottom: 0; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; background: rgba(5, 6, 9, .94); }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lightbox img { max-width: 100%; max-height: 82vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.lightbox figcaption { color: var(--muted); }
.lightbox button { background: none; border: 0; color: var(--text); font-size: 2.6rem; cursor: pointer; opacity: .75; }
.lightbox button:hover { opacity: 1; }
.lightbox-close { position: absolute; top: 12px; right: 20px; }

/* Admin */
.admin-main h1 { font-size: 1.8rem; }
.banner { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; border: 1px solid var(--line); }
.banner.ok { border-color: rgba(52, 211, 153, .45); background: rgba(52, 211, 153, .1); }
.banner.error { border-color: rgba(248, 113, 113, .5); background: rgba(248, 113, 113, .1); }
.banner.warn { border-color: rgba(251, 191, 36, .5); background: rgba(251, 191, 36, .1); }
.login-card { max-width: 420px; margin: 40px auto; }
.form { display: grid; gap: 16px; }
.form.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.form.inline.grow { flex: 1; }
.form.inline input:not([type="file"]) { flex: 1; min-width: 180px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
.form label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.form small { font-weight: 400; }
input, select, textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: inherit; font-weight: 400; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
input[type="file"] { padding: 8px; }
textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: .92rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[readonly] { opacity: .6; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat strong { display: block; font-size: 1.7rem; }
.stat span { color: var(--muted); font-size: .9rem; }
.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; background: var(--panel2); }
.table tr:last-child td { border-bottom: 0; }
.table td.actions { justify-content: flex-end; }
.current-icon { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; color: var(--muted); }
.current-icon img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.shot-admin { display: grid; gap: 10px; margin-top: 16px; }
.shot-row { display: flex; gap: 14px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.shot-row img { width: 140px; height: 88px; object-fit: cover; border-radius: 8px; }
.progress { height: 10px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); overflow: hidden; width: 100%; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .2s ease; }
.release-admin header { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.release-admin h3 { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.release-admin.is-hidden { opacity: .6; }
.feed-info p { margin: .3em 0; }
.danger-zone { border-color: rgba(248, 113, 113, .35); }

@media (max-width: 860px) {
  .app-hero { grid-template-columns: auto 1fr; }
  .download-box { grid-column: 1 / -1; align-items: stretch; }
  .columns { grid-template-columns: 1fr; }
  .side-col { padding-top: 0; }
  .grid.two { grid-template-columns: 1fr; }
  .table thead { display: none; }
  .table td { display: block; border: 0; padding: 6px 14px; }
  .table tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
}
@media (max-width: 520px) {
  .app-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .app-hero .chips { justify-content: center; }
  .lightbox { grid-template-columns: 40px 1fr 40px; }
}
