:root {
  color-scheme: dark;
  --bg: #05070d;
  --panel: rgba(255, 255, 255, 0.09);
  --text: #f5f7fa;
  --muted: #9da7b5;
  --accent: #2f7cf6;
  --accent-2: #7b61ff;
  --danger: #ff5b5b;
  --success: #25c16f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(47, 124, 246, 0.25), transparent 28%),
    linear-gradient(140deg, #06070b 0%, #111722 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem;
}

button {
  font: inherit;
}

.camera-card {
  width: min(100%, 470px);
  display: flex;
  justify-content: center;
}

.app-shell {
  width: 100%;
  min-height: calc(100vh - 1.8rem);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(7, 10, 18, 0.98) 0%, rgba(18, 24, 36, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
}

.app-header {
  padding: 1rem 1.15rem 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.eyebrow {
  margin: 0 0 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.68rem;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.app-pill {
  padding: 0.42rem 0.7rem;
  font-size: 0.74rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #dfe7f3;
  letter-spacing: 0.04em;
}

.camera-stage {
  position: relative;
  flex: 1;
  background: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  margin: 0 0.75rem;
  border-radius: 24px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

#video,
.preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-image {
  position: absolute;
  inset: 0;
  display: none;
  animation: fadeIn 0.25s ease;
}

.overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.06) 0%, rgba(0, 0, 0, 0.22) 100%);
}

.viewfinder {
  position: absolute;
  inset: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 20px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.status-message {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  padding: 0.8rem 0.95rem;
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.88);
  color: var(--text);
  text-align: center;
  font-size: 0.92rem;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s ease;
  pointer-events: none;
}

.status-message.show {
  opacity: 1;
  transform: translateY(0);
}

.status-message.success {
  color: #dff9ea;
  background: rgba(37, 193, 111, 0.92);
}

.status-message.error {
  color: #ffeaea;
  background: rgba(255, 91, 91, 0.95);
}

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
}

.capture-btn {
  width: 78px;
  height: 78px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff 0%, #e8ecf2 100%);
  display: grid;
  place-items: center;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.34);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.capture-btn:active {
  transform: scale(0.96);
}

.capture-core {
  width: 58px;
  height: 58px;
  display: block;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff 0%, #dfe6ee 100%);
  border: 4px solid #111;
}

.send-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-width: 118px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: white;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(47, 124, 246, 0.24);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.send-btn:not(:disabled):active {
  transform: scale(0.97);
}

.loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 640px) {
  body {
    padding: 0.6rem;
  }

  .app-shell {
    min-height: calc(100vh - 1.2rem);
    border-radius: 24px;
  }

  .app-header {
    padding: 0.9rem 0.95rem 0.45rem;
  }

  .camera-stage {
    margin: 0 0.55rem;
    border-radius: 18px;
  }

  .controls {
    padding: 0.95rem 0.95rem 1.1rem;
  }

  .capture-btn {
    width: 72px;
    height: 72px;
  }

  .capture-core {
    width: 52px;
    height: 52px;
  }
}
