:root {
  --brand: #ff7a00;
  --brand-2: #ffb703;
  --good: #22e07a;
  --bad: #ff4d5e;
  --special: #ffd166;
  --ink: #101426;
  --paper: #fff8ef;
  --card: #1a2038;
  --line: rgba(255, 255, 255, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Rubik', system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 50% 0%, #26305e 0%, #101426 55%, #090b16 100%);
  color: var(--paper);
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 28px 32px 16px;
  border-bottom: 1px solid var(--line);
}
.back {
  display: inline-block;
  color: var(--brand-2);
  font-weight: 700;
  text-decoration: none;
  margin-bottom: 10px;
  font-size: 14px;
}
.back:hover { text-decoration: underline; }
.top h1 { margin: 0 0 8px; font-size: clamp(24px, 4vw, 36px); font-weight: 900; }
.sub { margin: 0; opacity: .75; max-width: 640px; line-height: 1.5; font-size: 15px; }
.logo { height: 28px; display: block; margin-bottom: 12px; filter: brightness(0) invert(1); opacity: .9; }
.stats { font-size: 14px; font-weight: 700; color: var(--brand-2); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 16px 32px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(16, 20, 38, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
#search {
  flex: 1;
  min-width: 220px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .15);
  background: rgba(0, 0, 0, .35);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
}
#search:focus { outline: none; border-color: var(--brand-2); }
.toolbar-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-btns button {
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06);
  color: #fff;
  cursor: pointer;
}
.toolbar-btns button:hover { background: rgba(255, 255, 255, .12); }
.toolbar-btns #btn-reset { border-color: rgba(255, 122, 0, .4); color: var(--brand-2); }

.section { padding: 8px 32px 24px; }
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}
.section-head h2 { margin: 0; font-size: 20px; font-weight: 900; letter-spacing: .06em; }
.section-head .badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
}
.section-head.good h2 { color: var(--good); }
.section-head.bad h2 { color: var(--bad); }
.section-head.special h2 { color: var(--special); }
.section-head.powerup h2 { color: #4cc9f0; }
.kind-powerup { background: rgba(76, 201, 240, .2); color: #4cc9f0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: opacity .2s, transform .15s, border-color .2s;
}
.card.off {
  opacity: .45;
  transform: scale(.98);
  border-color: rgba(255, 77, 94, .35);
}
.card.off .preview { filter: grayscale(.7); }

.preview-wrap {
  position: relative;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #2c3560 0%, #1a2038 100%);
  border-bottom: 1px solid var(--line);
}
.preview-wrap canvas { display: block; max-width: 92%; max-height: 92%; }
.kind-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  padding: 4px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}
.kind-good { background: rgba(34, 224, 122, .2); color: var(--good); }
.kind-bad { background: rgba(255, 77, 94, .2); color: var(--bad); }
.kind-special { background: rgba(255, 209, 102, .2); color: var(--special); }

.card-body { padding: 14px 16px 16px; }
.card-title { margin: 0 0 4px; font-size: 17px; font-weight: 900; }
.card-id {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--brand-2);
  margin-bottom: 8px;
}
.card-desc { margin: 0 0 10px; font-size: 13px; opacity: .75; line-height: 1.45; }
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  opacity: .65;
  margin-bottom: 14px;
}
.meta span { white-space: nowrap; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.toggle-label { font-size: 13px; font-weight: 700; }
.toggle-label.off { color: var(--bad); }

.switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 77, 94, .35);
  border-radius: 999px;
  cursor: pointer;
  transition: .2s;
}
.slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}
.switch input:checked + .slider { background: rgba(34, 224, 122, .45); }
.switch input:checked + .slider::before { transform: translateX(22px); }

.foot {
  padding: 20px 32px 32px;
  font-size: 13px;
  opacity: .7;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
}
#disabled-json {
  background: rgba(0, 0, 0, .35);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  word-break: break-all;
  max-width: 100%;
}
.foot-note { margin-left: auto; opacity: .6; }

body:not(.debug-mode) .admin-only { display: none !important; }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  opacity: .6;
}

@media (max-width: 640px) {
  .top, .toolbar, .section, .foot { padding-left: 16px; padding-right: 16px; }
  .top { flex-direction: column; }
}
