:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #1c2a3a;
  --muted: #51606f;
  --line: #d6d0c3;
  --accent: #9a3412;
  --accent-ink: #ffffff;
  --warn-bg: #fdecd8;
  --warn-line: #e8c79a;
  --danger: #9a3412;
  --focus: #1c2a3a;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1b212a;
    --ink: #edf0f3;
    --muted: #a9b4bf;
    --line: #333d48;
    --accent: #e08a5b;
    --accent-ink: #14181d;
    --warn-bg: #3a2a16;
    --warn-line: #5a4527;
    --danger: #e08a5b;
    --focus: #edf0f3;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, "Segoe UI", system-ui, Roboto, sans-serif;
}

.page { max-width: 40rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

.site-header { margin-bottom: 1.5rem; }

.wordmark {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0 0 1rem;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: .12em;
}

.wordmark .kicker {
  font-weight: 500;
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: .6rem;
  border-left: 1px solid var(--line);
}

h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 0 0 .6rem;
  letter-spacing: -.01em;
}

.intro { margin: 0 0 1.25rem; color: var(--muted); }

.notice, .emergency {
  border-radius: var(--radius);
  padding: .9rem 1rem;
  margin: 0 0 1.25rem;
  border: 1px solid var(--line);
}

.notice { background: var(--surface); color: var(--muted); }

.emergency {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--ink);
  font-size: .95rem;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 1rem;
  padding: 1.1rem;
  min-width: 0;
}

fieldset:disabled { opacity: .6; }

legend {
  font-weight: 700;
  padding: 0 .4rem;
}

.contact-method {
  border: 0;
  padding: 0;
  margin: .5rem 0 0;
}

.contact-method legend {
  padding: 0;
  font-weight: 600;
  font-size: .9rem;
  color: var(--muted);
  margin-bottom: .4rem;
}

.contact-method label.radio {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 44px;
  margin: 0 1.25rem .25rem 0;
  color: var(--ink);
}

label {
  display: block;
  margin: 0 0 .9rem;
  font-weight: 600;
  font-size: .9rem;
  color: var(--muted);
}

.optional { font-weight: 400; }

input:not([type=radio]):not([type=file]),
textarea {
  display: block;
  width: 100%;
  margin-top: .35rem;
  padding: .65rem .7rem;
  min-height: 44px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

textarea { resize: vertical; min-height: 6rem; }

input:focus-visible,
textarea:focus-visible,
button:focus-visible,
.photo-picker:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

#items { list-style: none; padding: 0; margin: 0; }

.photo-field { margin: 1rem 0; }

.photo-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 3.25rem;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  margin: 0;
}

.photo-picker:hover { border-color: var(--accent); }

.photo-picker-icon {
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid currentColor;
  border-radius: 4px;
  position: relative;
}

.photo-picker-icon::before,
.photo-picker-icon::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.photo-picker-icon::before { top: 45%; left: 20%; right: 20%; height: 2px; }
.photo-picker-icon::after { left: 45%; top: 20%; bottom: 20%; width: 2px; }

.photo-input {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.photo-count {
  margin: .5rem 0 0;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
}

.photo-note {
  margin: .35rem 0 0;
  font-size: .85rem;
  color: var(--danger);
  min-height: 1.1em;
}

.photos {
  list-style: none;
  margin: .75rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: .6rem;
}

.photo-thumb { display: flex; flex-direction: column; gap: .35rem; }

.photo-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
}

button {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: .55rem 1.1rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.btn-secondary { width: 100%; margin: 0 0 1rem; }

.remove-item { width: auto; margin: .25rem 0 0; }

.photo-remove {
  width: 100%;
  min-height: 32px;
  padding: .25rem .5rem;
  font-size: .8rem;
}

#send {
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  margin-top: .5rem;
}

#send:disabled { opacity: .65; cursor: default; }

.status {
  margin: .75rem 0 0;
  min-height: 1.3em;
  font-weight: 600;
  color: var(--danger);
}

.receipt {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.receipt h2 { margin: 0 0 .75rem; }

.receipt-ref {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--accent);
  margin: 0 0 .75rem;
}
.ref-code { white-space: nowrap; }

.receipt-count { margin: 0 0 1rem; }

.receipt-note { color: var(--muted); margin: 0; }

button, .photo-picker, fieldset, .status {
  transition: opacity .15s ease, border-color .15s ease;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 480px) {
  .wordmark .kicker { display: block; padding-left: 0; border-left: 0; margin-top: .15rem; }
}
