@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700;900&display=swap');

:root {
  color-scheme: dark;
  --bg: #0d0d10;
  --bg-gradient: radial-gradient(ellipse 80% 50% at 50% 0%, #16161d 0%, #0d0d10 70%);
  --surface: rgba(22, 22, 28, 0.75);
  --surface-solid: #16161c;
  --surface-2: rgba(30, 30, 38, 0.65);
  --surface-3: #32323d;
  --text: #f0f0f4;
  --text-secondary: #c8c8d3;
  --muted: #8a8a9e;
  --line: rgba(70, 70, 85, 0.5);
  --line-strong: #4a4a5e;

  --accent: #9e9eb8;
  --accent-strong: #8a8aa0;
  --accent-glow: rgba(158, 158, 184, 0.25);
  --accent-soft: rgba(158, 158, 184, 0.12);

  --gradient-accent: linear-gradient(135deg, #9e9eb8, #6e6e85);
  --gradient-warm: linear-gradient(135deg, #b0b0c0, #9090a5);
  --gradient-cool: linear-gradient(135deg, #a8a8be, #7e7e96);
  --gradient-card: linear-gradient(145deg, rgba(22, 22, 28, 0.9), rgba(30, 30, 38, 0.6));
  --gradient-hero: linear-gradient(135deg, rgba(158, 158, 184, 0.08), rgba(110, 110, 133, 0.08));

  --blue: #7e7ece;
  --yellow: #c8b84a;
  --red: #e06060;
  --red-soft: rgba(224, 96, 96, 0.13);
  --green: #7eb87e;
  --green-soft: rgba(126, 184, 126, 0.13);
  --orange: #c8984a;
  --pink: #c878a8;
  --purple: #9e7ece;

  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.25);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 24px rgba(158, 158, 184, 0.12);
  --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.18);

  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  --radius-xs: 2px;
  --radius-sm: 2px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-xl: 20px;
  --gap-sm: 0.5rem;
  --gap-md: 1rem;
  --gap-lg: 1.75rem;

  --transition-fast: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-bounce: 500ms cubic-bezier(0.34, 1.2, 0.64, 1);
}

/* Плавные переходы при смене темы — активируются через JS класс */
body.theme-transitioning,
body.theme-transitioning *,
body.theme-transitioning *::before,
body.theme-transitioning *::after {
  transition: background-color 0.4s ease, color 0.4s ease,
              border-color 0.4s ease, box-shadow 0.4s ease,
              background 0.4s ease, opacity 0.4s ease !important;
}

.status-badge {
  min-height: 1.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge .material-symbols-rounded {
  font-size: 1rem;
}

.status-published {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
}

.status-moderation {
  border-color: color-mix(in srgb, var(--yellow) 45%, var(--line));
  background: color-mix(in srgb, var(--yellow) 14%, var(--surface));
  color: var(--yellow);
}



.rating-row { white-space: nowrap; }
.rating-score { margin-left: 0.4rem; }


.comment-stars {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  margin-left: 0.5rem;
}
.comment-stars .material-symbols-rounded {
  font-size: 1rem;
  line-height: 1;
  vertical-align: middle;
}
.comment-stars .filled-star {
  color: var(--yellow);
}
.comment-stars .empty-star {
  color: color-mix(in srgb, var(--muted) 60%, transparent);
}
.status-rejected {
  border-color: color-mix(in srgb, var(--red) 48%, var(--line));
  background: color-mix(in srgb, var(--red) 14%, var(--surface));
  color: var(--red);
}

.danger-icon-button {
  color: var(--red);
}

.profile-project.project-management-card {
  grid-template-columns: 3.3rem minmax(0, 1fr) auto auto auto;
}

.profile-project-main {
  min-width: 0;
}

.profile-project-title {
  display: inline;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  font-weight: 900;
  text-align: left;
}

.profile-project-title:hover {
  color: var(--accent);
}

.profile-project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.moderation-toolbar,
.moderation-stats,
.studio-badges,
.moderation-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.moderation-toolbar {
  margin: 0 0 1rem;
}

.project-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.project-stats .stat-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.project-stats .stat-item .material-symbols-rounded {
  font-size: 1rem;
  color: var(--muted);
}

.project-stats .stat-loading {
  color: var(--muted);
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.project-stats .stat-empty {
  color: var(--muted);
  font-weight: 400;
}

.project-stats .stat-encrypted {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--yellow);
  font-weight: 600;
}

.project-stats .stat-encrypted .material-symbols-rounded {
  font-size: 1rem;
}

.stat-password-btn {
  font-size: 0.78rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--yellow);
  border-radius: 2px;
  background: transparent;
  color: var(--yellow);
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
}

.stat-password-btn:hover {
  background: color-mix(in srgb, var(--yellow) 15%, transparent);
}

.moderation-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 2px;
  padding: 0.65rem 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tab-button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.tab-button:hover {
  background: var(--surface-2);
}

.stat-pill {
  min-height: 2.55rem;
  display: inline-grid;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  padding: 0.35rem 0.75rem;
}

.stat-pill strong {
  font-size: 1.15rem;
}

.stat-pill span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.moderation-grid {
  display: grid;
  gap: 1rem;
}

.moderation-card {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  padding: 0.85rem;
}

.moderation-cover {
  min-height: 9rem;
  display: grid;
  place-items: center;
  border-radius: 2px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 46%, transparent), color-mix(in srgb, var(--blue) 42%, transparent)),
    var(--surface-2);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.moderation-cover img {
  width: 4.2rem;
  height: 4.2rem;
  border-radius: 2px;
  object-fit: cover;
}

.moderation-cover span {
  font-size: 2rem;
  font-weight: 900;
}

.moderation-title-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.moderation-title-row h3,
.moderation-title-row p,
.moderation-description {
  margin: 0;
}

.moderation-title-row p,
.moderation-description,
.muted-note {
  color: var(--muted);
}

.moderation-body {
  display: grid;
  gap: 0.75rem;
}

.studio-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 1rem 0;
}

.studio-metrics div {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface-2);
  padding: 0.8rem;
}

.studio-metrics strong {
  display: block;
  font-size: 1.25rem;
}

.studio-metrics span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.studio-project-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.6rem;
}

.studio-project-chip {
  min-height: 4.5rem;
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 0.15rem 0.55rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--text);
  padding: 0.55rem;
  text-align: left;
}

.studio-project-chip img,
.studio-project-chip > span:first-child {
  grid-row: 1 / span 2;
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border-radius: 2px;
  background: var(--surface-3);
  object-fit: cover;
  font-weight: 900;
}

.studio-project-chip strong,
.studio-project-chip small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-project-chip small {
  font-weight: 800;
}

.file-drop.has-file {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.file-drop.is-dragging {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 14%, var(--surface));
  transform: translateY(-1px);
}

.file-drop-selection {
  max-width: 100%;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.2rem;
}

.insight-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 88%, transparent), color-mix(in srgb, var(--accent) 8%, var(--surface-2)));
  padding: 0.85rem;
  box-shadow: var(--shadow-soft);
}

.insight-card > .material-symbols-rounded {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
}

.insight-card small,
.insight-card em {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.insight-card strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 0.98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-spotlight-section {
  margin-top: 1.4rem;
}

.studio-spotlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.85rem;
}

.studio-spotlight-card {
  display: grid;
  grid-template-columns: 3.6rem minmax(0, 1fr);
  gap: 0.8rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--gradient-card);
  padding: 0.9rem;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.studio-spotlight-card:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.studio-spotlight-card .studio-info {
  min-width: 0;
}

.studio-spotlight-card h3,
.studio-spotlight-card p,
.studio-latest {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-latest {
  display: block;
  margin-top: 0.35rem;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
}

.view > .section-heading:first-child {
  margin-top: 0.15rem;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  .insight-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-management-card,
  .moderation-card {
    grid-template-columns: 1fr;
  }

  .studio-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .insight-strip,
  .studio-spotlight-grid {
    grid-template-columns: 1fr;
  }

  .insight-card {
    padding: 0.75rem;
  }
}


.skeleton-card {
  height: 260px;
  background: var(--gradient-card);
  border: 1px solid var(--line);
  border-radius: 2px;
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.9; }
}


.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green);
}
.verified-badge .material-symbols-rounded {
  font-size: 1rem;
}


html[data-accent="blue"] {
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --accent-soft: rgba(59, 130, 246, 0.12);
  --gradient-accent: linear-gradient(135deg, #3b82f6, #1d4ed8);
  --gradient-cool: linear-gradient(135deg, #3b82f6, #06b6d4);
  --blue: #3b82f6;
  --shadow-glow: 0 0 24px rgba(59, 130, 246, 0.15);
}
html[data-accent="purple"] {
  --accent: #a78bfa;
  --accent-strong: #8b5cf6;
  --accent-glow: rgba(167, 139, 250, 0.25);
  --accent-soft: rgba(167, 139, 250, 0.12);
  --gradient-accent: linear-gradient(135deg, #a78bfa, #7c3aed);
  --gradient-cool: linear-gradient(135deg, #a78bfa, #06b6d4);
  --blue: #a78bfa;
  --shadow-glow: 0 0 24px rgba(167, 139, 250, 0.15);
}
html[data-accent="pink"] {
  --accent: #f472b6;
  --accent-strong: #ec4899;
  --accent-glow: rgba(244, 114, 182, 0.25);
  --accent-soft: rgba(244, 114, 182, 0.12);
  --gradient-accent: linear-gradient(135deg, #f472b6, #db2777);
  --gradient-cool: linear-gradient(135deg, #f472b6, #06b6d4);
  --blue: #f472b6;
  --shadow-glow: 0 0 24px rgba(244, 114, 182, 0.15);
}
html[data-accent="orange"] {
  --accent: #fb923c;
  --accent-strong: #f97316;
  --accent-glow: rgba(251, 146, 60, 0.25);
  --accent-soft: rgba(251, 146, 60, 0.12);
  --gradient-accent: linear-gradient(135deg, #fb923c, #ea580c);
  --gradient-cool: linear-gradient(135deg, #fb923c, #06b6d4);
  --blue: #fb923c;
  --shadow-glow: 0 0 24px rgba(251, 146, 60, 0.15);
}
html[data-accent="red"] {
  --accent: #ef4444;
  --accent-strong: #dc2626;
  --accent-glow: rgba(239, 68, 68, 0.25);
  --accent-soft: rgba(239, 68, 68, 0.12);
  --gradient-accent: linear-gradient(135deg, #ef4444, #b91c1c);
  --gradient-cool: linear-gradient(135deg, #ef4444, #06b6d4);
  --blue: #ef4444;
  --shadow-glow: 0 0 24px rgba(239, 68, 68, 0.15);
}
html[data-accent="yellow"] {
  --accent: #fbbf24;
  --accent-strong: #f59e0b;
  --accent-glow: rgba(251, 191, 36, 0.25);
  --accent-soft: rgba(251, 191, 36, 0.12);
  --gradient-accent: linear-gradient(135deg, #fbbf24, #d97706);
  --gradient-cool: linear-gradient(135deg, #fbbf24, #06b6d4);
  --blue: #fbbf24;
  --shadow-glow: 0 0 24px rgba(251, 191, 36, 0.15);
}
html[data-accent="cyan"] {
  --accent: #22d3ee;
  --accent-strong: #06b6d4;
  --accent-glow: rgba(34, 211, 238, 0.25);
  --accent-soft: rgba(34, 211, 238, 0.12);
  --gradient-accent: linear-gradient(135deg, #22d3ee, #0891b2);
  --gradient-cool: linear-gradient(135deg, #22d3ee, #3b82f6);
  --blue: #22d3ee;
  --shadow-glow: 0 0 24px rgba(34, 211, 238, 0.15);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f0f0f5;
  --bg-gradient: radial-gradient(ellipse 80% 50% at 50% 0%, #e4e4ed 0%, #f0f0f5 70%);
  --surface: rgba(255, 255, 255, 0.85);
  --surface-solid: #ffffff;
  --surface-2: rgba(245, 245, 250, 0.85);
  --surface-3: #d4d4de;
  --text: #1a1a24;
  --text-secondary: #3a3a4a;
  --muted: #6e6e82;
  --line: rgba(140, 140, 158, 0.45);
  --line-strong: #9494aa;

  --accent: #8686a0;
  --accent-strong: #72728a;
  --accent-glow: rgba(134, 134, 160, 0.15);
  --accent-soft: rgba(134, 134, 160, 0.08);

  --blue: #6a6abc;
  --yellow: #b8a838;
  --red: #cc5050;
  --green: #5a9e5a;
  --orange: #b8883a;
  --pink: #b8689a;
  --purple: #8a6abc;

  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.05);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.09);
  --shadow-glow: 0 0 24px rgba(134, 134, 160, 0.1);
  --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.05);
}


.theme-flash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: none;
}


.theme-flash.light-bomb {
  animation: lightBomb 4.5s cubic-bezier(0.33, 1, 0.68, 1) forwards;
}

@keyframes lightBomb {
  0% {
    opacity: 0;
    background: white;
    clip-path: circle(0% at 0% 100%);
  }
  2% {
    opacity: 1;
  }
  75% {
    opacity: 1;
    background: white;
    clip-path: circle(150% at 0% 100%);
  }
  82% {
    opacity: 1;
    background: white;
  }
  100% {
    opacity: 0;
    background: white;
  }
}


.theme-flash.darken-smooth {
  animation: darkenSmooth 2s cubic-bezier(0.33, 1, 0.68, 1) forwards;
}

@keyframes darkenSmooth {
  0% {
    opacity: 0;
    background: #000;
  }
  55% {
    opacity: 0.92;
    background: #000;
  }
  65% {
    opacity: 0.92;
    background: #000;
  }
  100% {
    opacity: 0;
    background: #000;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
}

.hidden {
  display: none !important;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--accent-strong);
}

img {
  max-width: 100%;
  display: block;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

p {
  margin: 0;
}


.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 1.5rem;
  background: var(--bg);
  background-image: var(--bg-gradient);
}

.auth-art {
  display: none;
}
@media (min-width: 900px) {
  .auth-art {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 5rem;
  }
}

.brand-emblem {
  width: 88px;
  height: 88px;
  border-radius: 2px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2.5rem;
  border: 1px solid var(--line-strong);
  animation: pulseGlow 3s ease-in-out infinite;
}
.brand-emblem .material-symbols-rounded {
  font-size: 2.8rem;
  color: var(--accent);
}

@keyframes pulseGlow {
  0%, 100% { border-color: var(--line-strong); }
  50% { border-color: var(--accent); }
}

.auth-phone {
  width: 240px;
  height: 420px;
  border: 1.5px solid var(--line);
  border-radius: 2px;
  padding: 1.2rem;
  background: var(--surface);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border: 1px solid var(--line-strong);
}


.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 2.5rem;
}
.auth-title {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 2rem;
}
.logo-mark {
  width: 52px;
  height: 52px;
  border-radius: 2px;
  background: var(--gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.logo-mark .material-symbols-rounded {
  font-size: 1.6rem;
  color: #fff;
}
.auth-title p {
  font-size: 0.8rem;
  color: var(--muted);
}


.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
}
.field > span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.field input,
.field select,
.field textarea {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--line);
  border-radius: 2px;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.field textarea {
  resize: vertical;
  min-height: 80px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-md);
  margin-bottom: var(--gap-md);
}
@media (max-width: 540px) {
  .form-grid { grid-template-columns: 1fr; }
}

.form-error {
  color: var(--red);
  font-size: 0.85rem;
  min-height: 1.2rem;
}


.btn-ripple {
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.btn-ripple::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255,255,255,0.25) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.btn-ripple:active::after {
  opacity: 1;
  transition: opacity 0s;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--gradient-accent);
  color: #fff;
  border: none;
  border-radius: 2px;
  padding: 0.7rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.primary-button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.primary-button:hover {
  transform: translateY(-2px);
}
.primary-button:hover::after {
  opacity: 1;
}
.primary-button:active {
  transform: translateY(0);
}
.primary-button.compact {
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
}
.primary-button:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.outline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--line);
  border-radius: 2px;
  padding: 0.65rem 1.3rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(4px);
}
.outline-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
}
.outline-button:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  min-height: 2.5rem;
  min-width: 2.5rem;
  background: transparent;
  border: none;
  border-radius: 2px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.icon-button:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: scale(1.05);
}
.icon-button.small {
  width: 2rem;
  height: 2rem;
  min-height: 2rem;
  min-width: 2rem;
}
.icon-button .material-symbols-rounded {
  font-size: 1.4rem;
}

.text-button {
  display: inline;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  margin-top: 1rem;
  transition: color var(--transition-fast);
}
.text-button:hover {
  color: var(--accent);
}

.danger-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  color: var(--red);
  border: 1.5px solid color-mix(in srgb, var(--red) 30%, transparent);
  border-radius: 2px;
  padding: 0.65rem 1.3rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.danger-button:hover {
  background: color-mix(in srgb, var(--red) 10%, transparent);
  border-color: var(--red);
}

.chip-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1.5px solid var(--line);
  color: var(--muted);
  border-radius: 2px;
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.chip-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.chip-button.active {
  background: var(--gradient-accent);
  border-color: transparent;
  color: #fff;
}


.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 1.2rem 0.8rem;
  border: 1.5px dashed var(--line);
  border-radius: 2px;
  background: var(--surface);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}
.file-drop:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}
.file-drop .material-symbols-rounded {
  font-size: 1.8rem;
  color: var(--muted);
}
.file-drop strong {
  font-size: 0.85rem;
}
.file-drop small {
  font-size: 0.75rem;
  color: var(--muted);
}
.file-drop input {
  display: none;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  margin-top: 1.5rem;
}


.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  padding: 0.7rem 1.25rem;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: all var(--transition);
}
.topbar.scrolled {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  flex-shrink: 0;
}
.brand:hover {
  color: var(--text);
}
.brand-copy strong {
  font-size: 1.05rem;
  display: block;
  line-height: 1.2;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-copy small {
  font-size: 0.7rem;
  color: var(--muted);
}

.search-bar {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.4rem 1rem;
  transition: all var(--transition-fast);
}
.search-bar:focus-within {
  border-color: var(--accent);
}
.search-bar .material-symbols-rounded {
  font-size: 1.2rem;
  color: var(--muted);
  flex-shrink: 0;
}
.search-bar input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  min-width: 0;
}
.search-bar input:focus {
  outline: none;
}

.search-clear-btn {
  display: none;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 2px;
  line-height: 1;
  transition: color var(--transition-fast);
}
.search-clear-btn:hover {
  color: var(--text);
}
.search-bar.has-text .search-clear-btn {
  display: inline-flex;
}

.search-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}
.search-bar.is-searching .search-spinner {
  display: block;
}
.search-bar.is-searching .search-clear-btn {
  display: none;
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 2px 2px;
  max-height: 240px;
  overflow-y: auto;
  display: none;
}
.search-suggestions.visible {
  display: block;
}
.search-suggestion-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: 0.85rem;
}
.search-suggestion-item:hover {
  background: var(--accent-soft);
}
.search-suggestion-item img,
.search-suggestion-item .avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 2px;
  flex-shrink: 0;
}
.search-suggestion-item img {
  object-fit: cover;
}
.search-suggestion-item .avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}
.search-suggestion-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-suggestion-meta {
  color: var(--muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.avatar-button {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 2px;
  overflow: hidden;
  background: var(--surface-2);
  border: 2px solid var(--line);
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  transition: all var(--transition-fast);
}
.avatar-button:hover {
  border-color: var(--accent);
}
.avatar-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


.workspace {
  display: flex;
  flex: 1;
}

.side-rail {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
  border-right: 1px solid var(--line);
  background: transparent;
  height: calc(100dvh - 4rem);
  position: sticky;
  top: 4rem;
  overflow-y: auto;
}
.rail-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: none;
  border: none;
  color: var(--muted);
  padding: 0.7rem 0.95rem;
  border-radius: 2px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}
.rail-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateX(3px);
}
.rail-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.rail-item.danger:hover {
  background: color-mix(in srgb, var(--red) 10%, transparent);
  color: var(--red);
}
.nav-backdrop {
  display: none;
}
#menuToggle {
  display: none;
}

/* ─── Mobile Bottom Tab Bar ─── */
.mobile-tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
  padding: 0.3rem 0.25rem;
  justify-content: space-around;
  padding-bottom: max(0.3rem, env(safe-area-inset-bottom, 0.3rem));
}
.mobile-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  background: none;
  border: none;
  color: var(--muted);
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  border-radius: 2px;
  transition: all var(--transition-fast);
  font-size: 0.65rem;
  font-weight: 500;
  min-width: 0;
}
.mobile-tab-item .material-symbols-rounded {
  font-size: 1.3rem;
  transition: all var(--transition-fast);
}
.mobile-tab-item:hover {
  color: var(--accent);
}
.mobile-tab-item.active {
  color: var(--accent);
}
.mobile-tab-item.active .material-symbols-rounded {
  font-variation-settings: 'FILL' 1;
}

/* Badge for unread support chat */
.notif-badge {
  position: absolute;
  top: 0;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.mobile-tab-item,
.rail-item {
  position: relative;
}

/* ─── Scroll To Top ─── */
#scrollTop {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 2px;
  background: var(--gradient-accent);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.8) translateY(10px);
  pointer-events: none;
  transition: all var(--transition-spring);
  box-shadow: var(--shadow-glow);
}
#scrollTop.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

@media (max-width: 900px) {
  .side-rail {
    position: fixed;
    top: 0;
    left: -100%;
    width: 260px;
    height: 100dvh;
    z-index: 200;
    border-right: none;
    background: var(--surface);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    transition: left var(--transition);
    padding-top: 5rem;
  }
  .side-open .side-rail { left: 0; }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--text) 40%, transparent);
    backdrop-filter: blur(4px);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
  }
  .side-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  #menuToggle {
    display: inline-flex;
  }

  .mobile-tab-bar {
    display: flex;
  }

  .app-shell {
    padding-bottom: 3.5rem;
  }

  #scrollTop {
    bottom: 5rem;
    right: 0.75rem;
    width: 40px;
    height: 40px;
  }
}

/* ─── Drag-to-Refresh ─── */
.pull-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}
.pull-indicator.visible {
  display: flex;
}
.pull-indicator .material-symbols-rounded {
  transition: transform var(--transition-fast);
}
.pull-indicator.ready .material-symbols-rounded {
  transform: rotate(180deg);
}
.pull-indicator.loading .material-symbols-rounded {
  animation: spin 0.6s linear infinite;
}

/* ─── Heartbeat animation for like ─── */
@keyframes heartbeat {
  0% { transform: scale(1); }
  25% { transform: scale(1.3); }
  50% { transform: scale(0.95); }
  75% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.fav-heartbeat {
  animation: heartbeat 0.5s ease;
}

/* ─── File preview in upload ─── */
.file-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.file-preview-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.file-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.file-preview-item .file-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: rgba(0,0,0,0.7);
  border: none;
  border-radius: 2px;
  color: #fff;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.file-preview-item:hover .file-preview-remove {
  opacity: 1;
}
.file-preview-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-size: 1.2rem;
}
.file-preview-icon .material-symbols-rounded {
  font-size: 1.5rem;
}

/* ─── PWA Install Prompt ─── */
.pwa-install-banner {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  animation: slideUpBanner 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}
@keyframes slideUpBanner {
  from { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.pwa-install-banner .material-symbols-rounded {
  color: var(--accent);
  font-size: 1.5rem;
}
.pwa-install-banner strong {
  font-size: 0.9rem;
}
.pwa-install-banner p {
  font-size: 0.8rem;
  color: var(--muted);
}
.pwa-install-banner .pwa-dismiss {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem;
}
.pwa-install-banner .pwa-dismiss:hover {
  color: var(--text);
}

/* ─── Custom Confirm Dialog ─── */
.custom-confirm-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--text) 50%, transparent);
  backdrop-filter: blur(4px);
  z-index: 99998;
}
.custom-confirm-dialog {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  backdrop-filter: blur(30px);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1.75rem;
  max-width: 400px;
  width: 90%;
  z-index: 99999;
  animation: dialogIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.custom-confirm-dialog h3 {
  margin-bottom: 0.5rem;
}
.custom-confirm-dialog p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
.custom-confirm-dialog .dialog-actions {
  margin-top: 0;
}
.custom-confirm-dialog.active,
.custom-confirm-backdrop.active {
  display: block;
}

/* ─── Transitions between views ─── */
.view {
  display: none;
  flex: 1;
  padding: var(--gap-lg);
  max-width: 100%;
  overflow-x: hidden;
}
.view.active {
  display: block;
  animation: viewEnter 0.35s cubic-bezier(0.21, 1.02, 0.73, 1);
}

@keyframes viewEnter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.overlay-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  z-index: 300;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow-y: auto;
  padding: 2rem 1rem;
}
.overlay-view .app-dialog {
  max-width: 700px;
  margin: 0 auto;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.75rem;
  animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--gap-md);
  margin-bottom: var(--gap-lg);
}
.section-heading.compact-heading {
  margin-bottom: var(--gap-sm);
}
.eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.15rem;
  font-weight: 600;
}


.hero-band {
  background: var(--gradient-card);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 2rem;
  margin-bottom: var(--gap-lg);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}
.hero-band::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 6%, transparent), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.hero-band h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.stat-strip {
  display: flex;
  gap: 2.5rem;
  margin-top: 1.25rem;
}
.stat-strip > div {
  position: relative;
}
.stat-strip > div + div::before {
  content: '';
  position: absolute;
  left: -1.25rem;
  top: 10%;
  height: 80%;
  width: 1px;
  background: var(--line);
}
.stat-strip strong {
  font-size: 2rem;
  font-weight: 800;
  display: block;
  line-height: 1;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-strip span {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
  display: block;
}

.category-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: var(--gap-lg);
  -webkit-overflow-scrolling: touch;
}
.category-strip::-webkit-scrollbar {
  height: 4px;
}
.category-strip::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}

.sort-select {
  background: var(--surface);
  backdrop-filter: blur(8px);
  color: var(--text);
  border: 1.5px solid var(--line);
  border-radius: 2px;
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border var(--transition-fast);
}
.sort-select:focus {
  border-color: var(--accent);
  outline: none;
}


.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: var(--gap-lg);
}
@media (max-width: 480px) {
  .project-grid { grid-template-columns: 1fr; }
}

.project-card {
  background: var(--gradient-card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}
.project-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-soft), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}
.project-card:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  transform: translateY(-4px);
}
.project-card:hover::after {
  opacity: 1;
}

.project-cover {
  height: 150px;
  background: var(--surface-2);
  border-radius: 2px;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.cover-icons {
  display: flex;
  gap: 0.5rem;
  color: var(--muted);
}

.project-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.project-icon {
  width: 44px;
  height: 44px;
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}
.project-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-title-row h3 {
  font-size: 1rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-title-row p {
  font-size: 0.8rem;
  color: var(--muted);
}

.project-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: -webkit-box;
  line-clamp: 3;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.7rem;
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.engine-tag {
  font-size: 0.75rem;
  background: var(--surface-3);
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  font-weight: 600;
}
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  background: var(--surface-3);
  color: var(--muted);
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  font-weight: 500;
  max-width: 9.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.meta-pill .material-symbols-rounded {
  font-size: 0.85rem;
}
.password-pill {
  background: rgba(200, 180, 74, 0.15);
  color: var(--yellow);
  font-family: monospace;
}

.rating-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.6rem;
}
.stars {
  display: flex;
  gap: 0.1rem;
}
.star-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: color-mix(in srgb, var(--muted) 60%, transparent);
  transition: all var(--transition-fast);
}
.star-button.filled {
  color: var(--yellow);
}
.star-button:hover {
  transform: scale(1.15);
}
.star-button .material-symbols-rounded {
  font-size: 1.25rem;
}
.rating-score {
  font-size: 0.8rem;
  color: var(--muted);
}

.download-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.download-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface);
  backdrop-filter: blur(4px);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 2px;
  padding: 0.45rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.download-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.download-button.primary {
  background: var(--gradient-accent);
  border-color: transparent;
  color: #fff;
  font-weight: 800;
  padding: 0.6rem 1rem;
  border-radius: 2px;
}
.download-button.primary:hover {
  transform: translateY(-2px);
}
.download-button:disabled {
  opacity: 0.35;
  pointer-events: none;
}
.download-button .material-symbols-rounded {
  font-size: 1rem;
}


.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4rem 1.5rem;
  gap: 0.6rem;
}
.empty-state .material-symbols-rounded {
  font-size: 3.5rem;
  color: var(--muted);
  opacity: 0.5;
}
.empty-state h3 {
  font-size: 1.15rem;
}
.empty-state p {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 360px;
}


.profile-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--gap-lg);
}
@media (max-width: 700px) {
  .profile-layout { grid-template-columns: 1fr; }
}

.profile-panel {
  background: var(--gradient-card);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1.75rem;
  text-align: center;
  backdrop-filter: blur(12px);
}
.profile-avatar-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 0 auto 0.85rem;
}
.profile-avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 2px;
  object-fit: cover;
}


.avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-accent);
  color: #fff;
  font-weight: 800;
  border-radius: 2px;
  padding: 0.18rem 0.5rem;
  font-size: 1rem;
  line-height: 1;
}


.profile-avatar-wrap .avatar-fallback,
.studio-avatar .avatar-fallback,
.studio-member-avatar .avatar-fallback,
.project-icon .avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}


.detail-owner .avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  font-size: 1rem;
}

.avatar-fallback.mini {
  width: 1.8rem;
  height: 1.8rem;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.avatar-upload-button {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 30px;
  height: 30px;
  background: var(--surface-solid);
  border: 2px solid var(--surface);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.avatar-upload-button:hover {
  background: var(--gradient-accent);
  transform: scale(1.1);
}
.avatar-upload-button .material-symbols-rounded {
  font-size: 0.9rem;
  color: var(--text);
}
.avatar-upload-button:hover .material-symbols-rounded {
  color: #fff;
}
.avatar-upload-button input {
  display: none;
}

.profile-facts {
  display: grid;
  gap: 0.5rem;
  text-align: left;
  margin: 1.25rem 0 0;
}
.profile-facts div {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
}
.profile-facts dt {
  color: var(--muted);
}
.profile-facts dd {
  margin: 0;
  font-weight: 600;
}

.profile-project-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile-project {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--gradient-card);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.85rem;
  transition: all var(--transition-fast);
}
.profile-project:hover {
  border-color: var(--accent);
  transform: translateX(3px);
}
.profile-project h3 {
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-project p {
  font-size: 0.8rem;
  color: var(--muted);
}


.studio-card,
.studio-sub-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--gradient-card);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.85rem;
  margin-bottom: 0.5rem;
  transition: all var(--transition-fast);
}
.studio-card:hover,
.studio-sub-card:hover {
  border-color: var(--accent);
}
.studio-avatar {
  width: 48px;
  height: 48px;
  border-radius: 2px;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
  overflow: hidden;
}
.studio-avatar.large {
  width: 60px;
  height: 60px;
  font-size: 1.4rem;
}
.studio-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.studio-info {
  flex: 1;
  min-width: 0;
}
.studio-info h3 {
  font-size: 0.95rem;
}
.studio-info p {
  font-size: 0.8rem;
  color: var(--muted);
}
.studio-meta {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.studio-meta .material-symbols-rounded {
  font-size: 0.85rem;
  vertical-align: middle;
}
.studio-actions {
  display: flex;
  gap: 0.4rem;
}


.studio-hero {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.studio-hero-actions {
  margin-left: auto;
}
.studio-section {
  margin-top: 1rem;
}
.studio-section-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.badge {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 2px;
  font-weight: 600;
}
.studio-member-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
}
.studio-member-avatar {
  width: 34px;
  height: 34px;
  border-radius: 2px;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.studio-member-info {
  flex: 1;
}
.studio-member-name {
  font-size: 0.9rem;
  font-weight: 600;
}
.studio-member-role {
  font-size: 0.75rem;
  color: var(--muted);
}
.studio-member-controls {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.support-chat-container {
  display: flex;
  flex-direction: column;
  height: 55vh;
  max-height: 500px;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  background: var(--surface);
  backdrop-filter: blur(12px);
}
.support-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.support-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 0.5rem;
  color: var(--muted);
  text-align: center;
}
.msg {
  max-width: 80%;
  padding: 0.65rem 1rem;
  border-radius: 2px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.msg.user {
  align-self: flex-end;
  background: var(--gradient-accent);
  color: #fff;
}
.msg.admin {
  align-self: flex-start;
  background: var(--surface-2);
  backdrop-filter: blur(4px);
}
.msg-label {
  font-size: 0.7rem;
  font-weight: 600;
  display: block;
  margin-bottom: 0.2rem;
  opacity: 0.7;
}
.support-chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  backdrop-filter: blur(8px);
}
.support-chat-form input {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 2px;
  padding: 0.6rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
  transition: border var(--transition-fast);
}
.support-chat-form input:focus {
  border-color: var(--accent);
  outline: none;
}


.settings-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.settings-card {
  background: var(--gradient-card);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1.25rem;
  backdrop-filter: blur(8px);
}
.settings-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.settings-card-header .material-symbols-rounded {
  color: var(--accent);
}
.settings-card.danger-zone {
  border-color: color-mix(in srgb, var(--red) 30%, transparent);
}
.settings-card.danger-zone .settings-card-header .material-symbols-rounded {
  color: var(--red);
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.9rem;
}


.progress-wrap {
  margin: 1rem 0;
}
.progress-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.progress-track span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--gradient-accent);
  border-radius: 2px;
  transition: width var(--transition);
}
#uploadStatus,
#uploadingStatus {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.4rem;
}


.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  margin: 1rem 0;
}
@media (max-width: 540px) {
  .upload-grid { grid-template-columns: 1fr 1fr; }
}


.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--gradient-card);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.6rem 0.8rem;
  transition: all var(--transition-fast);
}
.leaderboard-row:hover {
  border-color: var(--accent);
  transform: translateX(3px);
}
.leaderboard-rank {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  background: var(--surface-3);
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.leaderboard-rank.top1 {
  background: var(--gradient-warm);
  color: #fff;
}
.leaderboard-rank.top2 {
  background: var(--surface-3);
  color: var(--muted);
}
.leaderboard-rank.top3 {
  background: var(--orange);
  color: #fff;
}
.leaderboard-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
}
.leaderboard-stat {
  font-size: 0.8rem;
  color: var(--muted);
}


.security-panel {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--gradient-card);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1.5rem;
}
.security-panel .material-symbols-rounded {
  font-size: 2rem;
  color: var(--green);
}


#lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  background: color-mix(in srgb, #000 92%, transparent);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
#lightbox.active {
  opacity: 1;
  pointer-events: auto;
}
#lightbox img {
  max-width: 90%;
  max-height: 85%;
  border-radius: 2px;
}


#profileEditForm {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1rem;
  margin-top: 0.75rem;
}
#profileEditForm .field {
  margin-bottom: 0.75rem;
}
#profileEditForm .dialog-actions {
  margin-top: 0;
}

.releases-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.release-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--line);
}
.release-item:last-child {
  border-bottom: none;
}

.upload-notice {
  background: var(--gradient-card);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.moderator-comment {
  background: color-mix(in srgb, var(--red) 6%, transparent);
  border-left: 3px solid var(--red);
  padding: 0.4rem 0.7rem;
  border-radius: 0 2px 2px 0;
  font-size: 0.85rem;
}


.toast-region {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 380px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 0.8rem 1.1rem;
  font-size: 0.9rem;
  pointer-events: auto;
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.removing {
  opacity: 0;
  transform: translateX(40px);
  pointer-events: none;
}
.toast.error {
  border-color: color-mix(in srgb, var(--red) 40%, transparent);
}
.toast.error .toast-icon {
  color: var(--red);
}
.toast.info {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.toast.info .toast-icon {
  color: var(--accent);
}
.toast.success {
  border-color: color-mix(in srgb, var(--green) 40%, transparent);
}
.toast.success .toast-icon {
  color: var(--green);
}
.toast-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}
.toast-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 2px;
  transition: all var(--transition-fast);
}
.toast-close:hover {
  background: var(--surface-2);
  color: var(--text);
}
.toast-close .material-symbols-rounded {
  font-size: 1rem;
}

.toast.undo {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.toast .undo-btn {
  background: var(--gradient-accent);
  color: #fff;
  border: none;
  border-radius: 2px;
  padding: 0.3rem 0.6rem;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-left: auto;
  flex-shrink: 0;
}
.toast .undo-btn:hover {
  transform: scale(1.05);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}


::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--line-strong);
}


@media (prefers-color-scheme: light) {
  html[data-theme="auto"] {
    color-scheme: light;
    --bg: #f0f0f5;
    --bg-gradient: radial-gradient(ellipse 80% 50% at 50% 0%, #e4e4ed 0%, #f0f0f5 70%);
    --surface: rgba(255, 255, 255, 0.85);
    --surface-solid: #ffffff;
    --surface-2: rgba(245, 245, 250, 0.85);
    --surface-3: #d4d4de;
    --text: #1a1a24;
    --text-secondary: #3a3a4a;
    --muted: #6e6e82;
    --line: rgba(140, 140, 158, 0.45);
    --line-strong: #9494aa;
    --accent: #8686a0;
    --accent-strong: #72728a;
    --accent-glow: rgba(134, 134, 160, 0.15);
    --accent-soft: rgba(134, 134, 160, 0.08);
    --blue: #6a6abc;
    --yellow: #b8a838;
    --red: #cc5050;
    --green: #5a9e5a;
    --orange: #b8883a;
    --pink: #b8689a;
    --purple: #8a6abc;
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.05);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.09);
    --shadow-glow: 0 0 24px rgba(134, 134, 160, 0.1);
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.05);
  }
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --bg: #0d0d10;
    --bg-gradient: radial-gradient(ellipse 80% 50% at 50% 0%, #16161d 0%, #0d0d10 70%);
    --surface: rgba(22, 22, 28, 0.75);
    --surface-solid: #16161c;
    --surface-2: rgba(30, 30, 38, 0.65);
    --surface-3: #32323d;
    --text: #f0f0f4;
    --text-secondary: #c8c8d3;
    --muted: #8a8a9e;
    --line: rgba(70, 70, 85, 0.5);
    --line-strong: #4a4a5e;
    --accent: #9e9eb8;
    --accent-strong: #8a8aa0;
    --accent-glow: rgba(158, 158, 184, 0.25);
    --accent-soft: rgba(158, 158, 184, 0.12);
    --blue: #7e7ece; --yellow: #c8b84a; --red: #e06060; --green: #7eb87e; --orange: #c8984a;
    --pink: #c878a8; --purple: #9e7ece;
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.25);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 24px rgba(158, 158, 184, 0.12);
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.18);
  }
}


button, a.button, .icon-button, .avatar-button, .rail-item, .project-card, .studio-card, .tab-button, .chip-button, .download-button, .project-title-row, .profile-project, .studio-member-row, .project-icon, .project-cover, .search-bar {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}


button::selection, .icon-button::selection, .avatar-button::selection, .rail-item::selection, .project-card::selection, .studio-card::selection, .tab-button::selection, .chip-button::selection, .download-button::selection, .project-title-row::selection, .project-icon::selection {
  background: transparent;
  color: inherit;
}


.allow-select { -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text; }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: 0.5rem;
}
.pagination-info {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  min-width: 4rem;
  text-align: center;
}
.pagination-bar .outline-button.compact {
  padding: 0.45rem 0.7rem;
  min-width: 2.4rem;
}
.pagination-bar .outline-button.compact:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.history-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
}
.history-strip::-webkit-scrollbar {
  height: 4px;
}
.history-strip::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}
.history-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text);
  font-size: 0.8rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
}
.history-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.history-chip img,
.history-chip-icon {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 2px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
}
.history-chip-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.accent-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.accent-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: 100px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  position: relative;
  min-width: 0;
}
.accent-pill:hover {
  border-color: var(--pill-color);
  background: var(--pill-color-soft);
  color: var(--pill-color);
}
.accent-pill.active {
  border-color: var(--pill-color);
  background: var(--pill-color-soft);
  color: var(--pill-color);
  font-weight: 600;
}
.accent-pill-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.accent-pill-label {
  white-space: nowrap;
}
.accent-pill-check {
  font-size: 1rem !important;
  margin-left: 0.2rem;
}

/* Google Play inspired refresh */
:root {
  --play-green: #01875f;
  --play-green-hover: #056449;
  --play-blue: #1a73e8;
  --play-orange: #f29900;
  --play-surface: color-mix(in srgb, var(--surface-solid) 86%, var(--bg) 14%);
}

.topbar {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar.scrolled {
  box-shadow: 0 10px 24px color-mix(in srgb, #000 8%, transparent);
}

.brand-copy strong {
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--text);
}

.search-bar {
  max-width: 620px;
  min-height: 46px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 82%, var(--surface-solid) 18%);
  box-shadow: none;
}

.search-bar:focus-within {
  border-color: color-mix(in srgb, var(--play-blue) 50%, var(--line));
  background: var(--surface-solid);
}

.hero-band {
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--play-green) 12%, var(--surface-solid)), var(--play-surface) 56%),
    var(--play-surface);
  box-shadow: var(--shadow-soft);
}

.hero-band::before {
  display: none;
}

.hero-band h2 {
  max-width: 760px;
  letter-spacing: 0;
}

.category-strip,
.accent-pills,
.history-strip {
  scroll-snap-type: x proximity;
}

.chip-button,
.accent-pill,
.history-chip {
  border-radius: 999px;
  scroll-snap-align: start;
}

.project-grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.15rem;
  align-items: stretch;
}

.project-card.play-card {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-height: 100%;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.project-card.play-card::after {
  display: none;
}

.project-card.play-card:hover {
  border-color: transparent;
  transform: translateY(-2px);
}

.project-card.play-card:hover .play-cover,
.project-card.play-card:focus-visible .play-cover {
  box-shadow: 0 12px 28px color-mix(in srgb, #000 14%, transparent);
}

.project-cover.play-cover {
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 0;
  border-radius: 8px;
  background-color: color-mix(in srgb, var(--surface-3) 76%, var(--play-blue) 24%);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--line);
  transition: box-shadow var(--transition), transform var(--transition);
}

.project-cover-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, color-mix(in srgb, #000 20%, transparent));
  pointer-events: none;
}

.cover-icons .material-symbols-rounded {
  font-size: 2rem;
}

.cover-badges {
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  bottom: 0.55rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.cover-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 24px;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  font-size: 0.7rem;
  font-weight: 800;
  box-shadow: 0 4px 18px color-mix(in srgb, #000 18%, transparent);
}

.cover-badge .material-symbols-rounded {
  font-size: 0.9rem;
  color: var(--play-green);
}

.project-title-row.play-title-row {
  margin: 0;
  align-items: center;
  min-width: 0;
}

.project-icon.play-icon {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.play-title-copy {
  min-width: 0;
  flex: 1;
}

.play-title-copy h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
}

.play-title-copy .user-clickable,
.plain-link {
  border: 0;
  background: none;
  color: var(--play-green);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-align: left;
}

.play-card-favorite {
  margin-left: auto;
}

.play-card-favorite .icon-button {
  width: 2.2rem;
  height: 2.2rem;
  min-height: 2.2rem;
}

.play-store-meta,
.play-stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

.play-store-meta > span,
.play-stat-row > span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Auth loading overlay */
.auth-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeIn 0.2s ease;
}
.auth-loading-overlay.active {
  display: flex;
}
.auth-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.auth-loading-text {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Auth divider for Google sign-in */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 0.25rem 0;
  color: var(--muted);
  font-size: 0.85rem;
  gap: 0.5rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Moderation badge count on nav rail */
.rail-item .mod-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 1rem;
  background: var(--red);
  color: #fff;
  margin-left: auto;
}

.play-store-meta > span:last-child,
.play-stat-row > span:last-child {
  border-right: 0;
}

.play-store-meta strong,
.play-stat-row strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  max-width: 100%;
  font-size: 0.88rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-store-meta small,
.play-stat-row small {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-store-meta .material-symbols-rounded,
.play-stat-row .material-symbols-rounded {
  font-size: 0.9rem;
  color: var(--play-orange);
}

.project-card.play-card .project-description {
  min-height: 3.3rem;
  margin: 0;
  line-clamp: 2;
  -webkit-line-clamp: 2;
}

.play-card-actions,
.detail-action-row {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.download-button {
  min-height: 40px;
  border-radius: 999px;
  font-weight: 700;
}

.download-button.primary {
  background: var(--play-green);
  color: #fff;
  border-color: var(--play-green);
  border-radius: 999px;
}

.download-button.primary:hover {
  background: var(--play-green-hover);
  border-color: var(--play-green-hover);
}

.download-button.is-refreshing-link .material-symbols-rounded {
  animation: spin 0.9s linear infinite;
}

#projectPageDetails {
  padding: 0 !important;
}

.play-detail {
  display: grid;
  gap: 1.15rem;
}

.play-detail-hero {
  display: grid;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.2rem;
}

.play-detail-cover {
  min-height: clamp(180px, 30vw, 330px);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--play-green) 18%, var(--surface-3)), var(--surface-2));
  background-size: cover;
  background-position: center;
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.play-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.play-detail-icon {
  width: 84px;
  height: 84px;
  border-radius: 8px;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm);
}

.play-detail-icon img,
.play-detail-icon .avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
}

.play-detail-title {
  min-width: 0;
}

.play-detail-title h3 {
  font-size: clamp(1.55rem, 3vw, 2.45rem);
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.play-detail .play-stat-row {
  max-width: 560px;
}

.detail-action-row .download-button.primary {
  min-width: min(260px, 100%);
  justify-content: center;
}

.detail-secondary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.detail-secondary-actions .outline-button {
  border-radius: 999px;
}

.accent-action {
  color: var(--play-green);
}

.play-detail-section {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.play-detail-section h3 {
  font-size: 1.18rem;
  letter-spacing: 0;
}

.detail-description {
  max-width: 840px;
  color: var(--text-secondary);
  line-height: 1.65;
  white-space: pre-wrap;
}

.detail-rating-row {
  margin-top: 0.8rem;
}

.play-screenshot-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 260px);
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.2rem 0 0.8rem;
  scroll-snap-type: x mandatory;
}

.play-screenshot-strip img {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  scroll-snap-align: start;
  background: var(--surface-2);
}

.empty-detail-media {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
}

.empty-detail-media .material-symbols-rounded {
  color: var(--play-blue);
}

.comment-form {
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
}

.comment-form textarea {
  border-radius: 8px;
}

.comment-counter {
  color: var(--muted);
  text-align: right;
  font-size: 0.75rem;
}

@media (max-width: 760px) {
  .topbar {
    gap: 0.55rem;
    padding: 0.55rem 0.75rem;
  }

  .brand-copy small {
    display: none;
  }

  .search-bar {
    order: 4;
    flex-basis: 100%;
    max-width: none;
  }

  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 0.85rem;
  }

  .project-card.play-card {
    gap: 0.65rem;
  }

  .project-icon.play-icon {
    width: 48px;
    height: 48px;
  }

  .play-store-meta {
    grid-template-columns: repeat(3, 1fr);
  }

  .play-store-meta > span {
    min-height: 46px;
  }

  .play-card-actions .download-button:not(.primary) {
    flex: 1 1 auto;
  }

  .play-detail-header {
    align-items: flex-start;
  }

  .play-detail-icon {
    width: 72px;
    height: 72px;
  }

  .play-detail .play-stat-row,
  .detail-action-row .download-button {
    width: 100%;
  }

  .detail-action-row .download-button {
    justify-content: center;
  }
}

@media (max-width: 430px) {
  .project-grid {
    grid-template-columns: 1fr;
  }

  .play-screenshot-strip {
    grid-auto-columns: minmax(165px, 72vw);
  }
}
