:root {
  color-scheme: light;
  --ink: #22201d;
  --muted: #6e6962;
  --line: #ddd7ce;
  --paper: #faf8f3;
  --panel: #ffffff;
  --accent: #1f7a72;
  --accent-dark: #135b55;
  --coral: #bd5948;
  --gold: #c7902f;
  --wash: #edf5f1;
  --shadow: 0 18px 48px rgba(48, 43, 34, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overscroll-behavior-y: none;
  touch-action: pan-x pan-y;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(250, 248, 243, 0.84), rgba(250, 248, 243, 0.96)),
    url("data:image/svg+xml,%3Csvg width='1200' height='800' viewBox='0 0 1200 800' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1200' height='800' fill='%23e8e1d6'/%3E%3Cpath d='M0 612c164-86 270-116 430-86 133 25 213 91 362 79 129-11 211-74 408-66v261H0z' fill='%23d9ebe4'/%3E%3Cpath d='M172 170h278v392H172z' rx='10' fill='%23ffffff' opacity='.74'/%3E%3Cpath d='M522 120h416v516H522z' rx='10' fill='%23ffffff' opacity='.62'/%3E%3Ccircle cx='323' cy='292' r='76' fill='%23c7902f' opacity='.42'/%3E%3Cpath d='M610 246h240v26H610zm0 70h196v26H610zm0 70h268v26H610z' fill='%2322201d' opacity='.16'/%3E%3C/svg%3E");
  background-position: center;
  background-size: cover;
}

.auth-panel {
  display: grid;
  width: min(100%, 460px);
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  padding: 24px;
  box-shadow: var(--shadow);
}

.auth-brand {
  padding-bottom: 4px;
}

.auth-form,
.oauth-stack {
  display: grid;
  gap: 12px;
}

.auth-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 3px;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--coral);
  font-size: 0.88rem;
  font-weight: 700;
}

.oauth-stack {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.oauth-button {
  width: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  background: #f3efe7;
  padding: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
  border-radius: 8px;
}

.brand h1,
.brand p,
.project-header h2,
.project-header p,
.section-heading h3,
.photo-card h4,
.photo-card p,
.status-strip p {
  margin: 0;
}

.brand h1 {
  font-size: 1.1rem;
}

.brand p,
.account-card p,
.subtle,
.status-strip p,
.photo-card p {
  color: var(--muted);
}

.account-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 13px;
}

.account-card strong,
.account-card p {
  display: block;
  margin: 0;
}

.account-card strong {
  margin-top: 4px;
}

.account-card p {
  overflow-wrap: anywhere;
  font-size: 0.84rem;
}

.project-form,
.photo-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #4f4942;
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 11px 12px;
  min-height: 44px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(31, 122, 114, 0.26);
  outline-offset: 2px;
}

.primary-action,
.secondary-action,
.danger-action,
.file-action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-action {
  background: var(--accent);
  color: #fff;
}

.primary-action:hover {
  background: var(--accent-dark);
}

.secondary-action,
.file-action {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.danger-action {
  border-color: rgba(189, 89, 72, 0.35);
  background: #fff7f5;
  color: #9c3f31;
}

.file-action input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.project-list-header,
.section-heading,
.header-actions,
.capture-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-list-header,
.section-heading {
  justify-content: space-between;
}

.project-list-header {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
}

.compact-action {
  min-height: 36px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.project-list {
  display: grid;
  gap: 10px;
  overflow: auto;
}

.project-button {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 13px;
  text-align: left;
}

.project-button.active,
.project-button:hover {
  border-color: rgba(31, 122, 114, 0.38);
  background: var(--panel);
}

.project-button-title {
  font-weight: 850;
}

.project-button-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.empty-state {
  display: grid;
  min-height: calc(100vh - 56px);
  align-items: center;
  background:
    linear-gradient(rgba(250, 248, 243, 0.76), rgba(250, 248, 243, 0.94)),
    url("data:image/svg+xml,%3Csvg width='1200' height='800' viewBox='0 0 1200 800' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1200' height='800' fill='%23e5ddd0'/%3E%3Cpath d='M80 620c180-120 280-90 430-180 120-72 140-170 320-210 120-26 220 2 290 44v526H80z' fill='%23d7e7df'/%3E%3Ccircle cx='865' cy='244' r='112' fill='%23d7a24a' opacity='.55'/%3E%3Cpath d='M214 237c84-74 210-92 312-40 86 44 143 128 150 224 9 122-68 246-184 294-93 38-206 20-291-41-101-73-154-210-121-324 15-51 47-88 134-113z' fill='%23ffffff' opacity='.75'/%3E%3Cpath d='M296 296c32-31 90-50 148-35 74 19 118 82 115 150-4 82-73 148-155 148-87 0-156-72-151-158 3-42 18-77 43-105z' fill='%2322201d' opacity='.12'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  padding: 48px;
}

.empty-state h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 5.2rem);
  line-height: 0.98;
}

.empty-state p:last-child {
  max-width: 610px;
  color: #514c45;
  font-size: 1.08rem;
  line-height: 1.6;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.project-view {
  display: grid;
  gap: 22px;
}

.hidden {
  display: none !important;
}

.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.project-header h2 {
  font-size: clamp(1.8rem, 3vw, 3.6rem);
  line-height: 1;
}

#invite-status {
  margin-top: 6px;
  font-weight: 700;
}

.capture-panel {
  display: grid;
  grid-template-columns: minmax(280px, 520px) minmax(280px, 1fr);
  gap: 18px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow);
}

.camera-wrap {
  position: relative;
  overflow: hidden;
  min-height: 320px;
  border-radius: 8px;
  background: #1f2524;
}

video,
.camera-placeholder,
.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 800;
}

.photo-form {
  align-content: center;
}

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

.capture-actions {
  flex-wrap: wrap;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.status-strip div {
  padding: 18px;
}

.status-strip div + div {
  border-left: 1px solid var(--line);
}

.status-strip span {
  display: block;
  font-size: 2rem;
  font-weight: 900;
}

.gallery-section {
  display: grid;
  gap: 14px;
}

.section-heading h3 {
  font-size: 1.25rem;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 3px;
}

.filter-button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 800;
}

.filter-button.active {
  background: var(--wash);
  color: var(--accent-dark);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.photo-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.photo-card img {
  display: block;
  aspect-ratio: 4 / 5;
  height: auto;
  background: #eee8df;
}

.photo-card-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
}

.photo-card h4 {
  font-size: 1rem;
}

.painted-toggle {
  display: flex;
  grid-template-columns: auto;
  align-items: center;
  white-space: nowrap;
}

.painted-toggle input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.remove-photo {
  position: absolute;
  top: 9px;
  right: 9px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  background: rgba(34, 32, 29, 0.66);
  color: #fff;
  font-size: 1.25rem;
}

.is-painted img {
  filter: saturate(0.55);
}

.is-painted::after {
  position: absolute;
  top: 10px;
  left: 10px;
  content: "Painted";
  border-radius: 8px;
  background: var(--gold);
  color: #1d1606;
  padding: 7px 9px;
  font-size: 0.78rem;
  font-weight: 900;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .project-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .capture-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .sidebar,
  .workspace {
    padding: 16px;
  }

  .empty-state {
    min-height: 520px;
    padding: 24px;
  }

  .project-header,
  .header-actions,
  .capture-actions,
  .field-grid,
  .photo-card-body {
    display: grid;
    grid-template-columns: 1fr;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .status-strip div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .segmented-control {
    width: 100%;
  }
}
