:root {
  --ink: #173f3a;
  --ink-deep: #0e2d29;
  --paper: #f5f0e7;
  --white: #fffdfa;
  --line: #d9d1c4;
  --orange: #dc6b42;
  --orange-dark: #bd4e29;
  --sage: #a8c4b9;
  --shadow: 0 24px 70px rgba(22, 55, 50, 0.13);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink-deep);
  background:
    radial-gradient(circle at 7% 8%, rgba(220, 107, 66, 0.12), transparent 27rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

button, input { font: inherit; }
button, .file-button { -webkit-tap-highlight-color: transparent; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0;
}

.coffee-home {
  color: var(--orange-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.coffee-home:hover { text-decoration: underline; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-deep);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 31px;
  height: 37px;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--ink-deep);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--orange);
  font-family: Georgia, serif;
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  color: var(--ink);
  background: rgba(168, 196, 185, 0.35);
  border: 1px solid rgba(23, 63, 58, 0.18);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 750;
}

.privacy-pill span { color: #3b8b68; font-size: 0.55rem; }

main { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

.intro { max-width: 760px; padding: 56px 0 42px; }
.eyebrow, .mini-label {
  margin: 0 0 12px;
  color: var(--orange-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  max-width: 720px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 7vw, 5.4rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.94;
}

.intro-copy {
  max-width: 580px;
  margin: 24px 0 0;
  color: #49635f;
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.6;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr);
  gap: 28px;
  align-items: start;
  padding-bottom: 70px;
}

.camera-panel, .guide-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.camera-panel { padding: 18px; }

.format-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.format-row .control-label { white-space: nowrap; }

.stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  max-height: 72vh;
  aspect-ratio: 35 / 45;
  overflow: hidden;
  background: #d8e3df;
  border-radius: 15px;
  isolation: isolate;
}

#camera, #photoPreview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#camera.user-facing { transform: scaleX(-1); }
#photoPreview { background: white; }

.empty-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 24px;
  color: #55706b;
  text-align: center;
}

.empty-state strong { color: var(--ink-deep); font-size: 1.05rem; }
.empty-state span:last-child { font-size: 0.84rem; }
.camera-glyph {
  display: grid;
  place-items: center;
  width: 58px;
  height: 45px;
  margin-bottom: 8px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 11px;
  font-size: 1.4rem;
}

.guide { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.head-guide {
  position: absolute;
  top: 13%;
  left: 50%;
  width: 48%;
  height: 52%;
  transform: translateX(-50%);
  border: 2px dashed rgba(255, 255, 255, 0.92);
  border-radius: 48%;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.eye-line {
  position: absolute;
  top: 42%;
  left: 17%;
  width: 66%;
  border-top: 1px solid rgba(255, 255, 255, 0.8);
  text-align: right;
}

.eye-line span {
  position: relative;
  top: -10px;
  padding-left: 4px;
  color: white;
  font-size: 0.6rem;
  text-shadow: 0 1px 2px #000;
}

.shoulder-guide {
  position: absolute;
  left: 12%;
  bottom: -12%;
  width: 76%;
  height: 40%;
  border: 2px dashed rgba(255, 255, 255, 0.9);
  border-radius: 50% 50% 0 0;
}

.countdown {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  color: white;
  background: rgba(14, 45, 41, 0.35);
  font-family: Georgia, serif;
  font-size: clamp(6rem, 25vw, 12rem);
  text-shadow: 0 5px 30px rgba(0, 0, 0, 0.28);
}

.stage-tip {
  position: absolute;
  z-index: 4;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 8px 12px;
  color: white;
  background: rgba(14, 45, 41, 0.82);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.camera-actions, .edit-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.button:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid #efaa74; outline-offset: 2px; }
.primary { color: white; background: var(--orange); border-color: var(--orange-dark); }
.primary:hover { background: var(--orange-dark); }
.secondary { color: var(--ink); background: #f2eee7; border-color: var(--line); }
.secondary:hover { background: #e8e1d6; }

.live-controls, .edit-controls { margin-top: 14px; }
.timer-row { display: flex; align-items: center; gap: 10px; }
.control-label { color: #617873; font-size: 0.78rem; font-weight: 800; }
.segmented { display: flex; flex: 1; padding: 3px; background: #eee8de; border-radius: 10px; }
.segmented button {
  flex: 1;
  padding: 8px;
  color: #54706a;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
}
.segmented button.selected { color: var(--ink-deep); background: white; box-shadow: 0 2px 8px rgba(27, 54, 49, 0.1); }
.icon-button {
  width: 42px;
  height: 42px;
  color: var(--ink);
  background: #eee8de;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.25rem;
}

.shutter {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  color: white;
  background: var(--ink);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
}
.shutter span { width: 25px; height: 25px; background: white; border: 4px solid var(--sage); border-radius: 50%; }
.shutter:disabled { cursor: wait; opacity: 0.6; }

.range-control { margin: 14px 2px; }
.range-control label { display: flex; justify-content: space-between; color: #4c6560; font-size: 0.8rem; font-weight: 750; }
.range-control input { width: 100%; margin: 10px 0 0; accent-color: var(--orange); }
.range-hints { display: flex; justify-content: space-between; margin-top: 2px; color: #84918e; font-size: 0.65rem; font-weight: 700; }
.status { min-height: 18px; margin: 12px 2px 0; color: #6b7774; font-size: 0.72rem; line-height: 1.45; }
.status.error { color: #9f3a24; }

.guide-panel { overflow: hidden; }
.size-card { display: grid; gap: 4px; padding: 24px; color: white; background: var(--ink); }
.size-card .mini-label { margin: 0 0 6px; color: #f2b69f; }
.size-card strong { font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }
.size-card span:last-child { color: #c5d7d2; font-size: 0.76rem; }
.checklist { padding: 24px; }
.checklist h2 { margin: 0 0 19px; font-family: Georgia, serif; font-size: 1.45rem; font-weight: 500; }
.checklist ul { display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; }
.checklist li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.checklist li > span {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  color: var(--orange-dark);
  background: #f7ded3;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 850;
}
.checklist strong, .checklist small { display: block; }
.checklist strong { margin-bottom: 3px; font-size: 0.84rem; }
.checklist small { color: #6d7e7a; font-size: 0.72rem; line-height: 1.45; }
footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 38px;
  color: #71817d;
  border-top: 1px solid var(--line);
  font-size: 0.7rem;
}

[hidden] { display: none !important; }

@media (max-width: 820px) {
  .intro { padding-top: 38px; }
  .workspace { grid-template-columns: 1fr; }
  .guide-panel { box-shadow: none; }
}

@media (max-width: 520px) {
  .site-header { padding-top: calc(14px + env(safe-area-inset-top)); }
  .coffee-home { display: none; }
  .privacy-pill { font-size: 0; padding: 8px; }
  .privacy-pill::after { content: "Private"; font-size: 0.7rem; }
  .intro { padding: 30px 0 28px; }
  h1 { font-size: clamp(2.55rem, 14vw, 4rem); }
  .camera-panel { padding: 10px; border-radius: 18px; }
  .format-row { align-items: stretch; flex-direction: column; gap: 7px; }
  .stage { border-radius: 11px; max-height: none; }
  .camera-actions, .edit-buttons { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; }
}
