* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-accent: #10233a;
  --card: rgba(11, 23, 40, 0.88);
  --card-strong: #13263f;
  --line: rgba(167, 190, 219, 0.18);
  --text: #f4f7fb;
  --muted: #b7c3d4;
  --primary: #67e8b0;
  --primary-strong: #22c55e;
  --secondary: #24364d;
  --danger: #ffb4b4;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

html {
  font-size: 18px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(103, 232, 176, 0.18), transparent 24rem),
    linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 55%, #040914 100%);
}

button,
input,
select {
  font: inherit;
}

#app {
  min-height: 100vh;
}

.screen {
  min-height: 100vh;
  padding: 1rem;
}

.screen-app-fit {
  min-height: var(--app-height, 100vh);
  height: var(--app-height, 100vh);
  overflow: hidden;
}

.screen-auth {
  display: grid;
  gap: 1rem;
  align-content: space-between;
  min-height: var(--app-height, 100vh);
  height: var(--app-height, 100vh);
  position: relative;
  overflow: hidden;
}

.screen-landing {
  min-height: 100vh;
  padding-block: 1.25rem 2rem;
}

.screen-auth .card {
  width: min(100%, 34rem);
  margin: 0;
  align-self: end;
}

.landing-shell {
  width: min(100%, 68rem);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.landing-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.landing-hero {
  display: grid;
  gap: 1rem;
  align-items: stretch;
}

.landing-copy,
.landing-preview {
  padding: 1.35rem;
  border-radius: 1.6rem;
}

.landing-copy {
  background:
    linear-gradient(135deg, rgba(103, 232, 176, 0.14), rgba(103, 232, 176, 0.02)),
    rgba(11, 23, 40, 0.78);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.landing-copy h1 {
  max-width: 12ch;
}

.landing-steps,
.landing-benefits {
  gap: 1rem;
}

.landing-step {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: rgba(7, 17, 31, 0.52);
}

.landing-step strong {
  display: block;
}

.container {
  width: min(100%, 34rem);
  margin: 0 auto;
}

.container-wide {
  width: min(100%, 42rem);
}

.container-fill {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.topbar-copy {
  flex: 1;
  min-width: 0;
}

.menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.menu-toggle {
  width: 3.2rem;
  height: 3.2rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(7, 17, 31, 0.92);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.menu-panel {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  z-index: 20;
  width: min(18rem, calc(100vw - 2rem));
  padding: 0.5rem;
  display: none;
  gap: 0.45rem;
  background: rgba(7, 17, 31, 0.96);
  border: 1px solid var(--line);
  border-radius: 1rem;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.menu-panel.open {
  display: grid;
}

.menu-item {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 0;
  border-radius: 0.85rem;
  background: var(--secondary);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.menu-item-danger {
  background: rgba(255, 180, 180, 0.12);
  color: #ffdede;
}

.brand {
  width: min(100%, 34rem);
  margin: 0 auto;
  padding: 0.75rem 0.35rem 0;
}

.app-logo {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
}

.app-logo-topbar {
  width: clamp(5.8rem, 22vw, 8rem);
  margin-bottom: 0.5rem;
}

.app-logo-nav {
  width: clamp(6.6rem, 24vw, 9.5rem);
}

.app-logo-auth {
  width: clamp(6.8rem, 25vw, 9rem);
  margin-bottom: 0.65rem;
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
}

.intro {
  margin: 0.5rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: clamp(2rem, 8vw, 3.4rem);
}

h2 {
  font-size: clamp(1.35rem, 5vw, 1.9rem);
}

.card,
.status-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  padding: 1.15rem;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.status-card {
  min-height: 4.5rem;
}

.message {
  margin: 0.85rem 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 180, 180, 0.12);
  color: #ffdede;
  line-height: 1.45;
}

.message.success {
  background: rgba(103, 232, 176, 0.12);
  color: #dcfff0;
}

.input,
select {
  width: 100%;
  min-height: 3.4rem;
  margin-top: 0.9rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(183, 195, 212, 0.14);
  border-radius: 1rem;
  background: rgba(7, 17, 31, 0.9);
  color: var(--text);
}

.input::placeholder {
  color: #8da1b8;
}

.btn {
  width: 100%;
  min-height: 3.4rem;
  padding: 0.95rem 1.1rem;
  border: 0;
  border-radius: 1rem;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
  font-weight: 700;
}

.btn:active {
  transform: scale(0.985);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #04110b;
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text);
}

.btn-inline {
  width: auto;
  min-width: 10rem;
}

.btn-small {
  width: auto;
  min-height: auto;
  padding: 0.7rem 0.95rem;
}

.mt-1 {
  margin-top: 0.75rem;
}

.grid {
  display: grid;
  gap: 0.75rem;
}

.toolbar {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.project-path-box {
  margin-top: 0.85rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  background: rgba(7, 17, 31, 0.52);
}

.project-path {
  display: block;
  margin: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  word-break: break-word;
  line-height: 1.5;
}

.project-preview-frame {
  margin-top: 0.9rem;
  aspect-ratio: 4 / 3;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #f3f0e8 0%, #e4ecf3 100%);
  display: grid;
  place-items: center;
}

.project-preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-preview-placeholder {
  display: none;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.project-preview-empty .project-preview-placeholder {
  display: block;
}

.stats-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.stats-last-viewed {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.stats-card-body {
  display: grid;
  gap: 1rem;
  margin-top: 0.9rem;
}

.stats-preview-frame {
  margin-top: 0;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #f3f0e8 0%, #e4ecf3 100%);
  display: block;
}

.stats-preview-image {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

.stats-preview-placeholder {
  display: none;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.stats-preview-empty .stats-preview-placeholder {
  display: block;
}

.stats-chart-wrap {
  min-width: 0;
  background: rgba(7, 17, 31, 0.32);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.9rem;
}

.stats-summary {
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.stats-chart-frame {
  position: relative;
  height: 14rem;
  min-height: 14rem;
}

.stats-chart {
  width: 100%;
  height: 100%;
  display: block;
}

.stats-detail {
  margin: 0.85rem 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
}

.camera-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
}

.camera-frame {
  position: relative;
  width: 100%;
  min-height: 0;
  border-radius: 1.6rem;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.camera-frame video,
.camera-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 1rem;
}

.result-image {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
  margin-top: 0.8rem;
  border-radius: 1rem;
}

#captureBtn,
#switchBtn,
#galleryBtn,
#cropBtn,
.camera-action-btn {
  position: absolute;
  display: grid;
  place-items: center;
  border: 0;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

#captureBtn {
  bottom: 1rem;
  left: 50%;
  width: 5.25rem;
  height: 5.25rem;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 0.3rem solid rgba(255, 255, 255, 0.9);
}

#captureBtn::after {
  content: "";
  width: 3.35rem;
  height: 3.35rem;
  border-radius: 50%;
  background: #fff;
}

#switchBtn,
#galleryBtn {
  bottom: 1rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: rgba(7, 17, 31, 0.66);
  color: #fff;
  font-size: 1.35rem;
}

#switchBtn {
  right: 1rem;
}

#galleryBtn {
  left: 1rem;
}

.camera-action-btn {
  bottom: 1rem;
  min-height: 3.5rem;
  color: #fff;
  background: rgba(7, 17, 31, 0.8);
  font-weight: 700;
}

.camera-action-primary {
  left: 50%;
  width: 4rem;
  height: 4rem;
  transform: translateX(-50%);
  border-radius: 50%;
  font-size: 1.7rem;
}

.bootstrap-icon {
  font-family: "bootstrap-icons";
  font-style: normal;
  font-weight: 400;
  line-height: 1;
}

.camera-action-secondary {
  left: 1rem;
  padding: 0 1rem;
  border-radius: 999px;
  font-size: 0.95rem;
}

#cropBtn {
  top: 1rem;
  right: 1rem;
  width: auto;
  min-width: 4.6rem;
  min-height: 2.8rem;
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
  background: rgba(7, 17, 31, 0.72);
  color: #fff;
  font-weight: 700;
}

#cropBtn:disabled {
  opacity: 0.72;
  cursor: default;
}
#status {
  margin-top: 1rem;
  line-height: 1.5;
  color: var(--muted);
}

img {
  max-width: 100%;
}

@media (min-width: 700px) {
  .screen {
    padding: 2rem 1.25rem;
  }

  .screen-auth {
    grid-template-columns: minmax(0, 1.1fr) minmax(19rem, 28rem);
    gap: 1.5rem;
  }

  .brand,
  .container {
    width: 100%;
  }

  .toolbar {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .topbar {
    align-items: center;
  }

  .landing-hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(20rem, 0.85fr);
    gap: 1.25rem;
  }

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

  .stats-card-body {
    grid-template-columns: minmax(11rem, 13rem) minmax(0, 1fr);
    align-items: stretch;
  }
}

@media (max-width: 420px) {
  html {
    font-size: 19px;
  }

  .screen {
    padding: 0.8rem;
  }

  .card,
  .status-card {
    padding: 1rem;
    border-radius: 1.15rem;
  }

  .topbar {
    align-items: flex-start;
  }

  .landing-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .landing-cta {
    width: 100%;
  }

  .landing-cta .btn {
    width: 100%;
  }

  .project-row {
    align-items: flex-start;
    flex-direction: column;
  }

  #captureBtn {
    width: 4.8rem;
    height: 4.8rem;
  }

  #captureBtn::after {
    width: 3rem;
    height: 3rem;
  }
}
