@import url('https://fonts.googleapis.com/css2?family=Dela+Gothic+One&family=M+PLUS+Rounded+1c:wght@400;700;800&display=swap');

:root {
  --night: #1a1433;
  --panel: #251d4a;
  --panel-2: #2f2560;
  --line: #43377d;
  --paper: #f6f2ff;
  --muted: #a99fd6;
  --sakura: #ff5c9d;
  --volt: #3fe0ff;
  --gold: #ffc93d;
  --danger: #ff4d6d;
  --ok: #5cf2a4;
  --r-common: #a99fd6;
  --r-rare: #3fe0ff;
  --r-epic: #c77dff;
  --r-legendary: #ffc93d;
  --display: 'Dela Gothic One', 'Arial Black', Impact, sans-serif;
  --body: 'M PLUS Rounded 1c', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  background: var(--night);
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(1200px 600px at 85% -10%, #3b1f63 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #123a5c 0%, transparent 60%), var(--night);
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: var(--volt);
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
:focus-visible {
  outline: 3px solid var(--volt);
  outline-offset: 2px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--night) 88%, transparent);
  backdrop-filter: blur(8px);
}
.wordmark {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--paper);
  transform: skewX(-8deg);
  display: inline-block;
}
.wordmark span {
  color: var(--sakura);
}
nav {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
}
nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}
nav a.active {
  color: var(--night);
  background: var(--paper);
}
.me {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.me img,
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--panel-2);
}
.link-btn {
  background: none;
  border: 0;
  color: var(--muted);
  text-decoration: underline;
  padding: 0;
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px clamp(16px, 4vw, 40px) 80px;
}
h1,
h2 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.1;
  margin: 0 0 16px;
}
h1 {
  font-size: clamp(36px, 7vw, 72px);
  transform: skewX(-6deg);
}
h2 {
  font-size: clamp(24px, 3.5vw, 34px);
}
p {
  max-width: 64ch;
}
.muted {
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  padding: 12px 22px;
  font-weight: 800;
  font-size: 17px;
  background: var(--sakura);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 0 #b3306a;
  transition: transform 0.08s;
}
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #b3306a;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.ghost {
  background: var(--panel-2);
  box-shadow: 0 4px 0 #1a1340;
}
.btn.small {
  padding: 8px 14px;
  font-size: 15px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
}
.row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.row > * {
  flex: 1 1 300px;
}
.stack > * + * {
  margin-top: 16px;
}

.countdown {
  font-family: var(--display);
  font-size: clamp(40px, 8vw, 80px);
  color: var(--gold);
  line-height: 1;
}

/* ---- Cards ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}
.card {
  --rc: var(--r-common);
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel);
  border: 2px solid var(--rc);
  display: flex;
  flex-direction: column;
}
.card[data-rarity='rare'] {
  --rc: var(--r-rare);
}
.card[data-rarity='epic'] {
  --rc: var(--r-epic);
}
.card[data-rarity='legendary'] {
  --rc: var(--r-legendary);
  box-shadow: 0 0 24px color-mix(in srgb, var(--r-legendary) 45%, transparent);
}
.card .art {
  aspect-ratio: 2 / 3;
  object-fit: cover;
  width: 100%;
}
.card .info {
  padding: 10px 12px 12px;
  font-size: 14px;
}
.card .name {
  font-family: var(--display);
  font-size: 20px;
  line-height: 1.1;
}
.card .title {
  color: var(--muted);
  font-size: 13px;
}
.card .rarity {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--rc);
  color: var(--night);
  font-weight: 800;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: capitalize;
}
.card.locked .art {
  filter: brightness(0.15) saturate(0);
}
.card.locked .name {
  color: var(--muted);
}
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0;
}
.chip {
  font-size: 12px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  text-transform: capitalize;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  text-align: center;
  font-size: 12px;
  margin: 8px 0;
}
.stats b {
  display: block;
  font-size: 15px;
}
.ability {
  font-size: 13px;
  color: var(--muted);
}
.ability b {
  color: var(--paper);
}

.reveal {
  display: grid;
  place-items: center;
  min-height: 200px;
}
.reveal .card {
  width: 220px;
  animation: pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes pop {
  from {
    transform: scale(0.4) rotate(-8deg);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* ---- Lineup ---- */
.slot {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}
.slot h3 {
  font-family: var(--display);
  font-weight: 400;
  margin: 0 0 10px;
  font-size: 20px;
}
select,
.field {
  width: 100%;
  font: inherit;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--paper);
}
.list-item input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--sakura);
}
.list-item:has(input:disabled) {
  opacity: 0.55;
}
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--night);
  padding: 4px;
  border-radius: 12px;
  margin-top: 12px;
}
.seg button {
  border: 0;
  background: none;
  padding: 8px 4px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
}
.seg button[aria-pressed='true'] {
  background: var(--volt);
  color: var(--night);
}
.slot .card {
  margin-top: 12px;
}
.slot .card .art {
  aspect-ratio: 1;
  object-position: top;
}

/* ---- Lists / bracket ---- */
.list {
  display: grid;
  gap: 10px;
}
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.list-item .grow {
  flex: 1;
  font-weight: 700;
}
.bracket {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.bracket-round {
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: space-around;
}
.bracket-round h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 18px;
  margin: 0;
}
.bm {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 15px;
}
.bm .p {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
}
.bm .p.win {
  color: var(--gold);
  font-weight: 800;
}
.bm .p.lose {
  color: var(--muted);
  text-decoration: line-through;
}
.bm .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}
.status-live {
  color: var(--sakura);
  font-weight: 800;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--paper);
  color: var(--night);
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 700;
  z-index: 50;
  max-width: 90vw;
}
.toast.error {
  background: var(--danger);
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }
  nav {
    order: 3;
    flex-basis: 100%;
  }
}
