/* CAPTION THIS — mobile-first. Dark "evening newsroom" palette to match
   the Btown Games arcade vibe. */

* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #14212e;
  --panel: #1e3040;
  --panel-2: #253a4d;
  --ink: #f2ede2;
  --muted: #9db2c4;
  --accent: #ffb62e;      /* maple gold */
  --good: #45d483;
  --bad: #ff6b6b;
  --radius: 14px;
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

/* header */
#topbar {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 14px 16px 10px;
}
#logo { font-size: 22px; font-weight: 900; letter-spacing: 1px; }
#logo span { color: var(--accent); }
#week-chip { font-size: 12px; color: var(--muted); font-weight: 600; }

/* views */
#views { flex: 1; padding: 0 14px 18px; }
.view { animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
.hidden { display: none !important; }
.section-title { font-size: 17px; margin: 6px 2px 10px; }

.notice {
  text-align: center; color: var(--muted);
  padding: 38px 22px; line-height: 1.5; font-size: 15px;
}
.notice.mini { padding: 12px; font-size: 14px; color: var(--good); }
.notice .big { font-size: 42px; margin-bottom: 10px; }
.notice p { margin: 6px 0; }
.linkish {
  background: none; border: none; color: var(--accent);
  font: inherit; text-decoration: underline; cursor: pointer; padding: 0;
}

.phase-banner {
  background: var(--panel); color: var(--accent);
  border: 1px solid rgba(255, 182, 46, .35);
  font-size: 13px; font-weight: 700; text-align: center;
  padding: 8px 10px; border-radius: 999px; margin: 2px 0 12px;
}
.phase-banner.vote { color: var(--good); border-color: rgba(69, 212, 131, .35); }

.photo-frame {
  border-radius: var(--radius); overflow: hidden;
  background: var(--panel); box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.photo-frame img { width: 100%; display: block; max-height: 52vh; object-fit: contain; background: #0d151d; }
.photo-frame figcaption {
  font-size: 12px; color: var(--muted); padding: 7px 12px;
}

.deadline { font-size: 13px; color: var(--muted); text-align: center; margin: 10px 0 4px; }
.hint { font-size: 13px; color: var(--muted); text-align: center; margin: 10px 4px; line-height: 1.45; }

/* caption form */
#caption-form { margin-top: 10px; }
textarea, input[type="text"], #name-input {
  width: 100%; background: var(--panel); color: var(--ink);
  border: 1px solid #35506a; border-radius: var(--radius);
  padding: 12px 14px; font: inherit; font-size: 16px; resize: none;
}
textarea:focus, input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.form-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; gap: 10px;
}
#caption-chars { font-size: 13px; color: var(--muted); min-width: 34px; }

.btn {
  border: none; border-radius: 999px; font-weight: 800; font-size: 15px;
  padding: 12px 22px; cursor: pointer; touch-action: manipulation;
}
.btn.primary { background: var(--accent); color: #23180a; }
.btn.primary:disabled { opacity: .45; cursor: default; }
.btn:active { transform: scale(.97); }

/* ---------------- swipe deck ---------------- */
#deck-wrap { position: relative; }
#deck {
  position: relative; height: min(58vh, 460px);
  touch-action: pan-x;
}
.card {
  position: absolute; inset: 0;
  border-radius: var(--radius); overflow: hidden;
  background: #0d151d center/cover no-repeat;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
  user-select: none; -webkit-user-select: none;
  will-change: transform;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.card.top { cursor: grab; }
.card.dragging { transition: none !important; cursor: grabbing; }
.card .card-caption {
  background: linear-gradient(transparent, rgba(6, 10, 14, .92) 34%);
  padding: 56px 16px 16px;
}
.card .card-text {
  font-size: 20px; font-weight: 800; line-height: 1.3;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .8);
}
.card .card-name { font-size: 13px; color: var(--muted); margin-top: 6px; }
.card .stamp {
  position: absolute; top: 18px; font-size: 30px; font-weight: 900;
  padding: 4px 14px; border: 4px solid; border-radius: 10px;
  opacity: 0; transform: rotate(-12deg); letter-spacing: 2px;
}
.card .stamp.yep { left: 14px; color: var(--good); border-color: var(--good); }
.card .stamp.nope { right: 14px; color: var(--bad); border-color: var(--bad); transform: rotate(12deg); }

#vote-controls {
  display: flex; justify-content: center; gap: 22px; margin: 16px 0 4px;
}
.swipe-btn {
  width: 62px; height: 62px; border-radius: 50%; border: none;
  font-size: 26px; cursor: pointer; touch-action: manipulation;
  background: var(--panel-2); box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
.swipe-btn.yep { background: rgba(69, 212, 131, .18); }
.swipe-btn.nope { background: rgba(255, 107, 107, .18); }
.swipe-btn.undo { width: 48px; height: 48px; font-size: 18px; align-self: center; }
.swipe-btn:disabled { opacity: .35; }
.swipe-btn:active { transform: scale(.92); }
#vote-progress { text-align: center; font-size: 14px; font-weight: 700; color: var(--accent); }

/* ---------------- results ---------------- */
#results-stats {
  text-align: center; font-size: 13px; color: var(--muted); margin: 10px 0 14px;
}
#results-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.result-row {
  background: var(--panel); border-radius: var(--radius);
  padding: 12px 14px; display: flex; gap: 12px; align-items: center;
}
.result-row .rank { font-size: 15px; font-weight: 900; color: var(--muted); min-width: 26px; text-align: center; }
.result-row .body { flex: 1; }
.result-row .text { font-size: 15px; font-weight: 600; line-height: 1.35; }
.result-row .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.result-row .net { font-weight: 900; font-size: 15px; color: var(--good); }
.result-row .net.neg { color: var(--bad); }
.result-row.winner {
  background: linear-gradient(135deg, #3c2f10, #2a3a24);
  border: 1px solid rgba(255, 182, 46, .5);
}
.result-row.winner .text { font-size: 17px; }
.winner-tag { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .5px; }

/* ---------------- submit a photo ---------------- */
#photo-drop {
  display: block; background: var(--panel); border: 2px dashed #40607e;
  border-radius: var(--radius); text-align: center; cursor: pointer;
  margin: 12px 0; overflow: hidden;
}
#photo-drop input { display: none; }
#photo-drop-inner { padding: 44px 20px; color: var(--muted); }
#photo-drop-inner .big { font-size: 40px; margin-bottom: 8px; }
#photo-preview { width: 100%; display: block; max-height: 48vh; object-fit: contain; }
#photo-credit { margin: 4px 0 12px; }
#view-submit .btn { width: 100%; }
#photo-status { min-height: 20px; }
#photo-status.ok { color: var(--good); }
#photo-status.err { color: var(--bad); }

/* ---------------- tab bar / footer ---------------- */
#tabbar {
  display: flex; background: var(--panel);
  border-top: 1px solid #2c445a;
  position: sticky; bottom: 0; z-index: 5;
}
.tab {
  flex: 1; background: none; border: none; color: var(--muted);
  font-size: 12px; font-weight: 700; padding: 10px 4px 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  touch-action: manipulation;
}
.tab span { font-size: 20px; }
.tab.sel { color: var(--accent); }
#foot {
  text-align: center; font-size: 12px; color: var(--muted);
  padding: 12px 16px 16px; background: var(--panel);
}
#foot a { color: var(--accent); }

/* ---------------- modal & toast ---------------- */
.modal {
  position: fixed; inset: 0; background: rgba(5, 10, 15, .72);
  display: flex; align-items: center; justify-content: center; z-index: 20;
  padding: 24px;
}
.modal-card {
  background: var(--panel); border-radius: var(--radius);
  padding: 22px; width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 12px;
}
.modal-card h3 { font-size: 18px; }
#toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: #0d151d; color: var(--ink); border: 1px solid #35506a;
  padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 30;
  max-width: 90vw; text-align: center;
}

/* ---------------- admin ---------------- */
.admin #views { padding-top: 8px; }
.admin-section { margin-bottom: 22px; }
.admin-card {
  background: var(--panel); border-radius: var(--radius);
  padding: 12px; margin-bottom: 10px;
}
.admin-card img { width: 100%; border-radius: 8px; max-height: 40vh; object-fit: contain; background: #0d151d; }
.admin-card .meta { font-size: 13px; color: var(--muted); margin: 8px 2px; line-height: 1.4; }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-actions .btn { flex: 1; padding: 10px 8px; font-size: 14px; }
.btn.good { background: var(--good); color: #05240f; }
.btn.danger { background: var(--bad); color: #2a0505; }
.btn.ghost { background: var(--panel-2); color: var(--ink); }
.admin-caption-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
  font-size: 14px;
}
.admin-caption-row .body { flex: 1; }
.admin-caption-row .who { color: var(--muted); font-size: 12px; margin-top: 3px; }
.admin-caption-row button { flex-shrink: 0; }
.badge {
  display: inline-block; background: var(--bad); color: #fff;
  border-radius: 999px; font-size: 12px; font-weight: 800; padding: 2px 9px;
  margin-left: 6px;
}
