/* ==========================================================================
   Hockey Opstelling – basis
   ========================================================================== */
:root {
  --green-900: #0d3b23;
  --green-700: #17663c;
  --green-500: #1f8a4c;
  --green-100: #e8f4ec;
  --blue-500: #2563eb;
  --ink: #16211c;
  --ink-soft: #5a6b62;
  --line: #d7e2da;
  --surface: #ffffff;
  --surface-alt: #f4f7f5;
  --danger: #b42318;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(13, 59, 35, .08), 0 1px 3px rgba(13, 59, 35, .06);
  --shadow-md: 0 6px 18px rgba(13, 59, 35, .12);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--surface-alt);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0; }

main { padding: 20px 16px 60px; max-width: 1180px; margin: 0 auto; }

.hint { margin: 4px 0 0; font-size: .8rem; color: var(--ink-soft); }

em { font-style: normal; color: var(--ink-soft); font-weight: 400; }

[hidden] { display: none !important; }

/* ==========================================================================
   Bovenbalk
   ========================================================================== */
.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--green-900);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { font-size: 1.5rem; line-height: 1; }
.brand h1 { font-size: 1.1rem; letter-spacing: .2px; }

.header-meta {
  flex: 1 1 220px;
  font-size: .85rem;
  color: #c8e3d3;
  min-height: 1.2em;
}

.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ==========================================================================
   Knoppen
   ========================================================================== */
.btn {
  font: inherit;
  font-weight: 600;
  font-size: .875rem;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--green-100); border-color: #b8d5c4; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(37, 99, 235, .45); outline-offset: 1px; }

.btn-primary {
  background: var(--green-700);
  border-color: var(--green-700);
  color: #fff;
}
.btn-primary:hover { background: var(--green-500); border-color: var(--green-500); }

.btn-small { padding: 5px 10px; font-size: .78rem; }

.btn-block { width: 100%; }

.btn-ghost {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .3);
  color: #fff;
}
.btn-ghost:hover { background: rgba(255, 255, 255, .24); border-color: #fff; }

.btn-danger { border-color: rgba(255, 255, 255, .3); }
.btn-danger:hover { background: #fdecea; color: var(--danger); border-color: #f3b6b0; }


/* ==========================================================================
   Wizard
   ========================================================================== */
.steps {
  list-style: none;
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  flex-wrap: wrap;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: .85rem;
  font-weight: 600;
}

.steps li span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  font-size: .78rem;
}

.steps li.is-active {
  background: var(--green-700);
  border-color: var(--green-700);
  color: #fff;
}
.steps li.is-active span { background: rgba(255, 255, 255, .25); border-color: transparent; color: #fff; }
.steps li.is-done { border-color: var(--green-500); color: var(--green-700); }
.steps li.is-done span { background: var(--green-100); border-color: var(--green-500); color: var(--green-700); }

.wizard-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin: 0;
}

.wizard-panel legend {
  font-weight: 700;
  font-size: .95rem;
  padding: 2px 8px;
  color: var(--green-900);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  font: inherit;
  font-size: .9rem;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(31, 138, 76, .16);
}
textarea { resize: vertical; font-family: inherit; }

.form-error {
  margin: 12px 0 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: #fdecea;
  color: var(--danger);
  font-size: .85rem;
  font-weight: 600;
}

/* ==========================================================================
   Lijst met posities / bank in de wizard
   ========================================================================== */
.row {
  display: grid;
  grid-template-columns: 84px 1fr 1fr 56px 30px;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
}
.row-head {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--ink-soft);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.row-head span { padding: 0 2px; }
.row-col.num { text-align: center; }

/* Rijen met wisselspelers hebben geen positielabel-kolom. */
.row.row--bank { grid-template-columns: 84px 1fr 56px 30px; }

.pos-num, .bench-num { text-align: center; }

/* Uitgeschakelde vakjes (voorbeeldweergave) mogen niet vaag lijken. */
.player-box:disabled, .bench-box:disabled {
  opacity: 1;
  -webkit-text-fill-color: currentColor;
  color: var(--ink);
}

@media (max-width: 560px) {
  .row.row--bank { grid-template-columns: 68px 1fr 44px 26px; }
}

/* Editor voor eigen regels in stap 1 (zie wizard.js). */
.row.row--lines { grid-template-columns: 116px 1fr 72px 30px 30px 30px; }

.field-lines {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.line-kind, .line-name, .line-count { font-size: .85rem; padding: 6px 8px; }
.line-count { text-align: center; }

.line-btn {
  border: none;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: .95rem;
  line-height: 1;
  padding: 4px;
  border-radius: 6px;
}
.line-btn:hover { background: var(--green-100); color: var(--green-700); }
.line-btn:disabled { opacity: .25; cursor: default; background: none; }

.lines-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.lines-actions .hint { margin: 0; }

@media (max-width: 560px) {
  .row.row--lines { grid-template-columns: 92px 1fr 56px 26px 26px 26px; }
}

.row-tag {
  font-size: .7rem;
  font-weight: 700;
  text-align: center;
  padding: 4px 2px;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-tag.line-keeper { background: #fff2cc; color: #8a6100; }
.row-tag.line-defense { background: #dbeafe; color: #1d4ed8; }
.row-tag.line-mid { background: #dcfce7; color: #15803d; }
.row-tag.line-attack { background: #fee2e2; color: #b91c1c; }
.row-tag.line-custom { background: #e2e8f0; color: #475569; }

.row-remove {
  border: none;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 4px;
  border-radius: 6px;
}
.row-remove:hover { background: #fdecea; color: var(--danger); }
.row-remove:disabled { opacity: .25; cursor: default; background: none; }

.position-list { max-height: 46vh; overflow: auto; padding-right: 4px; }

.paste-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.preview-title {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

@media (max-width: 560px) {
  .paste-row { grid-template-columns: 1fr; }
  .row { grid-template-columns: 68px 1fr 1fr 44px 26px; gap: 6px; }
}

/* ==========================================================================
   Het veld
   ========================================================================== */
.pitch-wrap { max-width: 560px; }

.pitch {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 8%, rgba(0,0,0,.04) 8% 16%),
    linear-gradient(180deg, #2f9a58 0%, #1f7d45 55%, #1a6b3b 100%);
  border: 3px solid #0d3b23;
  box-shadow: var(--shadow-md);
}

.pitch-wrap.is-preview .pitch { box-shadow: var(--shadow-sm); }

.pitch-markings { position: absolute; inset: 0; pointer-events: none; }
.pitch-markings i { position: absolute; border: 2px solid rgba(255, 255, 255, .55); }
.pitch-markings .m-half { left: 0; right: 0; top: 50%; height: 0; border-width: 0; border-top: 2px solid rgba(255,255,255,.55); }
.pitch-markings .m-circle {
  left: 50%; top: 50%; width: 26%; aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, -50%);
}
.pitch-markings .m-23 { left: 0; right: 0; height: 0; border-width: 0; border-top: 2px dashed rgba(255,255,255,.4); }
.pitch-markings .m-23-top { top: 22%; }
.pitch-markings .m-23-bottom { top: 78%; }
.pitch-markings .m-d {
  left: 50%; width: 30%; aspect-ratio: 2 / 1; border-radius: 50%;
}
.pitch-markings .m-d-top { top: -15%; transform: translateX(-50%); }
.pitch-markings .m-d-bottom { bottom: -15%; transform: translateX(-50%); }
.pitch-markings .m-goal {
  left: 50%; width: 12%; height: 2.5%; transform: translateX(-50%);
  background: rgba(255,255,255,.8); border: none; border-radius: 2px;
}
.pitch-markings .m-goal-top { top: 0; }
.pitch-markings .m-goal-bottom { bottom: 0; }

.pitch-empty { display: grid; place-items: center; height: 100%; color: #fff; font-weight: 600; }

/* ==========================================================================
   Vakjes van spelers
   ========================================================================== */
.player-box {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 22%;
  max-width: 106px;
  min-width: 58px;
  padding: 6px 4px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  border: 2px solid rgba(255, 255, 255, .85);
  border-left-width: 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .95);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
  transition: transform .1s, box-shadow .1s, border-color .1s;
}
.player-box:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }
.player-box:focus-visible { outline: 3px solid #facc15; outline-offset: 2px; }
.player-box.is-static { cursor: default; }

.player-box.line-keeper { border-left-color: #f0b100; }
.player-box.line-defense { border-left-color: #2563eb; }
.player-box.line-mid { border-left-color: #15803d; }
.player-box.line-attack { border-left-color: #dc2626; }
.player-box.line-custom { border-left-color: #64748b; }

.player-box .box-pos {
  font-size: .58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--ink-soft);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.player-box .box-name {
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.15;
  word-break: break-word;
  max-width: 100%;
}

.player-box .box-num {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--green-900);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
}
.player-box .box-num:empty { display: none; }

.player-box.is-empty .box-name { color: var(--ink-soft); font-weight: 600; font-style: italic; }

.player-box.is-selected {
  border-color: #facc15;
  box-shadow: 0 0 0 4px rgba(250, 204, 21, .55), 0 6px 16px rgba(0, 0, 0, .3);
  transform: translate(-50%, -50%) scale(1.06);
  z-index: 5;
}

.player-box.is-target { border-color: #facc15; border-style: dashed; }

/* ==========================================================================
   Bank
   ========================================================================== */
.bench {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 76px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.bench-empty { color: var(--ink-soft); font-size: .85rem; font-style: italic; }

.bench-box {
  position: relative;
  width: 118px;
  min-height: 62px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 2px solid var(--line);
  border-left-width: 5px;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.bench-box:hover { border-color: var(--green-500); }
.bench-box:focus-visible { outline: 3px solid rgba(37, 99, 235, .45); outline-offset: 1px; }

.bench-box .box-pos { display: none; }
.bench-box .box-name { font-size: .85rem; font-weight: 700; word-break: break-word; }
.bench-box.is-empty { border-left-color: var(--line); background: #fbfcfb; }
.bench-box.is-empty .box-name { color: var(--ink-soft); font-weight: 600; font-style: italic; }

.bench-box.is-selected {
  border-color: #facc15;
  box-shadow: 0 0 0 4px rgba(250, 204, 21, .5);
  transform: translateY(-2px);
}
.bench-box.is-target { border-style: dashed; }

/* ==========================================================================
   Bord, klok en wissellog
   ========================================================================== */
.board-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.clock { display: flex; align-items: center; gap: 8px; }
.clock-time {
  font-variant-numeric: tabular-nums;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green-900);
  min-width: 78px;
}

.board-status { margin: 0; font-size: .85rem; color: var(--ink-soft); font-weight: 600; }

.board-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(280px, 400px);
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .board-grid { grid-template-columns: 1fr; }
}

.board-main .pitch-wrap { max-width: 620px; }
.board-side { display: flex; flex-direction: column; gap: 14px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
}
.panel h2 {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head .btn { text-transform: none; letter-spacing: 0; }

.sub-log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow: auto;
}
.sub-log li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--line);
  font-size: .85rem;
}
.sub-log li:last-child { border-bottom: none; }
.sub-log .log-min {
  flex: 0 0 auto;
  min-width: 38px;
  text-align: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-700);
  font-weight: 700;
  font-size: .72rem;
}
.sub-log .log-out { color: var(--danger); font-weight: 600; }
.sub-log .log-arrow { color: var(--ink-soft); }
.sub-log .log-in { color: var(--green-700); font-weight: 700; }
.sub-log .log-pos { margin-left: auto; font-size: .72rem; color: var(--ink-soft); }

/* Wisselteller: pilletje op de vakjes en de tabel in de zijkolom. */
.box-subs {
  display: inline-block;
  min-width: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--green-700);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
}

.player-box .box-subs {
  position: absolute;
  right: -7px;
  bottom: -7px;
}

.bench-box .box-subs { margin-top: 2px; }

.sub-count {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.sub-count th,
.sub-count td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.sub-count th {
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-soft);
}

.sub-count .sc-num { text-align: right; white-space: nowrap; }
.sub-count .sc-total { font-weight: 700; }
.sub-count tr.is-bench .sc-name { color: var(--ink-soft); font-style: italic; }
.sub-count tbody tr:last-child td { border-bottom: none; }

/* ==========================================================================
   Printen
   ========================================================================== */
@media print {
  body { background: #fff; }
  .app-header, .board-bar, .btn, .hint, #wizard { display: none !important; }
  main { padding: 0; max-width: none; }
  .board-grid { grid-template-columns: 1.1fr .9fr; gap: 12px; }
  .panel, .pitch { box-shadow: none; }
  .pitch { border-color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bench { min-height: 0; }
  .sub-log { max-height: none; }
  .box-subs { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sub-count { font-size: .78rem; }
}





.wizard-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.wizard-split {
  display: grid;
  grid-template-columns: 1.25fr .9fr;
  gap: 22px;
  align-items: start;
  margin-top: 12px;
}
@media (max-width: 860px) {
  .wizard-split { grid-template-columns: 1fr; }
}

.wizard-col { min-width: 0; }
