/* Design tokens carried over from fugit-prototip.html for visual continuity. */
:root {
  --paper: #F2F4F5;
  --ink: #1B2430;
  --ink-soft: #5A6472;
  --red: #E4002B;
  --board: #14161A;
  --led: #FFB300;
  --led-dim: #5c4200;
  --line-r1: #00A1E0; --line-r2: #00A94F; --line-r3: #EF4044; --line-r4: #F5A800;
  --line-default: #5A6472;
  --card: #FFFFFF;
  --radius: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
  display: flex; justify-content: center;
}
.app { width: 100%; max-width: 440px; min-height: 100vh; background: var(--paper); padding-bottom: 56px; }

header {
  background: var(--card); padding: 18px 20px 14px; border-bottom: 3px solid var(--red);
  display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20;
}
.logo {
  width: 40px; height: 40px; border-radius: 50%; background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  font-weight: 800; font-size: 24px; letter-spacing: -1px; flex-shrink: 0;
}
.brand h1 {
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  font-size: 26px; font-weight: 800; letter-spacing: 2.5px; line-height: 1;
}
.brand p { font-size: 11.5px; color: var(--ink-soft); letter-spacing: .4px; margin-top: 2px; }
.gear {
  margin-left: auto; background: none; border: 1px solid #d5dade; border-radius: 50%;
  width: 34px; height: 34px; font-size: 16px; cursor: pointer; color: var(--ink-soft);
}
.gear:hover { background: #eceff1; }

section { padding: 18px 20px 0; }
.sec-label {
  font-size: 11px; letter-spacing: 1.8px; text-transform: uppercase; color: var(--ink-soft);
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.sec-label::after { content: ''; flex: 1; height: 1px; background: #dde1e4; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px rgba(27, 36, 48, .07); }
.line-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.line-badge {
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  font-weight: 800; font-size: 17px; color: #fff; padding: 3px 10px; border-radius: 6px; letter-spacing: .5px;
}
.line-row .route { font-size: 14px; font-weight: 600; }
.line-row .route small { display: block; font-weight: 400; color: var(--ink-soft); font-size: 12px; margin-top: 1px; }
.train { display: flex; align-items: center; justify-content: space-between; padding: 11px 4px; border-top: 1px solid #eef0f2; }
.train .time { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 16px; font-weight: 600; width: 56px; }
.train .dest { flex: 1; font-size: 13.5px; color: var(--ink-soft); }
.delay { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 12.5px; font-weight: 700; padding: 4px 9px; border-radius: 6px; }
.delay.ok { background: #e5f5ec; color: #0a7a41; }
.delay.bad { background: #fdeaea; color: var(--red); }
.delay.pending { background: #eceff1; color: var(--ink-soft); }
.empty-note { font-size: 12.5px; color: var(--ink-soft); padding: 8px 4px; }

.avis-cancel {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: #fdeaea; border: 1px dashed var(--red); font-size: 12.5px; color: var(--ink);
}
.avis-cancel b { color: var(--red); }
.avis-cancel .nota { color: var(--ink-soft); display: block; margin-top: 3px; font-size: 11.5px; }

.board {
  margin-top: 8px; background: var(--board); border-radius: var(--radius); padding: 18px 16px 16px;
  box-shadow: inset 0 0 0 1px #2a2d33, 0 4px 14px rgba(0, 0, 0, .25); position: relative; overflow: hidden;
}
.board::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .045) 1px, transparent 1.4px);
  background-size: 5px 5px; pointer-events: none;
}
.board-title {
  color: #9aa0a8; font-size: 11px; letter-spacing: 2.4px; text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.board-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--led); box-shadow: 0 0 8px var(--led); animation: pulse 2.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
@media (prefers-reduced-motion: reduce) { .board-title .dot { animation: none } }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; position: relative; z-index: 1; }
.tabs button {
  flex: 1; background: #1f2228; color: #8d939c; border: 1px solid #2c3039;
  font-family: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: .5px;
  padding: 8px 0; border-radius: 8px; cursor: pointer; transition: all .15s;
}
.tabs button:hover { color: #c8cdd4; }
.tabs button.active { background: var(--led); border-color: var(--led); color: #14161A; }
.tabs button:focus-visible { outline: 2px solid var(--led); outline-offset: 2px; }

.counter {
  font-family: 'IBM Plex Mono', ui-monospace, 'Courier New', monospace; color: var(--led);
  text-align: center; font-size: 64px; font-weight: 700; letter-spacing: 4px; line-height: 1;
  text-shadow: 0 0 18px rgba(255, 179, 0, .45), 0 0 2px rgba(255, 179, 0, .9);
  position: relative; z-index: 1; font-variant-numeric: tabular-nums; min-height: 66px;
}
.counter small { font-size: 22px; letter-spacing: 1px; margin-left: 6px; color: #d99c10; }
.counter-sub { color: #8d939c; text-align: center; font-size: 12.5px; margin-top: 8px; position: relative; z-index: 1; }

.chart { display: flex; align-items: flex-end; gap: 4px; height: 86px; margin-top: 18px; position: relative; z-index: 1; padding: 0 2px; }
.chart .bar { flex: 1; border-radius: 3px 3px 0 0; min-height: 3px; background: var(--led-dim); position: relative; transition: height .5s cubic-bezier(.2, .8, .2, 1); }
.chart .bar.hot { background: var(--led); box-shadow: 0 0 8px rgba(255, 179, 0, .4); }
.chart .bar .tip {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; color: #c8cdd4;
  opacity: 0; transition: opacity .15s; white-space: nowrap; pointer-events: none;
}
.chart .bar:hover .tip { opacity: 1; }
.chart-labels { display: flex; gap: 4px; margin-top: 6px; position: relative; z-index: 1; padding: 0 2px; }
.chart-labels span { flex: 1; text-align: center; font-size: 9px; color: #6b727c; letter-spacing: .3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stats { display: flex; gap: 10px; margin-top: 8px; }
.stat { flex: 1; background: var(--card); border-radius: 12px; padding: 12px 10px; text-align: center; box-shadow: 0 1px 3px rgba(27, 36, 48, .07); }
.stat .num { font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif; font-size: 26px; font-weight: 800; line-height: 1; }
.stat .lbl { font-size: 10.5px; color: var(--ink-soft); margin-top: 4px; letter-spacing: .3px; }

footer { margin-top: 26px; padding: 0 20px; font-size: 11px; color: var(--ink-soft); text-align: center; line-height: 1.7; }

/* ---------- configuració ---------- */
.config-card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 3px rgba(27, 36, 48, .07); margin-bottom: 14px; }
.config-card h2 { font-size: 15px; margin-bottom: 4px; }
.config-card p.hint { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 5px; letter-spacing: .3px; }
.field input[type="text"], .field input[type="time"], .field select {
  width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid #d5dade;
  font-family: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); margin-bottom: 14px; }
.checkbox-row input { width: 16px; height: 16px; }

.btn-primary {
  width: 100%; background: var(--red); color: #fff; border: none; cursor: pointer;
  font-family: inherit; font-size: 14.5px; font-weight: 700; padding: 13px; border-radius: 10px; letter-spacing: .3px;
}
.btn-primary:hover { background: #c50025; }
.btn-primary:disabled { background: #b9bfc6; cursor: default; }

.trajecte-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-top: 1px solid #eef0f2;
}
.trajecte-item .info { flex: 1; font-size: 13px; }
.trajecte-item .info b { display: block; }
.trajecte-item .info span { color: var(--ink-soft); font-size: 12px; }
.trajecte-item button { background: none; border: none; color: var(--ink-soft); cursor: pointer; font-size: 18px; padding: 4px 8px; }
.trajecte-item button:hover { color: var(--red); }

.link-secundari { display: block; text-align: center; margin-top: 12px; font-size: 12.5px; color: var(--ink-soft); background: none; border: none; cursor: pointer; text-decoration: underline; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; font-size: 13.5px; padding: 12px 20px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: all .3s; z-index: 50; box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

[hidden] { display: none !important; }

@media (max-width: 380px) { .counter { font-size: 52px; } }
