@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("fonts/plus-jakarta-sans/plus-jakarta-sans-latin.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --ink: #ffffff;
  --muted: #a1a1aa;
  --line: rgba(255, 255, 255, 0.1);
  --panel: rgba(18, 18, 18, 0.76);
  --page: #0a0a0a;
  --accent: #ff5100;
  --accent-2: #2f6bff;
  --danger: #fb7185;
  --surface: rgba(18, 18, 18, 0.7);
  --surface-strong: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.09);
  --text-soft: #d4d4d8;
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.2);
  --shadow-accent: 0 8px 24px rgba(255, 81, 0, 0.28);
}

html {
  background: #0a0a0a;
}

body {
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--page);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 12px 12px;
  color: var(--ink);
  line-height: 1.6;
}

::selection {
  background: rgba(255, 81, 0, 0.35);
  color: #ffffff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button,
input,
select {
  font-family: inherit;
}

button {
  min-height: 40px;
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--text-soft);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

button:hover:not(:disabled) {
  border-color: rgba(255, 81, 0, 0.45);
  background: var(--surface-hover);
  color: #ffffff;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: var(--shadow-accent);
}

button.primary:hover:not(:disabled) {
  background: #e54800;
  border-color: #e54800;
}

button.danger {
  color: var(--danger);
}

button.danger:hover:not(:disabled) {
  border-color: rgba(251, 113, 133, 0.45);
  background: rgba(251, 113, 133, 0.09);
  color: #fecdd3;
}

button:disabled,
input:disabled,
select:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

input:disabled,
select:disabled {
  background: rgba(255, 255, 255, 0.04);
}

.shell {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 14px 24px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 10, 0.82);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
}

.brand {
  min-width: 0;
}

.brand h1 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0;
  background: linear-gradient(90deg, #ff5100, #ff8800, #ff5100);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand span,
.status-line {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.topbar > .status-line {
  justify-self: end;
  max-width: min(100%, 960px);
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-align: right;
}

.layout {
  background: transparent;
}

.tabs {
  border-right: 1px solid var(--line);
  background: rgba(10, 10, 10, 0.62);
  backdrop-filter: blur(18px);
}

.tab {
  min-height: 44px;
  margin-bottom: 8px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
}

.tab.active {
  border-color: rgba(255, 81, 0, 0.75);
  background: rgba(255, 81, 0, 0.12);
  color: #ffb08a;
  box-shadow: inset 3px 0 0 var(--accent);
}

.content {
  padding: 20px;
}

.panel,
.metric,
.timing-table,
.flamegraph {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.panel {
  border-radius: 8px;
  padding: 18px;
}

.panel h2 {
  margin: 0;
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0;
}

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

input,
select {
  min-height: 42px;
  border-color: var(--line);
  background: rgba(18, 18, 18, 0.78);
  color: #ffffff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 650;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
  outline: none;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background-color 140ms ease;
}

input:hover,
select:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 81, 0, 0.18);
}

select option {
  background: #121212;
  color: #ffffff;
}

.codec-field {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.codec-dropdown {
  position: relative;
  min-width: 0;
}

.codec-dropdown-trigger {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: rgba(18, 18, 18, 0.78);
  color: #ffffff;
  text-align: left;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.codec-dropdown-trigger:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(18, 18, 18, 0.92);
}

.codec-dropdown-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 81, 0, 0.18);
}

.codec-dropdown-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  transition: transform 140ms ease;
}

.codec-dropdown-trigger[aria-expanded="true"] .codec-dropdown-chevron {
  transform: rotate(180deg);
}

.codec-dropdown-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  display: grid;
  gap: 2px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #121212;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.52);
}

.codec-dropdown-option {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: #ffffff;
  text-align: left;
}

.codec-dropdown-option:hover,
.codec-dropdown-option:focus-visible {
  background: var(--surface-hover);
  color: #ffffff;
}

.codec-dropdown-option.selected {
  background: rgba(255, 255, 255, 0.14);
}

.codec-dropdown-check {
  flex: 0 0 auto;
  color: #ffb08a;
}

input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  border: 1px solid rgba(255, 81, 0, 0.35);
  border-radius: 7px;
  background: rgba(255, 81, 0, 0.12);
  color: #ffb08a;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

pre {
  border-color: rgba(255, 255, 255, 0.1);
  background: #050505;
  color: #e7e5e4;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.event-log {
  color: #e7e5e4;
}

.metric {
  min-width: 152px;
  border-radius: 8px;
  color: #ffffff;
}

.metric strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.timing-panel {
  border-bottom-color: var(--line);
}

.timing-header h3 {
  color: #ffffff;
  font-weight: 800;
}

.timing-header span,
.timing-group,
.flame-row-label {
  color: var(--muted);
}

.timing-table {
  border-radius: 8px;
}

.timing-row {
  border-bottom-color: rgba(255, 255, 255, 0.07);
  background: rgba(18, 18, 18, 0.72);
  color: var(--text-soft);
}

.timing-row:nth-child(2n + 3) {
  background: rgba(255, 255, 255, 0.035);
}

.timing-row:hover,
.timing-row:focus-visible,
.timing-row.is-collapsible[aria-expanded="false"] {
  background: rgba(255, 81, 0, 0.1);
}

.timing-row-head {
  background: #121212;
  color: var(--muted);
}

.timing-row-head span,
.timing-row > span {
  border-right-color: rgba(255, 255, 255, 0.07);
}

.timing-column-resizer::after {
  background: rgba(255, 255, 255, 0.42);
}

.timing-column-resizer:hover::after,
.timing-column-resizer:focus-visible::after,
.timing-column-resizer.is-active::after {
  background: var(--orange);
}

.timing-column-resizer:hover:not(:disabled),
.timing-column-resizer:active:not(:disabled) {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.timing-toggle {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.timing-toggle::before {
  border-left-color: var(--muted);
}

.timing-phase-text strong,
.timing-number {
  color: #ffffff;
}

.timing-phase-text {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.timing-device {
  flex: 0 0 auto;
  padding: 1px 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 16px;
  letter-spacing: 0.035em;
  text-transform: none;
}

.timing-device.is-gpu {
  border-color: rgba(47, 107, 255, 0.62);
  background: rgba(47, 107, 255, 0.18);
  color: #bfdbfe;
}

.timing-device.is-cpu {
  border-color: rgba(25, 169, 116, 0.56);
  background: rgba(25, 169, 116, 0.16);
  color: #a7f3d0;
}

.timing-device.is-mixed {
  border-color: rgba(245, 158, 11, 0.58);
  background: rgba(245, 158, 11, 0.16);
  color: #fde68a;
}

.timing-axis,
.timing-lane {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(to right, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
}

.timing-bar.is-tiny {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.flamegraph {
  border-radius: 8px;
}

.flamegraph-axis {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.flame-row {
  background: rgba(255, 255, 255, 0.06);
}

.flame-block:hover,
.flame-block:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.78);
}

.phase-client {
  background: #27272a;
}

.phase-server {
  background: #2f6bff;
}

.phase-upload {
  background: #0ea5e9;
}

.phase-setup {
  background: #8b5cf6;
}

.phase-media {
  background: #ff5100;
}

.phase-tensor {
  background: #19a974;
}

.phase-prompt {
  background: #ec4899;
}

.phase-response {
  background: #f59e0b;
}

.phase-other {
  background: #71717a;
}

.info-panel {
  max-width: 1180px;
}

.info-lead {
  max-width: 980px;
  margin: 12px 0 0;
  color: var(--text-soft);
  font-size: 15px;
}

.info-section,
.guide {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.info-section h3,
.guide h3 {
  margin: 0 0 12px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
}

.info-topic {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.info-topic:first-of-type {
  border-top: 0;
}

.info-topic h4,
.guide h4 {
  margin: 0;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.info-topic p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
}

.guide-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.guide ul,
.guide ol {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--text-soft);
  font-size: 13px;
}

.guide li + li {
  margin-top: 6px;
}

video {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050505;
  box-shadow: var(--shadow-soft);
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .topbar > .status-line {
    justify-self: start;
    text-align: left;
  }

  .content {
    padding: 12px;
  }

  .tabs {
    background: rgba(10, 10, 10, 0.78);
  }

  .info-topic,
  .guide-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

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