:root {
  color-scheme: dark;
  --bg: #0c1018;
  --panel: #151b27;
  --line: #2d3749;
  --text: #edf2ff;
  --muted: #8e9ab0;
  --a: #a8f09a;
  --b: #8dd8ff;
  --danger: #ff8d9b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 80% -10%, #28404e 0, var(--bg) 43%);
  color: var(--text);
  font:
    14px/1.45 Inter,
    system-ui,
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--b);
  outline-offset: 2px;
}

.shell {
  max-width: 2200px;
  margin: auto;
  padding: 10px 24px 12px;
}

.app-header {
  position: sticky;
  top: 6px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 12px;
  padding: 4px 5px 4px 12px;
  border: 1px solid #354156;
  border-radius: 13px;
  background: #0b1018ee;
  box-shadow: 0 10px 28px #0006;
  backdrop-filter: blur(16px);
}

.app-header h1 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding-right: 11px;
  border-right: 1px solid #354156;
  font-size: 16px;
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.app-header h1:before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--a);
  box-shadow: 0 0 10px #a8f09a88;
}

.eyebrow {
  color: var(--a);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.tabs {
  display: flex;
  padding: 2px;
  gap: 2px;
  border-radius: 9px;
  background: #111925;
}

.tabs button {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.tabs button.active {
  background: var(--a);
  color: #10201e;
}

.language-picker {
  display: flex;
  align-items: center;
}

.language-picker select {
  width: auto;
  min-width: 92px;
  max-width: 104px;
  padding: 5px 24px 5px 7px;
  border-color: #354156;
  border-radius: 7px;
  background-color: #111925;
  font-size: 11px;
  font-weight: 700;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[role="tabpanel"][hidden] {
  display: none !important;
}

.card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, #1a2130f8, #111722f8);
  box-shadow: 0 22px 60px #0007;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 12px;
}

.head h2 {
  margin: 0;
  font-size: 19px;
}

.head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.count {
  color: var(--a);
  white-space: nowrap;
  font:
    12px ui-monospace,
    monospace;
}

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f151f;
  color: #b9c5da;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.toggle:has(input:checked) {
  border-color: #a8f09a80;
  color: var(--text);
  background: #a8f09a0d;
}

.toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--a);
}

.icon {
  color: var(--b);
  font:
    11px ui-monospace,
    monospace;
}

.overview-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px 12px;
}

.note {
  max-width: 440px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 14px 12px;
  padding: 7px 9px;
  border: 1px solid #354156;
  border-radius: 13px;
  background: linear-gradient(135deg, #151d2a, #0e151f);
  box-shadow: inset 0 1px 0 #ffffff08;
}

.filter-label {
  align-self: stretch;
  display: flex;
  align-items: center;
  margin-right: 4px;
  padding-right: 12px;
  border-right: 1px solid #3a465b;
  color: var(--b);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.filters button {
  border: 1px solid #303b4f;
  border-radius: 8px;
  background: #101722;
  color: var(--muted);
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.filters button:hover {
  border-color: var(--line);
  color: var(--text);
}

.filters button.active {
  background: var(--a);
  border-color: var(--a);
  color: #10201e;
  box-shadow: 0 4px 12px #a8f09a24;
}

.grid {
  display: block;
  padding: 0 14px 14px;
}

.ease-group {
  --group: #8dd8ff;
  --group-soft: #8dd8ff0b;
  --group-line: #8dd8ff3d;
  padding: 10px;
  border: 1px solid var(--group-line);
  border-top: 3px solid var(--group);
  border-radius: 16px;
  background: linear-gradient(145deg, var(--group-soft), #0d131d99);
  box-shadow:
    inset 0 1px 0 #ffffff08,
    0 10px 26px #0002;
}

.ease-group[data-group="in"] {
  --group: #a8f09a;
  --group-soft: #a8f09a0a;
  --group-line: #a8f09a38;
}

.ease-group[data-group="out"] {
  --group: #ffc47d;
  --group-soft: #ffc47d0a;
  --group-line: #ffc47d38;
}

.ease-group[data-group="inout"] {
  --group: #c6a7ff;
  --group-soft: #c6a7ff0a;
  --group-line: #c6a7ff38;
}

.ease-group+.ease-group {
  margin-top: 10px;
}

.ease-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 2px 8px;
  padding: 0 2px 7px;
  border-bottom: 1px solid var(--group-line);
}

.ease-group-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--group);
  font-size: 13px;
}

.ease-group-head h3:before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--group);
  box-shadow: 0 0 10px var(--group);
}

.ease-group-head span {
  color: #8491a8;
  font:
    10px ui-monospace,
    monospace;
}

.ease-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 9px;
}

.ease-group .tile {
  border-color: var(--group-line);
}

.tile {
  overflow: hidden;
  border: 1px solid #ffffff10;
  border-radius: 14px;
  background: #101620;
}

.tile[hidden] {
  display: none;
}

.tile-top {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px 6px;
}

.tile-name {
  font-weight: 700;
}

.tile-code {
  color: #70819c;
  font:
    10px ui-monospace,
    monospace;
}

.mini,
.viewer {
  position: relative;
  overflow: hidden;
  background-color: #111821;
  background-image: linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px);
  background-size: 26px 26px;
}

.mini {
  height: 118px;
}

.mini:after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, #101620, transparent 18%, transparent 82%, #101620);
}

.base {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 59px;
  height: 1px;
  background: #8dd8ff22;
}

.point-line {
  position: absolute;
  top: 10px;
  bottom: 10px;
  z-index: 2;
  display: none;
  width: 1px;
  background: #8dd8ff55;
}

.point-line:after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--b);
  border-radius: 50%;
  background: #111821;
  box-shadow: 0 0 10px #8dd8ff55;
}

.point-line b {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translate(-50%, -100%);
  color: var(--b);
  font:
    700 9px ui-monospace,
    monospace;
}

.object {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--a), #5bc5d0);
  color: #10201e;
  box-shadow: 0 8px 24px #66d5d05f;
  font-size: 9px;
  font-weight: 700;
  transform-origin: 50%;
  will-change: left, top, transform;
}

.mini .object {
  top: 42px;
}

.experiment {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  overflow: hidden;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #151b27;
}

.section {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.section:last-child {
  border: 0;
}

.section-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2,
.section-title h3 {
  margin: 0;
}

.section-title h2 {
  font-size: 18px;
}

.section-title h3 {
  font-size: 14px;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.channel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f151f;
}

.channel+.channel {
  margin-top: 9px;
}

.channel-head {
  margin-bottom: 9px;
}

.channel-head .toggle {
  padding: 0;
  min-height: auto;
  border: 0;
  background: transparent;
}

.ease-editor {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #0f151f;
}

.property-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-bottom: 12px;
}

.property-tab,
.ease-choice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171f2c;
  color: #a9b4c8;
  padding: 8px 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.property-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.property-tab.active,
.ease-choice.active {
  border-color: var(--a);
  background: var(--a);
  color: #10201e;
}

.property-tab.off:not(.active) {
  opacity: 0.48;
}

.ease-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 2px;
  border-block: 1px solid #ffffff10;
}

.ease-summary strong {
  color: var(--a);
  font:
    10px ui-monospace,
    monospace;
  text-align: right;
}

.ease-section {
  margin-top: 11px;
}

.ease-section>span {
  display: block;
  margin: 0 2px 6px;
  color: #70819c;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.family-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 8px;
  border: 1px solid #344055;
  border-radius: 10px;
  background: #0b111a;
  box-shadow: inset 0 1px 0 #ffffff07;
}

.direction-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.ease-choice:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field label {
  color: #aebbd0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

input[type="number"],
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0e141d;
  color: var(--text);
  padding: 9px 10px;
}

select:disabled {
  opacity: 0.4;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-top: 11px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #171f2c;
  color: #c6d1e4;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.button:hover {
  border-color: var(--b);
  color: var(--text);
}

.button.primary {
  border-color: #a8f09a80;
  background: var(--a);
  color: #10201e;
}

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

.button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.icon-btn {
  width: 30px;
  min-height: 30px;
  padding: 0;
}

.icon-btn:disabled {
  pointer-events: none;
}

.point-list {
  display: grid;
  gap: 8px;
  max-height: 400px;
  overflow: auto;
  overflow-x: hidden;
  padding: 2px;
  min-width: 0;
}

.point-row {
  display: grid;
  grid-template-columns: 22px 24px minmax(0, 1fr) 30px;
  gap: 7px;
  align-items: center;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0f151f;
}

.point-row.selected {
  border-color: var(--b);
  box-shadow: 0 0 0 2px #8dd8ff12;
}

.point-row:focus {
  outline: none;
}

.point-row:focus-visible {
  outline: 2px solid var(--b);
  outline-offset: 2px;
}

.point-row.dragging {
  opacity: 0.5;
}

.point-row.drag-over {
  border-color: var(--a);
  background: #15231e;
}

.handle {
  color: #6f7c92;
  cursor: grab;
  text-align: center;
  font-size: 16px;
}

.index {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--b);
  color: #0d1820;
  font:
    700 10px ui-monospace,
    monospace;
}

.point-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

.point-row .field {
  gap: 3px;
}

.point-row input {
  padding: 7px 5px;
  font-size: 11px;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 10px;
}

kbd {
  border: 1px solid #465269;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #202938;
  padding: 1px 5px;
  font:
    10px ui-monospace,
    monospace;
}

.output {
  --display-width: min(1600px, 100%);
  min-width: 0;
  padding: 20px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  width: var(--display-width);
  margin: 0 auto 12px;
}

.transport,
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.readout {
  color: var(--a);
  font:
    11px ui-monospace,
    monospace;
}

.timeline {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 10px;
  width: var(--display-width);
  margin: 0 auto 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f151f;
}

.timeline-time {
  color: #8f9db4;
  font:
    10px ui-monospace,
    monospace;
}

.timeline-time:last-child {
  text-align: right;
}

.timeline input[type="range"] {
  width: 100%;
  height: 18px;
  margin: 0;
  accent-color: var(--a);
  cursor: ew-resize;
}

.viewer {
  width: var(--display-width);
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: 16/9;
  margin-inline: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background-image: none;
  cursor: crosshair;
  touch-action: none;
}

.canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 1600px;
  height: 900px;
  transform: scale(var(--canvas-scale, 1));
  transform-origin: 0 0;
  background-color: #111821;
  background-image: linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px);
  background-size: 26px 26px;
}

.viewer:before {
  content: attr(data-add-hint);
  position: absolute;
  right: 12px;
  bottom: 10px;
  color: #647187;
  font-size: 10px;
  pointer-events: none;
}

.path {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.path polyline {
  fill: none;
  stroke: #8dd8ff66;
  stroke-width: 2;
  stroke-dasharray: 5 6;
  vector-effect: non-scaling-stroke;
}

.guide {
  position: absolute;
  z-index: 2;
  display: none;
  background: #a8f09a88;
  pointer-events: none;
}

.guide.v {
  top: 0;
  bottom: 0;
  width: 1px;
}

.guide.h {
  left: 0;
  right: 0;
  height: 1px;
}

.marker {
  position: absolute;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 2px solid var(--b);
  border-radius: 50%;
  background: #111821;
  color: var(--b);
  box-shadow: 0 3px 12px #0008;
  transform: translate(-50%, -50%);
  font:
    700 10px ui-monospace,
    monospace;
  cursor: grab;
  touch-action: none;
}

.marker.selected {
  border-color: var(--a);
  background: var(--a);
  color: #10201e;
  transform: translate(-50%, -50%) scale(1.12);
}

.marker:after {
  content: attr(data-values);
  position: absolute;
  top: 32px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  padding: 3px 6px;
  border-radius: 5px;
  background: #0b1018dd;
  color: #91a0b7;
  font:
    9px ui-monospace,
    monospace;
  opacity: 0;
  pointer-events: none;
}

.marker:hover:after,
.marker.selected:after {
  opacity: 1;
}

.point-gizmo {
  position: absolute;
  z-index: 8;
  width: 82px;
  height: 82px;
  transform: translate(-50%, -50%);
  border: 1px dashed #8dd8ff77;
  border-radius: 50%;
  pointer-events: none;
}

.gizmo-axis {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 32px;
  height: 2px;
  transform-origin: 0 50%;
  transform: rotate(var(--point-rotation));
  background: linear-gradient(90deg, var(--a), transparent);
  pointer-events: none;
}

.gizmo-handle {
  position: absolute;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 2px solid #0e141d;
  background: var(--b);
  color: #10201e;
  box-shadow: 0 2px 9px #0008;
  font:
    700 9px ui-monospace,
    monospace;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
}

.gizmo-rotate {
  left: 50%;
  top: -9px;
  transform: translateX(-50%);
  border-radius: 50%;
}

.gizmo-scale {
  right: -7px;
  bottom: -7px;
  border-radius: 4px;
  background: var(--a);
  cursor: nwse-resize;
}

.gizmo-handle:active {
  cursor: grabbing;
}

.viewer .object {
  z-index: 5;
  left: 50%;
  top: 50%;
  width: 70px;
  height: 52px;
  border-radius: 14px;
  transform: translate(-50%, -50%);
}

.viewer .object:after {
  content: "";
  position: absolute;
  right: 7px;
  top: 7px;
  width: 11px;
  height: 3px;
  border-radius: 2px;
  background: #10201e;
  box-shadow: 0 5px 0 -1px #10201e;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: var(--display-width);
  margin: 11px auto 0;
  color: var(--muted);
  font-size: 10px;
}

@media (min-width: 791px) {
  .output {
    --display-width: min(1600px, 100%, calc(177.7778dvh - 480px));
  }
}

@media (max-width: 1040px) {
  .experiment {
    grid-template-columns: 380px minmax(0, 1fr);
  }

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

@media (max-width: 790px) {
  .shell {
    padding: 8px 12px 12px;
  }

  .head,
  .overview-tools {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .viewer {
    height: auto;
  }

  .footer {
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 480px) {
  .app-header {
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
  }

  .grid {
    padding-inline: 12px;
  }

  .filters {
    margin-inline: 12px;
  }

  .ease-group {
    padding: 10px;
  }

  .ease-group-grid {
    grid-template-columns: 1fr;
  }

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

  .overview-tools {
    padding-inline: 12px;
  }

  .output {
    padding: 12px;
  }

  .viewer {
    height: auto;
  }
}

@media (min-width: 1600px) {
  .ease-group-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .experiment {
    grid-template-columns: 460px minmax(0, 1fr);
  }

  .output {
    padding: 24px;
  }

  .sidebar .section {
    padding-inline: 22px;
  }
}
