:root {
  --bg: #eceff3;
  --card: #ffffff;
  --border: #1c1d1f;
  --text: #121212;
  --muted: #5d6168;
  --row-bg: #2e2f33;
  --chip-bg: #f8f8f8;
  --s: #ff4a24;
  --a: #ffa126;
  --b: #ffd637;
  --c: #2ecb71;
  --d: #2f9dff;
  --e: #8e53ff;
  --f: #f048eb;
  --panel-height: 620px;
}

* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
}

.app {
  width: 100%;
  max-width: none;
  margin: 14px 0;
  padding: 0 2rem 16px;
  zoom: 0.9;
}

body {
  margin: 0;
  background: radial-gradient(circle at top right, #f7f8fa, #dde2e8);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  font-size: 15px;
}

.card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.hidden {
  display: none;
}

.login-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.3);
  z-index: 1000;
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  padding: 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.google-login-wrap {
  margin-top: 8px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.google-login-wrap > #googleLoginBtn {
  width: 100%;
  display: flex;
  justify-content: center;
}

.google-login-wrap > #googleLoginBtn > div {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto;
}

.google-login-wrap iframe {
  max-width: 100% !important;
}

.google-hint {
  margin-top: 8px;
  font-size: 12px;
}

.logo-wordmark {
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0.03em;
}

.login-subtitle {
  font-size: 14px;
}

.logo-mark {
  color: #111827;
}

.logo-mark-accent {
  color: #ef4444;
  margin: 0 2px;
}

.logo-wordmark-header {
  font-size: 20px;
}

.login-separator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  color: #9ca3af;
}

.login-separator-line {
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.login-separator-label {
  letter-spacing: 0.08em;
}

#loginForm {
  margin-top: 12px;
  display: flex;
  gap: 10px;
}

h1,
h2,
h3 {
  margin: 0 0 10px;
}

p {
  margin: 0;
  color: var(--muted);
}

#loginForm {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}

input,
button {
  border-radius: 10px;
  border: 2px solid var(--border);
  font-size: 15px;
}

input {
  flex: 1;
  padding: 10px 12px;
}

button {
  padding: 10px 14px;
  cursor: pointer;
  background: #141518;
  color: #fff;
}

.danger-btn {
  background: #b42318;
}

.action-group {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-self: end;
  flex-wrap: nowrap;
}

.vote-btn {
  background: #0f6c38;
}

.vote-btn:disabled {
  background: #6b7280;
  cursor: not-allowed;
  opacity: 0.92;
}

.vote-btn.voted:disabled {
  background: #1f9d55;
  opacity: 1;
}

.logout-btn {
  background: #374151;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: min(92vw, 420px);
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.modal-close-btn {
  margin-top: 12px;
  width: 100%;
}

.topbar {
  margin-bottom: 8px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  font-size: 14px;
  position: relative;
  overflow: hidden;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(102deg, rgba(255, 132, 40, 0) 0%, rgba(255, 132, 40, 0.22) 38%, rgba(255, 132, 40, 0) 72%);
  transform: translateX(-130%);
  animation: sweep-fire 6s linear infinite;
  pointer-events: none;
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  min-width: 0;
}

.topbar-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 34px;
}

.topbar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.topbar-center .urgency-pill {
  white-space: nowrap;
}

.topbar-center .category-tabs {
  flex-wrap: wrap;
  justify-content: center;
}

.topbar-center .category-tabs.hidden {
  display: none;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.welcome-row {
  display: none;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.user-avatar.hidden {
  display: none;
}

.live-pill {
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #fff;
  background: linear-gradient(180deg, #ff5e2f 0%, #d62f00 100%);
  box-shadow: 0 0 0 rgba(255, 88, 38, 0.65);
  animation: pulse-fire 1.8s ease-in-out infinite;
}

.urgency-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  color: #0f172a;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.category-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tab-btn {
  background: linear-gradient(180deg, #f8fafc 0%, #e7ecf4 100%);
  color: #1d2430;
  border: 3px solid #1c2535;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1;
  box-shadow: 0 7px 16px rgba(15, 22, 38, 0.14);
  transition: transform 0.2s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.2s ease;
}

.tab-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.26);
}

.tab-btn.active {
  background: linear-gradient(160deg, #203761 0%, #121f39 64%);
  color: #ffffff;
  border-color: #13243f;
  box-shadow: 0 0 0 rgba(255, 120, 48, 0.72), 0 10px 26px rgba(10, 19, 37, 0.5);
  animation: pulse-tab 2.1s ease-in-out infinite;
}

.content-grid {
  display: grid;
  grid-template-columns: 22% 56% 22%;
  gap: 10px;
  align-items: stretch;
}

.left-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: var(--panel-height);
  height: var(--panel-height);
  overflow: hidden;
}

.right-floating {
  position: sticky;
  top: 16px;
}

.center-board {
  min-width: 0;
  min-height: var(--panel-height);
  height: var(--panel-height);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tray-panel {
  padding: 10px;
  min-width: 0;
  min-height: var(--panel-height);
  height: var(--panel-height);
  overflow: hidden;
}

.tray-area {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tray-area h3 {
  margin-bottom: 8px;
}

.winner-card {
  padding: 10px;
}

.winner-card h3 {
  margin-bottom: 6px;
  font-size: 18px;
}

.winner-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
}

.winner-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.board-wrap {
  padding: 12px;
}

.tier-board {
  border: 2px solid var(--border);
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: var(--row-bg);
}

.prelogin-blur {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

.tier-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  min-height: 74px;
  flex: 1 1 0;
  border-bottom: 2px solid var(--border);
}

.tier-row:last-child {
  border-bottom: 0;
}

.tier-label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.1;
  padding: 6px;
  color: #fff;
  border-right: 2px solid var(--border);
}

.tier-label.S {
  background: var(--s);
}

.tier-label.A {
  background: var(--a);
}

.tier-label.B {
  background: var(--b);
  color: #2a2a2a;
}

.tier-label.D {
  background: var(--d);
}

.tier-label.F {
  background: var(--f);
}

.drop-zone {
  background: var(--row-bg);
  min-height: 72px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px;
  align-items: flex-start;
}

.drop-zone.drag-over {
  outline: 3px dashed #fff;
  outline-offset: -6px;
}

.unranked-area {
  margin-top: 12px;
}

.unranked-area h3 {
  margin: 0 0 8px;
}

.unranked-list {
  border: 2px solid var(--border);
}

.tray-list {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.tray-list .model-chip {
  min-width: 0;
  width: 100%;
}

.model-chip {
  border: 2px solid #111;
  background: var(--chip-bg);
  color: #111;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: grab;
  user-select: none;
  min-width: 150px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.model-chip-main {
  line-height: 1.15;
}

.model-chip-main strong {
  display: block;
  font-size: 13px;
}

.model-chip-main span {
  font-size: 11px;
  color: #41444b;
}

.provider-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1px solid #111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  flex: 0 0 auto;
}

.provider-icon.cell {
  margin-right: 6px;
}

.provider-logo {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1px solid #111;
  object-fit: contain;
  background: #fff;
  padding: 1px;
  flex: 0 0 auto;
}

.provider-logo.cell {
  margin-right: 6px;
}

.provider-openai {
  background: #111;
  color: #fff;
}

.provider-anthropic {
  background: #d97706;
  color: #fff;
}

.provider-google {
  background: #2563eb;
  color: #fff;
}

.provider-meta {
  background: #0f4ad0;
  color: #fff;
}

.provider-xai {
  background: #303030;
  color: #fff;
}

.provider-mistral {
  background: #ef4444;
  color: #fff;
}

.provider-anysphere {
  background: #0f172a;
  color: #fff;
}

.provider-codeium {
  background: #0c4a6e;
  color: #fff;
}

.provider-github {
  background: #111827;
  color: #fff;
}

.provider-replit {
  background: #ea580c;
  color: #fff;
}

.provider-tabnine {
  background: #4f46e5;
  color: #fff;
}

.provider-amazon {
  background: #232f3e;
  color: #fff;
}

.provider-sourcegraph {
  background: #2563eb;
  color: #fff;
}

.provider-jetbrains {
  background: #111827;
  color: #fff;
}

.provider-lovable {
  background: #ec4899;
  color: #fff;
}

.provider-antigravity {
  background: #0f172a;
  color: #fff;
}

.provider-stackblitz {
  background: #0284c7;
  color: #fff;
}

.provider-vercel {
  background: #111827;
  color: #fff;
}

.provider-cognition {
  background: #0f172a;
  color: #fff;
}

.provider-augment {
  background: #7c3aed;
  color: #fff;
}

.provider-cline {
  background: #4f46e5;
  color: #fff;
}

.provider-continue {
  background: #2563eb;
  color: #fff;
}

.provider-aider {
  background: #059669;
  color: #fff;
}

.provider-unknown {
  background: #9ca3af;
  color: #111;
}

.leaderboard-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.leaderboard-header h3 {
  margin: 0;
  font-size: 1em;
}

.stats-card {
  padding: 10px;
  overflow-x: auto;
  overflow-y: auto;
  font-size: 13px;
  flex: 1;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid #d8dde4;
  text-align: left;
  padding: 8px 6px;
  font-size: 14px;
}

th {
  background: #f3f6fa;
}

.model-cell {
  display: flex;
  align-items: center;
  gap: 7px;
}

.tier-pill {
  display: inline-flex;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
}

.tier-pill.B {
  color: #202020;
}

@keyframes pulse-fire {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 88, 38, 0.62);
  }
  70% {
    box-shadow: 0 0 0 11px rgba(255, 88, 38, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 88, 38, 0);
  }
}

@keyframes pulse-tab {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 112, 44, 0.58);
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 112, 44, 0);
    transform: translateY(-1px);
  }
}

@keyframes sweep-fire {
  0% {
    transform: translateX(-130%);
  }
  100% {
    transform: translateX(430%);
  }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .action-group,
  .topbar-avatar,
  .header-title {
    justify-self: stretch;
  }

  .category-tabs {
    justify-content: flex-start;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .right-floating {
    position: static;
  }

  .left-panel,
  .center-board,
  .tray-panel {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .tier-row {
    grid-template-columns: 100px 1fr;
  }

  .tier-label {
    font-size: 26px;
  }
}
