:root {
  --ground: #09090A;
  --surface: #0C0C0E;
  --surface-raised: #0E0E11;
  --surface-hover: #121215;
  --line: #1C1C20;
  --line-card: #232328;
  --line-control: #3A3A40;
  --line-hover: #5A5A62;
  --ink: #EDEDED;
  --ink-bright: #FFFFFF;
  --text-2: #A1A1A8;
  --text-3: #8E8E96;
  --text-4: #77777F;
  --text-dim: #55555C;
  --heading-dim: #6E6E76;
  --accent: #9FB7CC;
  --on-accent: #09090A;
  --card-light-top: #F5F5F6;
  --card-light-bottom: #DADADF;
  --ease: cubic-bezier(.16, 1, .3, 1);
  font-family: "Albert Sans", sans-serif;
  font-feature-settings: "lnum", "tnum";
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ground);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.ph-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 26px;
  border: 1px solid #EDEDED;
  border-radius: 999px;
  background: #EDEDED;
  color: #09090A;
  font: 500 15px/1 "Albert Sans", sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, transform .15s, border-color .15s;
}

@media (hover: hover) {
  .ph-btn:hover { background: #FFFFFF; }
}
.ph-btn:active { transform: scale(.96); }
.ph-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.ph-btn .ph-arr { display: inline-block; transition: transform .35s cubic-bezier(.16, 1, .3, 1); }
.ph-btn:hover .ph-arr { transform: translateX(4px); }

.ph-btn-secondary {
  background: transparent;
  color: #EDEDED;
  border-color: #3A3A40;
}
@media (hover: hover) {
  .ph-btn-secondary:hover {
    background: #121215;
    border-color: #EDEDED;
  }
}

.ph-btn-icon {
  width: 48px;
  min-width: 48px;
  padding: 0;
}

.ph-input {
  min-height: 48px;
  padding: 0 18px;
  background: #09090A;
  color: #EDEDED;
  border: 1px solid #3A3A40;
  border-radius: 999px;
  font: 400 15px "Albert Sans", sans-serif;
  width: 100%;
}

.ph-input:focus { border-color: #9FB7CC; outline: none; }

.ph-card {
  background: #0C0C0E;
  border: 1px solid #232328;
  border-radius: 22px;
  padding: 24px;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
@media (hover: hover) {
  .ph-card:hover { border-color: #5A5A62; }
}

.ph-card-light {
  background: linear-gradient(180deg, #F5F5F6, #DADADF);
  border-color: #EDEDED;
  color: #09090A;
  box-shadow: 0 40px 80px -40px rgba(237, 237, 237, .25);
}

.ph-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 10px;
  background: #0E0E11;
  border: 1px solid #232328;
  border-radius: 999px;
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .9);
}

.ph-link {
  color: #A1A1A8;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  padding-bottom: 3px;
  border: 0;
  font: 500 15px/1.4 "Albert Sans", sans-serif;
  cursor: pointer;
  transition: background-size .35s cubic-bezier(.16, 1, .3, 1), color .25s;
}
.ph-link:hover { background-size: 100% 1px; color: #FFFFFF; }

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 1px solid #9FB7CC;
  outline-offset: 4px;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 448px;
  height: 100%;
  min-height: 0;
}

.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--ground);
}

.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  flex: 1;
  min-height: 0;
  background: var(--line);
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--ground);
}

.pane-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.pane-title {
  min-width: 0;
}

.pane-title h2 {
  margin: 0;
  font: 500 15px/1.4 "Albert Sans", sans-serif;
  color: var(--ink);
}

.pane-title p {
  margin: 0;
  font: 400 13px/1.4 "Geist Mono", ui-monospace, monospace;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pane.is-active {
  box-shadow: inset 2px 0 0 var(--accent);
}

.pane-head .ph-btn {
  min-height: 40px;
  padding: 0 18px;
}

.pane-head .photo-label {
  display: none !important;
}

.film {
  position: relative;
  flex: 1;
  min-height: 160px;
  background: var(--surface);
  overflow: hidden;
}

.view {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.empty-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
  color: var(--text-3);
  font-size: 15px;
  line-height: 1.4;
  user-select: none;
}

.empty-hint::before {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid var(--line-card);
  border-radius: 10px;
  pointer-events: none;
}

.empty-hint p {
  margin: 0;
  position: relative;
  text-wrap: pretty;
}

.empty-hint[hidden] { display: none !important; }

.hud {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.hud > * { pointer-events: auto; }

.hud-zoom {
  right: 12px;
  bottom: 12px;
}

.hud-zoom[hidden],
.photo-label[hidden] { display: none !important; }

.hud .ph-btn {
  min-height: 40px;
  padding: 0 18px;
}

.hud .ph-btn-icon {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
}

.photo-label,
.zoom-pct {
  color: var(--text-2);
  font: 400 13px/1.4 "Geist Mono", ui-monospace, monospace;
  background: var(--surface-raised);
  border: 1px solid var(--line-card);
  border-radius: 999px;
  padding: 10px 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zoom-pct { max-width: none; }

.status {
  margin: 0;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-3);
  background: var(--ground);
  border-top: 1px solid var(--line);
}

.side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 16px;
  background: var(--ground);
  border-left: 1px solid var(--line);
  overflow: auto;
}

.fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: none;
}

.fields label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-3);
  margin: 0;
}

.row-2 {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
}

.instrument {
  display: grid;
  grid-template-columns: 176px 1fr;
  gap: 16px;
  align-items: start;
  flex: none;
}

#loupe {
  width: 176px;
  height: 176px;
  image-rendering: pixelated;
  background: var(--ground);
  display: block;
  border: 1px solid var(--line-card);
  border-radius: 10px;
}

.channels {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.channel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}

.live-swatch {
  width: 100%;
  height: 28px;
  background: var(--line);
  border: 1px solid var(--line-card);
  border-radius: 10px;
}

.channels dl { margin: 0; }
.channels dl > div {
  display: grid;
  grid-template-columns: 16px 1fr;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
}
.channels dl > div + div {
  border-top: 1px solid var(--line);
}

.channels dt {
  font: 400 13px/1.4 "Geist Mono", ui-monospace, monospace;
  color: var(--text-3);
}

.channels dd {
  margin: 0;
  font: 400 20px/1.2 "Geist Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.glare {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
}

.table-panel {
  flex: 1;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  padding: 16px 0 0;
}

.table-head {
  display: flex;
  justify-content: space-between;
  padding: 0 24px 12px;
  font: 400 13px/1.4 "Geist Mono", ui-monospace, monospace;
  color: var(--text-3);
}

.table-scroll { overflow: auto; flex: 1; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.5;
}

th, td {
  padding: 8px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--text-3);
  font-weight: 500;
  font-size: 13px;
  position: sticky;
  top: 0;
  background: var(--surface);
}

td:first-child, th:first-child { padding-left: 24px; }
td:last-child, th:last-child { padding-right: 16px; }

.rgb-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 16px;
  height: 16px;
  flex: none;
  border: 1px solid var(--line-control);
  border-radius: 4px;
}

.mono {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.pin-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  font: 400 11px/1 "Geist Mono", ui-monospace, monospace;
  background: var(--ink);
  color: var(--on-accent);
  border-radius: 999px;
}

.pin-num.pin-pos {
  background: var(--accent);
  color: var(--on-accent);
}

tr.selected { background: var(--surface-hover); }

.linkish {
  background: none;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
  font: 500 15px/1 "Albert Sans", sans-serif;
  padding: 0 2px;
}

.linkish:hover { color: var(--ink-bright); }

.export-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 4px 0 0;
}

.export-bar .ph-btn {
  min-height: 40px;
  padding: 0 18px;
}

.wissen {
  margin-left: auto;
  background: none;
}

.pane.dragover .empty-hint::before {
  border-color: var(--accent);
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(240px, 42vh) auto;
  }
  .side {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: none;
  }
  .status { display: none; }
  .hud .ph-btn {
    min-height: 32px;
    padding: 0 12px;
  }
  .hud .ph-btn-icon {
    width: 32px;
    min-width: 32px;
    min-height: 32px;
  }
  .zoom-pct { padding: 6px 10px; }
}

@media (max-width: 560px) {
  .panes { grid-template-columns: 1fr; }
  .pane { min-height: 200px; }
  .instrument { grid-template-columns: 132px 1fr; }
  #loupe { width: 132px; height: 132px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
