:root {
  --bg: #faf8f4;
  --card: #ffffff;
  --text: #1e1a14;
  --muted: #7a6f60;
  --border: #e8e0d0;
  --green: #2a8c4a;
  --yellow: #c98a00;
  --red: #c1381f;
  --dark: #1e1a14;
  --accent: #d4500a;
  --shadow-card: 0 4px 24px rgba(80,60,20,.09);
  --radius-card: 16px;
  --radius-btn: 10px;
  --radius-inner: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

/* ── TOPBAR ── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 1.75rem 2rem 1.5rem;
  background: #1e1a14;
  color: #f5efe4;
  border-bottom: 3px solid var(--accent);
}

.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .5rem;
  flex-shrink: 0;
}

.last-updated-header {
  font-family: sans-serif;
  font-size: .78rem;
  color: #a09070;
  margin: 0;
}

h1, h2, h3 { font-family: "Georgia", serif; margin-top: 0; line-height: 1.25; }

h1 {
  margin-bottom: .3rem;
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: -.02em;
  color: #f5efe4;
  font-weight: normal;
}

h2 { margin-bottom: .4rem; letter-spacing: -.01em; font-weight: normal; }
h3 { font-weight: normal; font-size: 1.05rem; }
p { margin-top: 0; }

.subtitle {
  margin-bottom: 0;
  color: #c4b89a;
  max-width: 560px;
  font-size: .92rem;
  font-family: sans-serif;
}

.eyebrow {
  margin-bottom: .3rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .68rem;
  font-weight: 700;
  font-family: sans-serif;
  color: var(--accent);
}

.topbar .eyebrow { color: #a09070; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.25rem;
}

/* ── NOTICE ── */
.notice {
  margin: 1rem 0;
  padding: .85rem 1.1rem;
  border-left: 4px solid var(--yellow);
  background: #fdf8ed;
  border-radius: 0 10px 10px 0;
  color: #4a3800;
  font-family: sans-serif;
  font-size: .88rem;
}

/* ── CARD ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.4rem;
  margin: 1rem 0;
  box-shadow: var(--shadow-card);
}

/* ── DIRECTION PICKER ── */
.direction-picker {
  margin: 1rem 0;
}

.picker-label {
  font-family: sans-serif;
  font-size: .88rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .6rem;
}

.direction-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

.dir-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .2rem;
  padding: 1.1rem 1.3rem;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius-card);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-card);
  transition: border-color .15s, background .15s;
}

.dir-card:hover {
  border-color: #c8bfae;
  background: #fdfaf6;
}

.dir-card.active {
  border-color: var(--accent);
  background: #fff8f4;
}

.dir-arrow {
  font-size: 1.6rem;
  line-height: 1;
  color: var(--accent);
  margin-bottom: .1rem;
}

.dir-card:not(.active) .dir-arrow {
  color: #a09070;
}

.dir-name {
  font-family: sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
}

.dir-name strong {
  font-weight: 700;
}

.dir-via {
  font-family: sans-serif;
  font-size: .78rem;
  color: var(--muted);
  margin-top: .1rem;
}

/* Override: app.js adds/removes .active on .tab, same elements */
.dir-card.tab { /* no extra styles needed, handled by .dir-card.active */ }

/* ── HERO STATUS ── */
.hero-status {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: #fdf8f2;
  border-left: 5px solid #c8bfae;
  transition: border-color .4s;
}

.hero-status-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c8bfae;
  flex-shrink: 0;
  transition: background .4s;
}

.hero-text { flex: 1; }

.hero-status h2 { font-size: 1.5rem; }

.hero-actions {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ── BUTTONS ── */
button, .secondary {
  border: 0;
  border-radius: var(--radius-btn);
  padding: .7rem 1.1rem;
  font-size: .9rem;
  font-weight: 700;
  font-family: sans-serif;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  transition: opacity .15s;
}

button:hover, .secondary:hover { opacity: .82; }

.primary { background: var(--accent); color: #fff; }

.secondary {
  background: #ede8de;
  color: var(--dark);
  border: 1px solid var(--border);
}

.ghost {
  color: #f5efe4;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  font-size: .82rem;
}

.full { width: 100%; margin-top: 1rem; }

.muted { color: var(--muted); margin-bottom: 0; font-family: sans-serif; }
.small { font-size: .83rem; font-family: sans-serif; }

/* ── SECTION HEAD ── */
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.1rem;
  padding-bottom: .8rem;
  border-bottom: 1px solid var(--border);
}

/* ── ROUTE LINE ── */
.route-line {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .6rem;
  margin: 0 0 1.25rem;
}

.route-node {
  padding: .9rem;
  border-radius: var(--radius-inner);
  background: #faf8f4;
  border: 1px solid var(--border);
  min-height: 80px;
}

.route-node::before {
  content: "";
  display: block;
  height: 5px;
  border-radius: 999px;
  background: #c8bfae;
  margin-bottom: .65rem;
}

.route-node.status-clear::before { background: var(--green); }
.route-node.status-slow::before,
.route-node.status-works::before { background: var(--yellow); }
.route-node.status-blocked::before,
.route-node.status-accident::before { background: var(--red); }
.route-node.status-unknown::before { background: #c8bfae; }

.node-title { font-weight: 700; font-size: .88rem; font-family: sans-serif; margin-bottom: .2rem; }
.node-meta { font-size: .78rem; color: var(--muted); font-family: sans-serif; }

/* ── SEGMENT & ALT CARDS ── */
.segment-grid,
.alternatives-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: .9rem;
}

.segment-card,
.alt-card,
.report-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  padding: 1rem 1.1rem;
  background: #faf8f4;
  font-family: sans-serif;
}

.segment-card--photo {
  background-size: cover;
  background-position: center;
  padding: 0;
  border: none;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.segment-card-overlay {
  background: linear-gradient(to top, rgba(20,15,8,.88) 60%, rgba(20,15,8,.2) 100%);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  flex: 1;
  justify-content: flex-end;
}

.segment-card--photo h3 {
  color: #f5efe4;
  margin-bottom: 0;
  font-size: 1rem;
  font-weight: 700;
}

.segment-card--photo .segment-desc {
  color: rgba(245,239,228,.75);
  font-size: .82rem;
  margin-bottom: .2rem;
  line-height: 1.45;
}

.segment-card--photo .segment-meta {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
  font-size: .76rem;
  color: rgba(245,239,228,.55);
  margin-top: .15rem;
}

.segment-card h3,
.alt-card h3 { margin-bottom: .3rem; font-size: .98rem; font-family: sans-serif; font-weight: 700; }

.segment-card--photo .badge {
  background: rgba(255,255,255,.15);
  color: #f5efe4;
  backdrop-filter: blur(4px);
  margin-bottom: .4rem;
}

.segment-card--photo .badge.clear   { background: rgba(42,140,74,.5);  color: #d6f0dd; }
.segment-card--photo .badge.slow,
.segment-card--photo .badge.works   { background: rgba(201,138,0,.5);  color: #fdefc8; }
.segment-card--photo .badge.blocked,
.segment-card--photo .badge.accident { background: rgba(193,56,31,.5); color: #fdddd6; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  padding: .25rem .6rem;
  border-radius: 6px;
  font-size: .74rem;
  font-weight: 700;
  font-family: sans-serif;
  margin-bottom: .5rem;
  letter-spacing: .01em;
}

.badge.clear   { background: #d6f0dd; color: #1a5e2e; }
.badge.slow,
.badge.works   { background: #fdefc8; color: #6b4800; }
.badge.blocked,
.badge.accident { background: #fdddd6; color: #8c2010; }
.badge.unknown { background: #ede8de; color: #5c5043; }

/* ── FORM ── */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: .9rem;
}

label {
  display: grid;
  gap: .3rem;
  font-weight: 700;
  font-family: sans-serif;
  font-size: .88rem;
  margin-bottom: .9rem;
}

input, select, textarea {
  width: 100%;
  border: 1px solid #d0c8b8;
  border-radius: 8px;
  padding: .75rem .9rem;
  font: inherit;
  font-family: sans-serif;
  background: #fdfaf6;
  color: var(--text);
  font-size: .93rem;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

/* ── STATUS CHOICE BUTTONS ── */
.status-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: .5rem;
  margin: 1rem 0;
}

.status-choice {
  margin: 0;
  padding: .8rem .4rem .7rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  text-align: center;
  cursor: pointer;
  background: #fdfaf6;
  transition: border-color .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
}

.status-choice input { display: none; }

.status-choice:has(input:checked) {
  border-color: var(--accent);
  background: #fff8f4;
}

.choice-icon { font-size: 1.3rem; line-height: 1; }

.status-choice span:not(.choice-icon) {
  font-weight: 700;
  font-size: .78rem;
  font-family: sans-serif;
  color: var(--text);
}

/* ── GPS ROW ── */
.gps-row {
  border: 1px dashed #c8bfae;
  padding: .85rem;
  border-radius: 10px;
  background: #faf8f4;
}

.checkbox { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: .88rem; }
.checkbox input { width: auto; accent-color: var(--accent); }

.form-message { margin: .8rem 0 0; font-weight: 700; font-family: sans-serif; font-size: .88rem; }

/* ── REPORTS ── */
.reports-list { display: grid; gap: .6rem; }

.report-item { display: grid; gap: .3rem; margin-bottom: 0; }

.report-top {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: center;
}

.report-comment {
  color: var(--text);
  font-style: italic;
  font-size: .91rem;
  padding-top: .2rem;
}

/* ── STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .9rem;
}

.stat-card {
  background: #faf8f4;
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  padding: 1rem 1.1rem;
  font-family: sans-serif;
}

.stat-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .4rem;
}

.stat-value {
  font-family: "Georgia", serif;
  font-size: 1.7rem;
  font-weight: normal;
  color: var(--text);
  margin-bottom: .2rem;
  line-height: 1.1;
}

.stat-value--sm {
  font-size: 1.15rem;
}

.stat-sub {
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 0;
}

/* ── SUPPORT BAND ── */
.support-band {
  background: #1e1a14;
  border-top: 3px solid var(--accent);
  padding: 1.75rem 2rem;
}

.support-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.support-text {
  flex: 1;
}

.support-title {
  font-family: "Georgia", serif;
  font-size: 1.1rem;
  color: #f5efe4;
  margin-bottom: .25rem;
  font-weight: normal;
}

.support-sub {
  font-family: sans-serif;
  font-size: .88rem;
  color: #a09070;
  margin-bottom: 0;
  max-width: 520px;
}

.support-btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  background: #0075EB;
  color: #fff;
  font-family: sans-serif;
  font-size: .92rem;
  font-weight: 700;
  text-decoration: none;
  padding: .75rem 1.3rem;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity .15s;
}

.support-btn:hover {
  opacity: .88;
}

@media (max-width: 820px) {
  .support-band { padding: 1.4rem 1rem; }
  .support-inner { flex-direction: column; align-items: stretch; }
  .support-btn { justify-content: center; }
}

/* ── FOOTER ── */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-family: sans-serif;
  font-size: .84rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* ── RESPONSIVE ── */
@media (max-width: 820px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-right { flex-direction: row; align-items: center; justify-content: space-between; }

  .direction-cards { grid-template-columns: 1fr; }

  .dir-card { flex-direction: row; align-items: center; gap: .9rem; }
  .dir-arrow { font-size: 1.3rem; margin-bottom: 0; }

  .hero-status { flex-direction: column; align-items: stretch; }
  .hero-status-dot { display: none; }
  .hero-actions { justify-content: stretch; }
  .hero-actions .primary,
  .hero-actions .secondary { width: 100%; justify-content: center; }

  .section-head { flex-direction: column; }

  .route-line,
  .segment-grid,
  .alternatives-grid,
  .stats-grid,
  .form-row,
  .status-buttons { grid-template-columns: 1fr; }

  .container { padding: .85rem; }
  .card { border-radius: 12px; }
  h1 { font-size: 1.85rem; }
  .ghost { width: auto; }
}
