:root {
  --accent-color: #7657ff;
  --on-accent-color: #ffffff;
  --color-main: #171820;
  --color-back: #f3f4f8;
  --color-surface: #ffffff;
  --color-panel: var(--color-surface);
  --color-border: #dfe1e9;
  --color-muted: #747989;
  --color-soft: #ecebf8;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --shadow-soft: 0 14px 38px rgba(31, 35, 54, 0.08);
  color-scheme: light;
}

html[data-theme="dark"],
html[data-brightness="dark"] {
  --color-main: #f4f5f8;
  --color-back: #171922;
  --color-surface: #222532;
  --color-panel: var(--color-surface);
  --color-border: #3a3e4d;
  --color-muted: #aeb3c2;
  --color-soft: #302d4c;
  --shadow-soft: 0 18px 42px rgba(0, 0, 0, 0.24);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--color-back);
  font-family: var(--font-ui);
  color: var(--color-main);
}

html[data-embed-context="full"],
html[data-embed-context="inline"] {
  background: transparent;
}

body {
  margin: 0;
  background: var(--color-back);
  color: var(--color-main);
  font-size: 15px;
  line-height: 1.45;
  transition: background-color 3333ms ease, color 3333ms ease;
}

html[data-embed-context="full"] body,
html[data-embed-context="inline"] body {
  background: transparent;
}

html[data-embed-context="direct"] body,
html[data-embed-context="full"] body {
  min-height: 100vh;
}

html[data-embed-context="inline"] body {
  min-height: 0;
}

button,
a,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent-color) 54%, transparent);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

#app-direct-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  min-height: 72px;
  padding: 18px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-panel) 88%, transparent);
  transition: background-color 3333ms ease, border-color 3333ms ease;
}

html:not([data-embed-context="direct"]) [data-direct-only] {
  display: none !important;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--color-muted);
  font-size: 0.82rem;
}

.breadcrumb a {
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--color-main);
}

.breadcrumb a[aria-current="page"] {
  color: var(--color-main);
}

.direct-header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.direct-app-title {
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.logo-button,
.icon-button {
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--color-main);
  cursor: pointer;
}

.logo-button {
  width: 32px;
  height: 32px;
  padding: 0;
}

.logo-button img {
  display: block;
  width: 27px;
  height: 27px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--color-muted);
  font-size: 1.6rem;
  line-height: 1;
}

.icon-button:hover {
  background: var(--color-soft);
  color: var(--color-main);
}

.preferences-panel {
  position: fixed;
  z-index: 10;
  top: 16px;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: var(--color-panel);
  box-shadow: var(--shadow-soft);
}

.preferences-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.preferences-panel h2,
.preferences-panel p {
  margin: 0;
}

.preferences-panel h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.preferences-copy {
  margin-top: 22px !important;
  color: var(--color-muted);
  font-size: 0.92rem;
}

.preferences-copy code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--color-soft);
  font-family: var(--font-mono);
  font-size: 0.82em;
}

.preferences-links {
  display: flex;
  gap: 14px;
  margin-top: 24px;
  font-size: 0.88rem;
  font-weight: 700;
}

.preferences-links a:hover {
  color: var(--accent-color);
}

.dashboard-shell {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) 0 56px;
}

.direct-intro {
  max-width: 620px;
  margin-bottom: clamp(30px, 5vw, 56px);
}

.kicker,
.section-label,
.eyebrow,
.section-unit,
.period-label {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.direct-intro h1 {
  max-width: 520px;
  margin: 10px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 5.3rem);
  letter-spacing: -0.075em;
  line-height: 0.98;
}

.intro-copy {
  max-width: 390px;
  margin: 0;
  color: var(--color-muted);
  font-size: 1rem;
}

.dashboard-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.dashboard-toolbar h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  letter-spacing: -0.045em;
}

.period-label {
  padding-bottom: 3px;
  letter-spacing: 0.04em;
  text-transform: none;
}

.status-message {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent-color);
  background: var(--color-soft);
  color: var(--color-main);
}

.dashboard-content {
  display: grid;
  grid-template-columns: minmax(235px, 1.1fr) minmax(250px, 1fr) minmax(280px, 1.15fr);
  gap: 14px;
  align-items: stretch;
}

.top-model,
.ranking-section,
.chart-section {
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: var(--color-panel);
  transition: background-color 3333ms ease, border-color 3333ms ease;
}

.top-model {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  min-height: 300px;
  padding: 22px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent-color) 11%, var(--color-panel)), var(--color-panel) 68%);
}

.top-model-media {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 152px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent-color) 10%, transparent);
}

.top-model-media img {
  display: block;
  width: 112px;
  height: 112px;
  object-fit: contain;
}

.rank-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-color);
  color: var(--on-accent-color);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.top-model-copy h3 {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 4vw, 2.1rem);
  letter-spacing: -0.06em;
  line-height: 1;
}

.top-model-share {
  margin: 10px 0 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.ranking-section,
.chart-section {
  padding: 20px;
}

.section-heading-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--color-border);
}

.section-heading-row h3 {
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
}

.section-unit {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
}

.ranking-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ranking-item {
  display: grid;
  grid-template-columns: 28px 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 76px;
  border-bottom: 1px solid var(--color-border);
}

.ranking-item:last-child {
  border-bottom: 0;
}

.ranking-number {
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.ranking-symbol {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.ranking-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.ranking-usage {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
}

.ranking-share {
  color: var(--color-muted);
  font-size: 0.72rem;
}

.chart-layout {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(140px, 0.9fr);
  grid-template-areas: "legend chart";
  align-items: center;
  gap: 18px;
  padding-top: 18px;
}

.chart-wrap {
  container-type: inline-size;
  grid-area: chart;
  position: relative;
  width: min(190px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
}

.usage-chart {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.usage-chart:focus,
.usage-chart:focus-visible,
.chart-segment:focus,
.chart-segment:focus-visible {
  outline: none;
}

.chart-track,
.chart-segment {
  fill: none;
  stroke-width: 16;
}

.chart-track {
  stroke: color-mix(in srgb, var(--color-border) 70%, transparent);
}

.chart-segment {
  stroke-linecap: butt;
  pointer-events: stroke;
  cursor: pointer;
  transition:
    opacity var(--model-opacity-duration, 300ms) ease,
    stroke-dasharray 3333ms ease,
    stroke-dashoffset 3333ms ease,
    stroke 3333ms ease;
}

.chart-segment--entering {
  transition:
    opacity var(--model-opacity-duration, 300ms) ease,
    stroke-dasharray var(--intro-segment-duration, 500ms) ease-in-out var(--intro-segment-delay, 0ms),
    stroke-dashoffset var(--intro-segment-duration, 500ms) ease-in-out var(--intro-segment-delay, 0ms),
    stroke 3333ms ease;
}

.chart-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  pointer-events: none;
}

.chart-center span {
  color: var(--accent-color);
  font-family: var(--font-ui);
  font-size: clamp(1.08rem, 11.4cqw, 1.5rem);
  font-weight: 800;
  letter-spacing: normal;
  transition: color 3333ms ease;
}

html:not([data-theme="dark"]):not([data-brightness="dark"]) .chart-center span {
  text-shadow:
    0 0 1px rgba(23, 24, 32, 0.28),
    0 1px 3px rgba(23, 24, 32, 0.38);
}

.chart-legend {
  grid-area: legend;
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legend-item {
  display: grid;
  grid-template-columns: 13px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
  font-size: clamp(1.08rem, 2vw, 1.35rem);
  transition: opacity var(--model-opacity-duration, 300ms) ease;
}

.legend-swatch {
  width: 13px;
  height: 13px;
  margin-top: 6px;
  border-radius: 50%;
  transition:
    opacity var(--model-opacity-duration, 300ms) ease,
    background-color 3333ms ease;
}

.legend-item:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent-color) 54%, transparent);
  outline-offset: 5px;
}

/* Homepage owns the live accent timeline. Do not add a second, lagging color transition. */
html[data-embed-context="full"] body,
html[data-embed-context="inline"] body,
html[data-embed-context="full"] #app-direct-header,
html[data-embed-context="inline"] #app-direct-header,
html[data-embed-context="full"] .top-model,
html[data-embed-context="inline"] .top-model,
html[data-embed-context="full"] .ranking-section,
html[data-embed-context="inline"] .ranking-section,
html[data-embed-context="full"] .chart-section,
html[data-embed-context="inline"] .chart-section {
  transition: none;
}

html[data-embed-context="full"] .chart-segment,
html[data-embed-context="inline"] .chart-segment {
  transition:
    opacity var(--model-opacity-duration, 300ms) ease,
    stroke-dasharray 3333ms ease,
    stroke-dashoffset 3333ms ease;
}

html[data-embed-context="full"] .chart-segment--entering,
html[data-embed-context="inline"] .chart-segment--entering {
  transition:
    opacity var(--model-opacity-duration, 300ms) ease,
    stroke-dasharray var(--intro-segment-duration, 500ms) ease-in-out var(--intro-segment-delay, 0ms),
    stroke-dashoffset var(--intro-segment-duration, 500ms) ease-in-out var(--intro-segment-delay, 0ms);
}

html[data-embed-context="full"] .chart-center span,
html[data-embed-context="inline"] .chart-center span {
  transition: none;
}

html[data-embed-context="full"] .legend-swatch,
html[data-embed-context="inline"] .legend-swatch {
  transition: opacity var(--model-opacity-duration, 300ms) ease;
}

.legend-copy {
  display: grid;
  gap: 4px;
}

.legend-name {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-detail {
  color: var(--color-muted);
  cursor: default;
  font-size: clamp(0.9rem, 1.5vw, 1.08rem);
}

#app-direct-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 16px 0 24px;
  color: var(--color-muted);
  font-size: 0.75rem;
}

#app-direct-footer a {
  text-decoration: none;
}

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

@media (max-width: 900px) {
  .dashboard-content {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .top-model {
    grid-row: span 2;
  }

  .chart-section {
    grid-column: 2;
  }
}

@media (max-width: 680px) {
  #app-direct-header {
    align-items: flex-start;
    padding: 16px 20px;
  }

  .direct-header-actions {
    gap: 8px;
  }

  .direct-app-title {
    display: none;
  }

  .dashboard-shell {
    width: min(100% - 28px, 520px);
    padding-top: 28px;
  }

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

  .top-model {
    grid-row: auto;
    min-height: 0;
  }

  .chart-section {
    grid-column: auto;
  }

  .chart-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "chart"
      "legend";
    justify-items: center;
    gap: 30px;
  }

  .share-poster > .chart-layout .chart-wrap {
    width: min(260px, 82vw);
  }

  .share-poster > .chart-layout .chart-legend {
    width: min(260px, 82vw);
    max-width: 100%;
    gap: 16px;
  }

  #app-direct-footer {
    width: min(100% - 28px, 520px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

html[data-reduced-motion="true"] *,
html[data-reduced-motion="true"] *::before,
html[data-reduced-motion="true"] *::after {
  transition-duration: 0.01ms !important;
  animation-duration: 0.01ms !important;
}

/* Share view: the chart is intentionally open and unboxed. */
#app {
  display: flex;
}

html[data-embed-context="direct"] #app {
  min-height: calc(100vh - 128px);
}

html[data-embed-context="full"] #app {
  min-height: 100vh;
}

html[data-embed-context="inline"] #app {
  min-height: 0;
}

.share-poster {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: calc(100% - 40px);
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(42px, 8vw, 96px) 0;
}

.share-poster > .chart-layout {
  width: fit-content;
  max-width: 100%;
  grid-template-columns: max-content minmax(0, 190px);
  align-self: center;
  justify-content: center;
  margin: auto;
  padding-top: 0;
}

@media (max-width: 680px) {
  .share-poster {
    width: min(100% - 28px, 520px);
    padding-top: 32px;
    padding-bottom: 42px;
  }

  .share-poster > .chart-layout {
    width: 100%;
    max-width: 520px;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }

  .share-poster > .chart-layout .chart-wrap,
  .share-poster > .chart-layout .chart-legend {
    justify-self: center;
  }
}
