:root {
  color-scheme: light;
  --ink: #231f20;
  --muted: #6d6467;
  --line: #eadde2;
  --surface: #fff8fb;
  --panel: rgba(255, 255, 255, 0.9);
  --accent: #e84f91;
  --accent-dark: #b82062;
  --blue: #a7d8ec;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 100svh;
}

.stage {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  background: #111;
}

#camera,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#camera {
  opacity: 0;
  transition: opacity 160ms ease;
}

#camera.ready {
  opacity: 1;
}

#overlay {
  pointer-events: none;
}

.reticle {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(38vw, 220px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.reticle span {
  position: absolute;
  inset: 18%;
  border: 1px dashed rgba(255, 255, 255, 0.5);
  border-radius: inherit;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100svh;
  padding: max(22px, env(safe-area-inset-top)) 22px max(22px, env(safe-area-inset-bottom));
  border-left: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.brand p {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.brand h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
}

.preview-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

#texturePreview {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--blue);
}

.preview-row strong,
.preview-row span,
.field span,
.control label,
.status {
  display: block;
}

.preview-row strong {
  margin-bottom: 4px;
  font-size: 14px;
}

.preview-row span,
.status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.field span,
.control label {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.actions,
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button,
.file-button {
  display: inline-grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segmented button {
  min-height: 36px;
  border: 0;
  background: transparent;
}

.segmented button.active {
  background: var(--ink);
  color: #fff;
}

.control input {
  width: 100%;
  accent-color: var(--accent);
}

.primary {
  min-height: 48px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.status {
  min-height: 36px;
  margin: 0;
}

@media (max-width: 820px) {
  body {
    overflow: auto;
    background: #111;
  }

  .shell {
    display: block;
    min-height: 100svh;
  }

  .stage {
    min-height: 66svh;
  }

  .panel {
    min-height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
  }

  .brand h1 {
    font-size: 30px;
  }
}
