:root {
  --bg: #f6f0e7;
  --bg-deep: #eadfce;
  --panel: rgba(255, 251, 246, 0.88);
  --panel-strong: #fffaf4;
  --ink: #18211c;
  --muted: #5f6c65;
  --line: rgba(24, 33, 28, 0.12);
  --accent: #0f6d62;
  --accent-strong: #0a534a;
  --accent-soft: #dceee9;
  --danger: #8b2f27;
  --shadow: 0 30px 70px -42px rgba(38, 29, 17, 0.55);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(210, 236, 227, 0.95), transparent 34%),
    radial-gradient(circle at top right, rgba(248, 220, 194, 0.82), transparent 28%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(125deg, transparent 0 42%, rgba(255, 255, 255, 0.24) 42% 44%, transparent 44% 100%),
    linear-gradient(305deg, transparent 0 78%, rgba(15, 109, 98, 0.08) 78% 80%, transparent 80% 100%);
}

body.is-locked .app {
  align-content: center;
}

.app {
  position: relative;
  min-height: 100vh;
  padding: clamp(20px, 4vw, 44px);
  display: grid;
  gap: clamp(20px, 4vw, 40px);
}

.auth-gate,
.hero,
.workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.auth-gate {
  width: min(640px, 100%);
}

.hero {
  display: grid;
  gap: 10px;
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  font-weight: 700;
  letter-spacing: -0.04em;
}

h1 {
  max-width: 10ch;
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  line-height: 0.94;
}

.hero-copy {
  max-width: 42rem;
  margin: 0;
  font-size: clamp(1.02rem, 2vw, 1.18rem);
  line-height: 1.6;
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: clamp(18px, 3vw, 30px);
  align-items: start;
}

.capture-panel,
.gallery-panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.capture-panel {
  padding: clamp(18px, 3vw, 30px);
  display: grid;
  gap: 16px;
}

.auth-card {
  gap: 18px;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.gallery-panel {
  padding: clamp(18px, 3vw, 28px);
  display: grid;
  gap: 18px;
}

.field-group,
.gallery-filter {
  display: grid;
  gap: 8px;
}

label {
  font-size: 0.77rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(15, 109, 98, 0.42);
  box-shadow: 0 0 0 4px rgba(15, 109, 98, 0.12);
  background: #fffdfa;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 14px 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    transform 140ms ease,
    opacity 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease,
    color 140ms ease,
    border-color 140ms ease;
}

button:hover:not([disabled]) {
  transform: translateY(-1px);
}

button[disabled] {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

#unlock-button,
#capture,
#record-video,
#upload-files {
  background: var(--accent);
  color: #f6f2ec;
  box-shadow: 0 20px 30px -24px rgba(15, 109, 98, 0.8);
}

#unlock-button:hover:not([disabled]),
#capture:hover:not([disabled]),
#record-video:hover:not([disabled]),
#upload-files:hover:not([disabled]) {
  background: var(--accent-strong);
}

#record-video.is-recording {
  background: #842f2c;
  box-shadow: 0 20px 30px -24px rgba(132, 47, 44, 0.8);
}

#record-video.is-recording:hover:not([disabled]) {
  background: #6f2624;
}

#flip-camera,
#refresh-gallery,
.preview-close {
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.profile-hint,
.camera-hint,
.gallery-copy,
.status,
.album-empty {
  margin: 0;
  color: var(--muted);
}

.profile-hint,
.status {
  min-height: 1.35em;
}

.status.error {
  color: var(--danger);
}

.camera-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(circle at top, rgba(38, 98, 88, 0.34), transparent 38%),
    #08110d;
  aspect-ratio: 4 / 5;
  touch-action: none;
}

.camera-wrap::after {
  content: "";
  position: absolute;
  inset: auto 16px 16px auto;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  opacity: 0.45;
}

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

.camera-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.recording-pill {
  position: absolute;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(12, 18, 17, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff6ec;
  font-size: 0.83rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  backdrop-filter: blur(12px);
}

.recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff6f67;
  box-shadow: 0 0 0 6px rgba(255, 111, 103, 0.15);
  animation: pulse-recording 1.15s ease-in-out infinite;
}

.focus-ring {
  position: absolute;
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  border-radius: 50%;
  border: 2px solid rgba(255, 246, 236, 0.92);
  box-shadow:
    0 0 0 1px rgba(10, 12, 11, 0.32),
    0 0 28px rgba(255, 246, 236, 0.22);
  background:
    radial-gradient(circle, transparent 0 56%, rgba(255, 246, 236, 0.18) 56% 58%, transparent 58%),
    transparent;
  transform: scale(1.12);
  opacity: 0;
  animation: focus-lock 700ms ease forwards;
}

.camera-zoom {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(12, 18, 17, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

.zoom-button,
.zoom-value {
  min-width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
}

.zoom-button {
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.14);
  color: #fff6ec;
  box-shadow: none;
}

.zoom-button:hover:not([disabled]) {
  background: rgba(255, 255, 255, 0.24);
}

.zoom-value {
  font-size: 0.84rem;
  font-weight: 700;
  color: #fff6ec;
  background: rgba(255, 255, 255, 0.08);
}

.zoom-slider {
  width: 100%;
  min-width: 0;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: none;
  appearance: none;
}

.zoom-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 246, 236, 0.86), rgba(220, 238, 233, 0.74));
}

.zoom-slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border: 0;
  border-radius: 50%;
  background: #fff6ec;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.28);
}

.zoom-slider::-moz-range-track {
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 246, 236, 0.86), rgba(220, 238, 233, 0.74));
}

.zoom-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: #fff6ec;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.28);
}

.camera-hint {
  min-height: 1.35em;
}

@keyframes focus-lock {
  0% {
    transform: scale(1.2);
    opacity: 0;
  }

  25% {
    opacity: 1;
  }

  55% {
    transform: scale(0.96);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 0;
  }
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.controls-secondary {
  margin-top: -4px;
}

.auth-controls {
  grid-template-columns: 1fr;
}

.gallery-head {
  display: grid;
  gap: 6px;
}

.gallery-head h2 {
  font-size: clamp(1.95rem, 4vw, 2.9rem);
  line-height: 0.98;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
  min-height: 220px;
}

.album-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  padding: 0;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #101613;
  color: inherit;
  text-align: left;
  box-shadow: 0 18px 28px -24px rgba(20, 24, 22, 0.72);
}

.album-item-video {
  background:
    radial-gradient(circle at top, rgba(21, 107, 96, 0.28), transparent 44%),
    linear-gradient(180deg, #182521 0%, #0b100f 100%);
}

.album-video-thumb {
  filter: saturate(0.94) contrast(1.02);
}

.album-item img,
.album-item video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #0c1210;
  border-radius: inherit;
}

.album-video-surface {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  padding: 18px;
}

.album-video-play {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(15, 17, 16, 0.56);
  border: 1px solid rgba(255, 246, 236, 0.18);
  color: #fff6ec;
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  text-indent: 4px;
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 28px -22px rgba(5, 7, 6, 0.92);
}

.album-video-format {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 246, 236, 0.88);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.album-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 34%, rgba(6, 10, 9, 0.78) 100%);
}

.album-meta {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  display: grid;
  gap: 4px;
  padding: 14px;
}

.album-owner {
  color: #fff6ec;
  font-size: 0.93rem;
  font-weight: 700;
}

.album-details {
  color: rgba(255, 246, 236, 0.78);
  font-size: 0.76rem;
}

.album-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(12, 18, 17, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff6ec;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.preview-modal[hidden] {
  display: none;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
}

.preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 15, 14, 0.82);
}

.preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preview-content {
  position: relative;
  width: min(92vw, 760px);
  max-height: 90vh;
  padding: 14px;
  display: grid;
  gap: 10px;
  border-radius: 24px;
  background: rgba(19, 23, 21, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 36px 60px -30px rgba(0, 0, 0, 0.68);
}

.preview-modal.is-video-preview .preview-content {
  width: min(78vw, 420px);
  max-height: none;
  padding: 0;
  gap: 12px;
  justify-items: center;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.preview-download {
  background: var(--accent);
  color: #f6f2ec;
  border: 1px solid rgba(15, 109, 98, 0.24);
  box-shadow: 0 20px 30px -24px rgba(15, 109, 98, 0.8);
}

.preview-download:hover:not([disabled]) {
  background: var(--accent-strong);
}

.preview-close {
  justify-self: end;
}

.preview-modal.is-video-preview .preview-actions {
  order: 2;
  justify-content: center;
  width: auto;
}

.preview-modal.is-video-preview .preview-close {
  display: none;
}

.preview-image,
.preview-player {
  width: 100%;
  justify-self: center;
  max-height: calc(90vh - 84px);
  display: block;
  border-radius: 16px;
  background: #000;
}

.preview-image {
  object-fit: contain;
}

.preview-player {
  overflow: hidden;
}

.preview-player[hidden] {
  display: none !important;
}

.preview-player video {
  display: block;
  width: 100%;
  max-height: calc(90vh - 84px);
}

.preview-player,
.preview-player video {
  background: #050707;
}

.preview-modal.is-video-preview .preview-player {
  order: 1;
  width: min(78vw, 420px);
  max-height: min(52vh, 340px);
  border-radius: 18px;
  background: transparent;
}

.preview-modal.is-video-preview .preview-player video {
  max-height: min(52vh, 340px);
}

@keyframes pulse-recording {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(0.8);
    opacity: 0.72;
  }
}

@media (max-width: 940px) {
  .workspace {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .app {
    padding: 16px;
    gap: 22px;
  }

  .hero-copy {
    font-size: 1rem;
  }

  .capture-panel,
  .gallery-panel {
    border-radius: 24px;
    padding: 16px;
  }

  .controls,
  .controls-secondary,
  .album-grid {
    grid-template-columns: 1fr;
  }

  .camera-wrap {
    border-radius: 22px;
  }

  .recording-pill {
    top: 12px;
    left: 12px;
  }

  .camera-zoom {
    left: 12px;
    right: 12px;
    bottom: 12px;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .preview-content {
    width: min(88vw, 380px);
    max-height: 78vh;
    padding: 12px;
    gap: 8px;
  }

  .preview-actions {
    width: 100%;
  }

  .preview-image,
  .preview-player {
    width: min(100%, 320px);
    max-height: min(46vh, 280px);
  }

  .preview-player video {
    max-height: min(46vh, 280px);
  }

  .preview-modal.is-video-preview .preview-content {
    width: min(74vw, 280px);
    gap: 10px;
  }

  .preview-modal.is-video-preview .preview-player {
    width: min(74vw, 280px);
    max-height: min(30vh, 190px);
    border-radius: 14px;
  }

  .preview-modal.is-video-preview .preview-player video {
    max-height: min(30vh, 190px);
  }

  .zoom-value {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    height: auto;
    padding: 8px 10px;
  }
}
