/* Match page layout; colors and shared components come from theme.css. */
label { color: var(--dim); display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

input, select, button {
  font: inherit;
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
}

button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--dim); }
button:disabled { opacity: 0.4; cursor: default; }
code { font: 11px ui-monospace, Menlo, monospace; color: var(--text); word-break: break-all; }

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  padding: 20px;
  align-items: start;
}

#panels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; min-width: 0; }

.panel { min-width: 0; display: flex; flex-direction: column; }
.panel .meta h2 { flex-shrink: 0; }
.panel .meta .history { max-width: 220px; min-width: 0; }
.panel .meta label { min-width: 0; }
.panel .meta .colorspace { max-width: 200px; min-width: 0; }

.viewport {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(220px, 40vh, 560px);
  overflow: hidden;
  background: #000;
  cursor: pointer;
}

.viewport.dragover { outline: 2px dashed var(--accent); outline-offset: -8px; background: #14202f; }
.viewport canvas.image { max-width: 100%; max-height: 100%; display: block; cursor: crosshair; }
.placeholder { color: var(--dim); text-align: center; padding: 16px; margin: 0; line-height: 1.7; }

.readout {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  color: var(--dim);
  font: 11px/1.4 ui-monospace, Menlo, monospace;
  min-height: 2.2em;
}

.readout .stats { overflow: hidden; text-overflow: ellipsis; }

.panel .cells { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); background: transparent; }
.panel .cells > div { min-height: 0; }
.panel .cells > div + div { border-left: 1px solid var(--line); }

#grade { position: sticky; top: 72px; }
.grade-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
#grade .meta { flex-wrap: wrap; row-gap: 2px; }

.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.toggle { cursor: pointer; }

#sliders { display: flex; flex-direction: column; gap: 10px; }
#sliders h3 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--dim); margin: 6px 0 0; border-top: 1px solid var(--line); padding-top: 10px; }
#sliders h3:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.group { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.group-head { display: flex; justify-content: space-between; color: var(--text); }
.slider { display: grid; grid-template-columns: 14px 1fr 72px; gap: 6px; align-items: center; }
.slider span { font: 11px ui-monospace, monospace; color: var(--dim); }
.slider input[type="range"] { width: 100%; padding: 0; accent-color: var(--accent); }
.slider input[type="number"] { padding: 2px 4px; font: 11px ui-monospace, monospace; }
.slider.r span { color: #e66; }
.slider.g span { color: #6c6; }
.slider.b span { color: #69f; }

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

@media (max-width: 1100px) {
  main { grid-template-columns: 1fr; }
  #grade { position: static; }
}

@media (max-width: 760px) {
  main { padding: 16px; }
  #panels { grid-template-columns: 1fr; }
}
