:root {
  --bg0: #05040a;
  --bg1: #0a0620;
  --accent: #a855f7;
  --accent-hover: #c084fc;
  --surface: rgba(255,255,255,.06);
  --surface-hover: rgba(255,255,255,.10);
  --border: rgba(255,255,255,.12);
  --text: rgba(255,255,255,.92);
  --text-dim: rgba(255,255,255,.55);
  --radius: 14px;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg1), var(--bg0));
  min-height: 100vh;
}

/* Login */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-box {
  width: 100%;
  max-width: 380px;
  padding: 32px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.login-box h1 {
  margin: 0 0 24px;
  font-size: 22px;
  text-align: center;
}
.login-box .error {
  color: var(--danger);
  font-size: 14px;
  margin-bottom: 12px;
  display: none;
}

/* Form elements */
label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
input[type="text"],
input[type="password"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.3);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}
textarea {
  resize: vertical;
  min-height: 120px;
  font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
  font-size: 13px;
  line-height: 1.6;
}
.form-group {
  margin-bottom: 16px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s ease;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-hover); }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover { background: rgba(239,68,68,.15); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* Layout */
.admin-layout {
  display: none;
  min-height: 100vh;
}
.admin-header {
  padding: 14px 20px;
  background: rgba(0,0,0,.5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-header h1 {
  margin: 0;
  font-size: 16px;
}
.admin-header-actions { display: flex; gap: 8px; }

.admin-body {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Mod list */
.mod-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.mod-list-header h2 { margin: 0; font-size: 20px; }

.mod-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 10px;
  cursor: pointer;
  transition: all .15s ease;
}
.mod-card:hover {
  background: var(--surface-hover);
  border-color: rgba(255,255,255,.18);
}
.mod-card-logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
}
.mod-card-info { flex: 1; min-width: 0; }
.mod-card-info h3 { margin: 0 0 4px; font-size: 15px; }
.mod-card-info p { margin: 0; font-size: 13px; color: var(--text-dim); }
.mod-card-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-dim);
}

/* Editor panel */
.editor-panel { display: none; }
.editor-panel.active { display: block; }

.editor-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.editor-tab {
  padding: 10px 18px;
  border: none;
  background: none;
  color: var(--text-dim);
  font: inherit;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.editor-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

/* Markdown preview */
.md-editor-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 400px;
}
.md-editor-wrap textarea {
  min-height: 400px;
}
.md-preview {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  overflow: auto;
  line-height: 1.7;
  font-size: 14px;
}
.md-preview h1, .md-preview h2, .md-preview h3 { margin-top: 16px; }
.md-preview h1:first-child, .md-preview h2:first-child { margin-top: 0; }
.md-preview img { max-width: 100%; border-radius: 8px; }
.md-preview code {
  background: rgba(255,255,255,.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}
.md-preview pre {
  background: rgba(0,0,0,.4);
  padding: 14px;
  border-radius: 10px;
  overflow-x: auto;
}
.md-preview pre code { background: none; padding: 0; }

/* Version list */
.version-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.version-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 13px;
}
.version-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.version-table tr:hover td { background: rgba(255,255,255,.03); }

/* Tags */
.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.tag-release { background: rgba(34,197,94,.18); color: var(--success); }
.tag-beta { background: rgba(245,158,11,.18); color: var(--warning); }
.tag-alpha { background: rgba(239,68,68,.18); color: var(--danger); }
.tag-loader {
  background: rgba(168,85,247,.15);
  color: var(--accent-hover);
  margin-right: 4px;
}
.tag-mc {
  background: rgba(255,255,255,.08);
  color: var(--text-dim);
  margin-right: 4px;
}

/* Upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s ease;
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--accent);
  background: rgba(168,85,247,.06);
}
.upload-area .filename {
  margin-top: 8px;
  color: var(--accent);
  font-weight: 600;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  border-radius: var(--radius);
  background: #111;
  border: 1px solid var(--border);
}
.modal h2 { margin: 0 0 20px; font-size: 18px; }

/* Logo upload */
.logo-upload {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.logo-preview {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 760px) {
  .md-editor-wrap { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
