@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  --bg: #08060f;
  --text: #f6f3ff;
  --muted: #a89bc4;
  --faint: #6f6488;
  --accent: #a78bfa;
  --accent2: #22d3ee;
  --accent3: #f472b6;
  --good: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --card: rgba(22, 16, 40, 0.78);
  --border: rgba(167, 139, 250, 0.18);
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 50% at 10% -10%, rgba(167, 139, 250, 0.3), transparent 55%),
    radial-gradient(ellipse 55% 40% at 90% 10%, rgba(34, 211, 238, 0.18), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(244, 114, 182, 0.14), transparent 55%),
    linear-gradient(180deg, #0c0818, #08060f 60%);
}

a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}
.wrap.wide { width: min(1180px, calc(100% - 2rem)); }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  text-decoration: none !important;
}
.mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 10px 28px rgba(167, 139, 250, 0.35);
  font-size: 1.2rem;
}
.brand b { display: block; font-weight: 800; letter-spacing: -0.02em; }
.brand small { color: var(--muted); font-size: 0.8rem; }

.hero { text-align: center; padding: 0.5rem 0 1.25rem; }
.hero h1 {
  margin: 0 0 0.55rem;
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(120deg, #fff, #c4b5fd 45%, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.muted { color: var(--muted); line-height: 1.5; }
.pill {
  display: inline-flex;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(167, 139, 250, 0.12);
  color: #ddd6fe;
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.panel {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.25rem;
}
.panel + .panel { margin-top: 1rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(40, 28, 70, 0.9), rgba(16, 12, 32, 0.95));
  color: var(--text);
  text-decoration: none !important;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(167, 139, 250, 0.4);
}
.card span { color: var(--muted); font-size: 0.82rem; }

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
input, select, textarea, button, .btn {
  font: inherit;
}
input[type="text"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(8, 6, 16, 0.8);
  color: var(--text);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.14);
}
textarea { min-height: 100px; resize: vertical; }

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.7rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
}
.btn:hover, button.btn:hover { background: rgba(255, 255, 255, 0.09); }
.btn.primary {
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 10px 26px rgba(167, 139, 250, 0.3);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.field { margin-bottom: 0.9rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.row > * { flex: 1 1 140px; }

.footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 0.85rem;
  text-align: center;
  line-height: 1.5;
}

/* music */
.viz {
  height: 120px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #05040a;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 12px;
  overflow: hidden;
}
.viz span {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--accent2), var(--accent));
  min-height: 8px;
  transition: height 0.08s linear;
}

/* typing */
.prompt {
  font-family: var(--mono);
  font-size: 1.05rem;
  line-height: 1.7;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #05040a;
  min-height: 120px;
  white-space: pre-wrap;
  word-break: break-word;
}
.prompt .ok { color: var(--good); }
.prompt .bad { color: var(--danger); background: rgba(251, 113, 133, 0.15); }
.prompt .cur { border-left: 2px solid var(--accent2); }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.6rem;
  margin: 0.85rem 0;
}
.stat {
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}
.stat b { display: block; font-size: 1.25rem; }
.stat span { font-size: 0.78rem; color: var(--muted); }

/* quotes */
.quote-card {
  padding: 1.75rem 1.5rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 100% 0%, rgba(244, 114, 182, 0.18), transparent 45%),
    linear-gradient(165deg, rgba(40, 24, 64, 0.95), rgba(12, 8, 24, 0.98));
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}
.quote-card blockquote {
  margin: 0;
  font-size: clamp(1.15rem, 3vw, 1.55rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.45;
}
.quote-card cite {
  color: var(--muted);
  font-style: normal;
  font-size: 0.95rem;
}

/* tierlist */
.tiers { display: flex; flex-direction: column; gap: 0.45rem; }
.tier-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  min-height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.tier-label {
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: #111;
}
.tier-drop {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  align-content: flex-start;
  min-height: 72px;
}
.chip-item {
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(167, 139, 250, 0.15);
  cursor: grab;
  user-select: none;
  font-size: 0.88rem;
}
.chip-item.dragging { opacity: 0.5; }
.pool {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 56px;
  padding: 0.65rem;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: rgba(0, 0, 0, 0.25);
}

/* trivia */
.room-code {
  font-family: var(--mono);
  font-size: 1.8rem;
  letter-spacing: 0.2em;
  font-weight: 700;
}
.players { display: flex; flex-direction: column; gap: 0.4rem; }
.player {
  display: flex;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}
.opts { display: grid; gap: 0.5rem; }
.opts button {
  text-align: left;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}
.opts button:hover { border-color: rgba(167, 139, 250, 0.45); }
.opts button.sel { border-color: var(--accent2); background: rgba(34, 211, 238, 0.12); }
.opts button.good { border-color: var(--good); background: rgba(52, 211, 153, 0.12); }
.opts button.bad { border-color: var(--danger); background: rgba(251, 113, 133, 0.12); }

/* pixel */
#px {
  image-rendering: pixelated;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #111;
  cursor: crosshair;
  max-width: 100%;
  touch-action: none;
}
.swatches { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
}
.swatch.on { border-color: #fff; }

.hidden { display: none !important; }
.toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.toast {
  padding: 0.7rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(16, 12, 32, 0.95);
  font-size: 0.9rem;
}
