:root {
  --bg-base: #fff9f5;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --surface-tint: #fff1eb;
  --text-main: #181c2e;
  --text-muted: #5c647a;
  --border: #e5eaf3;
  --primary-grad: linear-gradient(135deg, #ff5e7e 0%, #ff8e53 100%);
  --primary-solid: #ff6b6b;
  --secondary-accent: #00b4d8;
  --sun-accent: #ffb703;
  --mint-accent: #10b981;
  --shadow-sm: 0 4px 14px rgba(24, 28, 46, 0.06);
  --shadow-md: 0 12px 32px rgba(255, 107, 107, 0.14);
  --shadow-card: 0 10px 30px rgba(24, 28, 46, 0.07);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg-base);
  background-image:
    radial-gradient(circle at 10% 8%, rgba(255, 183, 3, 0.18) 0%, transparent 42%),
    radial-gradient(circle at 92% 14%, rgba(0, 180, 216, 0.16) 0%, transparent 45%),
    radial-gradient(circle at 50% 95%, rgba(255, 94, 126, 0.14) 0%, transparent 50%);
  color: var(--text-main);
  font: 15px/1.5 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

.app {
  max-width: 880px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 4px 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  flex: 0 0 auto;
}

.logo {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.sub {
  background: #ffffff;
  color: #ff5e7e;
  border: 1px solid rgba(255, 94, 126, 0.25);
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  box-shadow: var(--shadow-sm);
}

.frame {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #e0f4ff 0%, #fff0f5 50%, #fff8df 100%);
  border: 4px solid #ffffff;
  border-radius: var(--radius-xl);
  min-height: 360px;
  height: 62dvh;
  max-height: 640px;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-card);
}

.frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.placeholder {
  text-align: center;
  padding: 28px 24px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.placeholder-icon {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  background: #ffffff;
  color: #ff5e7e;
  display: grid;
  place-items: center;
  font-size: 34px;
  box-shadow: 0 10px 25px rgba(255, 94, 126, 0.18);
  margin-bottom: 14px;
}

.placeholder h2 {
  color: var(--text-main);
  font-size: 21px;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.placeholder p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 0 0 20px;
  line-height: 1.55;
}

.btn {
  border: 0;
  border-radius: 16px;
  padding: 13px 20px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:active:not(:disabled) {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary {
  background: var(--primary-grad);
  color: #ffffff;
  box-shadow: var(--shadow-md);
}

.secondary {
  background: #ffffff;
  color: var(--text-main);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.round {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  padding: 0;
  font-size: 22px;
}

.zoom-row {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  z-index: 4;
}

.zoom {
  padding: 6px 13px;
  border-radius: 99px;
  background: transparent;
  color: var(--text-main);
  border: 0;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.18s ease;
}

.zoom.active {
  background: var(--primary-grad);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(255, 94, 126, 0.35);
}

.zoom:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.camera-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin: 18px 0 10px;
}

.shutter-ring {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  padding: 5px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(255, 94, 126, 0.25);
  display: grid;
  place-items: center;
}

#capture {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--primary-grad);
  color: #ffffff;
  font-size: 24px;
  border: 0;
  box-shadow: none;
}

.status-wrap {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 99px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--secondary-accent);
  display: inline-block;
}

select,
input[type=text] {
  font: inherit;
  width: 100%;
  min-height: 44px;
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 13px;
  color: var(--text-main);
  font-weight: 600;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

select:focus,
input[type=text]:focus {
  outline: none;
  border-color: var(--secondary-accent);
  background: #ffffff;
}

#cameraSelect {
  margin-top: 10px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.hidden {
  display: none !important;
}

.editor-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.editor-badge {
  background: #e0f7fa;
  color: #00838f;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 99px;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.preview-wrap {
  background: linear-gradient(135deg, #eef6ff 0%, #fff3f6 100%);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 8px;
}

.preview {
  width: 100%;
  height: auto;
  max-height: 56vh;
  object-fit: contain;
  display: block;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

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

.field {
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
  margin: 0 0 6px;
}

.field input[type=range] {
  width: 100%;
  height: 36px;
  accent-color: #ff5e7e;
  cursor: pointer;
}

.geo-readout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  background: var(--surface-soft);
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.geo-value {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 10px;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

#date,
#coords {
  grid-column: 1 / -1;
}

.styles {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.style {
  min-height: 40px;
  font-size: 12px;
  padding: 8px 4px;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.style.active {
  background: var(--secondary-accent);
  color: #ffffff;
  border-color: var(--secondary-accent);
  box-shadow: 0 4px 12px rgba(0, 180, 216, 0.28);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.actions button {
  flex: 1;
  min-height: 48px;
}

#share {
  background: #e0f7fa;
  color: #007791;
  border-color: #b2ebf2;
}

.foot {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 20px 0 6px;
  margin-top: auto;
}

@media (max-width: 680px) {
  .app {
    padding: max(10px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
  }

  .head {
    margin-bottom: 10px;
  }

  .brand {
    font-size: 20px;
  }

  .logo {
    width: 88px;
    height: 88px;
  }

  .frame {
    height: 58dvh;
    min-height: 310px;
    border-radius: 24px;
  }

  .camera-controls {
    margin: 14px 0 8px;
    gap: 20px;
  }

  .shutter-ring {
    width: 76px;
    height: 76px;
  }

  .editor-panel {
    padding: 14px;
    border-radius: 24px;
  }

  .editor-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .preview {
    max-height: 40dvh;
  }

  .styles {
    grid-template-columns: repeat(3, 1fr);
  }

  .actions {
    position: sticky;
    bottom: max(8px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px;
    margin: 14px -6px -6px;
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(24, 28, 46, 0.08);
    z-index: 10;
  }
}
