@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap");
:root {
  --bg: #f5f6f2;
  --paper: #fff;
  --ink: #203c34;
  --muted: #738078;
  --line: #e1e7df;
  --green: #215b49;
  --lime: #ddedbe;
  --amber: #9b651c;
  --radius: 18px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    14px "DM Sans",
    system-ui,
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  border: 0;
}
a {
  color: var(--green);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #95b77c;
  outline-offset: 3px;
}
h1,
h2,
h3 {
  font-family: Manrope, system-ui, sans-serif;
  letter-spacing: -0.04em;
  margin: 0;
}
h1 {
  font-size: 34px;
  line-height: 1.2;
}
h2 {
  font-size: 22px;
}
h3 {
  font-size: 17px;
}
p {
  line-height: 1.65;
  margin: 10px 0;
  color: var(--muted);
}
.shell {
  display: grid;
  grid-template-columns: 238px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 32px 22px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.8px;
}
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
  margin-top: 4px;
}
.brand-icon {
  width: 38px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--green);
  color: #e7f2d1;
  font-size: 23px;
}
.nav {
  display: grid;
  gap: 7px;
}
.nav button {
  background: none;
  padding: 14px 13px;
  border-radius: 10px;
  text-align: left;
  color: #7b857d;
  display: flex;
  gap: 13px;
  align-items: center;
}
.nav button.active {
  background: #eef3e9;
  color: var(--green);
  font-weight: 700;
}
.nav svg {
  width: 18px;
  height: 18px;
}
.sidebar-foot {
  margin-top: auto;
  font-size: 12px;
  background: var(--bg);
  padding: 16px;
  border-radius: 12px;
  line-height: 1.6;
  color: var(--muted);
}
.sidebar-foot strong {
  color: var(--ink);
  display: block;
}
.main {
  padding: 28px 42px 60px;
  max-width: 1450px;
  width: 100%;
  margin: auto;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 27px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
}
.crumb {
  font-size: 12px;
  color: var(--muted);
}
.topright {
  display: flex;
  align-items: center;
  gap: 14px;
}
.avatar {
  border-radius: 50%;
  width: 34px;
  height: 34px;
  background: #e5eadd;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #eef3e9;
  border-radius: 30px;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
}
.badge.warn {
  background: #fff3df;
  color: var(--amber);
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin: 28px 0;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 12px;
}
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  padding: 13px 18px;
  border-radius: 10px;
  background: var(--green);
  color: white;
  font-weight: 600;
  text-decoration: none;
  min-height: 44px;
}
.btn svg {
  width: 17px;
  height: 17px;
}
.btn.secondary {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.light {
  background: #e7f0d9;
  color: var(--ink);
}
.btn.small {
  font-size: 12px;
  padding: 9px 12px;
  min-height: 38px;
}
.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.btn.danger {
  background: #a3352b;
  color: white;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  background: #163f34;
  border-radius: 20px;
  overflow: hidden;
  min-height: 260px;
  color: white;
  margin-bottom: 23px;
}
.hero-copy {
  padding: 32px;
}
.hero .eyebrow {
  color: #abc6a0;
}
.hero h2 {
  font-size: 29px;
  max-width: 390px;
  line-height: 1.25;
}
.hero p {
  color: #b8cdc1;
  font-size: 13px;
  max-width: 380px;
  margin: 16px 0 24px;
}
.hero-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  background: radial-gradient(ellipse at center, #3a6450 0%, #163f34 70%);
  overflow: hidden;
}
.hero-art:before {
  content: "";
  position: absolute;
  border: 1px solid #78958140;
  border-radius: 50%;
  width: 300px;
  height: 300px;
}
.hero-art:after {
  content: "4 BOTTLES · ONE CONSISTENT PROTOCOL";
  position: absolute;
  bottom: 24px;
  font-size: 8px;
  letter-spacing: 1.5px;
  color: #aec6b1;
}
.bottle-svg {
  width: 62px;
  height: 180px;
  filter: drop-shadow(4px 10px 6px #102b3550);
  z-index: 1;
}
.hero-art .bottle-svg:nth-child(2) {
  transform: translateY(-8px);
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 32px;
}
.stat {
  border: 1px solid var(--line);
  background: white;
  border-radius: 14px;
  padding: 20px;
}
.stat-top {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}
.stat strong {
  display: block;
  font-size: 29px;
  font-weight: 600;
  margin: 11px 0 5px;
  letter-spacing: -1px;
}
.stat small {
  color: var(--muted);
  font-size: 11px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0 17px;
}
.section-head small {
  color: var(--muted);
}
.bottles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.bottle-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 17px;
  text-align: left;
  color: var(--ink);
  transition:
    transform 0.15s,
    border 0.15s;
}
.bottle-card:hover {
  transform: translateY(-3px);
  border-color: #a2b68e;
}
.bottle-stage {
  background: #f1f4eb;
  border-radius: 10px;
  height: 145px;
  display: grid;
  place-items: center;
  position: relative;
  margin-bottom: 16px;
}
.bottle-stage .bottle-svg {
  height: 118px;
  width: 50px;
}
.bottle-code {
  position: absolute;
  top: 11px;
  left: 11px;
  font-size: 9px;
  letter-spacing: 1px;
  color: #7a8777;
}
.bottle-card h3 {
  font-size: 14px;
  letter-spacing: -0.2px;
}
.bottle-card p {
  font-size: 11px;
  margin: 5px 0 16px;
}
.progress {
  height: 4px;
  border-radius: 9px;
  background: #edf0e9;
  overflow: hidden;
}
.progress i {
  display: block;
  background: #779866;
  height: 100%;
}
.card-foot {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}
.bottom-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  margin-top: 25px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 23px;
}
.panel.soft {
  background: #edf2e6;
}
.empty {
  padding: 30px 10px;
  text-align: center;
}
.empty svg {
  width: 30px;
  height: 30px;
  color: #8b9b80;
  margin-bottom: 10px;
}
.empty p {
  font-size: 12px;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child {
  border: 0;
}
.row strong {
  font-size: 13px;
}
.row small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}
.row button {
  flex-shrink: 0;
}
.steps {
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}
.steps li {
  padding-left: 4px;
  margin: 12px 0;
}
.steps strong {
  color: var(--ink);
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
  font-size: 12px;
  font-weight: 600;
}
.field input,
.field select,
.field textarea {
  border: 1px solid #dce3d8;
  background: #fbfcf9;
  border-radius: 9px;
  padding: 13px;
  color: var(--ink);
  width: 100%;
  min-height: 44px;
}
.field small {
  font-weight: 400;
  color: var(--muted);
  line-height: 1.5;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  line-height: 1.6;
  margin: 13px 0;
}
.check input {
  accent-color: var(--green);
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 2px;
}
.notice {
  background: #f2f5eb;
  border-left: 3px solid #91a578;
  padding: 13px 16px;
  font-size: 12px;
  line-height: 1.7;
  margin: 18px 0;
  color: #56634e;
}
.notice.warn {
  background: #fff7e9;
  border-color: #cc9f53;
  color: #85652e;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.levels {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.level {
  padding: 18px 8px;
  background: #f3f5ee;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  text-align: center;
}
.level.active {
  background: var(--green);
  color: white;
}
.level.complete {
  background: #e1eccf;
}
.level strong {
  font-size: 19px;
  display: block;
}
.level small {
  font-size: 10px;
  display: block;
  margin-top: 6px;
}
.capture-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr);
  gap: 24px;
}
.viewfinder {
  aspect-ratio: 3/4;
  background: #182820;
  border-radius: 17px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 65vh;
}
.viewfinder video,
.viewfinder img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.viewfinder .frame {
  position: absolute;
  left: 25%;
  right: 25%;
  top: 9%;
  bottom: 9%;
  border: 1px dashed #d5e6b5a0;
  border-radius: 35% 35% 15% 15%;
  pointer-events: none;
}
.viewfinder .cam-label {
  position: absolute;
  top: 16px;
  left: 16px;
  color: white;
  background: #0006;
  padding: 7px 10px;
  border-radius: 20px;
  font-size: 10px;
}
.cam-placeholder {
  color: #b7c8b7;
  text-align: center;
  padding: 35px;
}
.cam-placeholder svg {
  height: 40px;
  width: 40px;
}
.capture-button {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #e7efd8;
  border: 5px solid white;
  outline: 1px solid #c2ceb6;
  display: grid;
  place-items: center;
  margin: 18px auto;
  color: var(--green);
}
.capture-button svg {
  width: 25px;
}
.instruction {
  font-size: 24px;
  line-height: 1.3;
  margin: 15px 0;
}
.angle-diagram {
  background: #f2f5eb;
  padding: 12px;
  border-radius: 13px;
  text-align: center;
  margin-bottom: 20px;
}
.angle-diagram svg {
  height: 130px;
  width: 100%;
}
.filename {
  font:
    11px ui-monospace,
    monospace;
  background: #f3f5ef;
  border-radius: 7px;
  padding: 13px;
  word-break: break-all;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}
.photo-tile {
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}
.photo-tile img {
  width: 100%;
  height: 170px;
  object-fit: contain;
  background: #e9ede5;
}
.photo-tile .info {
  padding: 13px;
}
.photo-tile strong {
  font-size: 12px;
}
.photo-tile p {
  font-size: 10px;
  margin: 6px 0;
  word-break: break-all;
}
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin: 20px 0;
}
.toolbar select {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}
.guide-img {
  width: 100%;
  border-radius: 12px;
  margin-top: 12px;
}
.muted {
  color: var(--muted);
}
.tiny {
  font-size: 11px;
}
.text-link {
  background: none;
  color: var(--green);
  font-size: 12px;
  padding: 6px 0;
  text-decoration: underline;
}
.pill-count {
  background: #eef1e6;
  border-radius: 8px;
  font-size: 10px;
  padding: 4px 8px;
  margin-left: auto;
}
.bar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.mobile-brand {
  display: none;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 20px;
  background: #203f34;
  color: white;
  border-radius: 12px;
  max-width: 90%;
  box-shadow: 0 10px 40px #0002;
  z-index: 100;
  display: none;
  font-size: 13px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  width: min(550px, 94vw);
  color: var(--ink);
  max-height: 90vh;
  overflow: auto;
}
dialog::backdrop {
  background: #142d2860;
  backdrop-filter: blur(3px);
}
dialog h2 {
  margin-bottom: 16px;
}
.divider {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.hidden {
  display: none !important;
}
.sync-status {
  font-size: 12px;
  margin: 12px 0;
  line-height: 1.6;
  color: var(--muted);
}
.countdown {
  position: absolute;
  font-size: 70px;
  color: white;
  text-shadow: 0 2px 20px #000;
  pointer-events: none;
}
.footer-note {
  font-size: 10px;
  color: #8a948a;
  margin-top: 30px;
  text-align: center;
  letter-spacing: 0.4px;
}
@media (min-width: 1500px) {
  .main {
    padding-left: 55px;
    padding-right: 55px;
  }
}
@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 195px 1fr;
  }
  .sidebar {
    padding: 25px 15px;
  }
  .main {
    padding: 25px;
  }
  .bottles {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats {
    gap: 10px;
  }
  .stat {
    padding: 16px;
  }
  .hero h2 {
    font-size: 25px;
  }
  .hero-art {
    gap: 0;
  }
  .bottom-grid {
    grid-template-columns: 1fr;
  }
  .capture-layout {
    grid-template-columns: 1fr 1fr;
  }
  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 720px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    height: auto;
    width: 100%;
    padding: 8px 7px calc(8px + env(safe-area-inset-bottom));
    z-index: 50;
    border: 0;
    border-top: 1px solid var(--line);
    gap: 0;
  }
  .sidebar .brand,
  .sidebar-foot {
    display: none;
  }
  .nav {
    display: flex;
    justify-content: space-around;
    gap: 1px;
  }
  .nav button {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    font-size: 9px;
    flex: 1;
    border-radius: 8px;
  }
  .nav svg {
    width: 19px;
    height: 19px;
  }
  .pill-count {
    display: none;
  }
  .main {
    padding: 20px 18px 110px;
  }
  .topbar {
    padding-bottom: 17px;
    margin-bottom: 23px;
  }
  .crumb {
    display: none;
  }
  .mobile-brand {
    display: flex;
    font-size: 17px;
  }
  .mobile-brand .brand-icon {
    width: 30px;
    height: 32px;
    font-size: 18px;
  }
  .topright .avatar {
    display: none;
  }
  .badge {
    font-size: 10px;
  }
  h1 {
    font-size: 27px;
  }
  .heading {
    align-items: flex-start;
    gap: 12px;
    margin: 22px 0;
  }
  .heading .btn {
    font-size: 11px;
    padding: 11px;
    white-space: nowrap;
  }
  .heading p {
    font-size: 12px;
  }
  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .hero-copy {
    padding: 25px;
  }
  .hero h2 {
    font-size: 26px;
    max-width: 280px;
  }
  .hero p {
    font-size: 12px;
    max-width: 270px;
  }
  .hero-art {
    display: none;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 25px;
  }
  .stat {
    padding: 16px;
  }
  .stat strong {
    font-size: 27px;
  }
  .stat-top {
    font-size: 11px;
  }
  .bottles {
    gap: 12px;
  }
  .bottle-card {
    padding: 12px;
  }
  .bottle-stage {
    height: 125px;
  }
  .bottle-card h3 {
    font-size: 12px;
  }
  .bottle-card p {
    font-size: 10px;
    min-height: 25px;
  }
  .panel {
    padding: 19px;
  }
  .grid2,
  .capture-layout {
    grid-template-columns: 1fr;
  }
  .levels {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .level {
    padding: 14px 5px;
  }
  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .photo-tile img {
    height: 160px;
  }
  .viewfinder {
    max-height: 60vh;
  }
  .capture-layout {
    gap: 16px;
  }
  .capture-layout .instruction-panel {
    order: -1;
  }
  .instruction-panel .angle-diagram {
    display: none;
  }
  .instruction-panel .instruction {
    font-size: 20px;
  }
  .instruction-panel .steps {
    display: none;
  }
  .section-head h2 {
    font-size: 20px;
  }
  .toolbar .btn {
    font-size: 11px;
  }
  .row {
    flex-wrap: wrap;
  }
  #toast {
    bottom: 100px;
  }
  .eyebrow {
    font-size: 9px;
  }
  .bottom-grid {
    gap: 15px;
  }
  .footer-note {
    line-height: 1.7;
  }
}

body.camera-open {
  overflow: hidden;
}
.camera-open #cameraStage {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  box-sizing: border-box;
}
.camera-open #viewfinder {
  flex: 1;
  min-height: 0;
  max-height: none;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  border-radius: 0;
  margin: 0;
  background: #000;
}
/* The live video and its guide frame share one box sized to the video's own aspect ratio. */
.viewfinder .live-wrap {
  position: relative;
  flex: none;
  width: 100%;
  height: 100%;
}
.viewfinder .live-wrap video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.camera-open .cam-label {
  z-index: 2;
}
.camera-open #cameraControls {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 12px;
  background: #000;
}
.camera-open #cameraControls .capture-button {
  margin: 0;
}
