/* PROF-TECH — light + dark, system fonts, no blur/filters (cheap to paint on phones). */
:root {
  color-scheme: light dark;
  --bg: #f3f6f4; --surface: #fff; --soft: #f6f9f7; --ink: #14261e; --muted: #5b6f65;
  --line: #dfe8e2; --line2: #c9d7ce; --brand: #12724f; --brand-h: #0d5a3e; --on-brand: #fff;
  --pale: #e3f3ea; --pale-ink: #0f5238; --signal: #d4f06b; --hero: #0e3a2a;
  --game: #e8eefb; --game-ink: #35507f; --danger: #b3363f; --danger-pale: #fdeeee;
  --focus: rgba(18,114,79,.28); --shadow: 0 1px 2px rgba(10,40,28,.06), 0 6px 18px rgba(10,40,28,.06);
  --shadow-h: 0 2px 4px rgba(10,40,28,.08), 0 14px 30px rgba(10,40,28,.12); --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09120e; --surface: #111e18; --soft: #15251d; --ink: #e6f0ea; --muted: #94a99d;
    --line: #20342a; --line2: #2d473a; --brand: #3ecf8e; --brand-h: #62dca6; --on-brand: #04170f;
    --pale: #163528; --pale-ink: #9be8c3; --hero: #0c241a; --game: #1b2a46; --game-ink: #a9c3f2;
    --danger: #ff8f97; --danger-pale: #3a1b1f; --focus: rgba(62,207,142,.35);
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-h: 0 10px 28px rgba(0,0,0,.55);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
template { display: none; }
.wrap { width: min(100% - 40px, 1120px); margin: 0 auto; }

/* Catalog */
.hero { position: relative; margin-top: 20px; padding: 40px; overflow: hidden; border-radius: var(--r);
  background: linear-gradient(135deg, var(--hero), color-mix(in srgb, var(--hero) 70%, #1c7a55)); color: #fff; }
.hero::after { content: ""; position: absolute; top: -120px; right: -80px; width: 340px; height: 340px; border-radius: 50%;
  border: 1px solid rgba(212,240,107,.3); box-shadow: 0 0 0 40px rgba(212,240,107,.05), 0 0 0 80px rgba(212,240,107,.04); pointer-events: none; }
.brand { display: flex; align-items: center; gap: 14px; position: relative; }
.logo { display: grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 12px;
  background: var(--signal); color: #0e3a2a; font-size: 1.6rem; font-weight: 800; }
h1 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.2rem); font-weight: 760; line-height: 1.2; }
h1 span { color: var(--brand); }
.hero h1 span { color: var(--signal); }
.sub { position: relative; max-width: 540px; margin: 12px 0 0; color: rgba(255,255,255,.78); }
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; margin: 0 -10px; padding: 16px 10px 10px; background: var(--bg); }
.search { flex: 1 1 260px; min-width: 0; height: 46px; padding: 0 14px 0 42px; border: 1px solid var(--line2); border-radius: 10px; color: var(--ink);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23849b8e' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='5.5'/%3E%3Cpath d='m12.5 12.5 4 4'/%3E%3C/svg%3E") 14px center no-repeat; }
.search::placeholder { color: var(--muted); }
.chips { display: flex; flex: none; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.chip { min-height: 38px; padding: 4px 16px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: .88rem; font-weight: 650; }
.chip:hover { background: var(--pale); color: var(--pale-ink); }
.chip.on, .chip.on:hover { background: var(--brand); color: var(--on-brand); }
.count { min-height: 24px; margin: 12px 0 10px; color: var(--muted); font-size: .85rem; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; padding: 0 0 64px; }
.app { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow); color: inherit; text-decoration: none;
  content-visibility: auto; contain-intrinsic-size: auto 270px; animation: rise .35s ease-out both; transition: transform .18s, box-shadow .18s, border-color .18s; }
.app:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow-h); }
.top { display: flex; align-items: center; gap: 14px; min-width: 0; }
.top > div:last-child { min-width: 0; }
.ic { display: grid; place-items: center; width: 56px; height: 56px; flex: none; overflow: hidden; border-radius: 14px; background: var(--pale); font-size: 1.6rem; }
.ic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ic.thumb { display: inline-grid; width: 32px; height: 32px; border-radius: 8px; font-size: .8rem; vertical-align: middle; }
.top h2 { margin: 0; overflow-wrap: anywhere; font-size: 1.08rem; line-height: 1.3; font-weight: 720; }
.tag { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 99px; background: var(--pale); color: var(--pale-ink); font-size: .68rem; font-weight: 750; letter-spacing: .03em; text-transform: uppercase; }
.tag.game { background: var(--game); color: var(--game-ink); }
.desc { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: .92rem; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 3px 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--soft); color: var(--muted); font-size: .76rem; }
.note { margin: 0; padding-left: 11px; border-left: 3px solid var(--brand); color: var(--muted); font-size: .85rem; }
.dl, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border: 1px solid var(--brand); border-radius: 10px;
  background: var(--brand); color: var(--on-brand); text-decoration: none; font-weight: 700; line-height: 1.3; transition: background .15s, border-color .15s, transform .1s; }
.dl { margin-top: auto; }
.dl:hover, .btn:hover { border-color: var(--brand-h); background: var(--brand-h); }
.dl:active, .btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .82rem; white-space: nowrap; }
.btn.ghost { border-color: var(--line2); background: var(--surface); color: var(--ink); }
.btn.ghost:hover { border-color: var(--brand); background: var(--soft); color: var(--brand); }
.btn.danger { border-color: transparent; background: var(--danger-pale); color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger); color: #fff; }
.app .dl.more { background: var(--pale); border-color: transparent; color: var(--pale-ink); }
.app:hover .dl.more { background: var(--brand); color: var(--on-brand); }
.empty { grid-column: 1 / -1; padding: 60px 16px; border: 1px dashed var(--line2); border-radius: var(--r); background: var(--surface); color: var(--muted); text-align: center; }
.empty b { display: block; margin-bottom: 8px; font-size: 2rem; }
.sk { height: 240px; border: 1px solid var(--line); border-radius: var(--r); background: linear-gradient(100deg, var(--surface) 30%, var(--soft) 50%, var(--surface) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
footer { padding: 22px 20px 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; text-align: center; }
footer a { color: var(--brand); text-underline-offset: 3px; }

/* Admin */
.w { width: min(100% - 40px, 840px); margin: 0 auto; padding: 32px 0 64px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.head h1 { font-size: 1.5rem; }
.c { margin-bottom: 18px; padding: 26px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
.c h3 { margin: 0 0 5px; font-size: 1.14rem; line-height: 1.35; }
label { display: block; margin: 16px 0 6px; font-size: .84rem; font-weight: 700; }
input, textarea, select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 10px; background: var(--surface); color: var(--ink); }
textarea { min-height: 80px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus, select:focus, .search:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
input[type=file] { padding: 9px; border-style: dashed; background: var(--soft); cursor: pointer; }
input[type=file]::file-selector-button { margin-right: 12px; padding: 6px 10px; border: 1px solid var(--line2); border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; }
input[type=checkbox] { width: 17px; min-height: 17px; height: 17px; margin: 0 10px 0 0; accent-color: var(--brand); }
.chk { display: flex; align-items: center; width: fit-content; margin: 18px 0 4px; font-weight: 500; cursor: pointer; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.m { color: var(--muted); font-size: .85rem; }
.msg { min-height: 1.25em; margin: 12px 0 0; }
.warn { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--line2); border-left: 4px solid var(--danger); border-radius: 10px; background: var(--danger-pale); }
.warn b { display: block; color: var(--danger); font-size: .88rem; }
.warn p { margin: 6px 0 2px; }
.warn .chk { margin: 12px 0 0; color: var(--danger); font-weight: 650; }
.r { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.r:first-child { border-top: 0; }
.r .nm { min-width: 0; overflow-wrap: anywhere; line-height: 1.6; }
.r .acts { display: flex; flex: none; gap: 8px; }
.bar-p { display: none; height: 8px; overflow: hidden; margin-top: 16px; border-radius: 99px; background: var(--pale); }
.bar-p i { display: block; width: 0; height: 100%; background: var(--brand); transition: width .2s; }
.login { max-width: 420px; margin: min(13vh, 100px) auto 0; }
.login .btn { width: 100%; margin-top: 20px; }

/* Detail */
.back { display: inline-flex; align-items: center; gap: 6px; margin: 24px 0 0; color: var(--muted); font-size: .9rem; font-weight: 650; text-decoration: none; }
.back:hover { color: var(--brand); }
.detail { max-width: 820px; margin: 16px auto 64px; padding: 32px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); animation: rise .35s ease-out both; }
.detail .top { gap: 18px; }
.detail .ic { width: 88px; height: 88px; border-radius: 20px; font-size: 2.6rem; }
.detail h1 { overflow-wrap: anywhere; font-size: clamp(1.4rem, 4vw, 1.9rem); }
.detail h3 { margin: 26px 0 8px; color: var(--muted); font-size: .76rem; letter-spacing: .05em; text-transform: uppercase; }
.detail .meta { margin-top: 18px; }
.detail .full { margin: 0; overflow-wrap: anywhere; white-space: pre-line; font-size: 1rem; }
.detail .note { font-size: .92rem; }
.detail .dl { width: 100%; min-height: 54px; margin-top: 28px; font-size: 1.05rem; }
.hint { margin: 12px 0 0; color: var(--muted); font-size: .82rem; text-align: center; }
.gen { display: grid; place-items: center; width: 100%; height: 100%; color: #fff; font-size: 1.15em; font-weight: 800; }

@media (max-width: 600px) {
  .wrap, .w { width: min(100% - 28px, 1120px); }
  .hero { margin-top: 14px; padding: 28px 22px; }
  .bar { flex-wrap: wrap; margin: 0 -6px; padding: 12px 6px 8px; }
  .search { flex-basis: 100%; }
  .chips { width: 100%; }
  .chip { flex: 1; }
  .grid { gap: 12px; padding-bottom: 44px; }
  .app { padding: 18px; }
  .c { padding: 18px; }
  .head h1 { font-size: 1.25rem; }
  .row { grid-template-columns: 1fr; gap: 0; }
  .r { align-items: flex-start; flex-direction: column; gap: 12px; }
  .r .acts { width: 100%; flex-wrap: wrap; }
  .login { margin-top: 10vh; }
  .detail { padding: 22px; }
  .detail .ic { width: 68px; height: 68px; font-size: 2.1rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Admin v2 */
.logo.sm { width: 38px; height: 38px; font-size: 1.15rem; border-radius: 10px; }
.head h1 small { color: var(--muted); font-size: .55em; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.sec { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.search.sm { flex: 0 1 200px; height: 38px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stats div { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.stats b { display: block; font-size: 1.4rem; line-height: 1.2; }
.stats small, .vbox small { color: var(--muted); font-size: .76rem; }
.step { display: flex; align-items: center; gap: 10px; margin: 28px 0 4px; padding-top: 20px; border-top: 1px solid var(--line); font-weight: 750; }
.step:first-of-type { border-top: 0; padding-top: 0; margin-top: 18px; }
.step span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: var(--on-brand); font-size: .78rem; }
.dz { display: grid; gap: 4px; margin: 10px 0 0; padding: 26px 16px; border: 2px dashed var(--line2); border-radius: var(--r); background: var(--soft); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dz:hover, .dz.over { border-color: var(--brand); background: var(--pale); }
.dz.has { border-style: solid; border-color: var(--brand); }
.dz b { overflow-wrap: anywhere; } .dz small { color: var(--muted); }
.vbox { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.vbox div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.vbox b { display: block; overflow-wrap: anywhere; }
.actions { display: flex; gap: 10px; margin-top: 20px; }
.actions .btn:first-child { flex: 1; }
.r.sel { margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 10px; background: var(--pale); }
.tag.force { background: var(--danger-pale); color: var(--danger); }
.r .nm a { color: var(--brand); }
code { padding: 1px 5px; border-radius: 4px; background: var(--soft); font-size: .88em; }
.md h4 { margin: 22px 0 6px; font-size: 1.05rem; }
.md h4:first-child { margin-top: 0; }
.md p { margin: 0 0 8px; overflow-wrap: anywhere; }
.md ul { margin: 0 0 8px; padding-left: 20px; }
.md li { margin: 3px 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .stats { grid-template-columns: repeat(2, 1fr); } .vbox { grid-template-columns: 1fr; } .sec { flex-wrap: wrap; } .search.sm { flex-basis: 100%; } .actions { flex-direction: column; } }
