/* Shared components: slanted tag, section head, controls, lap card, bars, chips. */

/* F1 slanted tag */
.tag {
  display: inline-block; background: var(--f1-red); color: #fff; font-weight: 700; font-size: 12px; line-height: 1;
  letter-spacing: 0.12em; text-transform: uppercase; padding: 6px 18px 6px 12px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%); white-space: nowrap;
}
.tag--ghost { background: var(--raised); color: var(--text); }
.tag--amber { background: var(--in-part); color: #1a1200; }

/* section head: tag + plain one-line explanation */
.sect-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.sect-head .what { color: var(--muted); font-size: 13.5px; line-height: 1.3; }
.rule-top { border-top: 1px solid var(--hair); padding-top: 14px; }

/* controls */
select.pick, .btn {
  background: var(--raised); border: 1px solid var(--hair); border-radius: 2px; color: var(--text);
  padding: 7px 10px; font-size: 14px; font-weight: 600; min-height: 34px;
}
select.pick { max-width: 100%; text-overflow: ellipsis; }
select.pick:focus-visible, .btn:focus-visible, .seg button:focus-visible, .tab:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.btn { cursor: pointer; letter-spacing: 0.06em; text-transform: uppercase; font-size: 12px; }
.btn:hover { background: #262636; }
.seg { display: inline-flex; border: 1px solid var(--hair); border-radius: 2px; overflow: hidden; }
.seg button {
  background: transparent; border: 0; border-right: 1px solid var(--hair); padding: 7px 12px; cursor: pointer; min-height: 34px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

/* pills */
.pill { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 8px; border-radius: 2px; }
.pill--valid { background: rgba(34, 211, 107, 0.16); color: var(--green); }
.pill--invalid { background: rgba(255, 90, 31, 0.16); color: var(--loss); }

.gain { color: var(--green); }
.lose { color: var(--loss); }

/* lap card (screen C; reused wherever two laps meet head to head) */
.lapcard {
  background: var(--panel); padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
  border-top: 1px solid var(--hair);
}
.lapcard--a { border-left: 4px solid var(--lap-a); }
.lapcard--b { border-right: 4px solid var(--lap-b); text-align: right; }
.lapcard__top { display: flex; align-items: center; gap: 10px; }
.lapcard--b .lapcard__top { flex-direction: row-reverse; }
.lapcard__top select { flex: 1; min-width: 0; }
.lapcard__lab { font-weight: 700; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; padding: 4px 10px; color: #14141c; }
.lapcard--a .lapcard__lab { background: var(--f1-red); color: #fff; }
.lapcard--b .lapcard__lab { background: var(--lap-b); }
.lapcard__id { display: flex; flex-direction: column; gap: 1px; }
.lapcard__who { font-size: 13px; color: var(--muted); }
.lapcard__num { font-size: 15px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.lapcard__num b { font-size: 36px; font-style: italic; font-weight: 700; margin-left: 6px; font-variant-numeric: tabular-nums; }
.lapcard--a .lapcard__num b { color: var(--lap-a); }
.lapcard--b .lapcard__num b { color: var(--lap-b); }
.lapcard__row { display: flex; gap: 22px; align-items: flex-end; }
.lapcard--b .lapcard__row { flex-direction: row-reverse; }
.kv { display: flex; flex-direction: column; gap: 0; }
.kv .label { font-size: 10.5px; }
.kv b { font-size: 30px; font-style: italic; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.05; }
.kv b.sm { font-size: 20px; font-style: normal; }
.lapcard__bars { display: flex; flex-direction: column; gap: 7px; }
.bar { display: grid; grid-template-columns: 1fr 44px; grid-template-rows: auto 6px; column-gap: 8px; row-gap: 3px; align-items: end; }
.lapcard--b .bar { direction: rtl; }
.lapcard--b .bar > * { direction: ltr; }
.bar .label { grid-column: 1; font-size: 10.5px; }
.bar em { grid-column: 2; grid-row: 1 / span 2; font-style: italic; font-weight: 700; font-size: 20px; text-align: right; font-variant-numeric: tabular-nums; align-self: center; }
.lapcard--b .bar em { text-align: left; }
.bar .track { grid-column: 1; height: 6px; background: var(--raised); position: relative; }
.bar .track i { position: absolute; top: 0; bottom: 0; left: 0; display: block; }
.lapcard--b .bar .track i { left: auto; right: 0; }
.lapcard--a .bar i { background: var(--lap-a); }
.lapcard--b .bar i { background: var(--lap-b); }
.lapcard--b .bar .label { text-align: right; }
.lapcard--b .bar em { text-align: left; }
.lapcard .sectors { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.lapcard--b .sectors { justify-content: flex-end; }
.lapcard .sectors b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* hover tooltip used on screen B */
.sec-chip { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.sec-chip i { width: 10px; height: 10px; display: inline-block; background: var(--faint); }
.sec-chip i.purple { background: var(--purple); }
.sec-chip i.green { background: var(--green); }

/* legend swatches */
.swatch { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.legend span { white-space: nowrap; }
.swatch--line { height: 0; width: 18px; border-top: 2px dashed var(--c); background: none !important; vertical-align: 3px; }
.swatch--dots { border-top-style: dotted; }
.legend span.wrap { white-space: normal; }
@media (min-width: 760px) { .legend .line-key { display: none; } }  /* wide screens label the lines in the chart margin */
@media (pointer: coarse) { .mouse-only { display: none; } }
