        :root {
            color-scheme: dark;
        }
        * {
            box-sizing: border-box;
        }
        body {
            margin: 0;
            font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
            background: radial-gradient(circle at top, #1f2937 0, #020617 42%, #000 100%);
            color: #e5e7eb;
        }
        a {
            color: inherit;
            text-decoration: none;
        }
        header {
            border-bottom: 1px solid rgba(15,23,42,0.9);
            background: linear-gradient(to right, #020617dd, #020617cc);
            backdrop-filter: blur(12px);
            position: sticky;
            top: 0;
            z-index: 20;
        }
        .nav-inner {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0.8rem 1.25rem;
            display: flex;
            align-items: center;
            gap: 1rem;
        }
        .brand {
            font-weight: 800;
            letter-spacing: 0.06em;
            font-size: 1rem;
            text-transform: uppercase;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        .brand-pill {
            width: 26px;
            height: 26px;
            border-radius: 999px;
            background: radial-gradient(circle at 30% 20%, #a855f7, #ec4899);
            box-shadow: 0 0 24px rgba(236, 72, 153, 0.5);
        }
        .nav-spacer {
            flex: 1;
        }
        .nav-chip {
            font-size: 0.8rem;
            padding: 0.25rem 0.7rem;
            border-radius: 999px;
            border: 1px solid #374151;
            background: #020617;
            color: #9ca3af;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 80px;
        }
        .nav-chip strong {
            margin-left: 0.25rem;
            color: #bbf7d0;
        }

        main {
            max-width: 1200px;
            margin: 0 auto;
            padding: 1.5rem 1.25rem 3rem;
        }

        .admin-bar {
            display: flex;
            justify-content: flex-end;
            margin-bottom: 0.75rem;
        }

        .layout {
            display: grid;
            grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
            gap: 1.5rem;
        }
        @media (max-width: 900px) {
            .layout {
                grid-template-columns: minmax(0, 1fr);
            }
        }

        .sidebar {
            background: rgba(15,23,42,0.95);
            border-radius: 1rem;
            padding: 1rem;
            border: 1px solid #111827;
            box-shadow: 0 22px 60px rgba(0,0,0,0.65);
        }
        .sidebar h2 {
            font-size: 0.95rem;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: #9ca3af;
            margin: 0 0 0.75rem;
        }
        .type-toggle {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 1rem;
        }
        .pill {
            flex: 1;
            text-align: center;
            font-size: 0.8rem;
            padding: 0.35rem 0.4rem;
            border-radius: 999px;
            border: 1px solid #374151;
            background: #020617;
            color: #9ca3af;
            cursor: pointer;
        }
        .pill.active {
            background: radial-gradient(circle at 10% 0%, #22c55e, #14b8a6);
            border-color: transparent;
            color: #020617;
            font-weight: 600;
        }

        .category-list {
            list-style: none;
            margin: 0;
            padding: 0;
            max-height: none;
            overflow: visible;
        }
        .category-item {
            margin-bottom: 0.2rem;
        }
        .category-link {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.35rem 0.55rem;
            border-radius: 0.6rem;
            font-size: 0.85rem;
            cursor: pointer;
        }
        .category-link:hover {
            background: #0b1120;
        }
        .category-link.active {
            background: #111827;
            color: #f9fafb;
        }
        .badge-count {
            font-size: 0.75rem;
            color: #6b7280;
        }

        .content-header {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
            align-items: center;
            margin-bottom: 1rem;
        }
        .content-header-text {
            flex: 1 1 auto;
        }
        .content-header-text h1 {
            font-size: 1.3rem;
            margin: 0;
        }
        .content-header-text p {
            margin: 0.1rem 0 0;
            font-size: 0.85rem;
            color: #9ca3af;
        }
        .legend {
            margin: 0.35rem 0 0;
            font-size: 0.78rem;
            color: #9ca3af;
        }

        .search-wrap {
            flex: 0 0 260px;
            display: flex;
            align-items: center;
            gap: 0.4rem;
            background: #020617;
            border-radius: 999px;
            padding: 0.25rem 0.7rem;
            border: 1px solid #1f2937;
        }
        .search-wrap input {
            flex: 1;
            border: none;
            background: transparent;
            color: #f9fafb;
            font-size: 0.85rem;
            outline: none;
        }
        .search-wrap span {
            font-size: 0.8rem;
            color: #6b7280;
        }
        @media (max-width: 700px) {
            .search-wrap {
                flex: 1 1 100%;
            }
        }

        .emote-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
            gap: 0.9rem;
        }
        .emote-card {
            background: radial-gradient(circle at top left, #111827, #020617 60%);
            border-radius: 1rem;
            padding: 0.7rem 0.7rem 0.75rem;
            border: 1px solid rgba(31,41,55,0.9);
            box-shadow: 0 16px 40px rgba(0,0,0,0.7);
            display: flex;
            flex-direction: column;
            gap: 0.4rem;
        }
        .emote-thumb {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0.2rem 0 0.1rem;
        }
        .emote-thumb img.emote-preview {
            display: block;
            image-rendering: pixelated;
            max-width: 100%;
            height: auto;
        }

        .chat-preview-bars {
            margin-top: 0.25rem;
            display: flex;
            flex-direction: column;
            gap: 0.2rem;
        }
        .chat-preview-bars img {
            display: block;
            width: 100%;
            max-width: 100%;
            border-radius: 0.5rem;
            border: 1px solid #1f2937;
        }

        .emote-meta {
            display: flex;
            flex-direction: column;
            gap: 0.1rem;
        }
        .emote-name-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.35rem;
        }
        .emote-name {
            font-size: 0.9rem;
            font-weight: 500;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .new-badge {
            font-size: 0.7rem;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            padding: 0.06rem 0.45rem;
            border-radius: 999px;
            background: radial-gradient(circle at 10% 0%, #f97316, #facc15);
            color: #111827;
            font-weight: 700;
            box-shadow: 0 0 12px rgba(248, 250, 252, 0.25);
            white-space: nowrap;
        }

        .emote-tags {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.75rem;
            color: #9ca3af;
        }
        .tag-chip {
            padding: 0.05rem 0.45rem;
            border-radius: 999px;
            border: 1px solid #1f2937;
            font-size: 0.7rem;
        }
        .tag-chip.badge-chip {
            border-color: #f59e0b;
            color: #fbbf24;
        }
        .tag-chip.emote-chip {
            border-color: #22c55e;
            color: #6ee7b7;
        }

        .emote-actions {
            margin-top: 0.25rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 0.4rem;
            font-size: 0.78rem;
        }
        .owned-pill {
            padding: 0.15rem 0.5rem;
            border-radius: 999px;
            border: 1px solid #22c55e;
            color: #bbf7d0;
            background: rgba(22,163,74,0.16);
            font-weight: 600;
            white-space: nowrap;
        }
        .download-link {
            font-size: 0.78rem;
            padding: 0.2rem 0.55rem;
            border-radius: 999px;
            border: 1px solid #1d4ed8;
            background: rgba(59,130,246,0.15);
            color: #bfdbfe;
            white-space: nowrap;
        }
        .buy-form {
            flex: 1;
        }
        .buy-btn {
            width: 100%;
            border-radius: 999px;
            border: 1px solid #22c55e;
            background: #22c55e;
            color: #020617;
            font-size: 0.8rem;
            font-weight: 600;
            padding: 0.3rem 0.4rem;
            cursor: pointer;
        }
        .buy-btn[disabled] {
            opacity: 0.6;
            cursor: not-allowed;
        }
        .need-credits {
            font-size: 0.76rem;
            color: #f97316;
        }
        .need-credits a {
            color: #fdba74;
            text-decoration: underline;
        }
        .signin-note {
            font-size: 0.76rem;
            color: #9ca3af;
        }
        .signin-note a {
            text-decoration: underline;
        }

        .empty-state {
            margin-top: 2rem;
            text-align: center;
            color: #6b7280;
            font-size: 0.9rem;
        }
		/* ==========================================================
   ADDITIONS (from challenge page styles) — safe to append
   ========================================================== */

/* Minor nav-chip improvement (gap) */
.nav-chip { gap: 0.25rem; }

/* Generic card */
.card {
  background: #020617;
  border-radius: 1.2rem;
  border: 1px solid #111827;
  padding: 1.5rem 1.7rem;
  box-shadow: 0 22px 60px rgba(0,0,0,0.8);
}
.card + .card { margin-top: 1.4rem; }

/* Intro / welcome card bits */
.intro-title {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
}
.intro-text {
  font-size: 0.95rem;
  color: #d1d5db;
  line-height: 1.7;
}
.intro-steps {
  margin-top: 0.9rem;
  font-size: 0.9rem;
  color: #e5e7eb;
  padding-left: 1.25rem;
}
.intro-steps li { margin-bottom: 0.35rem; }

/* Challenge header block */
.challenge-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
}
.challenge-title h1 {
  margin: 0;
  font-size: 1.4rem;
}
.challenge-title p {
  margin: 0.4rem 0 0.6rem;
  font-size: 0.9rem;
  color: #9ca3af;
}

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  gap: 0.35rem;
}
.status-active {
  background: rgba(34,197,94,0.15);
  border: 1px solid #22c55e;
  color: #bbf7d0;
}
.status-upcoming {
  background: rgba(56,189,248,0.15);
  border: 1px solid #38bdf8;
  color: #bae6fd;
}
.status-ended {
  background: rgba(239,68,68,0.15);
  border: 1px solid #ef4444;
  color: #fecaca;
}

/* Meta chips row */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #9ca3af;
}
.meta-item {
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #111827;
  background: radial-gradient(circle at top left, #111827, #020617);
}

/* Main description */
.description {
  margin-top: 1.2rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #e5e7eb;
}

/* Example block */
.example-block {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #9ca3af;
}
.example-block img {
  margin-top: 0.5rem;
  max-width: 100%;
  height: auto;
  border-radius: 0.8rem;
  border: 1px solid #111827;
}

/* Notices */
.notice {
  margin-top: 1rem;
  padding: 0.6rem 0.9rem;
  border-radius: 0.8rem;
  font-size: 0.85rem;
}
.notice-warning {
  background: rgba(251,191,36,0.09);
  border: 1px solid #fbbf24;
  color: #fef9c3;
}
.notice-error {
  background: rgba(239,68,68,0.09);
  border: 1px solid #ef4444;
  color: #fecaca;
}
.notice-success {
  background: rgba(34,197,94,0.09);
  border: 1px solid #22c55e;
  color: #bbf7d0;
}
.notice-info {
  background: rgba(59,130,246,0.08);
  border: 1px solid #3b82f6;
  color: #dbeafe;
}

/* Requirements block */
.requirements {
  margin-top: 1.1rem;
  font-size: 0.9rem;
}
.requirements h2 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}
.requirements ol {
  margin: 0;
  padding-left: 1.25rem;
}
.requirements li {
  margin-bottom: 0.3rem;
  line-height: 1.5;
}
.requirements strong { font-weight: 600; }

/* CTA row + button */
.cta-row {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
}
.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.3rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid #22c55e;
  background: #22c55e;
  color: #020617;
  cursor: pointer;
}
.cta-btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.cta-info {
  font-size: 0.8rem;
  color: #9ca3af;
}
.cta-info a { text-decoration: underline; }

/* Current submission panel */
.current-submission {
  margin-top: 1.3rem;
  padding-top: 1rem;
  border-top: 1px dashed #111827;
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 1rem;
}
@media (max-width: 800px) {
  .current-submission { grid-template-columns: minmax(0, 1fr); }
}
.current-submission h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}
.submission-image { text-align: center; }
.submission-image img {
  max-width: 100%;
  height: auto;
  border-radius: 0.8rem;
  border: 1px solid #111827;
}
.submission-meta {
  font-size: 0.85rem;
  color: #9ca3af;
}

/* History card */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
}
.history-header h2 {
  margin: 0;
  font-size: 1.1rem;
}
.points-pill {
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  border: 1px solid #22c55e;
  background: rgba(34,197,94,0.12);
  font-size: 0.82rem;
  color: #bbf7d0;
}
.history-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem;
}
.history-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  font-size: 0.82rem;
  border-radius: 0.7rem;
  padding: 0.45rem 0.55rem;
  background: radial-gradient(circle at top left, #020617, #020617 60%);
  border: 1px solid #111827;
}
.history-thumb img {
  width: 60px;
  height: auto;
  border-radius: 0.4rem;
  border: 1px solid #111827;
  display: block;
}
.history-main { min-width: 0; }
.history-title {
  font-weight: 500;
  margin-bottom: 0.2rem;
}
.history-meta {
  color: #9ca3af;
  font-size: 0.78rem;
}
.history-status-pill {
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  text-align: center;
  min-width: 80px;
}
.hs-pending {
  background: rgba(251,191,36,0.15);
  border: 1px solid #fbbf24;
  color: #fef9c3;
}
.hs-approved {
  background: rgba(34,197,94,0.15);
  border: 1px solid #22c55e;
  color: #bbf7d0;
}
.hs-rejected {
  background: rgba(239,68,68,0.15);
  border: 1px solid #ef4444;
  color: #fecaca;
}

/* Extra objective highlight */
.challenge-objective {
  margin-top: 1.2rem;
  padding: 1rem 1.2rem;
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 1.15rem;
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.5;
  text-shadow: 0 0 4px rgba(0,0,0,0.4);
}
/* ==========================================================
   ADDITIONS (form + alerts + file upload)
   ========================================================== */

/* Card typography defaults */
.card h1 {
  margin: 0 0 0.6rem;
  font-size: 1.35rem;
}
.card p {
  margin: 0.2rem 0 0.6rem;
  font-size: 0.9rem;
  color: #9ca3af;
}

/* Alerts (simple banners) */
.alert {
  margin-bottom: 0.8rem;
  padding: 0.7rem 0.9rem;
  border-radius: 0.75rem;
  font-size: 0.88rem;
}
.alert-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid #ef4444;
  color: #fecaca;
}
.alert-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid #22c55e;
  color: #bbf7d0;
}

/* Meta helper text */
.meta {
  margin: 0.6rem 0 1rem;
  font-size: 0.86rem;
  color: #9ca3af;
}

/* Basic form styling */
form { margin-top: 1rem; }

label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

input[type="file"] {
  font-size: 0.86rem;
  margin-bottom: 0.7rem;
}

.hint {
  font-size: 0.78rem;
  color: #6b7280;
  margin-bottom: 0.8rem;
}

button[type="submit"] {
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  border: 1px solid #22c55e;
  background: #22c55e;
  color: #020617;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Custom file upload button */
.file-upload-wrapper {
  display: inline-block;
  position: relative;
}

.file-upload-btn {
  background: #22c55e;
  border: 1px solid #22c55e;
  color: #020617;
  padding: 0.45rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  display: inline-block;
}

/* Invisible input overlays the button (click-through) */
.file-upload-wrapper input[type="file"] {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
/* ==========================================================
   ADDITIONS (Achievements page UI)
   ========================================================== */

/* Generic headings */
h1 {
  margin: 0 0 0.8rem;
  font-size: 1.6rem;
}
p.lead {
  margin: 0 0 1.4rem;
  font-size: 0.95rem;
  color: #9ca3af;
}

/* Achievements summary row */
.ach-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}
.ach-summary {
  flex: 1 1 160px;
  background: radial-gradient(circle at top, #020617, #020617 55%);
  border-radius: 0.9rem;
  border: 1px solid #111827;
  padding: 0.7rem 0.9rem;
  font-size: 0.8rem;
}
.ach-summary-label {
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
}
.ach-summary-value {
  margin-top: 0.15rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.ach-summary-value span.sub {
  font-size: 0.8rem;
  color: #6b7280;
  margin-left: 0.2rem;
}

/* Section titles */
.ach-section-title {
  margin: 1.4rem 0 0.6rem;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.ach-section-title span.icon { font-size: 1.1rem; }

.ach-section-subtitle {
  margin: 0 0 0.9rem;
  font-size: 0.86rem;
  color: #9ca3af;
}

/* Achievements grid */
.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.8rem;
}

/* Achievements cards */
.ach-card {
  border-radius: 0.95rem;
  border: 1px solid #111827;
  padding: 0.75rem 0.85rem 0.8rem;
  background: radial-gradient(circle at top left, #020617, #020617 60%);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.9rem;
}
.ach-card.locked {
  opacity: 0.7;
  border-style: dashed;
}

.ach-card-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.1rem;
}

/* Badge icon circles */
.ach-badge {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.ach-badge.unlocked {
  background: radial-gradient(circle at 20% 0%, #facc15, #f97316);
  box-shadow: 0 0 18px rgba(250,204,21,0.35);
}
.ach-badge.locked {
  background: radial-gradient(circle at 20% 0%, #111827, #020617);
  box-shadow: 0 0 14px rgba(15,23,42,0.8);
  color: #9ca3af;
}

/* Text blocks */
.ach-name { font-weight: 600; }
.ach-desc {
  font-size: 0.83rem;
  color: #9ca3af;
}
.ach-meta {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: #6b7280;
}
.ach-empty {
  font-size: 0.9rem;
  color: #9ca3af;
}

/* Mobile spacing */
@media (max-width: 700px) {
  .card {
    padding: 1.4rem 1.3rem 1.6rem;
  }
}

/* ==========================================================
   ADDITIONS (Profile card / buttons / achievements list)
   ========================================================== */

/* Profile-style rows */
.row { margin-bottom: 1rem; }

.label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  margin-bottom: 0.15rem;
}

.value { font-size: 1rem; }

.credits {
  font-weight: 700;
  color: #86efac;
}

/* Button system (note: you already have .btn in some pages; this is compatible) */
.actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  flex: 1;
  text-align: center;
  padding: 0.65rem 0.7rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid #22c55e;
  background: #22c55e;
  color: #020617;
}

.btn.secondary {
  background: transparent;
  border-color: #4b5563;
  color: #e5e7eb;
}

.btn.warning {
  background: #16a34a;
  border-color: #16a34a;
  color: #020617;
}

.btn:hover { filter: brightness(1.05); }

.btn-small {
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  font-size: 0.85rem;
  flex: none;
}

/* Achievements (list variant, different to grid variant) */
.achievements {
  margin-top: 1.8rem;
  padding-top: 1.5rem;
  border-top: 1px solid #111827;
}

.achievements-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.achievements-title span.icon { font-size: 1.1rem; }

.achievements-subtitle {
  font-size: 0.86rem;
  color: #9ca3af;
  margin-bottom: 0.9rem;
}

.ach-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ach-item {
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid #111827;
  background: radial-gradient(circle at top left, #020617, #020617 60%);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.88rem;
}

.ach-item + .ach-item { margin-top: 0.5rem; }

/* Note: .ach-name / .ach-desc / .ach-meta / .ach-empty already exist from earlier */

/* ==========================================================
   ADDITIONS (Custom CTA + emote variants + download sizes)
   ========================================================== */

/* Page subtitle */
.subtitle {
  margin: 0 0 1.3rem;
  font-size: 0.9rem;
  color: #9ca3af;
}

/* Custom CTA block */
.custom-cta {
  margin-bottom: 1.4rem;
  padding: 0.9rem 1rem;
  border-radius: 0.9rem;
  border: 1px solid #111827;
  background: radial-gradient(circle at top left, #0b1120, #020617 65%);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.custom-cta-text {
  flex: 1 1 220px;
  font-size: 0.88rem;
  color: #e5e7eb;
}
.custom-cta-text strong {
  color: #a5b4fc;
}
.custom-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* CTA buttons (variant-safe) */
.cta-btn.primary {
  background: #22c55e;
  border-color: #22c55e;
  color: #020617;
}
.cta-btn.secondary {
  background: transparent;
  border-color: #4b5563;
  color: #e5e7eb;
}
.cta-btn:hover {
  filter: brightness(1.05);
}

/* Emote card state variants */
.emote-card.recent {
  box-shadow:
    0 0 0 1px #22c55e,
    0 0 24px rgba(34,197,94,0.4);
}

.emote-card.custom-private {
  border-color: #ef4444;
  box-shadow:
    0 0 0 1px rgba(248,113,113,0.75),
    0 22px 60px rgba(248,113,113,0.35);
}

.emote-card.custom-public {
  border-color: #f97316;
  box-shadow:
    0 0 0 1px rgba(251,146,60,0.8),
    0 22px 60px rgba(249,115,22,0.35);
}

/* Enhanced emote thumb layout */
.emote-thumb {
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

/* Chat preview wrap (new variant) */
.chat-preview-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.chat-preview-img {
  width: 100%;
  max-width: 100%;
  border-radius: 0.5rem;
  border: 1px solid #1f2937;
  background: #020617;
  box-shadow: 0 6px 18px rgba(0,0,0,0.7);
}

/* Custom emote flags */
.custom-flag {
  margin-top: 0.15rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.custom-flag.private { color: #fecaca; }
.custom-flag.public  { color: #fed7aa; }

/* Footer row on emote cards */
.emote-footer {
  margin-top: 0.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: #9ca3af;
  gap: 0.5rem;
}

/* Download size pills */
.size-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem;
}
.size-pill {
  font-size: 0.72rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #1d4ed8;
  background: rgba(59,130,246,0.15);
  color: #bfdbfe;
  white-space: nowrap;
}

/* Empty state helpers */
.empty-state a {
  color: #9ca3af;
  text-decoration: underline;
}

/* Back links block */
.back-links {
  margin-top: 1.5rem;
  font-size: 0.85rem;
}
.back-links a {
  text-decoration: underline;
  color: #9ca3af;
}
.back-links a + a {
  margin-left: 1rem;
}

/* ==========================================================
   ADDITIONS (Credits / PayPal / purchase flow)
   ========================================================== */

/* Narrow purchase pages (opt-in by structure, not global main) */
.balance {
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* Inline success / error messages */
.msg-ok,
.msg-err {
  border-radius: 0.75rem;
  padding: 0.6rem 0.8rem;
  font-size: 0.82rem;
  margin-bottom: 0.9rem;
}
.msg-ok {
  background: rgba(22,163,74,0.12);
  border: 1px solid rgba(34,197,94,0.7);
  color: #bbf7d0;
}
.msg-err {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(248,113,113,0.7);
  color: #fecaca;
}

/* Credit pack selection */
.packs {
  margin: 1rem 0 1.2rem;
}
.packs-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  margin-bottom: 0.4rem;
}
.packs-options label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.packs-options input {
  margin-right: 0.45rem;
}

/* PayPal container (white card inside dark UI) */
.paypal-wrap {
  margin-top: 0.5rem;
  margin-bottom: 1.2rem;
  background: #ffffff;
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
  padding: 1.2rem 1.4rem 1.4rem;
  box-shadow: 0 8px 25px rgba(0,0,0,0.25);
  text-align: center;
}

.paypal-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #374151;
  margin: 0 0 0.8rem;
}

#paypal-button-container,
#paypal-button-container iframe {
  background: transparent !important;
}

.paypal-note {
  margin-top: 0.8rem;
  font-size: 0.78rem;
  color: #4b5563;
}

/* Dev / manual credit buttons */
button.dev-btn {
  width: 100%;
  border-radius: 999px;
  border: 1px solid #22c55e;
  background: #22c55e;
  color: #020617;
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  margin-top: 0.4rem;
  cursor: pointer;
}
button.dev-btn:hover {
  filter: brightness(1.05);
}

/* Helper text + back links */
.hint {
  margin-top: 0.8rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.back {
  margin-top: 1rem;
  text-align: left;
  font-size: 0.85rem;
}
.back a {
  text-decoration: underline;
  color: #9ca3af;
}

/* Developer-only section */
.dev-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed #1f2937;
}
.dev-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.7);
  color: #e9d5ff;
  margin-bottom: 0.4rem;
}

/* Local chips for page actions (so we don't affect header chips) */
.page-chip{
  font-size: 0.8rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #374151;
  background: #020617;
  color: #9ca3af;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
}

/* Breadcrumbs */
.breadcrumbs{
  margin-top: .35rem;
  font-size: .82rem;
  color: #9ca3af;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
}
.breadcrumbs a{ color:#bfdbfe; }
.breadcrumbs a:hover{ text-decoration: underline; }

/* ==========================================================
   ADDITIONS (PNG Viewer page UI)
   Safe to append — uses unique class names to avoid conflicts
   ========================================================== */

.viewer-card{
  background:#020617;
  border:1px solid #111827;
  border-radius:1rem;
  padding:1.2rem;
  box-shadow:0 20px 50px rgba(0,0,0,0.8);
}

.viewer-grid{
  display:grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr);
  gap:1rem;
  align-items:start;
}
@media (max-width: 900px){
  .viewer-grid{ grid-template-columns: minmax(0,1fr); }
}

.preview-wrap{
  display:flex;
  justify-content:center;
}

.preview-stack{
  position:relative;
  display:inline-block;
  line-height:0;
  border-radius:1rem;
  overflow:hidden;
  border:1px solid #1f2937;
  background:#0b1120;
  box-shadow:0 16px 40px rgba(0,0,0,0.7);
}

.preview-stack img{
  display:block;
  width:100%;
  height:auto;
  max-width:520px;
}

/* Hover overlay image (optional second image layered on top) */
.preview-hover{
  position:absolute;
  inset:0;
  opacity:0;
  transition:opacity .25s ease;
}
.preview-stack:hover .preview-hover{
  opacity:1;
}

.preview-caption{
  margin-top:.6rem;
  font-size:.85rem;
  color:#9ca3af;
  text-align:center;
}

/* Right-side stats chips */
.stats{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:.6rem;
}
@media (max-width: 520px){
  .stats{ grid-template-columns:minmax(0,1fr); }
}

.stat-chip{
  padding:.55rem .7rem;
  border-radius:.9rem;
  border:1px solid #111827;
  background: radial-gradient(circle at top left, #111827, #020617);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
  font-size:.82rem;
  color:#9ca3af;
}
.stat-chip strong{
  color:#e5e7eb;
  font-weight:700;
}

/* Button row helper (works with your existing .btn system) */
.btn-row{
  margin-top:.9rem;
  display:flex;
  flex-wrap:wrap;
  gap:.55rem;
}

/* Titles used on viewer pages */
.section-title-h2{
  margin:0 0 .6rem;
  font-size:1rem;
}
.similar-title{
  margin:1.25rem 0 .65rem;
  font-size:1.05rem;
  font-weight:600;
  color:#e5e7eb;
}

/* ==========================================================
   PNG Viewer polish (sidebar + file details text)
   ========================================================== */

.file-row{
  margin-top: .1rem;
  display: flex;
  gap: .35rem;
  align-items: baseline;
  font-size: .85rem;
  color: #9ca3af;
  line-height: 1.35;
}

.file-k{
  color:#e5e7eb;
  font-weight:700;
  flex: 0 0 auto;
}

.file-v{
  min-width: 0;
  word-break: break-word;   /* prevents ugly overflow */
  overflow-wrap: anywhere;  /* nicer wrapping for long slugs */
}

.sidebar-actions{
  margin-top: .6rem;
  display: flex;
}

.sidebar-actions .page-chip{
  width: 100%;
  justify-content: center;
}

.nowrap{ white-space: nowrap; }

/* Make stat chips read nicer */
.stat-chip span{ white-space: nowrap; }
.stat-chip strong{ white-space: nowrap; }

.btn.disabled{
  opacity: .55;
  cursor: not-allowed;
  text-align: center;
}

.btn.disabled:hover{
  filter: none;
}

/* ==========================================================
   FIX: PNG Viewer stat text overflowing
   (put at the VERY END of style.css)
   ========================================================== */

.stats{
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-chip{
  padding:.65rem .75rem;
  border-radius:.9rem;
  border:1px solid #111827;
  background: radial-gradient(circle at top left, #111827, #020617);
  display:flex;
  flex-direction: column;
  align-items:center;
  justify-content:center;
  gap:.2rem;
  font-size:.78rem;
  color:#9ca3af;
  text-align:center;
}


.stat-chip span{
  font-size:.75rem;
  text-transform: uppercase;
  letter-spacing:.08em;
  color:#9ca3af;
  white-space: nowrap;
}


.stat-chip strong{
  font-size:1.05rem;
  font-weight:700;
  color:#e5e7eb;
  line-height:1.1;
  white-space: nowrap;
}



/* Optional: on very small screens, make it single column */
@media (max-width: 520px){
  .stats{ grid-template-columns: minmax(0,1fr); }
  .stat-chip strong{ max-width: 70%; }
}

/* ─────────────────────────────────────────
   PNG FOLDERS (Sidebar tree) — refined
   - smaller text
   - NO arrow/chevron
───────────────────────────────────────── */

.games-nav{
  margin-top:.5rem;
  display:flex;
  flex-direction:column;
  gap:.3rem;
  max-height: calc(100vh - 220px);
  overflow:auto;
  padding-right:.25rem;
}

/* nice scrollbar (webkit only) */
.games-nav::-webkit-scrollbar{ width:8px; }
.games-nav::-webkit-scrollbar-track{ background:transparent; }
.games-nav::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.12);
  border-radius: 999px;
}
.games-nav::-webkit-scrollbar-thumb:hover{ background: rgba(255,255,255,.18); }

.games-item{
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.15);
  border-radius: 14px;
  overflow:hidden;
}

/* summary row */
.games-item > summary{
  list-style:none;
  cursor:pointer;
  padding:.45rem .65rem;
  display:flex;
  align-items:center;
  gap:.4rem;              /* smaller gap now that we removed arrow */
  user-select:none;
}

.games-item > summary::-webkit-details-marker{ display:none; }

/* REMOVE the chevron */
.games-item > summary::before{
  content:none !important;
  display:none !important;
}

.games-item > summary:hover{
  background: rgba(255,255,255,.06);
}

/* main folder link */
.games-game{
  color:#dbeafe;
  text-decoration:none;
  font-weight:700;
  letter-spacing:.015em;
  font-size:.82rem;        /* smaller */
  line-height:1.15;
  display:block;
  flex:1;
}

.games-game:hover{ text-decoration:underline; }

/* subfolders container */
.games-subs{
  padding:.25rem .65rem .65rem 1.15rem; /* less indent */
  display:flex;
  flex-direction:column;
  gap:.3rem;
}

/* leaf links (subfolders + folders without kids) */
.games-sub{
  display:block;
  text-decoration:none;
  color:#cbd5e1;
  font-size:.78rem;        /* smaller */
  padding:.32rem .45rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.12);
}

.games-sub:hover{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.12);
  color:#ffffff;
}

/* section title used in sidebar */
.sidebar .sidebar-section-title{
  font-weight:900;
  letter-spacing:.12em;
  font-size:.78rem;
  opacity:.9;
  margin-top:1rem;
  margin-bottom:.6rem;
  color: rgba(255,255,255,.75);
}

/* ─────────────────────────────────────────
   Header: two-row navigation layout
───────────────────────────────────────── */

.nav-stack{
  display:flex;
  flex-direction:column;
  gap:.55rem;
}

.nav-row{
  display:flex;
  align-items:center;
  gap:.45rem;
  flex-wrap:wrap;
}

/* Primary nav row */
.nav-row-main{
  padding-bottom:.35rem;
  border-bottom:1px solid rgba(255,255,255,.06);
}

/* User row slightly muted */
.nav-row-user .nav-chip{
  font-size:.78rem;
}

/* On small screens, collapse nicely */
@media (max-width: 720px){
  .nav-row{
    justify-content:center;
  }
  .nav-spacer{
    display:none;
  }
}

/* ==========================================================
   AUTH PAGES (Login / Register) — scoped so it won't affect site-wide .card
   Add to the VERY END of style.css
   ========================================================== */

.auth-wrap{
  min-height: calc(100vh - 70px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:1.5rem;
}

.auth-card{
  width:100%;
  max-width:420px;
  background:#020617;
  border-radius:1rem;
  border:1px solid #111827;
  padding:1.8rem 2rem 2rem;
  box-shadow:0 20px 50px rgba(0,0,0,0.8);
}

.auth-card h1{
  margin:0 0 0.75rem;
  font-size:1.4rem;
}

.auth-subtitle{
  margin:0 0 1.4rem;
  font-size:0.9rem;
  color:#9ca3af;
}

.auth-field{ margin-bottom:0.9rem; }

.auth-card label{
  display:block;
  font-size:0.82rem;
  text-transform:uppercase;
  letter-spacing:0.08em;
  color:#9ca3af;
  margin-bottom:0.25rem;
}

.auth-card input[type="text"],
.auth-card input[type="password"]{
  width:100%;
  border-radius:0.75rem;
  border:1px solid #1f2937;
  background:#020617;
  color:#f9fafb;
  padding:0.55rem 0.7rem;
  font-size:0.9rem;
  outline:none;
}

.auth-card input:focus{ border-color:#22c55e; }

.auth-errors{
  background:rgba(239,68,68,0.12);
  border:1px solid rgba(248,113,113,0.7);
  color:#fecaca;
  border-radius:0.75rem;
  padding:0.6rem 0.8rem;
  font-size:0.82rem;
  margin-bottom:0.9rem;
}

.auth-btn{
  width:100%;
  border-radius:999px;
  border:1px solid #22c55e;
  background:#22c55e;
  color:#020617;
  font-weight:600;
  padding:0.6rem 0.75rem;
  margin-top:0.4rem;
  cursor:pointer;
}

.auth-btn:hover{ filter:brightness(1.05); }

.auth-alt{
  margin-top:0.9rem;
  text-align:center;
  font-size:0.85rem;
  color:#9ca3af;
}

.auth-alt a{ text-decoration:underline; }

.auth-errors-list{
  margin: 0;
  padding-left: 1.1rem;
}
.auth-errors-list li{
  margin: .2rem 0;
}

/* ==========================================================
   ADDITIONS (Winners page UI)
   Safe to append — uses unique class names
   ========================================================== */

/* Winners card layout */
.winners-layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.winners-card {
  background: radial-gradient(circle at top left, #111827, #020617 60%);
  border-radius: 1rem;
  padding: 1.2rem 1.3rem 1.3rem;
  border: 1px solid rgba(31,41,55,0.9);
  box-shadow: 0 16px 40px rgba(0,0,0,0.7);
}

.winners-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  align-items: flex-start;
}

.winners-header h1 {
  font-size: 1.25rem;
  margin: 0;
}

.winners-header p {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: #9ca3af;
}

.winners-meta {
  font-size: 0.8rem;
  color: #6b7280;
  text-align: right;
  margin-top: 0.2rem;
}

.winners-table-wrap {
  margin-top: 0.5rem;
  border-radius: 0.9rem;
  border: 1px solid #1f2937;
  background: #020617;
  overflow: hidden;
  overflow-x: auto;
}

table.winners-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
  font-size: 0.9rem;
}

table.winners-table th,
table.winners-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #111827;
  white-space: nowrap;
}

table.winners-table th {
  background: #030712;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
}

table.winners-table tbody tr:nth-child(even) {
  background: #020617;
}

table.winners-table tbody tr:nth-child(odd) {
  background: #020617cc;
}

.winner-date {
  color: #9ca3af;
}

.winner-username {
  font-weight: 500;
}

.winner-amount {
  font-weight: 700;
  color: #facc15;
}

.no-results {
  margin-top: 0.5rem;
  font-style: italic;
  color: #9ca3af;
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .winners-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .winners-meta {
    text-align: left;
  }
}

/* ==========================================================
   Wheel Giveaway Winners — polish
   Scoped to .winners-* so it won't affect other pages
   ========================================================== */

.winners-layout{
  max-width: 980px;              /* keeps it from stretching too wide */
  margin: 0 auto;
}

.winners-card{
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  background: radial-gradient(circle at 15% 10%, rgba(168,85,247,.18), transparent 38%),
              radial-gradient(circle at 85% 20%, rgba(34,197,94,.10), transparent 40%),
              radial-gradient(circle at top left, #0b1224, #020617 60%);
  box-shadow: 0 26px 80px rgba(0,0,0,.75);
}

/* subtle shine line */
.winners-card::before{
  content:"";
  position:absolute;
  inset:-2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
  transform: translateX(-60%);
  pointer-events:none;
}

/* header spacing + typography */
.winners-header{
  margin-bottom: 1rem;
  padding-bottom: .9rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.winners-header h1{
  font-size: 1.55rem;
  letter-spacing: .02em;
}

.winners-header p{
  max-width: 62ch;
  line-height: 1.55;
}

/* meta line (top right) */
.winners-meta{
  padding: .35rem .7rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(2,6,23,.65);
}

/* optional little stat chips row */
.winners-stats{
  margin-top: .85rem;
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.winners-stat{
  display: inline-flex;
  align-items: baseline;
  gap: .45rem;
  padding: .45rem .75rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(2,6,23,.55);
  color: #9ca3af;
  font-size: .82rem;
}
.winners-stat strong{
  color: #e5e7eb;
  font-size: .95rem;
  font-weight: 800;
}
.winners-stat .accent{
  color: #facc15;
}

/* table container */
.winners-table-wrap{
  margin-top: .9rem;
  border-radius: 1rem;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(2,6,23,.72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}

/* table */
table.winners-table{
  min-width: 520px; /* a touch wider so it doesn't wrap awkwardly */
}

table.winners-table th{
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(3,7,18,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

table.winners-table td{
  border-bottom: 1px solid rgba(255,255,255,.06);
}

table.winners-table tbody tr{
  transition: transform .08s ease, background .15s ease;
}

table.winners-table tbody tr:hover{
  background: rgba(255,255,255,.04);
}

/* make amounts line up nicer */
.winner-amount{
  text-align: right;
  font-weight: 900;
  color: #facc15;
}

/* small “pill” look for usernames */
.winner-username{
  font-weight: 700;
  color: #e5e7eb;
}

.winner-date{
  color:#a8b1c2;
  font-variant-numeric: tabular-nums;
}

/* responsive improvements */
@media (max-width: 640px){
  .winners-header h1{ font-size: 1.35rem; }
  table.winners-table{ min-width: 480px; }
}

/* ==========================================================
   FIX: Wheel Giveaway header → match table container
   ========================================================== */

/* Wrap header content like the table */
.winners-header{
  margin-bottom: 1rem;
  padding: 1.2rem 1.4rem;
  border-radius: 1rem;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(2,6,23,.65);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

/* Remove the old divider line */
.winners-header{
  border-bottom: none;
}

/* Tighten title spacing */
.winners-header h1{
  margin: 0;
}

.winners-header p{
  margin: .4rem 0 0;
}

/* Meta pill stays top-right but aligned nicely */
.winners-meta{
  align-self: flex-start;
}

/* Stats row padding consistency */
.winners-stats{
  margin-top: .9rem;
}

/* Make header + table feel connected */
.winners-table-wrap{
  margin-top: .75rem;
}

/* On mobile, keep spacing clean */
@media (max-width: 700px){
  .winners-header{
    padding: 1rem 1.1rem;
  }
}

/* ==========================================================
   HOME PAGE (index.php) — scoped styles
   Safe to append. Uses .home-wrap/.home-grid to avoid clashes
   ========================================================== */

.home-wrap{max-width:1200px;margin:0 auto;padding:1.2rem 1.25rem 3rem;}
.home-grid{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(0,1fr);gap:1.2rem;}
@media (max-width: 980px){.home-grid{grid-template-columns:1fr;}}

.cardish{background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.10);border-radius:18px;padding:1rem;overflow:hidden;}

.hero{display:flex;flex-wrap:wrap;gap:1rem;align-items:center;justify-content:space-between;}
.hero h1{margin:0;font-size:1.35rem;font-weight:900;}
.hero p{margin:.35rem 0 0;color:rgba(255,255,255,.78);line-height:1.45;}

.home-wrap .pill-row{display:flex;flex-wrap:wrap;gap:.5rem;margin-top:.6rem;}
.home-wrap .pill{display:inline-flex;gap:.4rem;align-items:center;padding:.28rem .7rem;border-radius:999px;font-size:.82rem;font-weight:800;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.05);}
.home-wrap .pill strong{font-weight:900;}

.home-wrap .section-title{display:flex;align-items:baseline;justify-content:space-between;gap:1rem;margin:0 0 .7rem;}
.home-wrap .section-title h2{margin:0;font-size:1.05rem;font-weight:900;}
.home-wrap .section-title .small{font-size:.85rem;opacity:.85;}

/* 5 per row (desktop) */
.home-wrap .grid12{
  display:grid;
  grid-template-columns:repeat(5, 1fr);
  gap:.9rem;
}

/* Tablet */
@media (max-width: 1100px){
  .home-wrap .grid12{ grid-template-columns:repeat(4, 1fr); }
}

/* Mobile */
@media (max-width: 800px){
  .home-wrap .grid12{ grid-template-columns:repeat(2, 1fr); }
}

.home-wrap .mini-card{border-radius:16px;border:1px solid rgba(255,255,255,.10);background:rgba(255,255,255,.03);overflow:hidden;display:flex;flex-direction:column;}
.home-wrap .mini-thumb{aspect-ratio:1/1;background:rgba(0,0,0,.25);border-bottom:1px solid rgba(255,255,255,.08);}
.home-wrap .mini-thumb img{width:100%;height:100%;object-fit:cover;display:block;}
.home-wrap .mini-meta{padding:.7rem;}
.home-wrap .mini-name{font-weight:900;font-size:.9rem;line-height:1.2;margin:0 0 .35rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.home-wrap .mini-sub{font-size:.8rem;opacity:.85;display:flex;gap:.35rem;flex-wrap:wrap;}
.home-wrap .chip{display:inline-flex;align-items:center;gap:.35rem;padding:.2rem .55rem;border-radius:999px;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.04);font-size:.75rem;font-weight:800;}

.home-wrap .btn-row{display:flex;gap:.5rem;flex-wrap:wrap;margin-top:.6rem;}
.home-wrap .btn-a{display:inline-flex;align-items:center;justify-content:center;gap:.45rem;padding:.65rem .9rem;border-radius:14px;font-weight:900;text-decoration:none;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.06);}
.home-wrap .btn-a.primary{background:rgba(255,255,255,.12);}

.home-wrap .toplist{display:flex;flex-direction:column;gap:.55rem;}
.home-wrap .topitem{display:flex;gap:.7rem;align-items:center;border:1px solid rgba(255,255,255,.10);background:rgba(255,255,255,.03);border-radius:16px;padding:.55rem;}
.home-wrap .topitem .tthumb{width:54px;height:54px;border-radius:12px;overflow:hidden;background:rgba(0,0,0,.25);flex:0 0 auto;border:1px solid rgba(255,255,255,.08);}
.home-wrap .topitem .tthumb img{width:100%;height:100%;object-fit:cover;display:block;}
.home-wrap .topitem .tmain{min-width:0;}
.home-wrap .topitem .tname{font-weight:900;font-size:.85rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0;}
.home-wrap .topitem .tmeta{font-size:.78rem;opacity:.85;margin-top:.15rem;}

.home-wrap .challenge-card .row{display:flex;gap:1rem;flex-wrap:wrap;align-items:flex-start;}
.home-wrap .challenge-img{aspect-ratio:16/9;border-radius:16px;overflow:hidden;background:rgba(0,0,0,.25);border:1px solid rgba(255,255,255,.10);flex:1 1 360px;min-width:260px;}
.home-wrap .challenge-img img{width:100%;height:100%;object-fit:cover;display:block;}
.home-wrap .challenge-info{flex:1 1 280px;min-width:260px;}
.home-wrap .challenge-title{margin:0;font-size:1.05rem;font-weight:900;line-height:1.2;}
.home-wrap .challenge-text{margin:.45rem 0 0;opacity:.88;line-height:1.45;}

.home-wrap .notice{
  margin-top:.8rem;
  border-radius:16px;
  padding:.75rem .85rem;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.04);
  font-size:.9rem;
  line-height:1.4;
}

/* Static (non-clickable) cards */
.home-wrap .mini-card.is-static{ cursor: default; }
.home-wrap .mini-card.is-static:hover{ transform:none; box-shadow:none; }

/* ==========================================================
   CHALLENGES cards + modal (scoped) — safe to append
   ========================================================== */

.ch-page .period-pill{
  display:inline-flex; gap:.5rem; align-items:center;
  padding:.45rem .8rem; border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  font-size:.92rem;
}
.ch-page .period-pill strong{ font-weight:800; }

.ch-page .game-block{ margin-top: 1.2rem; }
.ch-page .game-title{
  display:flex; align-items:center; justify-content:space-between; gap:1rem;
  margin: 0 0 .7rem 0;
}
.ch-page .game-title h2{ margin:0; font-size:1.25rem; }

.ch-page .map-block{ margin-top: .8rem; }
.ch-page .map-title{ margin: 0 0 .55rem 0; font-size: 1.05rem; opacity:.95; }

.ch-page .challenge-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* Card */
.ch-page .ch-card{
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  overflow: hidden;
  display:flex;
  flex-direction:column;
}

/* 16:9 thumbnail area */
.ch-page .ch-thumb16x9{
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: rgba(0,0,0,.25);
  border-bottom: 1px solid rgba(255,255,255,.08);
  overflow:hidden;
}
.ch-page .ch-thumb16x9 img{
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display:block;
}
.ch-page .ch-thumb16x9 .thumb-fallback{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  opacity:.7;
  font-weight:800;
}

.ch-page .ch-body{
  padding: 1rem;
  display:flex;
  flex-direction:column;
  gap:.75rem;
}

.ch-page .ch-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:.8rem;
}

.ch-page .ch-titlewrap{ min-width:0; }
.ch-page .ch-title{
  margin:0;
  font-weight:900;
  line-height:1.15;
  font-size:1.05rem;
}
.ch-page .ch-sub{
  margin-top:.35rem;
  font-size:.9rem;
  opacity:.9;
  line-height:1.35;
}

/* IMPORTANT: scoped pill (won't touch global .pill) */
.ch-page .pill{
  display:inline-flex; align-items:center; gap:.4rem;
  padding:.28rem .65rem; border-radius:999px;
  font-size:.82rem; font-weight:800;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  white-space:nowrap;
}
.ch-page .pill.ok{ border-color: rgba(0,255,140,.25); background: rgba(0,255,140,.08); }
.ch-page .pill.warn{ border-color: rgba(255,200,0,.25); background: rgba(255,200,0,.08); }
.ch-page .pill.bad{ border-color: rgba(255,80,80,.25); background: rgba(255,80,80,.08); }

.ch-page .ch-meta{
  display:flex;
  flex-wrap:wrap;
  gap:.45rem;
  align-items:center;
}
.ch-page .meta-chip{
  display:inline-flex;
  align-items:center;
  gap:.4rem;
  padding:.32rem .7rem;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  font-size:.82rem;
  font-weight:800;
  opacity:.95;
}

.ch-page .ch-preview{
  font-size:.92rem;
  opacity:.92;
  line-height:1.4;
}

.ch-page .ch-footer{
  display:flex;
  flex-direction:column;
  gap:.5rem;
  margin-top:.2rem;
}

/* IMPORTANT: scoped btn (won't touch global .btn) */
.ch-page .btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.45rem;
  padding:.8rem .9rem;
  border-radius: 14px;
  font-weight:900;
  text-decoration:none;
  border:1px solid rgba(255,255,255,.12);
}
.ch-page .btn.primary{ background: rgba(255,255,255,.10); }
.ch-page .btn.disabled{
  opacity:.55;
  cursor:not-allowed;
  pointer-events:none;
}

.ch-page .mini{
  font-size:.85rem;
  opacity:.9;
}

/* Modal */
.ch-page .modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  display:none;
  align-items:center;
  justify-content:center;
  padding: 1rem;
  z-index: 9999;
}
.ch-page .modal-overlay.active{ display:flex; }

.ch-page .modal{
  width: min(980px, 96vw);
  max-height: 92vh;
  overflow:auto;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(10,14,24,.95);
  box-shadow: 0 30px 80px rgba(0,0,0,.7);
}
.ch-page .modal-head{
  position: sticky;
  top: 0;
  background: rgba(10,14,24,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: .9rem 1rem;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 1rem;
}
.ch-page .modal-head h3{
  margin:0;
  font-size: 1.05rem;
  font-weight: 900;
}
.ch-page .modal-close{
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: inherit;
  border-radius: 12px;
  padding: .45rem .7rem;
  font-weight: 900;
  cursor:pointer;
}

.ch-page .modal-body{
  padding: 1rem;
  display:grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 1rem;
}
@media (max-width: 860px){
  .ch-page .modal-body{ grid-template-columns: minmax(0, 1fr); }
}

.ch-page .modal-img{
  border-radius: 16px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.25);
  aspect-ratio: 16 / 9;
}
.ch-page .modal-img img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.ch-page .modal-section{
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  padding: 1rem;
}
.ch-page .modal-section h4{
  margin: 0 0 .6rem 0;
  font-size: .95rem;
  font-weight: 900;
}


/* ==========================================================
   HEADER: Title above buttons (fixed)
   ========================================================== */

.nav-row-main{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:.7rem;
  padding-bottom:.7rem;
}

/* New wrapper that controls the button layout */
.nav-primary{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:.55rem;
}

.brand-stack{ align-items:center; }

.brand-title{
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  line-height: 1.1;
}

/* ==========================================================
   HEADER: Professional brand left + buttons right
   ========================================================== */

.nav-row-main{
  display:flex;
  flex-direction:row;              /* <-- key change */
  align-items:center;
  justify-content:space-between;
  gap: 1rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

/* brand area */
.brand.brand-stack{
  display:flex;
  align-items:center;
  gap:0;                           /* no circle gap */
}

/* the title link */
.brand-title{
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.25rem;              /* bigger */
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1;
  color: #e5e7eb;
}

/* primary nav buttons live on the right */
.nav-primary{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:.55rem;
}

/* remove the circle globally */
.brand-pill{ display:none !important; }

/* mobile: center stack */
@media (max-width: 720px){
  .nav-row-main{
    flex-direction:column;
    align-items:center;
  }
  .nav-primary{ justify-content:center; }
}

/* HEADER: brand above primary buttons */
header .nav-row-main{
  display:flex;
  flex-direction:column;      /* stack brand then buttons */
  align-items:center;
  justify-content:center;
  gap:.6rem;
}

/* remove any spacer effect in the first row */
header .nav-row-main .nav-spacer{
  display:none !important;
}

/* keep buttons centered */
header .nav-primary{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:.55rem;
}

/* optional: a little breathing room under title */
header .brand-title{
  display:inline-block;
  margin-top:.1rem;
  margin-bottom:.05rem;
}

/* =========================
   HOME (clean layout)
   ========================= */

.home-wrap{
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

.home-grid{
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.2rem;
  align-items: start;
}

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

.cardish{
  background: rgba(10,15,25,0.75);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.35);
}

.section-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: .75rem;
  margin-bottom: .85rem;
}

.section-title h2{
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: .2px;
}

.section-title .small a{
  opacity: .9;
  text-decoration: none;
}
.section-title .small a:hover{ opacity: 1; text-decoration: underline; }

.grid12{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .85rem;
}

/* Mini cards */
.mini-card{
  display:flex;
  flex-direction:column;
  gap: .6rem;
  padding: .75rem;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
  min-height: 210px;
}
.mini-card:hover{
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
}

.mini-thumb{
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0,0,0,0.25);
  display:flex;
  align-items:center;
  justify-content:center;
}
.mini-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}

.mini-meta{ display:flex; flex-direction:column; gap:.45rem; width: 100%; }
.mini-name{
  font-weight: 700;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Make the chip area match the thumbnail width and center text */
.mini-sub{
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;   /* stack chips */
  gap: .35rem;
}

/* Each chip becomes full-width like the image, centered */
.chip{
  width: 100%;
  justify-content: center;      /* centers text inside */
  text-align: center;
  box-sizing: border-box;
}

/* Challenge card layout */
.challenge-card .row{
  display:grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 720px){
  .challenge-card .row{ grid-template-columns: 1fr; }
}

.challenge-img{
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow:hidden;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
}
.challenge-img img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}

.challenge-title{
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.pill-row{
  display:flex;
  flex-wrap:wrap;
  gap: .45rem;
  margin-top: .55rem;
}

.pill{
  display:inline-flex;
  gap:.35rem;
  align-items:center;
  padding: .25rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.25);
}

.challenge-text{
  margin: .75rem 0 0;
  line-height: 1.35;
  font-size: .92rem;
  opacity: .95;
}

.btn-row{
  display:flex;
  flex-wrap:wrap;
  gap:.55rem;
  margin-top: .85rem;
}

.btn-a{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: .55rem .9rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  text-decoration:none;
  color: inherit;
  font-weight: 700;
  font-size: .88rem;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn-a:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.16);
}
.btn-a.primary{
  background: rgba(99,102,241,0.25);
  border-color: rgba(99,102,241,0.35);
}

/* Right sidebar toplist */
.toplist{
  display:flex;
  flex-direction:column;
  gap:.6rem;
}

.topitem{
  display:flex;
  gap:.65rem;
  padding: .6rem;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.topitem:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.04)
}

/* ==========================================================
   ADMIN UI HELPERS (from inline style) — safe to append
   Used in /admin/ pages
   ========================================================== */

/* Admin 2-column grid layout */
.grid{
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1.2fr);
  gap: 1.5rem;
}
@media (max-width: 900px){
  .grid{ grid-template-columns: minmax(0, 1fr); }
}

/* Card heading helpers (your .card exists, this just aligns the headings) */
.card h1,
.card h2{
  margin: 0 0 0.75rem;
}
.card h1{ font-size: 1.4rem; }

/* Pill links row (different to your existing .pill) */
.pill-row{
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}
.pill-link{
  font-size: 0.8rem;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #1f2937;
  background: radial-gradient(circle at top left, #111827, #020617);
  color: #e5e7eb;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.pill-link span.icon{ font-size: 0.95rem; }

/* Stat blocks */
.stat-row{
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}
.stat{
  flex: 1 1 140px;
  background: radial-gradient(circle at top, #020617, #020617 55%);
  border-radius: 0.9rem;
  border: 1px solid #111827;
  padding: 0.7rem 0.9rem;
  font-size: 0.8rem;
}
.stat-label{
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
}
.stat-value{
  margin-top: 0.15rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.stat-value span.sub{
  font-size: 0.8rem;
  color: #6b7280;
  margin-left: 0.2rem;
}

/* Simple list style used in admin cards */
.list{
  margin-top: 0.4rem;
  padding-left: 1.1rem;
  font-size: 0.88rem;
  color: #9ca3af;
}
.list li + li{ margin-top: 0.15rem; }

/* ==========================================================

/* ==========================================================
   FINAL: Mobile overflow + homepage/header layout
   Keep this as the LAST block in style.css
   ========================================================== */

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

img, video, iframe {
  max-width: 100%;
  height: auto;
}

/* Flex/grid children must be allowed to shrink */
.home-grid,
.cardish,
.grid12,
.mini-card,
.topitem,
.nav-row,
.nav-primary {
  min-width: 0;
}

/* Header (your nav-stack structure) */
header .nav-inner.nav-stack {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

header .nav-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}

header .nav-row-main {
  display: flex;
  flex-direction: column;   /* brand above buttons on small screens */
  align-items: center;
  justify-content: center;
  gap: .6rem;
}

header .nav-primary {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .55rem;
}

header .nav-row-user {
  justify-content: center;
}

header .nav-spacer {
  display: none;
}

header .nav-chip {
  min-width: 0 !important;
  max-width: 100%;
  white-space: nowrap;
}

/* Prevent long text from forcing width */
.mini-name,
.tname,
.file-v,
.winner-username,
.challenge-title,
.challenge-text {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Home grid responsiveness */
@media (max-width: 980px) {
  .home-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 520px) {
  .home-wrap { padding-left: .9rem; padding-right: .9rem; }
  .grid12 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}



/* ==========================================================
   HOME PAGE: Latest Emotes grid + width (no stretch)
   ========================================================== */

/* Keep homepage centered like other pages */
.home-wrap{
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Grid: fluid cards that never overflow */
.home-wrap .grid12{
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .95rem;
}

/* Ensure grid children can shrink (prevents overflow) */
.home-wrap .grid12 > *{
  min-width: 0;
}

/* Phones: keep it readable and avoid “stretched” look */
@media (max-width: 520px){
  .home-wrap{
    padding-left: .9rem;
    padding-right: .9rem;
  }
  .home-wrap .grid12{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Very small phones: 1 column */
@media (max-width: 380px){
  .home-wrap .grid12{
    grid-template-columns: 1fr;
  }
}

/* Mobile: remove any weird gap before the sidebar stack */
@media (max-width: 980px){
  .home-grid > aside{
    margin-top: 0 !important;
  }
  .home-grid{
    row-gap: 1.2rem;
  }
}

/* ==========================================================
   PATCH v3: Fix mobile right-edge cutoff on HOME
   (prevents any element in the home grids/header from exceeding viewport)
   ========================================================== */

/* Don’t rely on hiding overflow; make layout actually fit */
@media (max-width: 900px){
  /* keep things inside the viewport */
  .home-wrap,
  .home-grid,
  .cardish,
  .home-wrap .grid12,
  .home-wrap .mini-card,
  .home-wrap .mini-thumb,
  .home-wrap .mini-meta,
  header,
  header .nav-inner,
  header .nav-row,
  header .nav-primary{
    max-width: 100%;
  }

  /* shrink-friendly flex/grid children */
  header .nav-row,
  header .nav-primary,
  .home-grid,
  .home-wrap .grid12,
  .home-wrap .mini-card,
  .home-wrap .topitem,
  .home-wrap .challenge-card .row,
  .home-wrap .challenge-img,
  .home-wrap .challenge-info{
    min-width: 0;
  }

  /* HOME: force safe columns (1fr can overflow without minmax(0,1fr)) */
  .home-wrap .grid12{
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  /* HOME padding slightly tighter so two columns always fit */
  .home-wrap{
    padding-left: .75rem !important;
    padding-right: .75rem !important;
  }
}

@media (max-width: 420px){
  .home-wrap .grid12{ grid-template-columns: 1fr !important; }
}

/* Safety: long titles/labels can’t force width */
@media (max-width: 900px){
  .home-wrap .mini-name,
  .home-wrap .tname,
  header .nav-chip{
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

/* ==========================================================
   PATCH v3: Fix mobile right-edge cutoff on HOME
   ========================================================== */

/* Always allow flex/grid children to shrink */
.home-wrap *,
.home-grid *,
header *{
  min-width: 0;
  max-width: 100%;
}

/* Ensure grids use shrink-safe tracks on small screens */
@media (max-width: 900px){
  .home-wrap{ padding-left: .75rem !important; padding-right: .75rem !important; }
  .home-grid{ grid-template-columns: 1fr !important; }
}

@media (max-width: 800px){
  .home-wrap .grid12{ grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 420px){
  .home-wrap .grid12{ grid-template-columns: 1fr !important; }
}

/* Header chips must wrap and never force width */
@media (max-width: 900px){
  header .nav-primary,
  header .nav-row{
    flex-wrap: wrap !important;
    justify-content: center !important;
  }
  header .nav-chip{
    min-width: 0 !important;
    max-width: 100% !important;
    white-space: nowrap;
  }
}

/* Remove the ‘cut off’ feeling by clipping instead of hiding scrollbars (safer on iOS) */
html, body{ overflow-x: clip; }

/* ==========================================================
   Challenge details pills: stack on mobile (readable)
   ========================================================== */

@media (max-width: 760px){
  /* the row that holds the pills */
  .challenge-card .pill-row{
    display: grid !important;
    grid-template-columns: 1fr !important; /* one per line */
    gap: .5rem !important;
    align-items: stretch;
  }

  /* each pill becomes full width and readable */
  .challenge-card .pill-row .pill{
    width: 100%;
    max-width: 100%;
    white-space: normal !important;   /* allow wrapping */
    text-align: left;
    justify-content: flex-start;
    line-height: 1.25;
  }
}


/* ==========================================================
   Challenge pills: readable on BOTH desktop + mobile
   ========================================================== */

/* Make pills flow into neat rows with sensible widths */
.challenge-card .pill-row{
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
  gap: .5rem !important;
  align-items: stretch;
}

/* Let pill text wrap (no more squashed unreadable pills) */
.challenge-card .pill-row .pill{
  width: 100%;
  max-width: 100%;
  white-space: normal !important;
  line-height: 1.25;
  text-align: left;
  justify-content: flex-start;
}

/* On very small screens, force a single column */
@media (max-width: 520px){
  .challenge-card .pill-row{
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================
   Homepage: force 2 emotes / PNGs per row on mobile
   ========================================================== */

/* Latest Emotes + Latest PNGs grids */
@media (max-width: 980px){
  .home-wrap .grid12{
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: .75rem;
  }
}

/* Optional: only go to 1 column on VERY small phones */
@media (max-width: 360px){
  .home-wrap .grid12{
    grid-template-columns: 1fr !important;
  }
}

/* Make sure cards never force extra width */
.home-wrap .mini-card{
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* ==========================================================
   Homepage desktop: 4 emotes / PNGs per row
   ========================================================== */

/* Large screens */
@media (min-width: 1200px){
  .home-wrap .grid12{
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

/* ==========================================================
   PNG PACKS PAGE (Resources Of The Dead) — additions
   Scoped to body.pngpacks-page so it won't affect other pages
   ========================================================== */

.pngpacks-page .pngpacks-latest{
  padding: 1rem;
}

/* Make “Latest added PNGs” look like the homepage grid (4 desktop / 2 mobile) */
.pngpacks-page .grid12{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .9rem;
}

@media (max-width: 980px){
  .pngpacks-page .grid12{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mini cards (only on this page) */
.pngpacks-page .mini-card{
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  min-width: 0;
}

.pngpacks-page .mini-thumb{
  aspect-ratio: 1 / 1;
  background: rgba(0,0,0,.25);
  border-bottom: 1px solid rgba(255,255,255,.08);
  overflow: hidden;
}
.pngpacks-page .mini-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pngpacks-page .mini-meta{
  padding: .8rem .85rem .9rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  min-width: 0;
}

.pngpacks-page .mini-name{
  font-weight: 900;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pngpacks-page .mini-sub{
  display: grid;
  grid-template-columns: 1fr;
  gap: .35rem;
}
.pngpacks-page .chip{
  width: 100%;
  justify-content: center;
  text-align: center;
}

/* Pack PNG count under the pack name */
.pngpacks-page .pack-png-count{
  margin-top: .15rem;
  font-size: .82rem;
  color: rgba(255,255,255,.72);
  letter-spacing: .02em;
}
