/* Coop Cam — calm, outdoorsy dark theme. Deep coop-green + warm cream + a
   single amber accent. Line-art only, no emoji. */

:root {
  --bg:      #16201b;
  --panel:   #1f2a24;
  --panel-2: #26322b;
  --line:    #33413a;
  --ink:     #eef2ec;
  --muted:   #9db0a5;
  --accent:  #e0a53d;
  --accent-ink: #221a08;
  --fail:    #c65a52;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

.muted { color: var(--muted); }
.center { text-align: center; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; font-size: .9em; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; padding-top: calc(14px + env(safe-area-inset-top));
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .2px; }
.brand-mark { color: var(--accent); }
.link-muted { color: var(--muted); text-decoration: none; font-size: .92rem; }
.link-muted:hover { color: var(--ink); }

.wrap { max-width: 720px; margin: 0 auto; padding: 18px; }

.statusline {
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 6px; margin-bottom: 14px; font-size: .95rem;
}

/* Pull to refresh */
.ptr {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; padding-top: calc(12px + env(safe-area-inset-top));
  z-index: 20; pointer-events: none; opacity: 0;
  color: var(--muted); font-size: .9rem;
  transform: translateY(calc(var(--pull, 0px) - 52px));
}
.ptr.ready { color: var(--accent); }
.ptr-icon { transition: transform .2s; }
.ptr.ready .ptr-icon { transform: rotate(-180deg); }
.ptr.active .ptr-icon { animation: ptrspin .9s linear infinite; }
@keyframes ptrspin { to { transform: rotate(360deg); } }

.hint { font-size: .85rem; margin: 16px 0 0; }

/* Camera grid */
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 620px) { .grid { grid-template-columns: 1fr 1fr; } }

.cam {
  margin: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.cam-tap { cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .08s; }
.cam-tap:active { transform: scale(.99); }
.cam-tap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cam-img { aspect-ratio: 16 / 9; background: #0f1512; }
.cam-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-fail {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; color: var(--fail);
}
.cam-fail small { color: var(--muted); font-size: .75rem; max-width: 80%; text-align: center; }
figcaption {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 12px; font-size: .92rem;
}
.cam-label { font-weight: 600; }

.empty {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 20px; text-align: center;
}
.empty p { margin: 6px 0; }

/* Actions */
.actions {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; justify-content: center;
}
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--accent);
  color: var(--accent-ink); font-weight: 650; font-size: .98rem;
  padding: 12px 18px; border-radius: 11px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px;
}
.btn:disabled { opacity: .65; cursor: default; }
.btn-ghost { background: transparent; color: var(--ink); }
#notify-status { margin-top: 14px; min-height: 1.2em; }

/* Login */
.login-body { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.login-card {
  width: 100%; max-width: 340px; text-align: center;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 34px 26px;
}
.login-card h1 { margin: 12px 0 4px; font-size: 1.5rem; }
.login-card form { margin-top: 18px; display: grid; gap: 10px; }
.login-card input {
  height: 48px; padding: 0 14px; font-size: 1rem;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 11px; color: var(--ink);
}
.login-card input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.login-card .btn, .login-card button {
  appearance: none; border: none; background: var(--accent); color: var(--accent-ink);
  font-weight: 650; font-size: 1rem; height: 48px; border-radius: 11px; cursor: pointer;
}
.error { color: var(--fail); font-size: .92rem; margin: 4px 0 0; }
