/* Styles for the print area. Prefix every selector with .print- (see docs/TECH_SPEC.md §10.3).
   A4 portrait, 10 mm margins: printable area 190 × 277 mm. Credential cards are 95 × 69 mm (2 × 4). */

@page print-a4 { size: A4 portrait; margin: 10mm; }

.print-mode body { background: #DDE5EB; }
.print-root { min-height: 100vh; --print-ink: var(--navy); --print-grey: var(--ink-2); --print-muted: var(--muted); --print-line: var(--hairline); }
.print-root, .print-root * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* ---------- screen-only toolbar ---------- */
.print-toolbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px; background: rgba(255, 255, 255, .97); border-bottom: 1px solid var(--print-line); box-shadow: 0 2px 12px rgba(0, 41, 65, .08);
}
.print-toolbar .spacer { flex: 1; }
.print-toolbar .btn-group > button { min-height: 34px; font-size: var(--fs-sm); }
.print-toolbar-title { display: flex; flex-direction: column; line-height: 1.25; margin-right: 8px; }
.print-toolbar-title strong { color: var(--print-ink); font-size: var(--fs-md); }
.print-toolbar-title span { font-size: var(--fs-xs); color: var(--print-muted); }
.print-toolbar-field { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--print-ink); }
.print-toolbar-field .select, .print-toolbar-field .input { min-height: 34px; padding: 4px 10px; font-size: var(--fs-sm); width: auto; }
.print-note { max-width: 210mm; margin: 12px auto 0; font-size: var(--fs-sm); color: var(--print-grey); display: flex; gap: 8px; align-items: center; }
.print-note svg { color: var(--teal-ink); flex: none; }
.print-pages { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 16px 16px 48px; }
.print-empty { padding: 60px 20px; text-align: center; color: var(--print-muted); font-size: var(--fs-base); }

/* ---------- sheet ---------- */
.print-sheet {
  width: 210mm; height: 297mm; padding: 10mm; background: #fff; box-shadow: 0 6px 24px rgba(0, 41, 65, .18);
  color: var(--print-grey); font-family: var(--font); font-size: 9pt; line-height: 1.35; overflow: hidden; position: relative; page: print-a4;
}
.print-wordmark {
  display: inline-grid; place-items: center; flex: none; background: var(--print-ink); color: #fff; font-weight: 800; letter-spacing: .08em;
  font-size: 9pt; padding: .9mm 2mm; border-radius: 1mm; line-height: 1;
}
.print-logo { display: block; flex: none; height: 5.2mm; width: auto; max-width: 24mm; object-fit: contain; }
.print-mono { font-family: var(--mono); font-weight: 700; color: var(--print-ink); letter-spacing: .01em; }
.print-muted { color: var(--print-muted); }
.print-num { text-align: right; font-variant-numeric: tabular-nums; }
.print-break { word-break: break-all; }

/* ---------- credential cards ---------- */
.print-cards { display: grid; grid-template-columns: repeat(2, 95mm); grid-template-rows: repeat(4, 69mm); width: 190mm; height: 276mm; }
.print-card {
  --m: #8795A1; --ml: 4mm; --mw: .25mm;
  position: relative; box-sizing: border-box; width: 95mm; height: 69mm; padding: 6mm 6.5mm 4.5mm; display: flex; flex-direction: column; overflow: hidden;
  background:
    linear-gradient(var(--m), var(--m)) left top / var(--ml) var(--mw) no-repeat,
    linear-gradient(var(--m), var(--m)) left top / var(--mw) var(--ml) no-repeat,
    linear-gradient(var(--m), var(--m)) right top / var(--ml) var(--mw) no-repeat,
    linear-gradient(var(--m), var(--m)) right top / var(--mw) var(--ml) no-repeat,
    linear-gradient(var(--m), var(--m)) left bottom / var(--ml) var(--mw) no-repeat,
    linear-gradient(var(--m), var(--m)) left bottom / var(--mw) var(--ml) no-repeat,
    linear-gradient(var(--m), var(--m)) right bottom / var(--ml) var(--mw) no-repeat,
    linear-gradient(var(--m), var(--m)) right bottom / var(--mw) var(--ml) no-repeat,
    #fff;
}
.print-card::before {
  content: ""; position: absolute; left: 6.5mm; right: 6.5mm; top: 3.2mm; height: 1mm; border-radius: 1mm;
  background: linear-gradient(90deg, var(--teal), var(--cyan));
}
.print-card-blank::before { display: none; }
.print-card-head { display: flex; align-items: center; gap: 2.4mm; margin-top: .6mm; }
.print-card-title { min-width: 0; line-height: 1.2; }
.print-card-game { font-weight: 700; color: var(--print-ink); font-size: 8.5pt; letter-spacing: -.005em; }
.print-card-event { font-size: 6.8pt; color: var(--print-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70mm; }
.print-card-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 27mm; gap: 3.5mm; margin-top: 2.4mm; min-height: 0; }
.print-card-main { min-width: 0; display: flex; flex-direction: column; }
.print-card-name { font-size: 13.5pt; font-weight: 800; color: var(--print-ink); line-height: 1.1; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.print-card-name.is-long { font-size: 11pt; }
.print-card-team { display: flex; align-items: flex-start; gap: 1.8mm; margin-top: 1.4mm; min-width: 0; }
.print-card-team i { width: 2.6mm; height: 2.6mm; border-radius: .6mm; background: var(--c); flex: none; margin-top: .9mm; }
.print-card-team > div { min-width: 0; display: flex; flex-direction: column; gap: .3mm; line-height: 1.2; }
.print-card-team b { font-size: 9.5pt; font-weight: 800; color: var(--print-ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.print-card-team span { font-size: 7.5pt; font-weight: 650; color: var(--print-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.print-card-team.is-long b { font-size: 8.5pt; }
.print-card-team.is-xlong b { font-size: 8pt; -webkit-line-clamp: 3; line-height: 1.15; }
.print-card-team.is-xlong span { -webkit-line-clamp: 1; }
.print-cred { margin: auto 0 0; padding-top: 1.2mm; display: flex; flex-direction: column; gap: .8mm; }
.print-cred > div { display: flex; flex-direction: column; }
.print-cred dt { font-size: 6.8pt; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--print-muted); }
.print-cred dd { margin: 0; font-size: 9.3pt; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.print-url { font-weight: 700; color: var(--teal-ink); font-size: 8.4pt !important; }
.print-card-qr { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.print-qr { width: 27mm; height: 27mm; padding: 1.2mm; background: #fff; border: .3mm solid var(--print-line); border-radius: 1.4mm; }
.print-qr svg { display: block; width: 100%; height: 100%; }
.print-qr-cap { font-size: 6.8pt; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--print-ink); margin-top: 1mm; white-space: nowrap; }
.print-card-foot { font-size: 6.8pt; color: var(--print-muted); margin-top: 1.4mm; border-top: .2mm solid var(--print-line); padding-top: 1mm; line-height: 1.25; }

/* ---------- team sheet ---------- */
.print-team-head, .print-run-head { display: flex; align-items: center; justify-content: space-between; gap: 6mm; padding-bottom: 4mm; border-bottom: .4mm solid var(--print-ink); }
.print-team-brand { display: flex; align-items: center; gap: 3mm; }
.print-team-brand .print-wordmark { font-size: 11pt; padding: 1.2mm 2.6mm; }
.print-team-brand .print-logo { height: 7.5mm; max-width: 34mm; }
.print-team-brand .print-card-game { font-size: 11pt; }
.print-team-brand .print-card-event { font-size: 8.5pt; max-width: 120mm; }
.print-team-kicker { font-size: 8pt; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--teal-ink); }
.print-team-title { display: flex; gap: 4mm; align-items: stretch; margin: 8mm 0 5mm; }
.print-team-title i { width: 2.2mm; border-radius: 1mm; background: var(--c); flex: none; }
.print-team-title h1 { font-size: 22pt; margin: 0; color: var(--print-ink); letter-spacing: -.02em; line-height: 1.1; }
.print-team-mode { font-size: 10pt; color: var(--print-muted); margin-top: 1mm; }
.print-team-how { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6mm; align-items: center; background: var(--band); border-radius: 3mm; padding: 4mm 5mm; margin-bottom: 6mm; }
.print-team-url { display: flex; flex-direction: column; }
.print-team-url span { font-size: 7pt; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--print-muted); }
.print-team-url strong { font-size: 14pt; color: var(--teal-ink); }
.print-team-how p { margin: 0; font-size: 9pt; }
.print-team-table { width: 100%; border-collapse: collapse; }
.print-team-table th { text-align: left; font-size: 7pt; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--print-muted); padding: 0 3mm 2mm 0; border-bottom: .3mm solid var(--print-line); }
.print-team-table td { padding: 3mm 3mm 3mm 0; border-bottom: .2mm solid var(--print-line); vertical-align: middle; font-size: 10pt; }
.print-team-table td.print-mono { font-size: 11pt; }
.print-th-qr { width: 26mm; }
.print-team-name { font-weight: 700; color: var(--print-ink); font-size: 11pt; }
.print-qr-sm { width: 23mm; height: 23mm; padding: 1mm; }
.print-team-foot { margin-top: auto; font-size: 8pt; color: var(--print-muted); border-top: .2mm solid var(--print-line); padding-top: 2mm; break-inside: avoid; }

/* ---------- run sheet ---------- */
.print-run-total { text-align: right; line-height: 1.15; }
.print-run-total strong { display: block; font-size: 15pt; color: var(--print-ink); }
.print-run-total span { font-size: 8pt; color: var(--print-muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.print-run-title { font-size: 18pt; color: var(--print-ink); margin: 4mm 0 2.5mm; letter-spacing: -.02em; line-height: 1.15; }
.print-run-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.6mm 5mm; margin: 0 0 4mm; }
.print-run-facts > div { display: flex; flex-direction: column; min-width: 0; }
.print-run-facts dt { font-size: 7pt; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--print-muted); }
.print-run-facts dd { margin: 0; font-size: 8.8pt; font-weight: 700; color: var(--print-ink); overflow-wrap: anywhere; }
.print-run-table { width: 100%; border-collapse: collapse; font-size: 8.2pt; line-height: 1.3; }
.print-run-table th { text-align: left; font-size: 7pt; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--print-muted); padding: 0 2mm 1.5mm 0; border-bottom: .3mm solid var(--print-ink); }
.print-run-table td { padding: 1.15mm 2mm 1.15mm 0; border-bottom: .2mm solid var(--print-line); vertical-align: top; }
.print-run-table td:last-child { width: 44mm; }
.print-run-table tr.is-sub td { color: var(--print-muted); padding-top: .7mm; padding-bottom: .7mm; font-size: 7.8pt; }
.print-run-table tr.is-sub .print-run-phase { font-weight: 650; padding-left: 3mm; }
.print-run-phase { font-weight: 700; color: var(--print-ink); white-space: nowrap; }
.print-run-action { font-weight: 700; color: var(--teal-ink); }
.print-run-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 7mm; margin-top: 4mm; break-inside: avoid; }
.print-run-cols h2 { font-size: 10pt; color: var(--print-ink); margin: 0 0 2mm; letter-spacing: 0; }
.print-run-companies { width: 100%; border-collapse: collapse; font-size: 8pt; }
.print-run-companies td { padding: 1mm 1.5mm 1mm 0; border-bottom: .2mm solid var(--print-line); vertical-align: top; line-height: 1.3; }
.print-run-companies i { display: inline-block; width: 2.6mm; height: 2.6mm; border-radius: .6mm; margin-top: .8mm; }
.print-run-seq { margin: 0; padding-left: 4.5mm; font-size: 8pt; line-height: 1.3; display: flex; flex-direction: column; gap: 1mm; }
.print-run-seq em { font-style: normal; font-weight: 700; color: var(--print-ink); }
.print-run-secret { margin: 0 0 4mm; padding: 2.2mm 3.5mm; border: .3mm dashed var(--print-muted); border-radius: 2mm; font-size: 8pt; break-inside: avoid; }
.print-run-secret-l { color: var(--print-grey); }
.print-run-secret-l strong { color: var(--print-ink); }
.print-run-link { font-size: 9.5pt; margin-top: 1mm; overflow-wrap: anywhere; line-height: 1.35; }
.print-run-key { display: inline-block; }
.print-run-cols h2 { break-after: avoid; }

/* The run sheet and the team sheets flow onto a second A4 page instead of cutting content off. */
.print-sheet-run, .print-sheet-team { height: auto; min-height: 297mm; overflow: visible; }
.print-sheet-team { display: flex; flex-direction: column; }
.print-avoid { break-inside: avoid; }

/* ---------- print ---------- */
@media print {
  .print-mode body { background: #fff; }
  .print-mode #app { min-height: 0; display: block; }
  .print-root { min-height: 0; background: none; }
  .print-toolbar, .print-note { display: none !important; }
  .print-pages { display: block; padding: 0; }
  .print-sheet { width: 190mm; height: 276mm; padding: 0; margin: 0; box-shadow: none; break-after: page; break-inside: avoid; }
  .print-sheet:last-child { break-after: auto; }
  .print-sheet-run, .print-sheet-team { height: auto; min-height: 276mm; break-inside: auto; }
}
