:root {
  color-scheme: light dark;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body {
  margin: 0;
  background: #f5f5f7;
  color: #1d1d1f;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  margin-bottom: 0.5rem;
  font-size: 2rem;
}

.card {
  background: #fff;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
  margin-bottom: 1.5rem;
}

.card h2,
.card h3 {
  margin-top: 0;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

input[type="file"] {
  border: 1px dashed #94a3b8;
  padding: 1rem;
  border-radius: 0.75rem;
  background: #f8fafc;
}

button {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: #2563eb;
  cursor: pointer;
}

button:hover {
  background: #1d4ed8;
}

.flash-list {
  list-style: none;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  border-radius: 0.75rem;
  background: #ecfccb;
  color: #365314;
  font-weight: 600;
}

.hint {
  margin: 0;
  font-size: 0.9rem;
  color: #475569;
}

.gallery {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.gallery li {
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #f8fafc;
  transition: border-color 150ms ease;
}

.gallery li.highlight {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.gallery a {
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
}

.gallery img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: #cbd5f5;
}

.gallery span {
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  word-break: break-all;
}

.card.muted {
  background: #0f172a;
  color: #e2e8f0;
}

.card.muted ul {
  margin: 0;
  padding-left: 1rem;
}

.video-shell {
  position: relative;
  background: #020617;
  border-radius: 1rem;
  overflow: hidden;
  margin-bottom: 1rem;
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-shell video {
  width: 100%;
  height: 100%;
  /* object-fit: cover; */
}

#capture-canvas {
  display: none;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.controls button {
  flex: 1 1 160px;
}

button.ghost {
  background: transparent;
  color: #0f172a;
  border: 1px solid #94a3b8;
}

.hidden {
  display: none !important;
}

.status {
  min-height: 1.2em;
  font-size: 0.9rem;
  color: #0369a1;
  margin-top: 0.75rem;
}

.status.error {
  color: #dc2626;
}

.analysis-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.analysis-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.analysis-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.analysis-preview-grid figure {
  margin: 0;
  padding: 0.75rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: #f8fafc;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.analysis-preview-grid img {
  width: 100%;
  border-radius: 0.75rem;
  display: block;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.analysis-preview-grid figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #475569;
  text-align: center;
}

.analysis-table {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.analysis-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.9fr 0.9fr 1.1fr 1.2fr;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.92rem;
}

.analysis-row--head {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: #475569;
}

.swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(15, 23, 42, 0.25);
  display: inline-block;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  border: 1px solid #cbd5f5;
  text-decoration: none;
  color: inherit;
  background: #f8fafc;
  font-weight: 600;
}

.pill-button.active {
  background: #2563eb;
  color: #fff;
  border-color: #1d4ed8;
}

.pill-button.ghost {
  background: transparent;
  border-color: #94a3b8;
  color: #0f172a;
}

.analysis-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.analysis-controls .pill-group {
  display: flex;
  gap: 0.5rem;
}

.config-select {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.config-select select {
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  border: 1px solid #cbd5f5;
  background: #fff;
}

.configurator-page .config-toolbar,
.configurator-page .sample-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.configurator-page .field {
  display: flex;
  flex-direction: column;
  min-width: 180px;
}

.configurator-page select {
  border-radius: 0.6rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid #cbd5f5;
}

.configurator-page .toolbar-buttons {
  display: flex;
  gap: 0.75rem;
}

.configurator-page button.ghost {
  background: transparent;
  border: 1px solid #94a3b8;
  color: #0f172a;
}

.configurator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.preview-column h2 {
  margin-top: 0;
}

.strip-preview {
  position: relative;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #0f172a;
  padding: 1rem;
}

.strip-preview img {
  width: 100%;
  border-radius: 0.75rem;
  display: block;
}

#zones-layer {
  position: absolute;
  inset: 1rem;
  pointer-events: none;
}

.pad-overlay-editor {
  position: absolute;
  border: 2px dashed rgba(59, 130, 246, 0.9);
  border-radius: 0.5rem;
  font-size: 5px;
  color: #ffffff;
  padding: 0.15rem;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.pad-overlay-editor span { 
  border-radius: 999px;
  padding: 0.1rem 0.3rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.config-table {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.config-row {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 0.5rem;
  align-items: center;
}

.config-row label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: #475569;
}

.config-row input {
  border-radius: 0.6rem;
  border: 1px solid #cbd5f5;
  padding: 0.35rem 0.5rem;
  font-size: 0.95rem;
}

.pad-label {
  font-weight: 600;
}

@media (max-width: 640px) {
  .config-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .analysis-row {
    grid-template-columns: 1fr 0.8fr;
    grid-auto-rows: auto;
  }
  .analysis-row span:nth-child(n + 3) {
    font-size: 0.8rem;
  }
}