/* =========================================================
   Share Portal Hub — design system v2
   ========================================================= */
:root {
  color-scheme: light;

  /* Surfaces (light base) */
  --bg-page: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-surface: #ffffff;
  --bg-overlay: #ffffff;
  --surface-1: #ffffff;
  --surface-2: rgba(15, 23, 42, 0.05);
  --surface-3: rgba(15, 23, 42, 0.09);
  --sticky-bg: rgba(255, 255, 255, 0.88);
  --preview-bg: #f1f5f9;
  --modal-backdrop: rgba(15, 23, 42, 0.48);

  /* Borders */
  --border-neutral: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.16);
  --border-hover: rgba(15, 23, 42, 0.24);
  --border-accent: rgba(225, 29, 72, 0.35);

  /* Text (all >= 4.5:1 on light surface) */
  --text-main: #0f172a;
  --text-sub: #475569;
  --text-meta: #64748b;
  --text-muted: #64748b;
  --text-on-accent: #ffffff;
  --text-on-chip-active: #ffffff;

  /* Brand & semantic */
  --accent: #e11d48;
  --accent-strong: #be123c;
  --accent-soft: #be123c;
  --accent-tint: rgba(225, 29, 72, 0.09);
  --accent-tint-hover: rgba(225, 29, 72, 0.16);
  --shadow-accent: 0 8px 20px -8px rgba(225, 29, 72, 0.45);
  --folder: #0284c7;
  --folder-fg: #0369a1;
  --folder-tint: rgba(2, 132, 199, 0.1);
  --folder-border: rgba(2, 132, 199, 0.32);
  --folder-border-hover: rgba(2, 132, 199, 0.65);
  --folder-tab-bg: rgba(14, 165, 233, 0.16);
  --folder-tab-hover: rgba(14, 165, 233, 0.28);
  --folder-card-bg: linear-gradient(180deg, rgba(14, 165, 233, 0.07), rgba(255, 255, 255, 0.96));
  --folder-card-hover: linear-gradient(180deg, rgba(14, 165, 233, 0.12), #ffffff);
  --tag-bg: rgba(139, 92, 246, 0.09);
  --tag-border: rgba(124, 58, 237, 0.28);
  --tag-fg: #6d28d9;
  --trending-bg: linear-gradient(135deg, rgba(225, 29, 72, 0.12), rgba(249, 115, 22, 0.14));
  --trending-border: rgba(234, 88, 12, 0.35);
  --trending-fg: #c2410c;
  --success: #059669;
  --btn-active-bg: #ffffff;

  /* Shape & depth */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.1);
  --shadow-pop: 0 20px 40px -12px rgba(15, 23, 42, 0.16);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 180ms;

  --gutter: 20px;
  --font-stack: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-page: #0b0f17;
    --bg-elevated: #111827;
    --bg-surface: #131b2b;
    --bg-overlay: #182235;
    --surface-1: #131b2b;
    --surface-2: rgba(148, 163, 184, 0.09);
    --surface-3: rgba(148, 163, 184, 0.16);
    --sticky-bg: rgba(11, 15, 23, 0.86);
    --preview-bg: #0f172a;
    --modal-backdrop: rgba(2, 6, 23, 0.72);
    --border-neutral: rgba(148, 163, 184, 0.14);
    --border-strong: rgba(148, 163, 184, 0.24);
    --border-hover: rgba(148, 163, 184, 0.36);
    --border-accent: rgba(251, 113, 133, 0.42);
    --text-main: #f1f5f9;
    --text-sub: #cbd5e1;
    --text-meta: #94a3b8;
    --text-muted: #94a3b8;
    --text-on-accent: #ffffff;
    --text-on-chip-active: #0b0f17;
    --accent: #f43f5e;
    --accent-strong: #e11d48;
    --accent-soft: #fda4af;
    --accent-tint: rgba(244, 63, 94, 0.16);
    --accent-tint-hover: rgba(244, 63, 94, 0.24);
    --shadow-accent: 0 8px 24px -8px rgba(244, 63, 94, 0.5);
    --folder: #38bdf8;
    --folder-fg: #7dd3fc;
    --folder-tint: rgba(56, 189, 248, 0.15);
    --folder-border: rgba(56, 189, 248, 0.32);
    --folder-border-hover: rgba(56, 189, 248, 0.65);
    --folder-tab-bg: rgba(56, 189, 248, 0.22);
    --folder-tab-hover: rgba(56, 189, 248, 0.34);
    --folder-card-bg: linear-gradient(180deg, rgba(56, 189, 248, 0.1), rgba(19, 27, 43, 0.96));
    --folder-card-hover: linear-gradient(180deg, rgba(56, 189, 248, 0.16), #182235);
    --tag-bg: rgba(167, 139, 250, 0.16);
    --tag-border: rgba(167, 139, 250, 0.34);
    --tag-fg: #ddd6fe;
    --trending-bg: linear-gradient(135deg, rgba(244, 63, 94, 0.18), rgba(251, 146, 60, 0.18));
    --trending-border: rgba(251, 146, 60, 0.42);
    --trending-fg: #fdba74;
    --success: #34d399;
    --btn-active-bg: #1e293b;
    --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.28), 0 12px 28px -12px rgba(0, 0, 0, 0.45);
    --shadow-pop: 0 20px 44px -10px rgba(0, 0, 0, 0.65);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #0b0f17;
  --bg-elevated: #111827;
  --bg-surface: #131b2b;
  --bg-overlay: #182235;
  --surface-1: #131b2b;
  --surface-2: rgba(148, 163, 184, 0.09);
  --surface-3: rgba(148, 163, 184, 0.16);
  --sticky-bg: rgba(11, 15, 23, 0.86);
  --preview-bg: #0f172a;
  --modal-backdrop: rgba(2, 6, 23, 0.72);
  --border-neutral: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.24);
  --border-hover: rgba(148, 163, 184, 0.36);
  --border-accent: rgba(251, 113, 133, 0.42);
  --text-main: #f1f5f9;
  --text-sub: #cbd5e1;
  --text-meta: #94a3b8;
  --text-muted: #94a3b8;
  --text-on-accent: #ffffff;
  --text-on-chip-active: #0b0f17;
  --accent: #f43f5e;
  --accent-strong: #e11d48;
  --accent-soft: #fda4af;
  --accent-tint: rgba(244, 63, 94, 0.16);
  --accent-tint-hover: rgba(244, 63, 94, 0.24);
  --shadow-accent: 0 8px 24px -8px rgba(244, 63, 94, 0.5);
  --folder: #38bdf8;
  --folder-fg: #7dd3fc;
  --folder-tint: rgba(56, 189, 248, 0.15);
  --folder-border: rgba(56, 189, 248, 0.32);
  --folder-border-hover: rgba(56, 189, 248, 0.65);
  --folder-tab-bg: rgba(56, 189, 248, 0.22);
  --folder-tab-hover: rgba(56, 189, 248, 0.34);
  --folder-card-bg: linear-gradient(180deg, rgba(56, 189, 248, 0.1), rgba(19, 27, 43, 0.96));
  --folder-card-hover: linear-gradient(180deg, rgba(56, 189, 248, 0.16), #182235);
  --tag-bg: rgba(167, 139, 250, 0.16);
  --tag-border: rgba(167, 139, 250, 0.34);
  --tag-fg: #ddd6fe;
  --trending-bg: linear-gradient(135deg, rgba(244, 63, 94, 0.18), rgba(251, 146, 60, 0.18));
  --trending-border: rgba(251, 146, 60, 0.42);
  --trending-fg: #fdba74;
  --success: #34d399;
  --btn-active-bg: #1e293b;
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.28), 0 12px 28px -12px rgba(0, 0, 0, 0.45);
  --shadow-pop: 0 20px 44px -10px rgba(0, 0, 0, 0.65);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-padding-top: 140px; }

body {
  font-family: var(--font-stack);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-main);
  background:
    radial-gradient(1200px 520px at 50% -180px, rgba(225, 29, 72, 0.07), transparent 70%),
    radial-gradient(800px 400px at 100% 0, rgba(14, 165, 233, 0.06), transparent 70%),
    var(--bg-page);
  background-repeat: no-repeat;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: opacity 0.15s ease;
}

body.modal-open { overflow: hidden; }

html.lang-loading body { opacity: 0; pointer-events: none; }

::selection { background: var(--accent-tint-hover); }

button { font: inherit; color: inherit; }

button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px var(--gutter) 96px;
}

/* ---------------------------------------------------------
   Header
   --------------------------------------------------------- */
.header { margin-bottom: 18px; }

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-accent);
}

.brand-text { min-width: 0; }

.title {
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.bio {
  color: var(--text-sub);
  font-size: 0.9rem;
  margin-top: 3px;
  line-height: 1.45;
  max-width: 60ch;
}

/* ---------------------------------------------------------
   Sticky toolbar: search + chips
   --------------------------------------------------------- */
.tools-sticky {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 12px 0;
  margin-bottom: 12px;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.tools-sticky.stuck {
  background: var(--sticky-bg);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  box-shadow: 0 1px 0 var(--border-neutral), 0 12px 24px -16px rgba(15, 23, 42, 0.22);
  margin-left: calc(var(--gutter) * -1);
  margin-right: calc(var(--gutter) * -1);
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 50px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  padding: 0 8px 0 18px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.search-bar:hover { border-color: var(--border-hover); }
.search-bar:focus-within {
  border-color: var(--border-accent);
  background: var(--bg-overlay);
  box-shadow: 0 0 0 4px var(--accent-tint);
}

.search-scope-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 7px 12px;
  margin-bottom: 10px;
  border-radius: var(--r-md);
  background: var(--folder-tint);
  border: 1px solid var(--folder-border);
  font-size: 0.82rem;
  color: var(--text-main);
}
.search-scope-bar[hidden] { display: none; }
.search-scope-btn {
  min-height: 28px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--folder-border);
  background: var(--bg-surface);
  color: var(--folder-fg);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.search-scope-btn:hover { background: var(--surface-2); }

.search-bar svg { color: var(--text-muted); flex-shrink: 0; width: 18px; height: 18px; }
.search-bar:focus-within > svg { color: var(--accent-soft); }

.search-bar input {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  font: inherit;
  font-size: 1rem;
  outline: none;
  min-width: 0;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input::-webkit-search-cancel-button { display: none; }
.search-bar input:focus-visible { outline: none; }

.search-clear {
  display: none;
  background: var(--surface-2);
  border: none;
  color: var(--text-sub);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.search-clear:hover { background: var(--surface-3); color: var(--text-main); }
.search-bar.has-text .search-clear { display: inline-grid; place-items: center; }

.trending-strip {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  background: var(--bg-overlay);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 14px 16px 16px;
  box-shadow: var(--shadow-pop);
  z-index: 50;
  animation: pop-in 160ms var(--ease);
}
.search-bar.suggest-open .trending-strip { display: block; }

.trending-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.trending-tags { display: flex; flex-wrap: wrap; gap: 8px; }

.trending-tag {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  background: var(--surface-1);
  border: 1px solid var(--border-neutral);
  color: var(--text-sub);
  border-radius: var(--r-pill);
  padding: 0 14px;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.trending-tag::before { content: "#"; color: var(--text-muted); margin-right: 3px; }
.trending-tag.active, .trending-tag:hover {
  border-color: var(--border-accent);
  color: var(--text-main);
  background: var(--accent-tint);
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
}
.chip-row::-webkit-scrollbar { display: none; }

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  min-height: 38px;
  background: var(--surface-1);
  border: 1px solid var(--border-neutral);
  color: var(--text-sub);
  border-radius: var(--r-pill);
  padding: 0 16px;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.cat-chip:hover { color: var(--text-main); background: var(--surface-2); border-color: var(--border-strong); }
.cat-chip.active {
  background: var(--text-main);
  border-color: var(--text-main);
  color: var(--text-on-chip-active);
  font-weight: 600;
}
.cat-chip:disabled { opacity: 0.5; cursor: default; }

.chip-new-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
}

/* ---------------------------------------------------------
   Banner + home sections
   --------------------------------------------------------- */
.since-banner {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, rgba(225, 29, 72, 0.09), rgba(225, 29, 72, 0.03));
  border: 1px solid var(--border-accent);
  color: var(--text-main);
  border-radius: var(--r-lg);
  padding: 13px 18px;
  margin-bottom: 24px;
  cursor: pointer;
  font-size: 0.88rem;
  text-align: left;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.since-banner:hover { transform: translateY(-1px); background: linear-gradient(90deg, rgba(225, 29, 72, 0.14), rgba(225, 29, 72, 0.05)); }
.since-banner[hidden] { display: none; }
.since-action { color: var(--accent-soft); font-weight: 650; white-space: nowrap; }
.since-action::after { content: " →"; }

.home-section { margin-bottom: 36px; }
.home-section[hidden] { display: none; }

.sec-bar, .section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.sec-title-wrap, .section-title-left { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.sec-title, .dir-heading, .faq-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.sec-meta, .result-count { font-size: 0.8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.sec-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.text-btn {
  background: transparent;
  border: none;
  color: var(--accent-soft);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  transition: background var(--dur) var(--ease);
  white-space: nowrap;
}
.text-btn:hover { background: var(--accent-tint); }

.arrow-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-main);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.arrow-btn:hover { background: var(--surface-3); border-color: var(--border-hover); }

/* Recent: horizontal poster rail */
.recent-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 2px;
  scrollbar-width: none;
  padding: 16px 2px 6px;
  margin: -10px -2px 0;
}
.recent-track::-webkit-scrollbar { display: none; }

/* Collections */
.collections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.col-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--border-neutral);
  color: var(--text-main);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.col-card:hover { border-color: var(--border-accent); background: var(--surface-2); transform: translateY(-2px); }

.col-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-surface);
}

.col-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.col-cat { font-size: 0.74rem; color: var(--accent-soft); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.col-cat em { font-style: normal; color: var(--text-muted); font-weight: 500; }
.col-title { font-size: 0.92rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------
   Directory header & view switch
   --------------------------------------------------------- */
.section-title { border-top: 1px solid var(--border-neutral); padding-top: 28px; }

.view-switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  background: var(--surface-1);
  border: 1px solid var(--border-neutral);
  border-radius: var(--r-pill);
  padding: 3px;
}

.view-btn {
  min-height: 32px;
  background: transparent;
  border: none;
  color: var(--text-sub);
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.view-btn:hover { color: var(--text-main); }
.view-btn.active { background: var(--btn-active-bg); color: var(--text-main); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18); }

/* ---------------------------------------------------------
   Resource grid
   --------------------------------------------------------- */
.list-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px 12px;
  padding-top: 8px;
}

.list-container.view-poster {
  grid-template-columns: repeat(auto-fill, minmax(208px, 1fr));
  gap: 22px 16px;
}

.section-group-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding-bottom: 6px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-group-title:first-child { margin-top: 4px; }
.section-group-title strong { font-weight: 700; }
.section-group-title strong::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1em;
  margin-right: 10px;
  vertical-align: -0.12em;
  border-radius: 2px;
  background: var(--accent);
}
.section-group-title span {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.shelf-more { margin-left: auto; }

/* Card (shared by list rows and gallery rail) */
.resource-card, .gallery-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 0 0 10px;
  border-radius: var(--r-lg);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  min-width: 0;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.resource-card:hover, .gallery-card:hover {
  transform: translateY(-2px);
}
.resource-card:active, .gallery-card:active { transform: translateY(0); }

.card-main-link {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.card-main-link[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }

.resource-card[data-visited] .card-title,
.gallery-card[data-visited] .card-title,
.col-card[data-visited] .col-title { color: var(--text-muted); }

.visited-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  font-size: 0.64rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: rgba(15, 23, 42, 0.78);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.preview-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-lg);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--preview-bg);
  box-shadow: 0 0 0 1px var(--border-neutral);
  transition: box-shadow var(--dur) var(--ease);
  isolation: isolate;
}
.resource-card:hover .preview-box,
.gallery-card:hover .preview-box {
  box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-card);
}

.preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  display: block;
  transition: transform 400ms var(--ease);
}
.resource-card:hover .preview-img, .gallery-card:hover .preview-img { transform: scale(1.04); }

.preview-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background:
    radial-gradient(circle at 30% 20%, hsla(var(--tile-hue, 260), 80%, 60%, 0.42), transparent 60%),
    linear-gradient(135deg, hsl(var(--tile-hue, 260), 52%, 28%), hsl(var(--tile-hue, 260), 42%, 13%));
}
.pf-icon { width: 18px; height: 18px; color: rgba(255, 255, 255, 0.85); }
.pf-initial { font-size: 1.2rem; font-weight: 700; color: #fff; letter-spacing: 0.02em; }
.pf-cat { font-size: 0.62rem; color: rgba(255, 255, 255, 0.82); letter-spacing: 0.04em; }

.cover-badge {
  display: inline-block;
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: rgba(9, 9, 11, 0.74);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.cover-badge.is-new { background: var(--accent-strong); font-weight: 700; letter-spacing: 0.04em; }

.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 0 2px; }
.card-title {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.card-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 2px;
  min-width: 0;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 6px;
  font-size: 0.72rem;
  color: var(--text-meta);
  font-variant-numeric: tabular-nums;
}
.card-meta > span { display: inline-flex; align-items: center; min-height: 22px; }

.card-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 6px;
}

.meta-badge, .card-cat {
  background: var(--surface-2);
  color: var(--text-sub);
  padding: 0 8px;
  border-radius: var(--r-pill);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-box::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, transparent 32%);
  pointer-events: none;
}

.gallery-card {
  flex: 0 0 248px;
  scroll-snap-align: start;
}

/* ---------------------------------------------------------
   Folder cards — clean single-tab sky-blue frame
   --------------------------------------------------------- */
.folder-card {
  margin-top: 8px;
  padding: 10px 10px 12px;
  border-radius: var(--r-lg);
  border: 1px solid var(--folder-border);
  background: var(--folder-card-bg);
}
.folder-card:hover {
  border-color: var(--folder-border-hover);
  background: var(--folder-card-hover);
  box-shadow: var(--shadow-card);
}

.folder-card .preview-box {
  overflow: visible;
  margin-top: 8px;
  box-shadow: 0 0 0 1px var(--folder-border);
}
.folder-card .preview-box > .preview-img,
.folder-card .preview-box > .preview-fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
.folder-card .preview-box::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 8%;
  right: 8%;
  top: -7px;
  height: 18px;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: var(--folder-tab-bg);
  border: 1px solid var(--folder-border);
  border-bottom: 0;
  transition: top var(--dur) var(--ease), background var(--dur) var(--ease);
}
.folder-card:hover .preview-box::before { top: -10px; background: var(--folder-tab-hover); }
.folder-card .preview-img { transform: none !important; }
.folder-card:hover .preview-box > .preview-img { filter: brightness(1.04); }
.folder-card .preview-box::after { border-radius: inherit; }

.folder-corner-badge {
  position: absolute;
  z-index: 2;
  left: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(9, 9, 11, 0.82);
  border: 1px solid var(--folder-border);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--folder);
  pointer-events: none;
}
.folder-corner-badge svg { width: 15px; height: 15px; }

.folder-pill {
  gap: 4px;
  background: var(--folder-tint);
  color: var(--folder-fg);
  border: 1px solid var(--folder-border);
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-weight: 600;
}
.folder-pill svg { width: 11px; height: 11px; flex-shrink: 0; }

.popular-pill {
  gap: 4px;
  background: var(--accent-tint);
  color: var(--accent-soft);
  border: 1px solid var(--border-accent);
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-weight: 600;
}
.popular-pill.is-trending {
  background: var(--trending-bg);
  color: var(--trending-fg);
  border-color: var(--trending-border);
}
.popular-pill.is-pickup {
  background: rgba(14, 165, 233, 0.14);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.35);
}
.admin-click-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  background: var(--surface-2, rgba(148, 163, 184, 0.14));
  color: var(--text-muted, #94a3b8);
  border: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.28));
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card-tag-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--tag-border);
  background: var(--tag-bg);
  color: var(--tag-fg);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}
.card-tag-pill:hover { background: #7c3aed; border-color: #7c3aed; color: #ffffff; }
.card-tag-more {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.card-alt-link-btn,
.card-report-btn,
.card-suggest-btn,
.card-admin-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-neutral);
  background: var(--surface-2);
  color: var(--text-sub);
  font-size: 0.71rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.card-alt-link-btn:hover,
.card-report-btn:hover,
.card-suggest-btn:hover,
.card-admin-edit-btn:hover { border-color: var(--border-strong); color: var(--text-main); background: var(--surface-3); }
.card-suggest-btn { margin-left: auto; }
.card-admin-edit-btn {
  border-color: var(--border-accent);
  background: var(--accent-tint);
  color: var(--accent-soft);
}
.card-admin-edit-btn:hover { background: var(--accent-tint-hover); color: var(--text-main); }
.card-alt-link-btn { border-color: var(--folder-border); color: var(--folder-fg); background: var(--folder-tint); }
.card-alt-link-btn:hover { background: var(--folder-tab-hover); }

.folder-detail-actions { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.folder-admin-edit-btn,
.folder-suggest-btn,
.folder-report-btn,
.folder-alt-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.folder-admin-edit-btn:hover,
.folder-suggest-btn:hover,
.folder-report-btn:hover,
.folder-alt-share-btn:hover { background: var(--surface-3); }
.folder-admin-edit-btn {
  border-color: var(--border-accent);
  background: var(--accent-tint);
  color: var(--accent-soft);
}
.folder-admin-edit-btn[hidden] { display: none; }
.folder-alt-share-btn {
  border-color: var(--folder-border);
  background: var(--folder-tint);
  color: var(--folder-fg);
}
.folder-alt-share-btn[hidden] { display: none; }

.popular-empty {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px dashed var(--border-strong);
  color: var(--text-sub);
  font-size: 0.84rem;
}

/* ---------------------------------------------------------
   Empty / load more / errors
   --------------------------------------------------------- */
.empty-state, .data-error, .load-more { display: none; }

.empty-state.show {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 52px 16px 36px;
  color: var(--text-sub);
  font-size: 0.95rem;
}
.empty-state-text { margin: 0; }
.empty-reset-btn {
  min-height: 36px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.empty-reset-btn:hover { background: var(--surface-3); }
.empty-reset-btn[hidden] { display: none; }
.empty-state.show::before {
  content: "";
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8b95' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") center / 24px no-repeat,
    var(--surface-2);
}

.data-error.show {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-accent);
  background: var(--accent-tint);
  font-size: 0.9rem;
}
.data-retry {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-pill);
  min-height: 36px;
  padding: 0 16px;
  font-weight: 650;
  cursor: pointer;
}

.load-more.show {
  display: block;
  margin: 32px auto 0;
  min-height: 46px;
  padding: 0 32px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-main);
  cursor: pointer;
  font-weight: 650;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.load-more.show:hover { background: var(--surface-3); border-color: rgba(15, 23, 42, 0.24); }

.empty-search-jump, .search-more-foot {
  margin-top: 20px;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px dashed var(--border-strong);
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-sub);
}
.empty-search-jump[hidden], .search-more-foot[hidden] { display: none; }
.empty-search-btn, .search-more-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  margin-top: 10px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  background: var(--accent-tint);
  color: var(--accent-soft);
  text-decoration: none;
  font-weight: 650;
}
.search-more-link { margin-left: 8px; }
.empty-search-btn:hover, .search-more-link:hover { background: rgba(225, 29, 72, 0.16); }

/* ---------------------------------------------------------
   FAQ & footer
   --------------------------------------------------------- */
.faq-section { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--border-neutral); }
.faq-title { margin-bottom: 14px; }
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item {
  background: var(--surface-1);
  border: 1px solid var(--border-neutral);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.faq-item:hover { border-color: var(--border-strong); }
.faq-item[open] { background: var(--surface-2); border-color: var(--border-strong); }
.faq-question {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  list-style: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 14px 16px;
  min-height: 48px;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-icon { color: var(--text-muted); transition: transform var(--dur) var(--ease); }
.faq-item[open] .faq-icon { transform: rotate(180deg); }
.faq-answer { padding: 0 16px 16px; color: var(--text-sub); font-size: 0.88rem; line-height: 1.65; }

.footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-neutral);
  display: flex;
  justify-content: center;
}
.uni-lang-dropdown { position: relative; }
.uni-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  padding: 0 16px;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-size: 0.86rem;
  transition: background var(--dur) var(--ease);
}
.uni-lang-trigger:hover { background: var(--surface-2); }
.uni-lang-caret { color: var(--text-muted); font-size: 0.7rem; transition: transform var(--dur) var(--ease); }
.uni-lang-dropdown.open .uni-lang-caret { transform: rotate(180deg); }

.uni-lang-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-overlay);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 6px;
  box-shadow: var(--shadow-pop);
  z-index: 60;
}
.uni-lang-dropdown.open .uni-lang-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; animation: pop-in 160ms var(--ease); }
.lang-link {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--text-sub);
  text-decoration: none;
  font-size: 0.84rem;
}
.lang-link:hover { background: var(--surface-2); color: var(--text-main); }
.lang-link.active { background: var(--accent-tint); color: var(--accent-soft); font-weight: 650; }

.back-top {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 45;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--sticky-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text-main);
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.back-top.show { opacity: 1; transform: none; pointer-events: auto; }
.back-top:hover { background: var(--bg-overlay); }

/* ---------------------------------------------------------
   Folder detail header & breadcrumbs
   --------------------------------------------------------- */
.folder-detail-bar {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(600px 200px at 0 0, var(--folder-tint), transparent 70%),
    var(--surface-1);
  border: 1px solid var(--folder-border);
  border-radius: var(--r-xl);
  padding: 16px 18px 18px;
  margin-bottom: 16px;
}
.folder-detail-bar[hidden] { display: none; }

.folder-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.folder-breadcrumbs:empty { display: none; }
.crumb-link {
  background: transparent;
  border: none;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  color: var(--folder-fg);
  font-weight: 600;
  cursor: pointer;
}
.crumb-link:hover { background: var(--folder-tint); }
.crumb-sep { color: var(--text-muted); }
.crumb-current { color: var(--text-main); font-weight: 600; word-break: break-word; }

.folder-detail-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.folder-back-btn, .folder-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 15px;
  border-radius: var(--r-pill);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.folder-back-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
}
.folder-back-btn:hover { background: var(--surface-3); }
.folder-share-btn {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-accent);
}
.folder-share-btn:hover { background: var(--accent-strong); transform: translateY(-1px); }

.folder-detail-meta { display: flex; align-items: center; gap: 16px; }
.folder-detail-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--r-md);
  object-fit: cover;
  object-position: center 22%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--folder-border), 0 -4px 0 -1px var(--folder-tab-bg);
}
.folder-detail-info { min-width: 0; flex: 1; }
.folder-detail-title { font-size: 1.28rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.3; word-break: break-word; }
.folder-detail-sub { font-size: 0.84rem; color: var(--text-sub); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Admin mode, theme toggle & file delete button */
.brand { position: relative; }
.header-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.header-ext-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 15px;
  border-radius: var(--r-pill);
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--text-on-accent);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: var(--shadow-accent);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.header-ext-btn:hover { background: var(--accent-strong); transform: translateY(-1px); }
.admin-toggle-btn,
.theme-toggle-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-neutral);
  background: var(--surface-1);
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.88rem;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.admin-toggle-btn:hover,
.theme-toggle-btn:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text-main); }
.admin-toggle-btn.active { border-color: var(--border-accent); background: var(--accent-tint); color: var(--accent-soft); }

.admin-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--accent-tint);
  border: 1px solid var(--border-accent);
  font-size: 0.82rem;
  color: var(--text-main);
}
.admin-bar[hidden] { display: none; }
.admin-bar-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-logout-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  border-radius: var(--r-pill);
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.admin-logout-btn:hover { background: var(--surface-3); }

.card-delete-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-accent);
  background: var(--bg-overlay);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card-delete-btn:hover { background: var(--accent); color: var(--text-on-accent); transform: scale(1.06); }

.admin-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 160;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: var(--bg-overlay);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop);
  font-size: 0.85rem;
  color: var(--text-main);
}
.admin-toast[hidden] { display: none; }
.admin-undo-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-pill);
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}
.admin-badge[hidden] { display: none; }

.portal-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: var(--modal-backdrop);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 16px;
}
.portal-modal-backdrop[hidden] { display: none; }
.portal-modal {
  width: min(100%, 460px);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--bg-overlay, #ffffff);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg, 16px);
  box-shadow: var(--shadow-pop);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.portal-modal-wide { width: min(100%, 640px); }
.portal-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.portal-modal-title { font-size: 1rem; font-weight: 700; margin: 0; color: var(--text-main); }
.portal-modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-neutral);
  background: var(--surface-2);
  color: var(--text-sub);
  cursor: pointer;
}
.portal-modal-close:hover { color: var(--text-main); background: var(--surface-3); }
.portal-modal-target {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-sub);
  background: var(--surface-1);
  border: 1px solid var(--border-neutral);
  border-radius: var(--r-md);
  padding: 8px 10px;
  word-break: break-word;
}
.portal-modal-form { display: flex; flex-direction: column; gap: 12px; }
.portal-form-error { margin: 0; font-size: 0.82rem; font-weight: 600; color: var(--accent); }
.portal-form-error[hidden] { display: none; }
.portal-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--text-sub); }
.portal-field input {
  width: 100%;
  box-sizing: border-box;
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-main);
  font-size: 0.88rem;
}
.suggest-quick-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-tag-chip {
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-neutral);
  background: var(--surface-2);
  color: var(--text-sub);
  font-size: 0.76rem;
  cursor: pointer;
}
.quick-tag-chip:hover { border-color: var(--border-accent); color: var(--text-main); }
.portal-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.portal-btn-secondary {
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-neutral);
  background: var(--surface-2);
  color: var(--text-main);
  font-size: 0.84rem;
  cursor: pointer;
}
.portal-btn-primary {
  min-height: 36px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 650;
  cursor: pointer;
}
.portal-btn-primary:hover { filter: brightness(1.08); }
.admin-suggest-body { display: flex; flex-direction: column; gap: 10px; }
.admin-sug-card {
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-neutral);
  background: var(--surface-1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-sug-meta { font-size: 0.76rem; color: var(--text-muted); }
.admin-sug-row { font-size: 0.85rem; color: var(--text-main); word-break: break-word; }
.admin-sug-actions { display: flex; gap: 8px; justify-content: flex-end; }
.admin-sug-sec-title { font-size: 0.82rem; font-weight: 700; color: var(--text-sub); margin-top: 6px; }

/* ---------------------------------------------------------
   Animations, responsive, reduced motion
   --------------------------------------------------------- */
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.uni-lang-dropdown.open .uni-lang-menu { animation-name: pop-in-x; }
@keyframes pop-in-x {
  from { opacity: 0; transform: translate(-50%, 4px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 920px) {
  .list-container.view-poster { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 14px; }
}

@media (max-width: 600px) {
  :root { --gutter: 16px; }
  body { font-size: 14px; }
  .container { padding-top: 18px; }
  .brand { flex-direction: column; align-items: stretch; gap: 10px; }
  .brand-main { gap: 12px; }
  .header-actions { margin-left: 0; justify-content: flex-end; }
  .header-ext-btn { min-height: 32px; padding: 0 12px; font-size: 0.78rem; margin-right: auto; }
  .avatar { width: 46px; height: 46px; border-radius: 13px; }
  .search-bar { height: 46px; }
  .gallery-card { flex-basis: 72%; }
  .sec-actions .arrow-btn { display: none; }
  .collections-grid { grid-template-columns: 1fr; }
  .list-container.view-poster { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .list-container.view-poster .card-title { font-size: 0.84rem; }
  .list-container.view-poster .card-meta .meta-badge { display: none; }
  .folder-detail-thumb { width: 56px; height: 56px; }
  .folder-detail-title { font-size: 1.1rem; }
}

@media (hover: none) {
  .resource-card:hover, .gallery-card:hover, .col-card:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
