:root {
  color-scheme: light;
  --card: rgba(255, 255, 255, 0.96);
  --ink: #172033;
  --muted: #6b7280;
  --line: rgba(17, 24, 39, 0.14);
  --primary: #1d4ed8;
  --primary-ink: #ffffff;
  --soft: #f3f6fb;
  --shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
}

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

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

.stage {
  width: 100vw;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 12px;
  background: transparent;
}

.selfie-card {
  width: min(360px, calc(100vw - 24px));
  height: min(620px, calc(100svh - 24px));
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--card);
  box-shadow: var(--shadow);
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  touch-action: none;
  user-select: none;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: grab;
}

.top-bar:active {
  cursor: grabbing;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.1;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
}

.camera-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #eef2f7;
}

.camera,
.snapshot-preview {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.camera {
  transform: scaleX(-1);
}

.snapshot-canvas {
  display: none;
}

.camera-message {
  position: absolute;
  inset: auto 14px 14px;
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button {
  min-height: 48px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0 12px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button:disabled,
.button.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}

.secondary,
.save {
  background: var(--soft);
  color: var(--ink);
}

.version {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 420px) {
  .stage {
    padding: 8px;
  }

  .selfie-card {
    width: min(340px, calc(100vw - 16px));
    height: min(600px, calc(100svh - 16px));
    padding: 14px;
    border-radius: 28px;
  }

  .controls {
    gap: 8px;
  }

  .button {
    min-height: 46px;
    font-size: 0.86rem;
  }
}
