/* Goober Pics — one stylesheet, no framework. */

:root {
  --brand: #0b63ce;
  --brand-ink: #ffffff;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --ink: #16202c;
  --ink-soft: #5b6b7c;
  --line: #dde3ea;
  --ok: #17794a;
  --ok-bg: #e7f5ee;
  --warn: #8a5a00;
  --warn-bg: #fdf3e0;
  --err: #b3261e;
  --err-bg: #fdecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 6px 20px rgba(16, 32, 48, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161c;
    --surface: #1a212a;
    --ink: #e8edf3;
    --ink-soft: #9aa8b7;
    --line: #2b3542;
    --ok: #6ee7a8;
    --ok-bg: #143026;
    --warn: #f0c469;
    --warn-bg: #33280f;
    --err: #ff9c92;
    --err-bg: #3a1a17;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

h1 { font-size: 1.4rem; margin: 0 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; letter-spacing: -.01em; }
p { margin: 0 0 .8rem; }
a { color: var(--brand); }

.wrap { max-width: 44rem; margin: 0 auto; padding: 0 1rem; }
.muted { color: var(--ink-soft); }
.small { font-size: .86rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ topbar */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: .7rem 0;
  padding-top: calc(.7rem + env(safe-area-inset-top));
  position: sticky; top: 0; z-index: 20;
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.topbar-title { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.topbar-title strong { display: block; line-height: 1.2; }
.topbar-sub { display: block; font-size: .82rem; color: var(--ink-soft); }
.logo {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: none;
  border-radius: 11px; background: var(--brand); color: var(--brand-ink);
}
.net-badge {
  font-size: .78rem; font-weight: 600; padding: .25rem .55rem;
  border-radius: 99px; background: var(--warn-bg); color: var(--warn); flex: none;
}

/* ------------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
  margin: 1rem 0;
}
.notice { margin-top: 3rem; }
.instructions p { margin: 0; white-space: pre-line; }

/* ------------------------------------------------------------------ inputs */

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: .8rem 1.1rem;
  font: inherit; font-weight: 600;
  cursor: pointer;
  min-height: 48px;           /* comfortable thumb target */
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, black); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-soft); }
.btn-block { display: block; width: 100%; }
.btn-small { min-height: 36px; padding: .4rem .7rem; font-size: .85rem; font-weight: 500; }
.btn[disabled] { opacity: .55; cursor: default; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .9rem; }
@media (max-width: 380px) { .actions { grid-template-columns: 1fr; } }

.field { margin: .7rem 0; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .25rem; }
input[type="text"], textarea {
  width: 100%; padding: .7rem .8rem;
  font: inherit; color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px;
}
input[type="text"]:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
textarea { resize: vertical; }

.details { margin-top: .9rem; border-top: 1px solid var(--line); padding-top: .7rem; }
.details summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.switch { display: flex; gap: .55rem; align-items: flex-start; font-size: .88rem; margin-top: .5rem; }
.switch input { margin-top: .25rem; width: 18px; height: 18px; flex: none; accent-color: var(--brand); }

/* -------------------------------------------------------------- PIN screen */

.gate { margin-top: 2rem; }
.pin-input {
  width: 100%; text-align: center;
  font-size: 2rem; letter-spacing: .5em; text-indent: .5em;
  padding: .7rem; margin: .8rem 0;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--ink);
}
.error { color: var(--err); background: var(--err-bg); padding: .6rem .7rem; border-radius: 9px; font-size: .9rem; }

/* -------------------------------------------------------------- drop zone */

.dropzone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 1.6rem 1rem;
  text-align: center;
  color: var(--ink-soft);
  transition: border-color .15s ease, background .15s ease;
}
.dropzone.hot { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, transparent); color: var(--ink); }
.dz-title { font-weight: 600; color: var(--ink); margin: .5rem 0 .1rem; }
.dropzone p { margin: 0; }
@media (pointer: coarse) { .dropzone { display: none; } }

/* ------------------------------------------------------------------- queue */

.queue-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.progress-all { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin: .5rem 0 .4rem; }
.progress-all-bar { height: 100%; width: 0; background: var(--brand); transition: width .25s ease; }

.queue { list-style: none; margin: .7rem 0 0; padding: 0; }
.queue li {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: .7rem; align-items: center;
  padding: .55rem 0; border-top: 1px solid var(--line);
}
.queue li:first-child { border-top: 0; }
.q-thumb {
  width: 44px; height: 44px; border-radius: 8px; object-fit: cover;
  background: var(--bg); border: 1px solid var(--line);
}
.q-body { min-width: 0; }
.q-name {
  display: block; font-size: .9rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.q-meta { font-size: .78rem; color: var(--ink-soft); }
.q-bar { height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: .3rem; }
.q-bar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s ease; }
.q-status { font-size: .78rem; font-weight: 600; white-space: nowrap; }
.q-status.ok { color: var(--ok); }
.q-status.err { color: var(--err); }
.q-status.wait { color: var(--ink-soft); }
.q-retry { font-size: .78rem; background: none; border: 0; color: var(--brand); cursor: pointer; padding: .2rem; text-decoration: underline; }

/* Video in the client's queue: a play mark beats an empty grey square while
   the poster frame is still being grabbed. */
.q-thumb-video {
  display: grid; place-items: center;
  color: var(--ink-soft); font-size: 1rem;
}

.count {
  font-size: .78rem; font-weight: 600; background: var(--bg); color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 99px; padding: .1rem .5rem; vertical-align: middle;
}

.sent-list { list-style: none; margin: 0; padding: 0; max-height: 15rem; overflow-y: auto; }
.sent-list li {
  display: flex; justify-content: space-between; gap: .7rem;
  padding: .4rem 0; border-top: 1px solid var(--line); font-size: .88rem;
}
.sent-list li:first-child { border-top: 0; }
.sent-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.done-card { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: var(--ok-bg); }
.done-card h2 { color: var(--ok); }

.ios-steps { margin: .5rem 0 .8rem 1.1rem; padding: 0; font-size: .9rem; color: var(--ink-soft); }
.ios-steps li { margin: .3rem 0; }

.footer { padding: 1.5rem 1rem 2.5rem; text-align: center; }

/* ------------------------------------------------------------------- admin */

body.admin { background: var(--bg); }
.admin-bar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: .8rem 0; margin-bottom: 1rem;
}
.admin-bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.admin-bar strong { font-size: 1rem; }
.admin-bar nav { display: flex; gap: .9rem; font-size: .9rem; }
.wrap-wide { max-width: 66rem; margin: 0 auto; padding: 0 1rem; }

table.grid { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.grid th, table.grid td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
table.grid tr:last-child td { border-bottom: 0; }

.pill { display: inline-block; font-size: .74rem; font-weight: 600; padding: .15rem .5rem; border-radius: 99px; }
.pill-open { background: var(--ok-bg); color: var(--ok); }
.pill-closed { background: var(--bg); color: var(--ink-soft); border: 1px solid var(--line); }
.pill-err { background: var(--err-bg); color: var(--err); }
.pill-pending { background: var(--warn-bg); color: var(--warn); }

.banner { padding: .75rem .9rem; border-radius: 10px; margin: 0 0 1rem; font-size: .92rem; }
.banner-ok { background: var(--ok-bg); color: var(--ok); }
.banner-err { background: var(--err-bg); color: var(--err); }
.banner-warn { background: var(--warn-bg); color: var(--warn); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .7rem; margin-top: .8rem; }
/* margin:0 matters — a figure carries a 40px side margin by default, which
   would otherwise eat most of each grid cell. */
.shot { position: relative; margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.shot img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.shot .no-preview {
  display: grid; place-items: center; aspect-ratio: 1;
  font-size: .75rem; color: var(--ink-soft); text-align: center; padding: .5rem; word-break: break-word;
}
.shot figcaption { padding: .4rem .5rem; font-size: .72rem; color: var(--ink-soft); }
.shot .shot-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.shot form { position: absolute; top: .3rem; right: .3rem; }

/* Video tiles: a play badge over the poster frame, and the running time in
   the corner, so a gallery of stills and clips is readable at a glance. */
.shot a { position: relative; display: block; }
.shot .play {
  position: absolute; inset: 0; margin: auto;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); color: #fff;
  font-size: .85rem; padding-left: 3px;
  pointer-events: none;
}
.shot .play-big { font-size: 1.5rem; color: var(--ink-soft); }
.shot .duration {
  position: absolute; bottom: 2.6rem; right: .3rem;
  background: rgba(0, 0, 0, .7); color: #fff;
  font-size: .7rem; font-weight: 600;
  padding: .1rem .35rem; border-radius: 4px;
}
.shot .del {
  background: rgba(0, 0, 0, .6); color: #fff; border: 0; border-radius: 6px;
  width: 26px; height: 26px; cursor: pointer; font-size: .9rem; line-height: 1;
}

.copy-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.copy-row code {
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
  padding: .25rem .45rem; font-size: .82rem; word-break: break-all;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .3rem 1rem; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.hint { font-size: .8rem; color: var(--ink-soft); margin: .15rem 0 0; }
