/* Builder view. The context is the design brief: one hand, outdoors, gloves,
   bad light. Every choice below answers it:
   - near-black background, near-white text, ~14:1 body contrast — readable at
     dusk and in glare, doesn't torch night vision, kind to AMOLED batteries
   - hi-vis amber for the one primary action per screen — the site-safety colour,
     ~10:1 against the background with black text on it
   - every target ≥56px tall and most are full-width — glove-sized
   - primary actions live at the bottom of the flow, in thumb reach
   - typing is optional everywhere: photo + stage chips make a complete update */

:root {
  --bg: #0B0D0F;
  --surface: #16191D;
  --raised: #1E2227;
  --line: #2A2F36;
  --text: #F5F7F9;
  --muted: #9BA6B0;
  --amber: #FFB020;
  --amber-press: #E69C0E;
  --on-amber: #14100A;
  --danger: #FF5A48;
  --ok: #35C766;
  --focus: #7ED0FF;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

#app { max-width: 560px; margin: 0 auto; padding: 0 14px 40px; }
.loading, .noscript { text-align: center; color: var(--muted); padding: 48px 16px; }

h1 { font-size: 1.3rem; line-height: 1.25; margin: 18px 0 2px; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin: 0 0 16px; font-size: 0.95rem; }

.demo-banner {
  background: #2A2410; color: #FFD97A; border: 1px solid #4A3F14;
  padding: 12px 14px; border-radius: 10px; margin: 14px 0 0;
  font-weight: 600; font-size: 0.95rem;
}

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin-top: 16px;
}
.card h2 { margin: 0 0 10px; font-size: 1.02rem; color: var(--muted); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

/* Buttons — glove-sized */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 60px;
  border: 0; border-radius: 12px; cursor: pointer;
  font: 700 1.15rem/1.2 inherit; font-family: inherit;
  padding: 12px 18px;
  color: var(--text); background: var(--raised, #1E2227);
}
.btn-primary { background: var(--amber); color: var(--on-amber); }
.btn-primary:active { background: var(--amber-press); }
.btn-quiet { background: transparent; border: 2px solid var(--line); min-height: 56px; font-size: 1rem; }
.btn-danger-armed { background: var(--danger); color: #1A0805; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn + .btn { margin-top: 10px; }

/* Share card */
.share-link {
  display: block; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; font-family: ui-monospace, Consolas, monospace; font-size: 0.95rem;
  word-break: break-all; color: var(--text); margin-bottom: 12px;
}
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-note { color: var(--muted); font-size: 0.88rem; margin: 10px 0 0; }

/* Composer */
.photo-pick {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 96px; border: 2px dashed var(--line); border-radius: 12px;
  background: var(--bg); color: var(--text); font-weight: 700; font-size: 1.1rem;
  cursor: pointer; width: 100%;
}
.photo-pick:active { border-color: var(--amber); }
.photo-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photo-preview { position: relative; margin-top: 10px; }
.photo-preview img { width: 100%; border-radius: 10px; }
.photo-preview .photo-kb {
  position: absolute; bottom: 10px; left: 10px;
  background: rgba(11, 13, 15, 0.8); color: var(--ok);
  font-weight: 700; font-size: 0.85rem; padding: 4px 10px; border-radius: 6px;
}
.photo-remove {
  position: absolute; top: 10px; right: 10px;
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(11, 13, 15, 0.8); color: var(--text); font-size: 22px;
}

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 6px; margin-top: 12px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: none; min-height: 52px; padding: 10px 18px;
  border-radius: 999px; border: 2px solid var(--line);
  background: var(--bg); color: var(--text); font: 600 1rem/1.2 inherit; font-family: inherit;
  cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); color: var(--on-amber); font-weight: 800; }

textarea.note {
  width: 100%; margin-top: 12px; min-height: 76px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  font: inherit; padding: 12px; resize: vertical;
}
textarea.note::placeholder { color: #5E6973; }

.compose-status { margin: 10px 0 0; font-weight: 600; min-height: 1.4em; }
.compose-status.err { color: var(--danger); }
.compose-status.ok { color: var(--ok); }

/* Updates list */
.u-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.u-item { display: grid; grid-template-columns: 84px 1fr auto; gap: 12px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.u-item img { width: 84px; height: 63px; object-fit: cover; border-radius: 6px; }
.u-thumb-none { width: 84px; height: 63px; border-radius: 6px; background: var(--surface); display: grid; place-items: center; color: var(--muted); font-size: 0.75rem; }
.u-body { min-width: 0; }
.u-text { margin: 0; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.u-meta { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.u-del {
  min-width: 56px; min-height: 56px; border-radius: 10px; border: 2px solid var(--line);
  background: transparent; color: var(--muted); font: 600 0.85rem/1.1 inherit; font-family: inherit; cursor: pointer;
}
.u-del.armed { background: var(--danger); border-color: var(--danger); color: #1A0805; font-weight: 800; }
.u-empty { color: var(--muted); text-align: center; padding: 12px 0; }

/* Details editor */
details.editor summary {
  list-style: none; cursor: pointer; min-height: 56px; display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 1.02rem;
}
details.editor summary::after { content: "▾"; color: var(--muted); }
details[open].editor summary::after { content: "▴"; }
.field { margin-top: 12px; }
.field label { display: block; font-weight: 600; font-size: 0.92rem; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; min-height: 56px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  font: inherit; padding: 12px;
}
.stage-edit-row { display: grid; grid-template-columns: 1fr 56px; gap: 8px; margin-top: 8px; }
.stage-edit-row input { min-height: 52px; }
.stage-del { border: 2px solid var(--line); background: transparent; color: var(--muted); border-radius: 10px; cursor: pointer; font-size: 1.2rem; }

.page-error { text-align: center; padding: 64px 16px; }
.page-error h1 { font-size: 1.3rem; }
.page-error p { color: var(--muted); }

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