:root {
  --bg: #000000;
  --surface: #0d0d0d;
  --surface2: #151515;
  --surface3: #1c1c1c;
  --border: #2a2040;
  --border2: #3d2d70;
  --purple: #7c3aed;
  --purple-light: #a78bfa;
  --purple-dim: #4c1d95;
  --purple-muted: #312060;
  --text: #f0eeff;
  --text-sub: #b8aee0;
  --muted: #6b5d9a;
  --verified: #22c55e;
  --unverified: #ef4444;
  --duo: #67e8f9;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

header {
  background: var(--surface);
  border-bottom: 2px solid var(--purple);
  padding: 28px 32px;
  text-align: center;
}

.header-eyebrow {
  font-family: "Inter", sans-serif;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

h1 {
  font-family: "Inter", sans-serif;
  font-size: clamp(11px, 1.8vw, 17px);
  line-height: 1.7;
  color: var(--purple-light);
  letter-spacing: 1px;
}

.stats-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.stat-cell {
  padding: 14px 28px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 160px;
  text-align: center;
  align-items: center;
}

.stat-cell:last-child {
  border-right: none;
}

.stat-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 26px;
  line-height: 1;
}

.stat-value.green {
  color: var(--verified);
}
.stat-value.red {
  color: var(--unverified);
}
.stat-value.purple {
  color: var(--purple-light);
}

.stat-sub {
  font-size: 11px;
  color: var(--muted);
}

.progress-track {
  height: 3px;
  background: var(--surface3);
  border-bottom: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  background: var(--purple);
  transition: width 0.8s ease;
}

.controls {
  padding: 14px 20px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-wrap svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  width: 14px;
  height: 14px;
  pointer-events: none;
}

input[type="text"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: "Exo 2", sans-serif;
  font-size: 13px;
  padding: 9px 12px 9px 34px;
  outline: none;
  transition: border-color 0.15s;
  border-radius: 4px;
}

input[type="text"]:focus {
  border-color: var(--purple);
  outline: 2px solid var(--purple);
  outline-offset: 1px;
}

select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-sub);
  font-family: "Exo 2", sans-serif;
  font-size: 13px;
  padding: 9px 30px 9px 12px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%236b5d9a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s;
  border-radius: 4px;
}

select:focus {
  border-color: var(--purple);
  outline: 2px solid var(--purple);
  outline-offset: 1px;
}

.btn-sort {
  font-family: "Inter", sans-serif;
  font-size: 7px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  letter-spacing: 1px;
  border-radius: 4px;
}

.btn-sort:hover {
  border-color: var(--purple);
  color: var(--purple-light);
}
.btn-sort:focus {
  border-color: var(--purple);
  outline: 2px solid var(--purple);
  outline-offset: 1px;
}
.btn-sort.desc {
  color: var(--purple-light);
}

.list-header {
  display: grid;
  grid-template-columns: 56px 220px 1fr 160px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.lh-cell {
  font-size: 9px;
  font-family: "Inter", sans-serif;
  color: var(--muted);
  letter-spacing: 1px;
  padding: 9px 14px;
  border-right: 1px solid var(--border);
  text-transform: uppercase;
}

.lh-cell:first-child {
  text-align: center;
  padding: 9px 6px;
}
.lh-cell:last-child {
  border-right: none;
}

.level-row {
  display: grid;
  grid-template-columns: 56px 1fr 160px 200px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.15s,
    box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.1);
  border-radius: 4px;
  margin: 2px 0;
  animation: rowIn 0.2s ease-out both;
}

.level-row:hover {
  background: var(--surface2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}

.level-row.verified-row {
  border-left: 3px solid var(--verified);
}
.level-row.unverified-row {
  border-left: 3px solid var(--unverified);
}

.rank-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-right: 1px solid var(--border);
}

.rank-num {
  font-family: "Inter", sans-serif;
  font-size: 9px;
  color: var(--muted);
  line-height: 1;
}

.rank-num.top10 {
  color: var(--purple-light);
}
.rank-num.top3 {
  color: var(--purple-light);
}
.rank-num.rank1 {
  color: #fff;
}

.thumb-col {
  display: flex;
  align-items: stretch;
}

.thumb-inner {
  width: 200px;
  height: 120px;
  background: var(--surface3);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.thumb-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.level-row:hover .thumb-inner img {
  transform: scale(1.04);
}

.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  background: linear-gradient(135deg, var(--purple-muted), var(--surface3));
}

.info-col {
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  border-right: 1px solid var(--border);
}

.level-name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  letter-spacing: 0.3px;
}

.level-creators {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.level-meta-row {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.meta-chip {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-chip svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.level-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.tag {
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid;
  white-space: nowrap;
  font-family: "Exo 2", sans-serif;
  letter-spacing: 0.3px;
  transition: transform 0.15s;
  border-radius: 12px;
}

.tag:hover {
  transform: scale(1.05);
}
.tag.duo {
  color: var(--duo);
  border-color: var(--duo);
  background: rgba(103, 232, 249, 0.08);
}
.tag.v-yes {
  color: var(--verified);
  border-color: var(--verified);
  background: rgba(34, 197, 94, 0.08);
}
.tag.v-no {
  color: var(--unverified);
  border-color: var(--unverified);
  background: rgba(239, 68, 68, 0.08);
}

.wr-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 16px;
  gap: 3px;
}

.wr-label {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wr-pct {
  font-size: 22px;
  color: var(--purple-light);
  line-height: 1;
}

.wr-pct.complete {
  color: var(--verified);
}
.wr-pct.none {
  color: var(--muted);
  font-size: 16px;
}

.wr-holder {
  font-size: 11px;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-top: 3px solid var(--purple);
  width: 100%;
  max-width: 680px;
  position: relative;
  animation: mIn 0.18s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  border-radius: 8px;
}

@keyframes mIn {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

.modal-hero {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.modal-thumb {
  width: 240px;
  height: 150px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--purple-muted), var(--surface3));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
  border-right: 1px solid var(--border);
  border-radius: 4px 0 0 4px;
}

.modal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-title-area {
  flex: 1;
  padding: 18px 48px 18px 20px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-rank-badge {
  font-family: "Inter", sans-serif;
  font-size: 8px;
  color: var(--purple-light);
  letter-spacing: 1px;
}

.modal-name {
  font-size: 20px;
  color: var(--text);
  line-height: 1.2;
}

.modal-creators-line {
  font-size: 12px;
  color: var(--text-sub);
}

.modal-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15;
  border-radius: 4px;
}

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

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}

.detail-block {
  padding: 14px 18px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.detail-block:nth-child(3n) {
  border-right: none;
}
.detail-block.full {
  grid-column: 1 / -1;
  border-right: none;
}
.detail-block.half {
  grid-column: span 2;
}

.detail-key {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.detail-val {
  font-size: 14px;
  color: var(--text);
}

.detail-val.big {
  font-size: 24px;
  color: var(--purple-light);
}
.detail-val.big.green {
  color: var(--verified);
}
.detail-val.code {
  font-family: monospace;
  font-size: 16px;
  color: var(--purple-light);
  letter-spacing: 2px;
}
.detail-val.green-txt {
  color: var(--verified);
}
.detail-val.red-txt {
  color: var(--unverified);
}

.progress-verified-note {
  font-size: 11px;
  color: var(--verified);
  margin-top: 3px;
}

.empty-state {
  padding: 80px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 16px;
}
.empty-state p {
  font-family: "Inter", sans-serif;
  font-size: 9px;
  line-height: 2;
}
.edit-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #000;
  overflow-y: auto;
  animation: editModalIn 0.18s ease;
}

.edit-modal-backdrop.open {
  display: block;
}

@keyframes editModalIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.edit-modal-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.edit-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border2);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.edit-title {
  font-size: 20px;
  color: var(--purple-light);
  flex: 1;
  font-family: "Inter", sans-serif;
  letter-spacing: 1px;
  font-weight: 700;
}

.edit-hint {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 2px;
  font-family: "Inter", sans-serif;
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 3px;
}

.edit-topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ebtn {
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background 0.15s,
    box-shadow 0.15s,
    border-color 0.15s,
    color 0.15s;
  white-space: nowrap;
}

.ebtn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-sub);
}
.ebtn-ghost:hover {
  border-color: var(--purple);
  color: var(--purple-light);
}

.ebtn-purple {
  background: rgba(124, 58, 237, 0.12);
  border-color: rgba(124, 58, 237, 0.4);
  color: var(--purple-light);
}
.ebtn-purple:hover {
  background: rgba(124, 58, 237, 0.22);
  box-shadow: 0 0 14px rgba(124, 58, 237, 0.25);
}

.ebtn-green {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--verified);
}
.ebtn-green:hover {
  background: rgba(34, 197, 94, 0.18);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.2);
}

.ebtn-red {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--unverified);
}
.ebtn-red:hover {
  background: rgba(239, 68, 68, 0.18);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.ebtn-sm {
  font-size: 10px;
  padding: 5px 10px;
  letter-spacing: 0.5px;
}

.edit-view {
  display: none;
}
.edit-view.active {
  display: block;
}

.edit-list-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}

.edit-search {
  flex: 1;
  max-width: 360px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: "Inter", sans-serif;
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  border-radius: 4px;
  transition: border-color 0.15s;
}
.edit-search:focus {
  border-color: var(--purple);
}

.edit-table-wrap {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  overflow-x: auto;
}

.edit-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.edit-table th {
  font-size: 9px;
  font-family: "Inter", sans-serif;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 10px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border2);
}

.edit-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(42, 32, 64, 0.6);
  font-size: 13px;
  font-weight: 500;
  vertical-align: middle;
  color: var(--text-sub);
}

.edit-table tr:last-child td {
  border-bottom: none;
}
.edit-table tr:hover td {
  background: rgba(124, 58, 237, 0.04);
}

.edit-td-rank {
  color: var(--muted);
  font-size: 11px;
  width: 52px;
  font-family: monospace;
}
.edit-td-name {
  color: var(--text);
  font-weight: 600;
}
.edit-td-creator {
  color: var(--purple-light);
  font-size: 12px;
}
.edit-td-id {
  color: var(--muted);
  font-family: monospace;
  font-size: 11px;
}
.edit-td-section {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.edit-td-status {
  font-size: 11px;
  font-weight: 600;
}
.edit-td-actions {
  white-space: nowrap;
  text-align: right;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}
.form-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.form-title-h3 {
  font-size: 18px;
  color: var(--text);
  flex: 1;
  font-family: "Inter", sans-serif;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}

.form-grid.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 9px;
  font-family: "Inter", sans-serif;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.form-input,
.form-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: "Inter", sans-serif;
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  border-radius: 4px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  width: 100%;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.15);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%236b5d9a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.form-select option {
  background: var(--surface2);
}

.form-section-title {
  font-size: 10px;
  font-family: "Inter", sans-serif;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 14px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 0;
}

.id-entry {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 8px;
}

.id-entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: flex-end;
}

.id-remove-btn {
  margin-bottom: 0;
  align-self: flex-end;
}

.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
  flex-wrap: wrap;
}
.save-flash {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: var(--verified);
  font-family: "Inter", sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  padding: 10px 20px;
  border-radius: 4px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.2s,
    transform 0.2s;
  pointer-events: none;
}

.save-flash.show {
  opacity: 1;
  transform: translateY(0);
}
@media (max-width: 700px) {
  .list-header,
  .level-row {
    grid-template-columns: 40px 110px 1fr;
  }
  .lh-cell:last-child,
  .wr-col {
    display: none;
  }
  .thumb-inner {
    width: 110px;
    height: 80px;
  }
  h1 {
    font-size: 10px;
  }
  .modal-grid {
    grid-template-columns: 1fr 1fr;
  }
  .detail-block:nth-child(3n) {
    border-right: 1px solid var(--border);
  }
  .detail-block:nth-child(2n) {
    border-right: none;
  }
  .detail-block.half {
    grid-column: span 2;
  }
  .modal-thumb {
    width: 140px;
    height: 110px;
  }
  .form-grid,
  .form-grid.cols-3 {
    grid-template-columns: 1fr;
  }
  .id-entry-grid {
    grid-template-columns: 1fr 1fr;
  }
  .id-remove-btn {
    grid-column: 1 / -1;
  }
  .edit-topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .list-header,
  .level-row {
    grid-template-columns: 60px 220px 1fr 160px;
  }
  .thumb-inner {
    width: 160px;
    height: 100px;
  }
  .modal {
    max-width: 720px;
  }
}

@media (min-width: 1024px) {
  .modal {
    max-width: 800px;
  }
  .list-header,
  .level-row {
    grid-template-columns: 64px 220px 1fr 160px;
  }
  .thumb-inner {
    width: 220px;
    height: 130px;
  }
}
