@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --bg: #0b0f1a;
  --bg-soft: #101626;
  --surface: #151c30;
  --surface-2: #1b243c;
  --border: #252f4a;
  --text: #e8ecf7;
  --text-muted: #9aa6c2;
  --text-faint: #6b7694;
  --accent: #7c9cff;
  --accent-strong: #5b7cf5;
  --accent-soft: rgba(124, 156, 255, 0.14);
  --ok: #4ade80;
  --danger: #f87171;
  --radius-lg: 1rem;
  --radius-md: 0.625rem;
  --radius-sm: 0.4375rem;
  --shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: radial-gradient(120% 90% at 50% 0%, #141b30 0%, var(--bg) 55%);
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  left: -62.5rem;
  top: 0.5rem;
  z-index: 50;
  background: var(--accent);
  color: #0b0f1a;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  left: 0.5rem;
}

#app {
  width: 100%;
  padding: 2.5rem 1.5rem 3rem;
}

.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2.25rem;
  text-align: center;
}

.brand {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.brand-mark {
  color: var(--accent);
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 0.25rem;
  text-wrap: balance;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-muted);
}

.status-wrap {
  text-align: center;
  padding-top: 0.25rem;
}

.status {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.status.error {
  color: var(--danger);
  font-weight: 600;
}

.model-list {
  font-size: 0.8125rem;
  color: var(--text-faint);
  text-align: center;
  white-space: nowrap;
  min-width: 14rem;
}

h2,
h3,
h4 {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text);
  letter-spacing: -0.01em;
}

.layout {
  display: grid;
  grid-template-columns: 43.75rem minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.controls {
  background: var(--surface);
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 1rem;
}

.controls-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
}

.controls-head h2 {
  font-size: 1.125rem;
}

.mode-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.reset-btn {
  padding: 0.625rem 1.25rem;
  border: 0.0625rem solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: 'Geist', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.reset-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(248, 113, 113, 0.06);
}

.reset-btn:focus-visible {
  outline: 0.125rem solid var(--accent);
  outline-offset: 0.125rem;
}

.tabs-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.tabs {
  display: flex;
  gap: 0.375rem;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  width: 100%;
}

.tab {
  flex: 1;
  padding: 0.5rem 1.5rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Geist', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, transform 0.1s;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.tab:active {
  transform: scale(0.97);
}

.tab:focus-visible {
  outline: 0.125rem solid var(--accent);
  outline-offset: 0.125rem;
}

.tab.active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.3);
}

.tabs-desc {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.375rem;
  width: 100%;
}

.tab-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
  opacity: 0;
  transition: opacity 0.2s;
}

.tab-desc.active {
  opacity: 1;
}

.model-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  width: 100%;
  max-width: 46rem;
}

.model-card {
  position: relative;
  touch-action: manipulation;
  padding: 0.75rem 1rem;
  border: 0.0625rem solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: 'Geist', sans-serif;
  text-align: center;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  transition: border-color 0.2s, background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.card-dot {
  position: absolute;
  top: 0.625rem;
  right: 0.625rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--dot-color);
  flex-shrink: 0;
}

.model-card:hover:not(:disabled) {
  border-color: var(--accent);
  background: #202a47;
  transform: translateY(-0.125rem);
  box-shadow: 0 0.375rem 1rem rgba(0, 0, 0, 0.3);
}

.model-card:active:not(:disabled) {
  transform: translateY(0);
}

.model-card:focus-visible {
  outline: 0.125rem solid var(--accent);
  outline-offset: 0.125rem;
}

.model-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 0.1875rem var(--accent-soft);
}

.model-card:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.picker-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.update-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.update-wrap .model-list {
  min-width: 0;
}

.hint {
  font-size: 0.8125rem;
  color: var(--text-faint);
}

.update-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  background: var(--accent);
  color: #0b0f1a;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: 'Geist', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.update-btn:hover {
  background: var(--accent-strong);
  box-shadow: 0 0.375rem 1rem rgba(91, 124, 245, 0.35);
}

.update-btn:active {
  transform: scale(0.97);
}

.update-btn:focus-visible {
  outline: 0.125rem solid var(--accent);
  outline-offset: 0.1875rem;
}

.update-icon {
  width: 1rem;
  height: 1rem;
  display: inline-flex;
}

.update-icon svg {
  width: 100%;
  height: 100%;
}

.visualization {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
  min-width: 0;
}

.radar-container {
  background: var(--surface);
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  min-width: 0;
}

.radar-col {
  min-width: 0;
}

.radar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.radar-head h3 {
  font-size: 1.25rem;
}

.radar-meta {
  font-size: 0.8125rem;
  color: var(--text-faint);
}

.radar-and-price {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  min-width: 0;
}

#radar-chart {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.radar-svg {
  width: 100%;
  height: auto;
  display: block;
  max-width: 46rem;
  min-width: 0;
  filter: drop-shadow(0 0.375rem 1rem rgba(0, 0, 0, 0.25));
}

.axis-legend {
  margin-top: 1rem;
  border-top: 0.0625rem solid var(--border);
  padding-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.625rem 1.5rem;
}

.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
  min-width: 0;
}

.legend-item:nth-child(-n+4) {
  border-bottom: 0.0625rem solid var(--border);
  padding-bottom: 0.625rem;
}

.legend-item strong {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  min-width: 5rem;
}

.legend-body {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.legend-best {
  font-size: 0.75rem;
  line-height: 1;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  visibility: hidden;
  min-width: 0;
  overflow: hidden;
}

.legend-best-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legend-best .tip-badge {
  color: #f5c26b;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

.legend-best--silver .tip-badge {
  color: #c9d1dc;
}

.legend-best--bronze .tip-badge {
  color: #cd7f32;
}

.legend-best .tip-badge svg {
  width: 0.75rem;
  height: 0.75rem;
}

.legend-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--dot-color);
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0.2rem;
}
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    #27324f 50%,
    var(--surface-2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.skeleton-card {
  height: 4.25rem;
  border: 0.0625rem solid var(--border);
}

.skeleton-radar {
  width: 100%;
  max-width: 46rem;
  aspect-ratio: 980 / 1240;
  border: 0.0625rem solid var(--border);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

footer {
  text-align: center;
  margin-top: 2rem;
  color: var(--text-faint);
  font-size: 0.875rem;
}

footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 0.125rem;
}

footer a:hover {
  color: var(--accent);
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0.75rem);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  border: 0.0625rem solid var(--border);
  color: var(--text);
  font-size: 0.875rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.radar-tooltip {
  position: fixed;
  max-width: 19rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  border: 0.0625rem solid var(--border);
  color: var(--text);
  font-size: 0.8125rem;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
}

.radar-tooltip.show {
  opacity: 1;
}

.tip-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.tip-empty .tip-title {
  margin-bottom: 0;
}

.tip-row {
  display: flex;
  align-items: center;
  gap: 0.4375rem;
  white-space: nowrap;
  line-height: 1.5;
}

.tip-row strong {
  font-weight: 500;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.tip-row .legend-dot {
  width: 0.4375rem;
  height: 0.4375rem;
  align-self: center;
  margin-top: 0;
}

.tip-row .tip-value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.tip-row .tip-badge {
  margin-left: auto;
  color: #f5c26b;
  display: inline-flex;
}

.tip-badge svg {
  width: 0.875rem;
  height: 0.875rem;
}

.legend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  background: var(--accent);
  color: #0b0f1a;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: 'Geist', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  margin-top: 0.75rem;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.legend-toggle:hover {
  background: var(--accent-strong);
  box-shadow: 0 0.375rem 1rem rgba(91, 124, 245, 0.35);
}

.legend-toggle:active {
  transform: scale(0.97);
}

.legend-toggle:focus-visible {
  outline: 0.125rem solid var(--accent);
  outline-offset: 0.1875rem;
}

.axis-legend.hidden {
  display: none;
}

@media (max-width: 68rem) {
  .layout {
    grid-template-columns: 1fr;
  }

  .controls {
    position: static;
  }

  .model-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .axis-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .legend-item:nth-child(-n+4) {
    border-bottom: none;
    padding-bottom: 0;
  }

  .legend-item:nth-child(-n+2) {
    border-bottom: 0.0625rem solid var(--border);
    padding-bottom: 0.625rem;
  }
}

@media (max-width: 48rem) {
  #app {
    padding: 1.5rem 1rem 2rem;
  }

  .site-header {
    gap: 1rem;
  }

  .status-wrap {
    text-align: center;
  }

  h1 {
    font-size: 1.5rem;
  }

  .controls {
    padding: 1rem;
  }

  .radar-container {
    padding: 1rem;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
    padding: 0.5rem 0.75rem;
  }

  .tab-desc {
    font-size: 0.75rem;
  }

  .model-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .picker-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .update-btn,
  .legend-toggle {
    justify-content: center;
    width: 100%;
  }

  .axis-legend {
    grid-template-columns: minmax(0, 1fr);
  }

  .legend-item:nth-child(-n+2) {
    border-bottom: none;
    padding-bottom: 0;
  }

  .legend-item:not(:last-child) {
    border-bottom: 0.0625rem solid var(--border);
    padding-bottom: 0.625rem;
  }
}
