/* ============================================================
   qeytil — tiny app store
   cartoon / blocky / minecraft-ish theme, mobile-first
   palette: sky blue • white • black • orange
   tuned for LOW-END devices: no infinite animations,
   solid shadows only (zero blur), tiny DOM updates
   ============================================================ */

:root {
  --ink: #14141c;
  --ink-soft: rgba(20, 20, 28, 0.25);
  --paper: #ffffff;
  --paper-2: #eef6fd;
  --sky: #a5e0ff;
  --sky-deep: #7ccdf8;
  --sky-tint: #e3f3ff;
  --orange: #ff8b2c;
  --orange-dark: #d3690e;
  --orange-soft: #ffe1c2;
  --night: #16161f;
  --muted: #3d5a75;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Chakra Petch", "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.5;
  letter-spacing: .2px;
  color: var(--ink);
  background: var(--sky);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.14) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 2px, transparent 2px);
  background-size: 28px 28px;
}

img, svg { display: block; max-width: 100%; }

h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0; }
a { color: inherit; }

/* ---------- pixel clouds (static: zero CPU cost) ---------- */
.clouds { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.cloud { position: absolute; width: 46px; height: 14px; background: #fff; opacity: .85; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; }
.cloud::before { width: 22px; height: 10px; left: 8px; top: -9px; }
.cloud::after  { width: 10px; height: 16px; left: 26px; top: -15px; }
.cloud.c1 { top: 12%; left: 6%; }
.cloud.c2 { top: 24%; left: 62%; transform: scale(1.4); }
.cloud.c3 { top: 55%; left: 80%; transform: scale(.8); }
.cloud.c4 { top: 70%; left: 4%; transform: scale(1.1); }

/* ---------- layout ---------- */
.wrap { position: relative; z-index: 1; width: min(1060px, 100%); margin-inline: auto; padding-inline: 14px; }

main.wrap { padding-top: 18px; padding-bottom: 48px; min-height: 70vh; }

.view { display: none; }
.view.active { display: block; animation: pop-in .15s ease-out; }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- panels ---------- */
.panel {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 6px 0 var(--ink-soft);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 1rem; font-weight: 700;
  color: var(--ink); text-decoration: none;
  padding: 10px 18px;
  background: var(--paper-2);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  transition: transform .05s ease, box-shadow .05s ease;
  user-select: none;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.orange { background: var(--orange); color: #fff; text-shadow: 1px 1px 0 rgba(0,0,0,.35); }
.btn.blue { background: var(--sky-deep); }
.btn.big { font-size: 1.25rem; padding: 14px 26px; width: 100%; }

/* ============================================================
   HEADER
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--orange);
  border-bottom: 3px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink-soft);
}
.topbar::after {
  /* texture strip */
  content: "";
  display: block; height: 4px;
  background:
    repeating-linear-gradient(90deg,
      transparent 0 10px, rgba(255,255,255,.28) 10px 14px),
    var(--orange-dark);
}
.topbar-inner {
  width: min(1060px, 100%); margin-inline: auto; padding: 6px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.brand {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
}
.brand .logo-rat { width: 32px; height: 32px; filter: drop-shadow(1px 1px 0 rgba(0,0,0,.25)); }
.brand-name {
  font-size: 1.3rem; font-weight: 700; letter-spacing: 1px;
  color: #fff;
  text-shadow: 1px 1px 0 var(--orange-dark), 2px 2px 0 rgba(0,0,0,.18);
}

/* hamburger menu */
.menu-wrap { position: relative; }
.menu-btn {
  width: 40px; height: 40px; padding: 8px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 8px;
  box-shadow: 0 2px 0 var(--ink);
  cursor: pointer; display: flex; flex-direction: column; justify-content: center; gap: 4px;
  transition: transform .05s ease, box-shadow .05s ease;
}
.menu-btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--ink); }
.menu-btn span {
  display: block; width: 100%; height: 3px; background: var(--ink); border-radius: 2px;
  transition: transform .15s ease, opacity .15s ease;
}
.menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn.open span:nth-child(2) { opacity: 0; }
.menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* dropdown */
.menu-dd {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 160px; background: var(--paper); border: 3px solid var(--ink);
  border-radius: 10px; box-shadow: 0 4px 0 var(--ink-soft);
  padding: 6px; z-index: 100;
  flex-direction: column; gap: 2px;
}
.menu-dd.show { display: flex; }
.menu-link {
  display: block; font-family: inherit; font-size: .92rem; font-weight: 700;
  color: var(--ink); text-decoration: none; padding: 8px 12px;
  border-radius: 7px; transition: background .1s ease;
}
.menu-link:hover { background: var(--orange-soft); }
.menu-link:active { background: var(--orange); color: #fff; }
.menu-link.active { background: var(--orange); color: #fff; }

/* header right group + tiny language toggle */
.header-right { display: flex; align-items: center; gap: 6px; }
.lang-toggle {
  display: inline-flex;
  background: var(--paper);
  border: 3px solid var(--ink); border-radius: 9px;
  overflow: hidden;
  box-shadow: 0 3px 0 var(--ink);
}
.lang-btn {
  font-family: inherit; font-size: .82rem; font-weight: 700;
  color: var(--ink); background: transparent;
  border: 0; padding: 6px 10px; cursor: pointer;
}
.lang-btn + .lang-btn { border-left: 3px solid var(--ink); }
.lang-btn.active { background: var(--orange); color: #fff; }
.lang-btn:not(.active):hover { background: var(--orange-soft); }
.lang-btn:not(.active):active { background: var(--orange); color: #fff; }

/* ============================================================
   HOME — hero
   ============================================================ */
.hero { margin-top: 18px; padding: 20px; display: flex; align-items: center; gap: 16px; overflow: hidden; position: relative; }
.hero-rat { flex: 0 0 auto; width: 118px; height: 118px; }
.hero-copy h1 { font-size: clamp(1.7rem, 6vw, 2.6rem); }
.hero-copy p { margin-top: 8px; font-size: 1.05rem; color: var(--muted); font-weight: 600; }
.hero-badges { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.badge {
  font-size: .8rem; font-weight: 700;
  background: var(--sky-tint); border: 2px solid var(--ink); border-radius: 7px;
  padding: 3px 8px;
}

/* orange divider under hero */
.accent-strip {
  height: 14px; margin-top: 18px; border-radius: 7px;
  border: 3px solid var(--ink);
  background:
    repeating-linear-gradient(90deg, transparent 0 12px, rgba(255,255,255,.3) 12px 18px),
    linear-gradient(var(--orange) 55%, var(--orange-dark) 55%);
}

/* ============================================================
   HOME — search + chips
   ============================================================ */
.toolbar { margin-top: 18px; display: grid; gap: 10px; }
.search-box { display: flex; gap: 8px; }
.search-box input {
  flex: 1; min-width: 0;
  font-family: inherit; font-size: 1.05rem; color: var(--ink);
  padding: 11px 14px;
  background: #fff;
  border: 3px solid var(--ink); border-radius: 10px;
  outline: none;
  box-shadow: inset 0 3px 0 rgba(0,0,0,.07), 0 4px 0 var(--ink-soft);
}
.search-box input:focus { background: var(--sky-tint); }
.search-box input::placeholder { color: rgba(20,20,28,.45); }
.search-btn { padding: 0 16px; font-size: 1.1rem; }

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip {
  flex: 0 0 auto;
  font-family: inherit; font-size: .92rem; font-weight: 700;
  color: var(--ink);
  background: var(--paper); border: 3px solid var(--ink); border-radius: 999px;
  padding: 5px 14px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.chip.active { background: var(--orange); color: #fff; transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.chip:not(.active):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

/* ============================================================
   HOME — app cards grid
   ============================================================ */
.grid { margin-top: 18px; display: grid; gap: 16px; grid-template-columns: 1fr; }

.card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--paper);
  border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: 0 5px 0 var(--ink-soft);
  cursor: pointer;
  transition: transform .07s ease, box-shadow .07s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 0 var(--ink-soft); }
.card:active { transform: translateY(1px); box-shadow: 0 3px 0 var(--ink-soft); }

.card-icon { flex: 0 0 auto; width: 64px; height: 64px; border-radius: 14px; overflow: hidden; border: 3px solid var(--ink); }
.card-icon svg { width: 100%; height: 100%; image-rendering: pixelated; }

.card-body { flex: 1; min-width: 0; }
.card-title { font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-desc {
  margin-top: 3px; font-size: .9rem; color: var(--muted); font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.tag {
  font-size: .72rem; font-weight: 700;
  border: 2px solid var(--ink); border-radius: 6px;
  padding: 1px 7px;
  background: var(--paper-2);
}
.tag.cat { background: var(--orange-soft); }
.tag.ver { background: var(--paper-2); }
.tag.dl  { background: var(--sky-tint); }

.get-btn { flex: 0 0 auto; }

.empty {
  margin-top: 26px; text-align: center;
  display: grid; justify-items: center; gap: 8px;
  color: var(--muted); font-weight: 700;
}
.empty .rat-slot { width: 110px; height: 110px; }

/* production launch state: empty catalog */
.coming-soon {
  margin-top: 22px; padding: 34px 22px;
  text-align: center;
  display: grid; justify-items: center; gap: 12px;
}
.coming-soon[hidden] { display: none; }
.coming-soon .soon-rat { width: 128px; height: 128px; }
.coming-soon h2 { font-size: clamp(1.4rem, 6vw, 2rem); }
.coming-soon p { color: var(--muted); font-weight: 600; max-width: 420px; }
.coming-soon .btn { margin-top: 6px; }

/* ============================================================
   APP DETAIL SCREEN
   ============================================================ */
.back-row { margin-top: 16px; }

.app-hero { margin-top: 12px; padding: 18px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.app-head { display: flex; align-items: center; gap: 14px; text-align: left; }
.app-icon { width: 84px; height: 84px; flex: 0 0 auto; border-radius: 18px; overflow: hidden; border: 3px solid var(--ink); }
.app-title { font-size: clamp(1.4rem, 5.5vw, 2rem); }
.app-dev-row { margin-top: 4px; }
.dev-tag { background: var(--sky-tint); font-size: .82rem; }
.official { background: var(--orange); color: #fff; font-size: .82rem; }
.v-tick {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; line-height: 1;
  background: #7ccdf8; color: #fff; border-radius: 50%;
  font-size: .7rem; font-weight: 800;
  box-shadow: 0 1px 0 var(--ink);
  vertical-align: middle;
}
.official .v-tick, .vt-orange { background: var(--orange); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.dl-btn { margin-top: 2px; max-width: 380px; }
.tag.updated { background: var(--night); color: var(--sky); font-size: .72rem; }
.dl-soon {
  background: var(--paper-2);
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: 0 4px 0 var(--ink-soft);
}

.shots-wrap { margin-top: 16px; }
.shots { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: thin; }
.shot {
  flex: 0 0 auto; width: min(240px, 72vw);
  border: 3px solid var(--ink); border-radius: 10px; overflow: hidden;
  background: #fff; box-shadow: 0 4px 0 var(--ink-soft);
}
.shot svg { width: 100%; height: auto; }

.section-block { margin-top: 16px; padding: 16px 18px; }
.update-note { border-left: 4px solid var(--orange); background: var(--orange-soft); }
.section-title {
  font-size: 1.15rem; margin-bottom: 8px;
  display: inline-block; background: var(--orange); color: #fff;
  text-shadow: 1px 1px 0 rgba(0,0,0,.35);
  border: 3px solid var(--ink); border-radius: 8px; padding: 2px 10px;
  box-shadow: 0 3px 0 var(--ink);
}
.section-block p { font-weight: 500; color: #343a44; }

.privacy-mini { display: flex; gap: 12px; align-items: center; }
.privacy-mini .rat-slot { flex: 0 0 auto; width: 74px; height: 74px; }

/* --- install guide --- */
.install-guide { margin-top: 16px; padding: 16px 18px; text-align: center; }
.install-note { font-weight: 600; color: var(--muted); margin-bottom: 12px; font-size: .95rem; }
.install-img {
  width: 100%; max-width: 520px; border-radius: 12px;
  border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink-soft);
}
.privacy-mini a { font-weight: 700; color: var(--orange-dark); }

/* ============================================================
   CONTACT
   ============================================================ */
.page-panel { margin-top: 18px; padding: 20px 18px; }
.page-head { display: flex; align-items: center; gap: 14px; }
.page-head .rat-slot { flex: 0 0 auto; width: 92px; height: 92px; }
.page-head h1 { font-size: clamp(1.5rem, 6vw, 2.2rem); }
.page-sub { margin-top: 4px; color: var(--muted); font-weight: 600; }

.form { margin-top: 18px; display: grid; gap: 14px; max-width: 520px; }
.field { display: grid; gap: 5px; }
.field label { font-weight: 700; font-size: .95rem; }
.field input, .field textarea {
  font-family: inherit; font-size: 1rem; color: var(--ink);
  padding: 10px 12px; background: #fff;
  border: 3px solid var(--ink); border-radius: 9px; outline: none;
  box-shadow: inset 0 3px 0 rgba(0,0,0,.06);
}
.field input:focus, .field textarea:focus { background: var(--sky-tint); }
.field textarea { resize: vertical; min-height: 120px; }
.form-note { font-size: .82rem; color: var(--muted); }

.success-box {
  margin-top: 18px; padding: 18px; display: none;
  align-items: center; gap: 14px;
  background: #fff4e6; border: 3px dashed var(--orange-dark); border-radius: var(--radius);
}
.success-box.show { display: flex; }
.success-box .rat-slot { flex: 0 0 auto; width: 78px; height: 78px; }

/* ============================================================
   PRIVACY
   ============================================================ */
.policy-card { margin-top: 18px; padding: 18px; }
.policy-list { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.policy-list li {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--paper-2); border: 3px solid var(--ink); border-radius: 9px;
  padding: 10px 12px; font-weight: 500;
}
.policy-list .tick {
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: 1px;
  background: var(--orange); border: 2px solid var(--ink); border-radius: 6px;
  color: #fff; font-weight: 700; display: grid; place-items: center;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer { margin-top: 30px; background: var(--night); border-top: 4px solid #000; position: relative; z-index: 1; }
.footer-accent {
  height: 12px;
  background:
    repeating-linear-gradient(90deg, transparent 0 12px, rgba(255,255,255,.28) 12px 17px),
    var(--orange);
  border-bottom: 3px solid #000;
}
.footer-inner {
  width: min(1060px, 100%); margin-inline: auto; padding: 18px 14px 26px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  color: #eef6fd;
}
.footer-rat { width: 64px; height: 64px; flex: 0 0 auto; }
.footer-links { display: flex; gap: 12px; flex-wrap: wrap; }
.footer-links a { color: #fff; font-weight: 700; text-decoration: none; }
.footer-copy { width: 100%; font-size: .85rem; opacity: .85; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed; z-index: 99; left: 50%; bottom: 18px;
  transform: translateX(-50%) translateY(20px);
  display: flex; align-items: center; gap: 10px;
  max-width: min(420px, 92vw);
  background: var(--night); color: #fff;
  border: 3px solid #000; border-radius: 12px;
  padding: 10px 16px; font-weight: 700;
  box-shadow: 0 5px 0 rgba(0,0,0,.3);
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .rat-face { width: 36px; height: 36px; flex: 0 0 auto; }

/* ============================================================
   DEVELOPER PORTAL / ADMIN
   ============================================================ */
.dev-panel h1 { font-size: clamp(1.4rem, 5.5vw, 2rem); }
.pass-row { display: flex; gap: 8px; align-items: stretch; }
.pass-row input { flex: 1; min-width: 0; }
.pass-row .mini-btn { display: grid; place-items: center; font-size: 1rem; }
.dev-form { max-width: 640px; }
.dev-form input, .dev-form select, .dev-form textarea,
.inline-form input, .inline-form select {
  font-family: inherit; font-size: 1rem; color: var(--ink);
  padding: 10px 12px; background: #fff;
  border: 3px solid var(--ink); border-radius: 9px; outline: none;
  box-shadow: inset 0 3px 0 rgba(0,0,0,.06);
}
.dev-form input:focus, .dev-form select:focus, .dev-form textarea:focus { background: var(--sky-tint); }
.dev-form input:disabled { background: var(--paper-2); color: var(--muted); cursor: not-allowed; }
.dev-form textarea { resize: vertical; min-height: 110px; }

.form-error { min-height: 20px; color: var(--orange-dark); font-weight: 700; }
.hint { display: block; margin-top: 4px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.small { font-size: .82rem; color: var(--muted); font-weight: 600; }

.dev-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 14px; }
.dev-table { width: 100%; min-width: 520px; border-collapse: collapse; }
.dev-table th { text-align: left; font-size: .8rem; padding: 6px 8px; border-bottom: 3px solid var(--ink); white-space: nowrap; }
.dev-table td { padding: 8px; border-bottom: 2px solid var(--ink-soft); font-weight: 500; vertical-align: middle; }
.row-icon { width: 36px; height: 36px; object-fit: cover; border: 2px solid var(--ink); border-radius: 7px; vertical-align: middle; margin-right: 6px; background: #fff; }

.tag.pend { background: var(--orange-soft); }
.tag.live { background: var(--sky-tint); }
.tag.rej  { background: var(--night); color: #fff; }

.mini-btn {
  font-family: inherit; font-weight: 700; font-size: .85rem; cursor: pointer;
  color: var(--ink); background: var(--paper);
  border: 3px solid var(--ink); border-radius: 8px; padding: 5px 10px;
  box-shadow: 0 2px 0 var(--ink); text-decoration: none;
}
.mini-btn:active { transform: translateY(2px); box-shadow: none; }
.mini-btn.ok { background: var(--orange); color: #fff; }
.mini-btn.danger { background: var(--night); color: #fff; }

.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-grid { display: grid; gap: 22px; grid-template-columns: 1fr; }
.profile-list { list-style: none; padding: 0; display: grid; gap: 6px; margin: 0 0 12px; }
.profile-list li { background: var(--paper-2); border: 3px solid var(--ink); border-radius: 9px; padding: 8px 10px; font-size: .92rem; word-break: break-all; }

.icon-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.up-icon { width: 64px; height: 64px; border-radius: 12px; border: 3px solid var(--ink); object-fit: cover; background: #fff; }
.up-status { font-size: .8rem; font-weight: 700; color: var(--muted); }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label { font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }

.shot-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.shot-thumb { position: relative; margin: 0; }
.shot-thumb img { width: 96px; height: 64px; object-fit: cover; border: 2px solid var(--ink); border-radius: 7px; display: block; background: #fff; }
.shot-x {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px;
  background: var(--night); color: #fff; border: 2px solid var(--ink); border-radius: 7px;
  font-weight: 700; line-height: 1; cursor: pointer;
}

.mod-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--paper-2); border: 3px solid var(--ink); border-radius: 11px;
  padding: 10px; margin-top: 12px;
}
.mod-icon { width: 52px; height: 52px; object-fit: cover; border: 3px solid var(--ink); border-radius: 10px; flex: 0 0 auto; background: #fff; }
.mod-body { flex: 1; min-width: 0; }
.mod-actions { display: grid; gap: 6px; align-content: start; }
.mod-reason input { width: 100%; margin-top: 6px; }
.rej-note { display: block; color: var(--orange-dark); font-weight: 700; font-size: .85rem; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.inline-form input, .inline-form select { flex: 1 1 140px; min-width: 0; }
.adm-tabs { margin: 14px 0 4px; }

.dev-empty { text-align: center; color: var(--muted); font-weight: 700; padding: 18px 0; }
.dev-loading { text-align: center; color: var(--muted); font-weight: 700; padding: 40px 0; }
.build-tag { margin-top: 14px; text-align: center; font-size: .75rem; color: var(--muted); opacity: .8; }

/* ============================================================
   RESPONSIVE (mobile-first upgrades)
   ============================================================ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.loading-spinner {
  display: inline-block;
  width: 28px; height: 28px;
  border: 4px solid var(--ink-soft);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 60px 20px;
  color: var(--muted);
  font-weight: 700;
  animation: fade-in .2s ease;
}
.loading-screen .loading-spinner {
  width: 36px; height: 36px;
  border-width: 5px;
}
.view.active {
  animation: slide-up .2s ease-out;
}
.btn { transition: transform .08s ease, box-shadow .08s ease, opacity .15s ease; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.loading { pointer-events: none; opacity: .7; }
.btn.loading::after {
  content: "";
  display: inline-block;
  width: 16px; height: 16px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .5s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}
.card { transition: transform .1s ease, box-shadow .1s ease; }

/* PWA install popup */
.install-popup {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--night); color: #fff;
  padding: 16px 18px; z-index: 900;
  box-shadow: 0 -3px 0 var(--ink);
  display: flex; align-items: center; gap: 12px;
  transform: translateY(100%);
  transition: transform .25s ease;
}
.install-popup.show { transform: translateY(0); }
.install-popup .install-msg { flex: 1; font-size: .88rem; line-height: 1.35; }
.install-popup .install-msg strong { display: block; font-size: 1rem; margin-bottom: 2px; }
.install-popup .install-actions { display: flex; gap: 8px; flex-shrink: 0; }
.install-popup .btn-install {
  background: var(--orange); color: #fff; border: none; border-radius: 8px;
  padding: 10px 18px; font-size: .88rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 0 var(--ink); font-family: inherit;
}
.install-popup .btn-dismiss {
  background: transparent; color: var(--sky); border: none;
  font-size: .82rem; cursor: pointer; padding: 10px 8px; font-family: inherit;
}

@media (min-width: 640px) {
  body { font-size: 19px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 26px; }
  .app-hero { justify-items: start; text-align: left; }
  .dash-grid { grid-template-columns: 1.8fr 1fr; }
  /* desktop: normal flex button layouts */
  .dash-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .dash-actions .btn { flex: 1 1 auto; min-width: 0; border-radius: 10px; font-size: 1rem; padding: 10px 18px; }
  .dash-actions .btn:first-child { grid-column: auto; }
  .dash-actions .btn:nth-child(2),
  .dash-actions .btn:nth-child(3),
  .dash-actions .btn:last-child { border-radius: 10px; }
  .adm-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
  .adm-tabs .mini-btn { flex: 1 1 auto; min-width: 0; border-radius: 8px; padding: 8px 10px; font-size: .82rem; }
}

@media (min-width: 960px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .toolbar { grid-template-columns: 1fr auto; align-items: center; }
  .chip-row { justify-content: flex-end; }
  .brand-name { font-size: 2rem; }
  .shots::-webkit-scrollbar { height: 10px; }
  .shots::-webkit-scrollbar-thumb { background: var(--ink); border-radius: 6px; }
  .shots::-webkit-scrollbar-track { background: var(--paper-2); }
}

/* --- mobile touch targets (44px minimum) --- */
.btn, .mini-btn, .menu-link, .chip, .lang-btn, .modal-btn, .footer-links a {
  min-height: 44px;
  min-width: 44px;
}
.pass-row .mini-btn { min-height: 44px; min-width: 44px; }
.dev-form input, .dev-form select, .dev-form textarea,
.inline-form input, .inline-form select,
.field input, .field textarea {
  min-height: 44px;
}
.own-card input { min-height: 44px; }
.own-btn { min-height: 48px; }

/* --- focus-visible for keyboard / switch users --- */
.btn:focus-visible, .mini-btn:focus-visible, .menu-link:focus-visible,
.chip:focus-visible, .lang-btn:focus-visible, .modal-btn:focus-visible,
.own-btn:focus-visible, .footer-links a:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

/* --- admin tabs: fun pill buttons on mobile --- */
.adm-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0 4px;
}
.adm-tabs .mini-btn {
  flex: none;
  min-width: 0;
  text-align: center;
  padding: 12px 6px;
  font-size: .85rem;
  border-radius: 12px;
  min-height: 44px;
}
.adm-tabs .mini-btn:nth-child(1) { border-radius: 14px 6px 6px 6px; }
.adm-tabs .mini-btn:nth-child(2) { border-radius: 6px 14px 6px 6px; }
.adm-tabs .mini-btn:nth-child(3) { border-radius: 6px 6px 6px 14px; }
.adm-tabs .mini-btn:nth-child(4) { border-radius: 6px 6px 14px 6px; }

/* --- chat box: proper scrolling and padding --- */
#chat-box {
  max-height: 400px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 3px solid var(--ink);
  border-radius: 10px;
  padding: 10px;
  margin: 12px 0;
  background: #fff;
}
.chat-send-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.chat-msg-input {
  flex: 1;
  min-width: 0;
}

/* --- chat bubbles mobile --- */
.chat-bubble {
  margin-bottom: 8px;
  max-width: 85%;
}
.chat-bubble.mine { margin-left: auto; text-align: right; }
.chat-bubble.theirs { margin-right: auto; }
.chat-bubble-inner {
  display: inline-block;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  word-break: break-word;
}
.chat-bubble.mine .chat-bubble-inner { background: var(--orange); color: #fff; }
.chat-bubble.theirs .chat-bubble-inner { background: var(--paper-2); border: 3px solid var(--ink); }
.chat-ts { font-size: .72rem; opacity: .7; margin-top: 4px; }

/* --- color input mobile sizing --- */
input[type="color"] {
  min-height: 44px;
  min-width: 60px;
  padding: 4px;
  cursor: pointer;
}

/* --- hero: prevent overflow on tiny screens --- */
.hero {
  overflow: hidden;
}
.hero-rat {
  flex-shrink: 0;
}

/* --- mod-card: stack on very small screens --- */
@media (max-width: 400px) {
  .mod-card { flex-direction: column; }
  .mod-actions { width: 100%; }
}

/* --- inline-form: stack on mobile --- */
@media (max-width: 480px) {
  .inline-form { flex-direction: column; }
  .inline-form input, .inline-form select { width: 100%; }
}

/* --- dash-actions: fun 2-column grid on mobile --- */
.dash-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.dash-actions .btn {
  text-align: center;
  justify-content: center;
  border-radius: 14px;
  font-size: .92rem;
  padding: 12px 8px;
}
.dash-actions .btn:first-child {
  grid-column: 1 / -1;
  font-size: 1.05rem;
  padding: 14px 12px;
}
.dash-actions .btn:nth-child(2) { border-radius: 14px 6px 6px 14px; }
.dash-actions .btn:nth-child(3) { border-radius: 6px 14px 14px 6px; }
.dash-actions .btn:last-child { border-radius: 14px 14px 6px 6px; }

/* --- prevent body horizontal overflow --- */
html, body {
  overflow-x: hidden;
}

/* --- owner login: safe for small screens --- */
.own-wrap {
  padding: 20px 12px;
}
.own-card {
  padding: 22px 16px;
}

/* --- form errors: ensure visibility --- */
.form-error {
  min-height: 20px;
  word-break: break-word;
}

.kb-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); margin: 16px 0; }
.kb-entry { background: var(--paper-2); border: 3px solid var(--ink); border-radius: 12px; padding: 12px; font-size: .9rem; }
.kb-entry p { color: var(--muted); font-size: .82rem; margin-top: 4px; }

#chat-box { margin-top: 14px; }

/* ===== owner restricted login ===== */
.own-wrap { min-height: 80vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #14141c 0%, #1f1a14 100%);
  border-radius: 18px; padding: 30px 16px; }
.own-card { width: min(380px, 92%); background: #1b1e24; border: 3px solid #ff8b2c;
  border-radius: 18px; padding: 28px 24px; box-shadow: 0 8px 0 rgba(0,0,0,.45); text-align: center; }
.own-lock { font-size: 40px; }
.own-title { color: #ff8b2c; letter-spacing: 4px; font-weight: 800; margin-top: 10px; }
.own-sub { color: #9aa3a9; font-size: 13px; margin: 6px 0 22px; }
.own-lbl { display: block; text-align: left; color: #9aa3a9; font-size: 12px;
  font-weight: 700; margin: 12px 0 5px; letter-spacing: 1px; }
.own-card input { width: 100%; background: #101216; color: #fff;
  border: 2px solid #3a3f47; border-radius: 10px; padding: 12px;
  font-family: inherit; font-size: 15px; outline: none; }
.own-card input:focus { border-color: #ff8b2c; }
.own-btn { width: 100%; margin-top: 20px; background: #ff8b2c; color: #14141c;
  border: none; border-radius: 10px; padding: 13px; font-family: inherit;
  font-size: 15px; font-weight: 800; letter-spacing: 2px; cursor: pointer; }
.own-btn:hover { background: #ffa04f; }
.own-btn:active { transform: translateY(2px); }
.own-foot { margin-top: 16px; color: #6d747c; font-size: 11px; letter-spacing: 1px; }
