:root {
  --bg: #111418;
  --bg-elevated: #1a1e24;
  --bg-elevated-2: #21262e;
  --ink: #f3f4f6;
  --muted: #9aa1ac;
  --border: #2c313a;
  --accent: #ff7a1a;
  --accent-ink: #14110a;
  --accent-2: #ffd21a;
  --danger: #ff5a5f;
  --danger-ink: #2b0a0a;
  --notice: #16301f;
  --notice-ink: #6ee7a0;
  --error: #341113;
  --error-ink: #ff9a9d;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Immediate feedback on link/form-submit clicks — see public/js/app.js
   for why: a slow first response (e.g. a sleeping free-tier host waking
   up) should never look like the tap did nothing. */
body.is-navigating { cursor: wait; }
.is-loading { opacity: 0.55; position: relative; }
.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -22px;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: app-spin 0.6s linear infinite;
}
.btn.is-loading::after { right: 12px; }
@keyframes app-spin { to { transform: rotate(360deg); } }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: 0;
}

body.has-tabbar { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-elevated);
  border-bottom: 2px solid var(--border);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topbar .brand .brand-icon { width: 28px; height: auto; flex-shrink: 0; }

.brand-word, .tagline, .yogor-badge {
  font-family: "Big Shoulders Stencil", "Segoe UI", Arial, sans-serif;
  font-weight: 800;
}

.topbar .status-pill {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-elevated-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.topbar .status-pill.verified { color: #14110a; background: var(--accent-2); border-color: var(--accent-2); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.feedback-link {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-decoration: none;
}
.feedback-link:hover { color: var(--accent); }

/* ---- Bottom tab bar ---- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: var(--bg-elevated);
  border-top: 2px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}

.tabbar a, .tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 4px 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.tabbar svg { width: 24px; height: 24px; }

.tabbar a.active { color: var(--accent); }

/* ---- Layout ---- */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px 32px;
}

.container.narrow { max-width: 440px; }

.card {
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.hero { padding: 12px 0 20px; text-align: center; }
.hero .hero-logo { width: 150px; height: auto; margin-bottom: 10px; }
.hero .tagline {
  font-size: 1.7rem;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0 0 12px;
}
.hero p { color: var(--muted); font-size: 0.95rem; }

.yogor-badge {
  display: inline-block;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  padding: 3px 12px;
  border-radius: 4px;
  transform: rotate(-3deg);
  margin: 0 0 14px;
}

.cta-row { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

h1 { font-size: 1.2rem; margin-top: 0; font-weight: 800; }
h2 { font-size: 1rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---- Forms ---- */
form label {
  display: block;
  margin-bottom: 16px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="tel"],
form input[type="date"],
form select,
form textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 13px 14px;
  font-size: 1rem;
  min-height: 48px;
  background: var(--bg-elevated-2);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--ink);
  font-family: inherit;
}

form input:focus, form select:focus, form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.field-row { display: flex; gap: 10px; }
.field-row label { flex: 1; }
.field-row .field-state { flex: 0 0 90px; }

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 400;
  text-transform: none;
  font-size: 0.9rem;
  color: var(--ink);
}
.checkbox-label input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  padding: 12px 18px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg-elevated-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  text-decoration: underline;
  font-family: inherit;
}

.inline-form { display: inline-block; margin-right: 8px; margin-top: 8px; }
.inline-form .btn { width: auto; }

.banner {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 600;
}
.banner-error { background: var(--error); color: var(--error-ink); border: 1px solid var(--danger); }
.banner-notice { background: var(--notice); color: var(--notice-ink); border: 1px solid #22c55e; }

.testing-banner {
  background: var(--accent-2);
  color: #2b1d00;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ---- Search ---- */
.search-form { display: flex; gap: 8px; margin-bottom: 18px; }
.search-input-wrap { position: relative; flex: 1; }
.search-form svg {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--muted);
  pointer-events: none;
}
.search-form input { width: 100%; padding: 13px 44px 13px 14px; min-height: 50px; border-radius: 10px; border: 2px solid var(--border); background: var(--bg-elevated-2); color: var(--ink); font-size: 1rem; }
.search-form .btn { width: auto; padding: 0 20px; }

.report-list { list-style: none; padding: 0; margin: 0; }
.report-item {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--bg-elevated);
}
.report-item a { text-decoration: none; color: var(--ink); display: block; }
.report-item .report-name { font-size: 1.05rem; font-weight: 800; }
.report-item.status-disputed { border-left: 5px solid var(--accent-2); }
.report-item.status-removed { opacity: 0.5; }

.tag {
  display: inline-block;
  background: var(--bg-elevated-2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: 6px;
}
.tag-disputed { background: var(--accent-2); color: #2b1d00; border-color: var(--accent-2); }

.dispute {
  border-top: 2px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
}

/* ---- Rating toggle (report-new) ---- */
.rating-block { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.rating-block input[type="radio"] { display: none; }
.rating-btn {
  flex: 1 1 auto;
  min-width: 130px;
  text-align: center;
  padding: 16px 10px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated-2);
  color: var(--ink);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 0.9rem;
  cursor: pointer;
  margin: 0;
}
#rating-bad:checked ~ .rating-btn-bad { border-color: var(--danger); background: rgba(255, 90, 95, 0.16); color: var(--danger); }
#rating-good:checked ~ .rating-btn-good { border-color: #22c55e; background: rgba(34, 197, 94, 0.16); color: #4ade80; }

.reasons-bad, .reasons-good { display: none; flex-basis: 100%; margin-top: 6px; }
#rating-bad:checked ~ .reasons-bad { display: block; }
#rating-good:checked ~ .reasons-good { display: block; }

/* ---- Category picker (report-new) ---- */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.category-option { position: relative; }
.category-option input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.category-option .category-label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 64px;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated-2);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: none;
}
.category-option input:checked + .category-label {
  border-color: var(--accent);
  background: rgba(255, 122, 26, 0.18);
  color: var(--accent);
}
.category-option input:focus-visible + .category-label { outline: 2px solid var(--accent); }

/* ---- Table (admin) ---- */
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.03em; }

@media (max-width: 480px) {
  .container { padding: 14px 12px 24px; }
}

/* ---- Desktop / larger screens ----
   Mobile-first chrome (fixed bottom tab bar, narrow single column) reads as
   broken on a laptop — a full-width bar with 3 icons spread across 1400px
   looks stretched and disconnected from the content above it. Above this
   breakpoint, the tab bar drops out of fixed positioning and becomes a
   contained bar directly under the header instead (it's already placed
   right after the header in the HTML, so this is a pure CSS repositioning,
   not a different page). */
@media (min-width: 900px) {
  body.has-tabbar { padding-bottom: 0; }

  .container { max-width: 960px; }
  .container.narrow { max-width: 480px; }

  .topbar, .tabbar { padding-left: 32px; padding-right: 32px; }

  .tabbar {
    position: static;
    max-width: 960px;
    margin: 0 auto;
    border-top: none;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
    justify-content: flex-start;
    gap: 4px;
  }

  .tabbar a, .tabbar button {
    flex: none;
    flex-direction: row;
    gap: 8px;
    padding: 14px 18px;
    font-size: 0.8rem;
  }

  .tabbar svg { width: 20px; height: 20px; }

  .category-grid { grid-template-columns: repeat(3, 1fr); }

  .card { padding: 28px; }

  .hero { padding: 40px 0 32px; }
  .hero .hero-logo { width: 210px; height: auto; }
  .hero .tagline { font-size: 2.6rem; }
  .hero p { font-size: 1.05rem; max-width: 480px; margin: 0 auto; }
  .cta-row { flex-direction: row; justify-content: center; max-width: 420px; margin-left: auto; margin-right: auto; }
}

/* ---- Help / site-tour modal ---- */
.help-trigger {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  background: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.help-trigger:hover { border-color: var(--accent); color: var(--accent); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  padding: 0;
}
.modal-overlay[hidden] { display: none; }

.modal {
  position: relative;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-elevated-2);
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.help-sections section { margin-bottom: 16px; }
.help-sections h3 { margin: 0 0 4px; font-size: 0.95rem; }
.help-sections p { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.4; }

@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: 16px; }
}

/* ---- Field-level help ("?" popovers on form labels) ---- */
form .label-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }

.field-help {
  position: relative;
  display: inline-flex;
}
.field-help-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--muted);
  background: none;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-transform: none;
  letter-spacing: normal;
}
.field-help-btn:hover, .field-help-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }

.field-help-tip {
  position: absolute;
  z-index: 50;
  top: 26px;
  left: 0;
  width: max-content;
  max-width: 260px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.78rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.field-help-tip[hidden] { display: none; }

/* ---- Legal pages (terms / privacy / guidelines) ---- */
.legal-page h1 { margin-bottom: 4px; }
.legal-page h2 {
  margin: 22px 0 8px;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.95rem;
  color: var(--ink);
}
.legal-page h2:first-of-type { margin-top: 18px; }
.legal-page p { line-height: 1.5; color: var(--ink); margin: 0 0 10px; }
.legal-page ul { margin: 0 0 12px; padding-left: 20px; line-height: 1.5; }
.legal-page li { margin-bottom: 6px; }
.legal-page a { color: var(--accent); }
.legal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: center;
  padding: 18px 16px 28px;
  font-size: 0.8rem;
}
.legal-footer a { color: var(--muted); }
.legal-footer a:hover { color: var(--accent); }
