@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Permanent+Marker&family=Inter:wght@400;600;700;800&display=swap');

:root {
  --bg: #0e0c10;
  --bg-2: #17121a;
  --surface: #1b171f;
  --surface-2: #232028;
  --ink: #f4f0ea;
  --ink-dim: #b6acb4;
  --muted: #7c7280;
  --accent: #ff2d4d;
  --accent-ink: #1a0509;
  --accent-2: #34d399;
  --accent-3: #ffcf3d;
  --line: #37323b;
  --shadow-hard: 6px 6px 0 rgba(0, 0, 0, 0.55);
  --shadow-hard-sm: 4px 4px 0 rgba(0, 0, 0, 0.55);
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: radial-gradient(120% 90% at 15% 0%, #221a24 0%, var(--bg) 55%), var(--bg);
  min-height: 100vh;
  padding: 0 16px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wrap { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 16px; }

/* ---- checkerboard strip, Vans tape style ---- */
.checker {
  height: 12px;
  width: 100%;
  background-image: repeating-conic-gradient(#0a0a0c 0% 25%, #f4f0ea 0% 50%);
  background-size: 16px 16px;
  border-radius: 3px;
  flex: 0 0 auto;
}
.checker.top { margin: 0 -16px; width: calc(100% + 32px); border-radius: 0; }

header.top {
  padding: 22px 0 4px;
  text-align: center;
}
header.top .eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
header.top h1 {
  margin: 6px 0 0;
  font-family: 'Archivo Black', 'Inter', sans-serif;
  font-size: 30px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  line-height: 1.05;
}
header.top h1 .hl {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 2px 8px;
  display: inline-block;
  transform: rotate(-1.5deg);
  box-shadow: var(--shadow-hard-sm);
}

.card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: 20px;
}

.message-card {
  text-align: center;
  padding: 30px 22px;
  position: relative;
  overflow: hidden;
}
.message-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 50% at 50% -10%, rgba(255, 45, 77, 0.14), transparent 70%);
  pointer-events: none;
}
.message-card .mood {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,0.4));
}
.message-card .date {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  margin-bottom: 12px;
}
.message-card p.text {
  font-size: 19px;
  line-height: 1.55;
  font-weight: 600;
  margin: 0;
  white-space: pre-wrap;
  position: relative;
}

.media-wrap {
  margin-top: 18px;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  line-height: 0;
  border: 2px solid var(--line);
}
.media-wrap img, .media-wrap video { width: 100%; max-height: 420px; object-fit: cover; display: block; }

.empty-state { text-align: center; color: var(--ink-dim); padding: 30px 10px; }
.empty-state .big-emoji { font-size: 36px; display: block; margin-bottom: 10px; }

.section-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin: 4px 2px 0;
}

.poll-card h3 { margin: 0 0 4px; font-size: 17px; font-weight: 800; }
.poll-card .hint { font-size: 13px; color: var(--muted); margin-bottom: 14px; }

.options { display: flex; flex-direction: column; gap: 10px; }

.option-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 2px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s ease, transform .08s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.option-btn:active { transform: translate(2px, 2px); }
.option-btn.chosen {
  border-color: var(--accent);
  box-shadow: var(--shadow-hard-sm);
  color: var(--accent);
}
.option-btn .label:last-child { color: var(--accent); font-weight: 900; }

.toggle-row { display: flex; gap: 10px; }
.toggle-row .option-btn { text-align: center; justify-content: center; }

.voted-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--accent-2);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.history-item { padding: 14px 16px; }
.history-item .date {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}
.history-item p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink-dim); }

details.history summary {
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-align: center;
  padding: 6px;
}
details.history summary::-webkit-details-marker { display: none; }
details.history[open] summary { margin-bottom: 4px; color: var(--ink); }
details.history .history-list { display: flex; flex-direction: column; gap: 10px; }

.install-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}
.install-banner .icon { font-size: 24px; }
.install-banner .txt { flex: 1; font-size: 13px; line-height: 1.4; color: var(--ink-dim); }
.install-banner .txt b { display: block; font-size: 13px; margin-bottom: 2px; color: var(--ink); text-transform: uppercase; letter-spacing: 0.04em; }
.install-banner button.close-x {
  border: none;
  background: none;
  color: var(--muted);
  padding: 4px 6px;
  font-size: 18px;
  cursor: pointer;
}
#install-btn { flex: 0 0 auto; width: auto; padding: 9px 14px; font-size: 12px; }

.push-banner { text-align: center; padding: 18px 16px; }
.push-banner p { margin: 0 0 12px; font-size: 13px; color: var(--ink-dim); line-height: 1.5; }

.btn-primary {
  border: 2px solid var(--ink);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 13px 18px;
  border-radius: 10px;
  font-weight: 900;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: var(--shadow-hard-sm);
  width: 100%;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn-primary:active { transform: translate(3px, 3px); box-shadow: 0 0 0 rgba(0,0,0,0); }

.btn-secondary {
  border: 2px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  padding: 11px 16px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  width: 100%;
}
.btn-secondary:hover { border-color: var(--ink-dim); }

.btn-danger {
  border: 2px solid var(--accent);
  background: var(--accent-ink);
  color: var(--accent);
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.btn-ghost {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 8px;
}

footer.tiny {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.6;
  padding: 6px 0 20px;
}

/* ---------- Admin ---------- */
body.admin { align-items: stretch; }
.admin .wrap { max-width: 560px; margin: 0 auto; }

.login-card { max-width: 360px; margin: 14vh auto 0; text-align: center; }
.login-card h1 { font-family: 'Archivo Black', sans-serif; font-size: 20px; margin-bottom: 4px; text-transform: uppercase; }
.login-card p { color: var(--muted); font-size: 13px; margin-top: 0; }

input[type="password"], input[type="text"], input[type="email"], textarea, select {
  width: 100%;
  border: 2px solid var(--line);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  margin-top: 6px;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }
label.field {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 16px;
}
label.field:first-child { margin-top: 0; }

.tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: 12px; border: 2px solid var(--line); }
.tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 6px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
}
.tabs button.active { background: var(--accent); color: var(--accent-ink); }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px 6px 12px;
  font-size: 13px;
  font-weight: 700;
}
.chip button { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; }

.status-msg {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px;
  border-radius: 10px;
  border: 2px solid;
}
.status-msg.ok { background: rgba(52, 211, 153, 0.1); color: var(--accent-2); border-color: var(--accent-2); }
.status-msg.err { background: rgba(255, 45, 77, 0.1); color: var(--accent); border-color: var(--accent); }

.entry-card { display: flex; flex-direction: column; gap: 8px; }
.entry-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.entry-card .body { font-size: 14px; line-height: 1.4; }

/* ---------- media upload ---------- */
.media-tabs { display: flex; gap: 6px; margin-top: 8px; }
.media-tabs button {
  flex: 1;
  border: 2px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  padding: 8px 6px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.media-tabs button.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.media-panel { margin-top: 10px; }

.upload-drop {
  display: block;
  width: 100%;
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 22px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.upload-drop:hover { border-color: var(--accent); color: var(--ink-dim); }
.upload-drop input[type="file"] { display: none; }

.media-preview {
  margin-top: 12px;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--line);
  background: #000;
  line-height: 0;
}
.media-preview img, .media-preview video { width: 100%; display: block; max-height: 260px; object-fit: contain; }
.media-preview .remove-media {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 2px solid var(--ink);
  background: var(--accent-ink);
  color: var(--ink);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.giphy-search-row { display: flex; gap: 8px; margin-top: 8px; }
.giphy-search-row input { margin-top: 0; }
.giphy-search-row button { flex: 0 0 auto; width: auto; padding: 0 16px; margin-top: 0; }

.giphy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 12px;
  max-height: 320px;
  overflow-y: auto;
}
.giphy-grid img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid var(--line);
  cursor: pointer;
  display: block;
}
.giphy-grid img:hover { border-color: var(--accent); }
.giphy-hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

.upload-progress {
  margin-top: 10px;
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.upload-progress .fill { height: 100%; background: var(--accent); width: 0%; transition: width .2s ease; }

@media (max-width: 360px) {
  .message-card p.text { font-size: 17px; }
  header.top h1 { font-size: 26px; }
}
