*, *::before, *::after {
  box-sizing: border-box;
}

:root { 
  --bg: #101010; 
  --card-bg: #1a1a1a; 
  --text-main: #eeeeee; 
  --text-muted: #888888; 
  --accent: #00e5ff; 
  --line: #333333; 
  --sadko: #00E676; 
  --novi: #FF9100; 
}

body { 
  background: var(--bg); 
  color: var(--text-main); 
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
  margin: 0; 
  height: 100vh; 
  overflow: hidden; 
}

/* --- Layout --- */
.container { 
  display: flex; 
  flex-direction: column; 
  height: 100%; 
  width: 100%; 
  max-width: 2000px; 
  margin: 0 auto; 
}

.header { 
  flex: 0 0 65px; 
  display: flex; 
  background: #000; 
  border-bottom: 2px solid var(--line); 
  align-items: center; 
  font-size: 1.3rem; 
  font-weight: 900; 
  letter-spacing: 3px; 
  z-index: 20; 
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.col-header { flex: 1; text-align: center; text-transform: uppercase; }
.stem-header { flex: 0 0 120px; text-align: center; color: var(--accent); font-size: 0.9rem; }

/* --- Timeline Scroll Area --- */
.timeline-scroll { 
  flex: 1; 
  overflow-y: auto; 
  overflow-x: hidden; /* Force kill horizontal bleed */
  scroll-behavior: auto;
  position: relative; 
  padding-bottom: 100px; 
}

/* Display Utilities */
.hidden { display: none !important; }

.row { 
  display: flex; 
  align-items: stretch;
  position: relative; 
}
.row:hover { background: #141414; }
.row.is-today { background: rgba(0, 229, 255, 0.03); }

/* --- Columns --- */
.col { 
  flex: 1; 
  min-width: 0; 
  padding: 25px 20px; 
  display: flex; 
  flex-direction: column; 
  gap: 25px; 
}
.col.sadko { align-items: flex-end; border-right: 1px solid var(--line); text-align: right; }
.col.novi { align-items: flex-start; border-left: 1px solid var(--line); text-align: left; }

/* --- The Stem (Spine) --- */
.stem { 
  flex: 0 0 120px; 
  flex-shrink: 0; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  padding-top: 35px; 
  padding-bottom: 35px;
  position: relative; 
}

.stem::before { 
  content: ''; 
  position: absolute; 
  top: 0; bottom: 0; left: 50%; 
  width: 2px; 
  background: var(--line); 
  transform: translateX(-50%); 
  z-index: 0; 
}

.date-node { 
  background: var(--card-bg); 
  border: 2px solid var(--accent); 
  border-radius: 50%; 
  width: 80px; height: 80px; 
  display: flex; flex-direction: column; 
  align-items: center; justify-content: center; 
  z-index: 2; 
  box-shadow: 0 0 20px rgba(0,0,0,0.6); 
}
.dow { font-size: 0.9em; color: var(--accent); font-weight: bold; line-height: 1; margin-bottom: 2px; text-transform: uppercase; }
.day-num { font-size: 1.1em; color: #fff; font-weight: bold; line-height: 1; text-align: center; }
.year-tag { font-size: 0.7em; color: var(--text-muted); margin-top: 2px; }

/* --- Cards --- */
.trip-card { 
  background: var(--card-bg); 
  border: 1px solid #333; 
  border-radius: 6px; 
  padding: 18px; 
  width: 100%; 
  max-width: 650px;
  position: relative; 
  box-shadow: 0 4px 12px rgba(0,0,0,0.4); 
  transition: transform 0.1s ease-in-out;
}
.trip-card:hover { transform: scale(1.01); border-color: #555; z-index: 10; }

.sadko .trip-card { border-right: 4px solid var(--sadko); }
.novi .trip-card { border-left: 4px solid var(--novi); }

.col.sadko .trip-card::after { content: ''; position: absolute; right: -46px; top: 40px; width: 42px; height: 2px; background: var(--line); }
.col.sadko .trip-card::before { content: ''; position: absolute; right: -50px; top: 37px; width: 8px; height: 8px; background: var(--sadko); border-radius: 50%; box-shadow: 0 0 10px var(--sadko); }

.col.novi .trip-card::after { content: ''; position: absolute; left: -46px; top: 40px; width: 42px; height: 2px; background: var(--line); }
.col.novi .trip-card::before { content: ''; position: absolute; left: -50px; top: 37px; width: 8px; height: 8px; background: var(--novi); border-radius: 50%; box-shadow: 0 0 10px var(--novi); }

/* --- Card Content --- */
.trip-header { display: flex; justify-content: space-between; border-bottom: 1px solid #333; padding-bottom: 10px; margin-bottom: 10px; }
.trip-id { font-family: 'Courier New', monospace; font-size: 1.3em; color: #fff; font-weight: bold; }
.trip-driver { color: var(--accent); font-weight: bold; font-size: 1.1em; text-align: right; }

.trip-meta { display: flex; gap: 12px; font-size: 0.85em; color: var(--text-muted); margin-bottom: 12px; }
.sadko .trip-meta { justify-content: flex-end; }
.meta-tag { background: #222; padding: 4px 8px; border-radius: 4px; border: 1px solid #333; }

/* Stops */
.stop-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.stop-item { display: flex; gap: 15px; padding: 8px 0; border-top: 1px solid #252525; font-size: 0.95em; align-items: baseline; }
.sadko .stop-item { flex-direction: row-reverse; text-align: right; }

.stop-time { color: var(--accent); font-family: 'Courier New', monospace; font-weight: bold; background: rgba(0, 229, 255, 0.1); padding: 2px 6px; border-radius: 3px; white-space: nowrap; flex-shrink: 0; }
.stop-addr { color: #ddd; line-height: 1.4; }
.stop-items { display: block; font-size: 0.85em; color: #666; margin-top: 4px; font-style: italic; white-space: pre-wrap; }


/* --- Text Wrapping (Fix Horizontal Scroll) --- */
.trip-card, .stop-addr, .stop-items, .trip-id {
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

/* --- Jump Button --- */
.jump-btn {
  background: var(--card-bg);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.1s;
}
.jump-btn:hover { background: rgba(0, 229, 255, 0.1); }
.jump-btn:active { background: var(--accent); color: #000; }

/* --- Mobile Hardening (< 800px) --- */
@media (max-width: 800px) {
  .header { font-size: 1.1rem; flex: 0 0 75px; }
  
  .col { padding: 12px 6px; gap: 12px; }
  .trip-card { padding: 10px; font-size: 0.95rem; }
  .stop-item { gap: 8px; flex-direction: row; align-items: flex-start; }
  
  /* Shrink Stem */
  .stem { flex: 0 0 70px; padding-top: 20px; padding-bottom: 20px; }
  .date-node { width: 55px; height: 55px; }
  .dow { font-size: 0.75em; }
  .day-num { font-size: 0.9em; }
  .year-tag { display: none; } /* Drop year on mobile to save space */
  
  /* Shrink Connectors */
  .col.sadko .trip-card::after { right: -21px; width: 20px; }
  .col.sadko .trip-card::before { right: -25px; }
  .col.novi .trip-card::after { left: -21px; width: 20px; }
  .col.novi .trip-card::before { left: -25px; }
  
  /* Adjust Typography */
  .trip-header { flex-direction: column; gap: 5px; }
  .sadko .trip-header { align-items: flex-end; }
  .trip-meta { flex-wrap: wrap; }
  .sadko .stop-item { flex-direction: column; align-items: flex-end; }
  .stop-time { display: inline-block; width: max-content; }
}
/* --- Print Button --- */
.print-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: 12px;
  padding: 0;
  transition: color 0.1s;
  vertical-align: middle;
}
.print-btn:hover { color: var(--accent); }
.print-btn svg { 
  width: 18px; 
  height: 18px; 
  fill: currentColor; 
  display: inline-block;
  vertical-align: baseline;
}
