:root {
  --ink: #1d232b;
  --muted: #667180;
  --line: #c9d0d8;
  --accent: #1f5fae;
  --good: #1e8a4c;
  --bad: #b3261e;
  --solution: #b36b00;
  --card: 120px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; color: var(--ink); background: #f5f7fa; }
main { max-width: 900px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { margin: 0 0 8px; font-size: 1.6rem; }
.intro { margin: 0 0 4px; font-size: 1.05rem; }
.direction { margin: 0 0 20px; color: var(--muted); }

.chain { display: flex; align-items: center; justify-content: safe center; flex-wrap: nowrap; gap: 0; padding: 12px 0 20px; overflow-x: auto; }
.chain.tight { --card: 96px; }
.chain.tight .connector { min-width: 56px; }
.card { width: var(--card); flex: none; text-align: center; }
.card .photo { width: var(--card); height: calc(var(--card) * 1.5); border-radius: 12px; object-fit: cover; object-position: top; border: 3px solid var(--line); background: #dfe3e8; display: block; }
.card .name { margin-top: 6px; font-weight: 600; font-size: 0.9rem; line-height: 1.2; }
.card .years { color: var(--muted); font-size: 0.8rem; }
.card.end .photo { border-color: var(--accent); }
.card.current .photo { border-color: var(--good); }
.card.revealed .photo { border-color: var(--solution); }
.card.empty .blank { width: var(--card); height: calc(var(--card) * 1.5); border-radius: 12px; border: 3px dashed var(--line); display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--line); }
.card.empty .name, .card.empty .years { visibility: hidden; }

.connector { flex: 1 1 70px; min-width: 70px; max-width: 130px; align-self: flex-start; display: flex; flex-direction: column; align-items: center; }
.connector .logo-wrap { position: relative; width: 100%; height: calc(var(--card) * 1.5); display: flex; align-items: center; justify-content: center; }
.connector .bar { position: absolute; left: 0; right: 0; top: 50%; border-top: 3px solid var(--line); }
.connector.empty .bar { border-top-style: dashed; }
.connector.filled .bar { border-top-color: var(--accent); }
.connector.revealed .bar { border-top-color: var(--solution); }
.connector.hint .bar { border-top-color: var(--solution); border-top-style: dashed; }
.connector .logo, .connector .badge { position: relative; width: 40px; height: 40px; border-radius: 50%; background: #f5f7fa; padding: 3px; object-fit: contain; }
.connector .badge { color: #fff; font-size: 0.7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0; }
.connector .when { font-size: 0.85rem; font-weight: 600; text-align: center; }
.connector .team { font-size: 0.72rem; color: var(--muted); text-align: center; line-height: 1.1; }

.status { min-height: 3em; text-align: center; margin-bottom: 8px; }
.status .message { margin: 0 0 6px; }
.status .bad { color: var(--bad); }
.status .good { color: var(--good); font-weight: 600; }
.status .warn { color: var(--solution); }
.status button { margin: 4px 4px 0; }

.search-box { position: relative; max-width: 420px; margin: 0 auto 16px; }
.search-box input { width: 100%; padding: 12px 14px; font-size: 1rem; border: 2px solid var(--line); border-radius: 8px; }
.search-box input:focus { outline: none; border-color: var(--accent); }
.search-box input:disabled { background: #eceff3; }
.suggestions { position: absolute; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 0; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); z-index: 5; overflow: hidden; }
.suggestions li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; cursor: pointer; }
.suggestions li.active, .suggestions li:hover { background: #e8f0fb; }
.suggestions img { width: 36px; height: 54px; border-radius: 6px; object-fit: cover; object-position: top; background: #dfe3e8; }
.suggestions .label { font-size: 0.95rem; }
.suggestions .label small { color: var(--muted); margin-left: 4px; }

.buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
button { font: inherit; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }

@media (max-width: 640px) {
  :root { --card: 84px; }
  .chain { flex-direction: column; overflow-x: visible; }
  .connector { flex: none; flex-direction: row; align-self: center; align-items: center; gap: 10px; min-height: 56px; width: auto; max-width: none; }
  .connector .logo-wrap { width: 40px; height: 56px; }
  .connector .bar { left: 50%; right: auto; top: 0; bottom: 0; border-top: 0; border-left: 3px solid var(--line); }
  .connector.empty .bar { border-left-style: dashed; }
  .connector.filled .bar { border-left-color: var(--accent); }
  .connector.revealed .bar { border-left-color: var(--solution); }
  .connector.hint .bar { border-left-color: var(--solution); border-left-style: dashed; }
  .card.empty .blank { width: 56px; height: 84px; font-size: 1.2rem; }
  .card.empty .name, .card.empty .years { display: none; }
  .connector .text { text-align: left; }
  .connector .when, .connector .team { text-align: left; }
}
