:root {
  --bg: #f7f6f3;
  --panel: #ffffff;
  --ink: #111111;
  --muted: #6b6b6b;
  --accent: #111111;
  --line: #e3e1dc;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body.landing {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #ffffff 0%, var(--bg) 55%, #efece6 100%);
  color: var(--ink);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.screen {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 24px;
}

.panel {
  width: min(1040px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 34px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.intro {
  justify-content: center;
  text-align: center;
}

.intro-header h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  margin: 8px 0 0;
}

.intro-video {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
}

.intro-video video {
  width: 100%;
  aspect-ratio: 9 / 16;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  display: block;
}

.intro-hint {
  color: var(--muted);
  margin: 0;
}

.intro-actions {
  display: flex;
  justify-content: center;
}

.intro-actions .btn-ghost {
  padding: 10px 18px;
  font-size: 0.9rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0;
}

.challenge-header h2 {
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  margin: 8px 0 0;
}

.control-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: nowrap;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.top-actions {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar {
  height: 6px;
}

.tabs::-webkit-scrollbar-thumb {
  background: #d8d4cd;
  border-radius: 999px;
}

.tab-btn {
  border-radius: 12px 12px 0 0;
  border: 1px solid var(--line);
  border-bottom: none;
  background: #f6f4ef;
  color: var(--muted);
  padding: 10px 18px;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn.active {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  position: relative;
  top: 1px;
}

.tab-panels {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.btn-solid,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--ink);
  padding: 12px 20px;
  font-size: 0.95rem;
  background: transparent;
  color: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
  text-decoration: none;
}

.btn-solid {
  background: var(--ink);
  color: #fff;
}

.btn-solid:disabled,
.btn-ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-solid:active,
.btn-ghost:active {
  transform: scale(0.98);
}

.capture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.capture-box {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #faf9f7;
}

.mini-label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#live-video {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  background: #000;
  flex: 1;
  object-fit: contain;
}

.camera-stage {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 70vh;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.camera-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cfc8bd;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.camera-stage:not(.d-none) .camera-placeholder {
  display: none;
}

.camera-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  gap: 12px;
  padding-top: 6px;
}

.upload-btn {
  width: 100%;
  margin-top: 10px;
  flex-direction: row;
  justify-content: center;
  gap: 10px;
}

.icon-btn {
  border: 1px solid #e8e6df;
  background: #fff;
  color: var(--ink);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  min-height: 64px;
}

.icon-btn:active {
  transform: translateY(1px);
}

.icon-primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.preview-box {
  flex: 1;
  border: 1px dashed var(--line);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 12px;
}

.preview-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.preview-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #ebe6de;
  background: #000;
}

.preview-item img,
.preview-item video {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  display: block;
}

.preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

#preview img,
#preview video {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 12px;
}

.status {
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  background: #f2f2f2;
}

.status-secondary {
  background: #f2f2f2;
  border-color: var(--line);
}

.status-info {
  background: #eef4ff;
  border-color: #c9dcff;
}

.status-success {
  background: #e6f4ea;
  border-color: #c2e2cc;
}

.status-warning {
  background: #fff4e5;
  border-color: #f4d3a5;
}

.status-danger {
  background: #fdecea;
  border-color: #f5c6c1;
}

.upload-progress-modal {
  z-index: 13;
}

.upload-progress-panel {
  width: min(420px, 92vw);
  text-align: left;
}

.upload-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.upload-progress-track {
  width: 100%;
  height: 10px;
  background: #ece8e0;
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--ink);
  transition: width 0.2s ease;
}

.limits-info {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f3f1ec;
  border: 1px solid var(--line);
}

.gallery {
  text-align: left;
}

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.gallery-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gallery-card video,
.gallery-card img {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  background: #000;
  object-fit: cover;
}

.gallery-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.confirm-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 17, 17, 0.85);
  backdrop-filter: blur(6px);
  padding: 24px;
  z-index: 10;
}

.confirm-card {
  width: min(520px, 100%);
  background: var(--panel);
  border-radius: 24px;
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.confirm-card h2 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}

.confirm-text {
  margin: 0;
  color: var(--muted);
}

.confirm-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.modal-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 17, 17, 0.65);
  backdrop-filter: blur(4px);
  padding: 24px;
  z-index: 12;
}

.modal-card {
  width: min(440px, 100%);
  background: var(--panel);
  border-radius: 22px;
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (max-width: 720px) {
  .panel {
    padding: 24px;
    border-radius: 22px;
  }

  .intro-video video {
    max-height: 60vh;
  }

  .actions {
    flex-direction: column;
  }

  .intro-actions {
    width: 100%;
  }

  .btn-solid,
  .btn-ghost {
    width: 100%;
    justify-content: center;
  }

  .top-actions {
    flex-direction: row;
  }

  .control-bar {
    align-items: flex-start;
  }

  .camera-controls {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-header .btn-ghost {
    width: auto;
  }

  .capture-grid {
    grid-template-columns: 1fr;
  }

  .capture-box {
    min-height: 220px;
  }

  .confirm-card {
    padding: 24px;
  }
}

@media (max-width: 480px) {
  .screen {
    padding: 16px;
  }

  .panel {
    padding: 20px;
    border-radius: 18px;
    gap: 18px;
  }

  .intro-video video {
    max-height: 55vh;
  }

  .intro-header h1,
  .challenge-header h2 {
    font-size: clamp(1.4rem, 6vw, 2rem);
  }

  .status {
    font-size: 0.9rem;
  }

  .confirm-actions {
    flex-direction: column;
  }

  .confirm-actions .btn-solid,
  .confirm-actions .btn-ghost {
    width: 100%;
  }
}