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

:root {
  --bg: #0d0d0d;
  --surface: #171717;
  --surface-hover: #1f1f1f;
  --border: #2a2a2a;
  --text: #e5e5e5;
  --text-secondary: #888;
  --text-tertiary: #555;
  --accent: #b8864b;
  --accent-hover: #c9975c;
  --error: #b33a3a;
  --error-bg: #1f0f0f;
  --success: #3a7d4a;
  --radius: 4px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

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

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */

.header {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  margin-bottom: 48px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.logo span {
  color: var(--accent);
}

.header-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.header-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.header-nav a:hover {
  color: var(--text);
}

/* Page title */

.page-title {
  margin-bottom: 40px;
}

.page-title h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.page-title p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* Mod grid */

.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 64px;
}

/* Mod card */

.mod-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.mod-card:hover {
  border-color: #444;
}

.mod-card-images {
  position: relative;
  background: #111;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.mod-card-images img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.mod-card-image-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
}

.mod-card-body {
  padding: 20px;
}

.mod-card-body h2 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  line-height: 1.3;
}

.mod-card-body p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mod-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-sans);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: transparent;
  color: var(--text);
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1;
}

.btn:hover {
  border-color: #555;
  background: var(--surface-hover);
}

.btn-primary {
  background: var(--accent);
  color: #0d0d0d;
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #0d0d0d;
}

.btn-danger {
  color: var(--error);
  border-color: var(--error);
}

.btn-danger:hover {
  background: var(--error-bg);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8125rem;
}

/* Empty state */

.empty-state {
  text-align: center;
  padding: 80px 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-state h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* Modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 24px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 20px 24px 24px;
}

/* Forms */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  color: var(--text);
  background: #111;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease;
  outline: none;
}

.form-input:focus {
  border-color: #555;
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.form-error {
  color: var(--error);
  font-size: 0.8125rem;
  margin-top: 4px;
}

.form-hint {
  color: var(--text-tertiary);
  font-size: 0.75rem;
  margin-top: 4px;
}

/* File upload */

.file-upload {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.file-upload:hover {
  border-color: #444;
}

.file-upload p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 4px;
}

.file-upload span {
  color: var(--text-tertiary);
  font-size: 0.75rem;
}

.file-upload input[type="file"] {
  display: none;
}

/* Image previews */

.image-previews {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.image-preview {
  position: relative;
  width: 90px;
  height: 90px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.75);
  border: none;
  color: var(--text);
  width: 20px;
  height: 20px;
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview-remove:hover {
  background: var(--error);
}

/* Admin login */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.login-box h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.login-box p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 32px;
}

/* Admin header */

.admin-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  margin-bottom: 32px;
}

.admin-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 2px 8px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
}

/* Toast */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 0.875rem;
  color: var(--text);
  max-width: 360px;
  animation: toast-in 0.2s ease;
}

.toast-error {
  border-color: var(--error);
}

.toast-success {
  border-color: var(--success);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loading */

.loading {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* Responsive */

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

  .header-inner {
    flex-direction: column;
    gap: 12px;
  }

  .login-box {
    padding: 24px;
  }

  .modal {
    max-width: 100%;
  }
}

/* Footer */

.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 48px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

@media (max-width: 700px) {
  .footer-inner {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* Image gallery in mod detail */

.gallery-nav {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: center;
}

.gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease;
}

.gallery-dot.active {
  background: var(--accent);
}

/* Scrollbar */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #444;
}
