/* ================================================================
   store2 — style.css
   Dark app layout · sidebar navigation · mobile-first
   ================================================================ */

:root {
  /* Backgrounds */
  --c-bg:       #090909;
  --c-sidebar:  #101010;
  --c-surface:  #131313;
  --c-surface2: #181818;
  --c-hover:    #1e1e1e;
  --c-input:    #191919;

  /* Borders */
  --c-border:  #1e1e1e;
  --c-border2: #2a2a2a;

  /* Text */
  --c-t1: #eeeeee;
  --c-t2: #999999;
  --c-t3: #555555;

  /* Accent */
  --c-accent:    #0080FF;
  --c-accent-bg: rgba(0,128,255,.16);
  --c-accent-bd: rgba(0,128,255,.45);
  --c-danger:    #ff453a;
  --c-success:   #30d158;

  /* Layout */
  --sidebar-w:    240px;
  --topbar-h:     56px;
  --bottomnav-h:  62px;

  /* Radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  /* Font */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Backward-compat aliases (fullstory, attachment reuse these) */
  --bg-main:      var(--c-bg);
  --bg-panel:     var(--c-surface);
  --bg-hover:     var(--c-hover);
  --border-color: var(--c-border2);
  --text-main:    var(--c-t1);
  --text-muted:   var(--c-t2);
  --accent:       var(--c-accent);
  --radius-lg:    var(--r-xl);
  --radius-md:    var(--r-lg);
  --radius-sm:    var(--r-sm);
  --font-stack:   var(--font);
}

/* ================================================================
   RESET & BASE
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: clip; background: var(--c-bg); }
html, body { width: 100%; }

body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-t1);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body.modal-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
img, video, iframe, table { max-width: 100%; height: auto; display: block; }

/* ================================================================
   APP SHELL  (groups 1–4, authenticated buyers)
   ================================================================ */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.app-sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--c-sidebar);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
}

.sb-logo-wrap {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.sb-logo { height: 20px; width: auto; opacity: .85; display: block; }

.sb-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
  scrollbar-width: none;
}
.sb-nav::-webkit-scrollbar { display: none; }

.sb-section-label {
  padding: 14px 12px 5px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--c-t3);
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--c-t2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
  cursor: pointer;
}
.sb-item:hover  { background: var(--c-hover); color: var(--c-t1); }
.sb-item.active { background: var(--c-hover); color: var(--c-t1); }
.sb-item svg    { flex-shrink: 0; width: 16px; height: 16px; opacity: .65; transition: opacity .15s; }
.sb-item:hover svg, .sb-item.active svg { opacity: 1; }

/* ---- USER BLOCK (rendered by userinfo.tpl via {login}) ---- */
.sb-user-wrap {
  flex-shrink: 0;
  border-top: 1px solid var(--c-border);
  padding: 10px 8px 12px;
}

.sb-user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  margin-bottom: 2px;
}
.sb-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--c-hover);
  flex-shrink: 0;
}
.sb-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-user-role {
  font-size: 11px;
  color: var(--c-t3);
  margin-top: 1px;
}

.sb-user-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--c-t2);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
  margin-bottom: 1px;
}
.sb-user-link:hover { background: var(--c-hover); color: var(--c-t1); }
.sb-user-link svg   { width: 15px; height: 15px; opacity: .6; flex-shrink: 0; }

/* login.tpl guest CTA */
.sb-login-cta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--c-t2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background .2s, color .2s;
}
.sb-login-cta:hover { background: var(--c-hover); color: var(--c-t1); }
.sb-login-cta svg   { opacity: .6; flex-shrink: 0; }

/* ---- Sidebar user account popover ---- */
.sb-user { position: relative; }
.sb-user-trigger {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 8px; background: transparent;
  border: 1px solid transparent; border-radius: 10px;
  cursor: pointer; text-align: left; font-family: inherit;
  transition: background .15s, border-color .15s;
}
.sb-user-trigger:hover { background: var(--c-hover); }
.sb-user.open .sb-user-trigger { background: var(--c-hover); border-color: var(--c-border2); }
.sb-user-ava { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.sb-user-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.sb-user-name { font-size: 13.5px; font-weight: 600; color: var(--c-t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-sub  { font-size: 11px; color: var(--c-t3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-chev { color: var(--c-t3); flex-shrink: 0; transition: transform .2s; }
.sb-user.open .sb-user-chev { transform: rotate(180deg); }

.sb-user-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px);
  min-width: 210px;
  background: var(--c-surface2, #181818);
  border: 1px solid var(--c-border2); border-radius: 12px;
  padding: 6px; box-shadow: 0 14px 44px rgba(0,0,0,.55);
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .16s, transform .16s, visibility .16s;
  z-index: 60;
}
.sb-user.open .sb-user-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.sb-user-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--c-t2);
  text-decoration: none; transition: background .14s, color .14s;
}
.sb-user-item:hover { background: var(--c-hover); color: var(--c-t1); }
.sb-user-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .85; }
.sb-user-item--danger { color: var(--c-danger, #ff453a); }
.sb-user-item--danger:hover { background: rgba(255,69,58,.12); color: var(--c-danger, #ff453a); }
.sb-user-sep { height: 1px; background: var(--c-border); margin: 5px 4px; }

/* Collapsed sidebar: avatar only, menu floats out */
html.sb-closed .sb-user-meta,
html.sb-closed .sb-user-chev { display: none; }
html.sb-closed .sb-user-trigger { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
html.sb-closed .sb-user-menu { left: 0; right: auto; width: 210px; }

/* ---- MAIN CONTENT ---- */
.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-topbar { display: none; } /* hidden on desktop */

.app-content {
  flex: 1;
  padding: 36px 44px 44px;
  max-width: 1200px;
  width: 100%;
  margin:0 auto;
}

.mobile-bottom-nav { display: none; } /* shown on mobile only */
.mob-menu-backdrop { display: none; }
.sb-mob-close {
  display: none;
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 8px; border: 1px solid var(--c-border2);
  background: transparent; color: var(--c-t2); cursor: pointer;
  align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.sb-mob-close:hover { background: var(--c-hover); color: var(--c-t1); }

/* ================================================================
   GUEST LAYOUT  (group 5)
   ================================================================ */

.guest-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: rgba(9,9,9,.95);
  border-bottom: 1px solid var(--c-border2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.guest-header-inner {
  max-width: 1440px;
  margin: 0 auto;
  height: 64px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.guest-logo { height: 21px; width: auto; display: block; }

.guest-nav {
  display: flex;
  gap: 28px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.guest-nav a {
  color: var(--c-t2);
  font-size: 14px;
  font-weight: 500;
  transition: color .2s;
}
.guest-nav a:hover { color: var(--c-t1); }

.guest-actions { display: flex; align-items: center; gap: 14px; }

/* Header access dropdown (login.tpl for group 5) */
.hdr-access { position: relative; }
.hdr-access-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: #000;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .2s;
  white-space: nowrap;
}
.hdr-access-btn:hover { opacity: .88; }
.hdr-access-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #131313;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 6px;
  min-width: 210px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity .18s, transform .18s;
  z-index: 500;
  box-shadow: 0 12px 32px rgba(0,0,0,.65);
}
.hdr-access:hover .hdr-access-menu,
.hdr-access:focus-within .hdr-access-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.hdr-access-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #eee;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s;
  text-decoration: none;
}
.hdr-access-item:hover { background: #1e1e1e; color: #fff; }
.hdr-access-sep { height: 1px; background: #2a2a2a; margin: 4px 6px; }
.hdr-access-menu::before { content:""; position:absolute; top:-12px; left:0; right:0; height:12px; }
.hdr-access-ico { flex-shrink:0; }

.guest-burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-t1);
  padding: 4px;
  align-items: center;
  justify-content: center;
}
.guest-burger svg { width: 26px; height: 26px; fill: currentColor; }

.guest-mobile-nav {
  position: absolute;
  top: 64px;
  left: 0;
  width: 100%;
  background: #111;
  border-bottom: 1px solid var(--c-border2);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity .2s, transform .2s;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.guest-mobile-nav.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.guest-mobile-nav a {
  padding: 14px 24px;
  border-bottom: 1px solid var(--c-border2);
  font-size: 15px;
  color: var(--c-t1);
  font-weight: 500;
}
.guest-mobile-nav a:last-child { border-bottom: none; }

.guest-page {
  max-width: 1440px;
  margin: 24px auto;
  padding: 0 32px;
}

@media (max-width: 900px) {
  .guest-nav { display: none; }
  .guest-burger { display: flex; }
  .guest-header-inner { padding: 0 20px; }
}

/* Guest footer */
.guest-footer {
  margin-top: auto;
  padding: 48px 0 28px;
  border-top: 1px solid rgba(255,255,255,.04);
}
.guest-footer-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.guest-footer-brand { display: flex; flex-direction: column; gap: 10px; }
.guest-footer-logo  { height: 20px; width: auto; opacity: .8; align-self: flex-start; flex: 0 0 auto; }
.guest-footer-tag   { font-size: 12px; color: var(--c-t3); }
.guest-footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.guest-footer-links a {
  font-size: 13px;
  color: var(--c-t3);
  transition: color .2s;
  font-weight: 500;
}
.guest-footer-links a:hover { color: var(--c-t2); }
.guest-footer-copy  { font-size: 12px; color: var(--c-t3); }

@media (max-width: 768px) {
  .guest-footer-inner { flex-direction: column; align-items: center; text-align: center; }
  .guest-footer-links { justify-content: center; }
  .guest-page { padding: 0 16px; }
}

/* ================================================================
   APP FOOTER (inside app layout)
   ================================================================ */
.app-footer {
  padding: 24px 44px;
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.app-footer-copy  { font-size: 12px; color: var(--c-t3); }
.app-footer-links { display: flex; gap: 18px; }
.app-footer-links a {
  font-size: 12px;
  color: var(--c-t3);
  transition: color .2s;
}
.app-footer-links a:hover { color: var(--c-t2); }

/* ================================================================
   PAGE HEADER (inside app content)
   ================================================================ */
.page-hdr {
  margin-bottom: 28px;
}
.page-hdr-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.5px;
  line-height: 1.2;
}
.page-hdr-sub {
  font-size: 14px;
  color: var(--c-t2);
  margin-top: 6px;
}

/* ================================================================
   CATALOG GRID
   ================================================================ */
.catalog-section-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.3px;
  margin-bottom: 14px;
  margin-top: 36px;
  color: var(--c-t1);
}
.catalog-section-title:first-child { margin-top: 0; }

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ================================================================
   PRODUCT CARD  (shortstory.tpl)
   ================================================================ */
.pcard {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
  position: relative;
}
.pcard:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,.55);
  border-color: #2e2e2e;
}

/* Poster wrapped in <a> */
.pcard-img { display: block; width: 100%; text-decoration: none; }
.pcard-poster {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  background-color: var(--c-hover);
  position: relative;
  overflow: hidden;
  transition: filter .2s;
}
.pcard-img:hover .pcard-poster { filter: brightness(.82); }

/* Badges — top-left */
.pcard-tl {
  position: absolute; top: 9px; left: 9px;
  display: flex; gap: 5px; flex-wrap: wrap; z-index: 2;
}
.pc-badge {
  display: inline-flex; align-items: center;
  background: rgba(9,9,9,.72);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.08);
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; color: var(--c-t1);
  letter-spacing: .1px; white-space: nowrap;
}
.pc-badge-cat  { color: var(--c-accent); border-color: var(--c-accent-bd); background: rgba(0,0,0,.65); }
.pc-badge-pick { color: #f5c518; border-color: rgba(245,197,24,.28); background: rgba(0,0,0,.65); }

/* Bought badge — top-right */
.pc-bought {
  position: absolute; top: 9px; right: 9px; z-index: 2;
  background: var(--c-accent-bg); border: 1px solid var(--c-accent-bd);
  color: var(--c-accent); padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: .2px;
  backdrop-filter: blur(8px);
}

/* Body */
.pcard-body { padding: 13px 15px 15px; display: flex; flex-direction: column; }
.pcard-title {
  font-size: 14px; font-weight: 700; color: var(--c-t1);
  line-height: 1.4; margin: 0 0 8px;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.pcard-title a { color: inherit; text-decoration: none; }
.pcard-title a:hover { color: var(--c-accent); }

/* Meta row */
.pc-meta {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--c-t3);
  margin-bottom: 12px; flex: 1;
  white-space: nowrap; overflow: hidden;
}
.pc-meta svg { flex-shrink: 0; }
.pc-score { color: var(--c-t2); font-weight: 600; }
.pc-sep { color: #333; }

/* Footer */
.pcard-foot {
  display: flex; align-items: center;
  justify-content: space-between; gap: 10px;
  padding-top: 11px; border-top: 1px solid var(--c-border);
  margin-top: auto;
}
.pc-price { font-size: 17px; font-weight: 800; color: var(--c-t1, #eee); letter-spacing: -.3px; }
.pc-price-owned { font-size: 12.5px; font-weight: 500; color: var(--c-t3); }

/* Buttons */
.pc-btn {
  height: 32px; padding: 0 14px;
  border-radius: var(--r-sm); font-size: 12.5px; font-weight: 600;
  cursor: pointer; border: none; font-family: var(--font);
  transition: opacity .2s, transform .1s;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 5px;
  text-decoration: none;
}
.pc-btn:active { transform: scale(.96); }
.pc-btn-buy  { background: #fff; color: #000; }
.pc-btn-buy:hover { opacity: .88; }
.pc-btn-open { background: transparent; color: var(--c-t1); border: 1px solid var(--c-border2); }
.pc-btn-open:hover { background: var(--c-hover); }

/* ================================================================
   MY FILES
   ================================================================ */
.mfiles-wrap {
  max-width: 800px;
}
.mfiles-hdr {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.4px;
  margin-bottom: 24px;
}
.mfiles-list { display: flex; flex-direction: column; gap: 10px; }

.mfile-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color .2s;
}
.mfile-card:hover { border-color: var(--c-border2); }

.mfile-poster {
  width: 88px;
  height: 56px;
  border-radius: var(--r-sm);
  background-size: cover;
  background-position: center;
  background-color: var(--c-hover);
  flex-shrink: 0;
}
.mfile-info { flex: 1; min-width: 0; }
.mfile-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--c-t1);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mfile-date { font-size: 12px; color: var(--c-t3); }

.btn-mfile {
  height: 34px;
  padding: 0 16px;
  background: #fff;
  color: #000;
  border: none;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  font-family: var(--font);
  transition: opacity .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-mfile:hover { opacity: .85; }

/* ================================================================
   STATIC PAGES
   ================================================================ */
.static-page {
  max-width: 740px;
  line-height: 1.78;
  font-size: 15px;
  color: var(--c-t2);
}
.static-page h1, .static-page h2, .static-page h3 {
  color: var(--c-t1);
  font-weight: 600;
  margin: 1.6em 0 .6em;
  line-height: 1.3;
  letter-spacing: -.3px;
}
.static-page h1 { font-size: 26px; margin-top: 0; }
.static-page h2 { font-size: 20px; }
.static-page p  { margin-bottom: 1em; }
.static-page a  { color: var(--c-accent); border-bottom: 1px dashed var(--c-accent-bd); transition: border-color .2s; }
.static-page a:hover { border-bottom-color: var(--c-accent); }
.static-page ul, .static-page ol { padding-left: 1.4em; margin-bottom: 1em; }
.static-page li { margin-bottom: .4em; }

/* ================================================================
   COOKIE NOTICE
   ================================================================ */
.cookie-notice {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(140px);
  width: calc(100% - 48px);
  max-width: 580px;
  background: rgba(16,16,16,.92);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--r-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: transform .45s cubic-bezier(.34,1.56,.64,1), opacity .4s;
}
.cookie-notice.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
@media (max-width: 768px) {
  .cookie-notice {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    transform: translateX(0) translateY(140px);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: var(--r-lg);
  }
  .cookie-notice.show { transform: translateX(0) translateY(0); }
}
.cookie-content p { font-size: 13px; color: var(--c-t2); line-height: 1.5; }
.cookie-content a { color: var(--c-t1); text-decoration: underline; }
.btn-cookie {
  background: #fff;
  color: #000;
  border: none;
  padding: 9px 20px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: var(--font);
  transition: opacity .2s, transform .1s;
}
.btn-cookie:hover  { opacity: .88; }
.btn-cookie:active { transform: scale(.95); }

/* ================================================================
   MOBILE  (≤ 768px)
   ================================================================ */
@media (max-width: 768px) {
  /* Sidebar becomes a slide-in drawer */
  #appSidebar {
    display: flex;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    height: 100dvh;
    width: 84vw; max-width: 320px;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    box-shadow: 4px 0 40px rgba(0,0,0,.5);
  }
  html.mob-menu-open #appSidebar { transform: translateX(0); }
  #appSidebar .sb-label         { opacity: 1 !important; max-width: none !important; }
  #appSidebar .sb-section-label { opacity: 1 !important; max-height: none !important; padding-top: 14px !important; }
  #appSidebar .sb-item          { justify-content: flex-start !important; padding-left: 12px !important; padding-right: 12px !important; gap: 12px !important; }
  #appSidebar .sb-logo          { opacity: 1 !important; max-width: 160px !important; }
  #appSidebar .catnum           { display: flex !important; }
  .sb-toggle    { display: none !important; }
  .sb-mob-close { display: flex; }

  /* Drawer backdrop */
  .mob-menu-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    z-index: 290;
    opacity: 0; visibility: hidden;
    transition: opacity .26s, visibility .26s;
  }
  html.mob-menu-open .mob-menu-backdrop { opacity: 1; visibility: visible; }
  html.mob-menu-open { overflow: hidden; }

  .app-main    { margin-left: 0; padding-bottom: var(--bottomnav-h); }

  /* Mobile top bar */
  .app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: var(--topbar-h);
    position: sticky;
    top: 0;
    z-index: 90;
    background: rgba(12,12,12,.93);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--c-border);
  }
  .app-topbar-logo  { height: 18px; width: auto; display: block; }
  .app-topbar-right { display: flex; align-items: center; gap: 8px; }

  /* Mobile header: avatar-only trigger, menu drops downward */
  .app-topbar-right .sb-user-trigger { padding: 0; background: none; border: none; gap: 0; }
  .app-topbar-right .sb-user-meta,
  .app-topbar-right .sb-user-chev    { display: none; }
  .app-topbar-right .sb-user-ava     { width: 34px; height: 34px; border: 1px solid var(--c-border2); }
  .app-topbar-right .sb-user-menu {
    top: calc(100% + 8px); bottom: auto;
    left: auto; right: 0; min-width: 210px;
    transform: translateY(-6px);
  }
  .app-topbar-right .sb-user.open .sb-user-menu { transform: translateY(0); }

  /* Content padding */
  .app-content { padding: 16px 16px 8px; }

  /* App footer */
  .app-footer { padding: 18px 16px; flex-direction: column; text-align: center; }
  .app-footer-links { justify-content: center; }

  /* Bottom navigation */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottomnav-h);
    background: rgba(12,12,12,.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--c-border);
    z-index: 200;
  }
  .mob-nav-btn {
    flex: 1;
    background: none; border: 0; -webkit-appearance: none; appearance: none;
    font-family: inherit; cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--c-t3);
    font-size: 10px;
    font-weight: 500;
    transition: color .15s;
    padding-bottom: 4px;
  }
  .mob-nav-btn svg     { width: 22px; height: 22px; }
  .mob-nav-btn.active  { color: var(--c-t1); }
  .mob-nav-btn:hover   { color: var(--c-t2); }

  /* Cookie above bottom nav */
  .app-shell ~ .cookie-notice { bottom: calc(var(--bottomnav-h) + 10px); }

  /* Card grid: 2 columns on tablets, 1 on phones */
  .catalog-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* My files: vertical */
  .mfile-card { flex-direction: column; align-items: stretch; }
  .mfile-poster { width: 100%; height: 160px; }
  .btn-mfile { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .catalog-grid { grid-template-columns: 1fr; }
}

/* APP HEADER (main top bar) - added 2026-06-25 */
.app-header{display:flex;align-items:center;gap:12px;height:62px;flex-shrink:0;padding:0 24px;position:sticky;top:0;z-index:90;background:rgba(16,16,16,.85);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border-bottom:1px solid var(--c-border);}
.app-search{display:flex;align-items:center;width:40px;height:40px;flex:0 0 auto;border:1px solid transparent;border-radius:10px;background:transparent;overflow:hidden;transition:width .25s cubic-bezier(.4,0,.2,1),background .15s,border-color .15s;}
.app-search:not(.open):hover{background:var(--c-hover);}
.app-search.open{width:340px;background:var(--c-surface2);border-color:var(--c-border2);}
.app-search-btn{width:40px;height:40px;flex:0 0 auto;display:flex;align-items:center;justify-content:center;padding:0;background:transparent;border:none;color:var(--c-t2);cursor:pointer;transition:color .15s;}
.app-search:not(.open):hover .app-search-btn{color:var(--c-t1);}
.app-search.open .app-search-btn{color:var(--c-t3);}
.app-search-btn svg{width:18px;height:18px;}
.app-search-input{flex:1;min-width:0;width:0;height:38px;padding:0;background:transparent!important;border:none!important;box-shadow:none!important;border-radius:0!important;outline:none;color:var(--c-t1);font-family:inherit;font-size:13.5px;opacity:0;transition:opacity .18s;}
.app-search.open .app-search-input{opacity:1;}
.app-search-kbd{flex:0 0 auto;display:none;align-items:center;justify-content:center;width:26px;height:26px;margin-right:8px;padding:0;background:transparent;border:1px solid var(--c-border2);border-radius:7px;color:var(--c-t3);cursor:pointer;opacity:0;transition:opacity .18s,color .15s,border-color .15s,background .15s;}
.app-search.open .app-search-kbd{display:flex;opacity:1;}
.app-search-kbd:hover{color:var(--c-t1);border-color:#3a3a3a;background:var(--c-hover);}
.app-search-kbd svg{width:14px;height:14px;}
.app-search-input::placeholder{color:var(--c-t3);}
.app-header-right{display:flex;align-items:center;gap:8px;margin-left:auto;}
.app-bell{position:relative;width:40px;height:40px;flex-shrink:0;display:flex;align-items:center;justify-content:center;border-radius:10px;border:1px solid transparent;color:var(--c-t2);cursor:pointer;transition:background .15s,color .15s,border-color .15s;}
.app-bell:hover{background:var(--c-hover);color:var(--c-t1);}
.app-bell svg{width:19px;height:19px;}
.app-bell-badge{position:absolute;top:5px;right:5px;min-width:16px;height:16px;padding:0 4px;display:flex;align-items:center;justify-content:center;background:var(--c-accent);color:#fff;font-size:10px;font-weight:700;line-height:1;border-radius:8px;border:2px solid var(--c-bg);}
.app-header-right .sb-user-trigger{width:auto;padding:0;background:none;border:none;gap:0;}
.app-header-right .sb-user-trigger:hover{background:none;}
.app-header-right .sb-user-meta,.app-header-right .sb-user-chev{display:none;}
.app-header-right .sb-user-ava{width:38px;height:38px;border:1px solid var(--c-border2);}
.app-header-right .sb-user-menu{top:calc(100% + 8px);bottom:auto;left:auto;right:0;min-width:220px;transform:translateY(-6px);}
.app-header-right .sb-user.open .sb-user-menu{transform:translateY(0);}
.sb-cta-wrap{flex-shrink:0;border-top:1px solid var(--c-border);padding:8px;}
.sb-cta{display:flex;align-items:center;gap:11px;padding:10px 11px;border-radius:10px;text-decoration:none;background:var(--c-surface2);border:1px solid var(--c-border);transition:background .15s,border-color .15s;}
.sb-cta:hover{background:var(--c-hover);border-color:var(--c-border2);}
.sb-cta-ico{flex:0 0 auto;width:30px;height:30px;display:flex;align-items:center;justify-content:center;color:var(--c-accent);}
.sb-cta-ico svg{width:20px;height:20px;}
.sb-cta-body{display:flex;flex-direction:column;min-width:0;flex:1;}
.sb-cta-title{font-size:13px;font-weight:600;color:var(--c-t1);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sb-cta-text{font-size:11px;color:var(--c-t3);margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sb-cta-arr{flex:0 0 auto;width:15px;height:15px;color:var(--c-t3);transition:transform .15s,color .15s;}
.sb-cta:hover .sb-cta-arr{transform:translateX(2px);color:var(--c-t2);}
html.sb-closed .sb-cta{justify-content:center;padding:9px 0;gap:0;}
html.sb-closed .sb-cta-body,html.sb-closed .sb-cta-arr{display:none;}
@media (max-width:768px){.app-header{display:none;}}
/* /APP HEADER */
