/* Tactics board UI (tlb-*): head band, stage with pitch on the left, editing
   column on the right with the mode toggle on top. Used by the match lineup
   editor; the drawing engine stays static/js/tactics-board.js, the UI state
   (mode, zoom, 3D, figures) comes from static/js/tactics-board-ui.js. */

.tlb { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; overflow-y: auto; background: #fff; font-family: 'Inter', system-ui, sans-serif; color: #111827; }

/* Head band (like the trainer desktop pages) */
.tlb-head { flex-shrink: 0; background: color-mix(in srgb, var(--brand-button, #2F7D6A) 12%, white); padding: 14px 20px; }
.tlb-head__in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.tlb-head__left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tlb-h1 { margin: 0; font-size: 24px; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.tlb-h1 small { font-size: 16px; font-weight: 600; color: #4b5563; letter-spacing: 0; }
.tlb-sub { margin: 2px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: #6b7280; }
.tlb-sub .is-ok { color: #15803d; }
.tlb-sub .is-err { color: #b91c1c; }
.tlb-head__right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tlb-pill { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 16px; border-radius: 999px; background: rgba(255, 255, 255, .85); color: #111827; font-size: 14px; font-weight: 600; white-space: nowrap; text-decoration: none; transition: background-color .15s ease, opacity .15s ease; }
.tlb-pill:hover { background: #fff; color: #111827; }
.tlb-pill svg { width: 18px; height: 18px; flex-shrink: 0; }
.tlb-pill[aria-pressed="true"] { background: #111827; color: #fff; }
.tlb-pill--brand { background: var(--brand-button, #2F7D6A); color: #fff; box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--brand-button, #2F7D6A) 70%, transparent); }
.tlb-pill--brand:hover { background: var(--brand-button, #2F7D6A); color: #fff; opacity: .92; }

/* Work area */
.tlb-work { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-areas: "stage seg" "stage side"; grid-template-rows: auto 1fr; gap: 14px 24px; padding: 16px 20px 20px; }
.tlb-seg-wrap { grid-area: seg; }
.tlb-seg { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 4px; border-radius: 12px; background: #f3f4f6; }
.tlb-seg__pill { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3); border-radius: 9px; background: var(--brand-button, #2F7D6A); box-shadow: 0 1px 2px rgba(15, 23, 42, .15); transition: transform .38s cubic-bezier(.34, 1.4, .5, 1); }
.tlb-seg--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tlb-seg--2 .tlb-seg__pill { width: calc((100% - 8px) / 2); }
.tlb-seg button { position: relative; z-index: 1; min-height: 40px; border-radius: 9px; font-size: 14px; font-weight: 600; color: #6b7280; transition: color .2s ease; }
.tlb-seg button[aria-selected="true"] { color: #fff; }

.tlb-stage { grid-area: stage; position: relative; min-width: 0; min-height: 0; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 22px; background: radial-gradient(120% 90% at 50% 40%, #f4f7f6, #e7eeeb); touch-action: none; }
.tlb-stage.is-zoomed { cursor: grab; }
.tlb-stage.is-panning { cursor: grabbing; }
.tlb-pitchview { position: relative; width: min(calc(100% - 32px), calc((100vh - 170px) * 0.75)); }
.tlb-pitchview.is-3d { perspective: 1200px; perspective-origin: 50% -10%; cursor: grab; }
.tlb-frame { position: relative; padding: 14px; border-radius: 18px; background: #256c31; box-shadow: 0 22px 44px -26px rgba(15, 40, 25, .65); transform-style: preserve-3d; }
.tlb-frame.is-cam { transition: transform .7s cubic-bezier(.2, .7, .2, 1); }
.tlb-field { position: relative; width: 100%; aspect-ratio: 105 / 140; transform-style: preserve-3d; }
/* isolation flattens 3D children in most browsers: only in the flat view */
.tlb-pitchview:not(.is-3d) .tlb-field { isolation: isolate; }
.tlb-field > svg.tlb-markings { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.tlb-pitchview.is-3d .tlb-field { pointer-events: none; }
.tlb-slots { position: absolute; inset: 0; z-index: 60; pointer-events: none; transform-style: preserve-3d; }

.tlb-zoom { position: absolute; right: 14px; top: 14px; z-index: 35; display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, .94); box-shadow: 0 8px 20px -12px rgba(0, 0, 0, .5); }
.tlb-zoom button { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: #111827; }
.tlb-zoom button:hover { background: #f3f4f6; }
.tlb-zoom svg { width: 16px; height: 16px; }

/* Player figures (the app's SVG players) */
.tlb-fig { position: absolute; display: flex; flex-direction: column; align-items: center; transform-origin: 50% 100%; }
.tlb-fig img { display: block; width: calc(var(--u, 4px) * 8.2); height: auto; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); transition: transform .15s ease; }
.tlb-fig__tag { position: absolute; left: 50%; top: calc(100% - var(--u, 4px) * .6); transform: translateX(-50%); display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px 1px 2px; border-radius: 999px; background: rgba(17, 24, 39, .8); color: #fff; font-size: max(9px, calc(var(--u, 4px) * 2.2)); font-weight: 700; line-height: 1.35; white-space: nowrap; pointer-events: none; }
.tlb-fig__tag b { min-width: 1.5em; padding: 0 3px; border-radius: 999px; background: #fff; color: #111827; text-align: center; font-weight: 800; }
.tlb-fig.is-absent .tlb-fig__tag { background: #dc2626; }
.tlb-fig__cap { position: absolute; right: calc(var(--u, 4px) * -.6); top: calc(var(--u, 4px) * .8); width: calc(var(--u, 4px) * 3); height: calc(var(--u, 4px) * 3); min-width: 14px; min-height: 14px; border-radius: 999px; background: #facc15; color: #3b2f00; font-size: max(8px, calc(var(--u, 4px) * 1.8)); font-weight: 800; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.tlb-fig__x { position: absolute; top: 0; right: calc(var(--u, 4px) * -1.4); width: 20px; height: 20px; border-radius: 999px; background: #fff; color: #6b7280; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); opacity: 0; transition: opacity .15s ease; }
.tlb-fig__x svg { width: 12px; height: 12px; }
.tlb-fig:hover .tlb-fig__x, .tlb-fig:focus-within .tlb-fig__x { opacity: 1; }
.tlb-fig__x:hover { color: #dc2626; }
@media (hover: none) { .tlb-fig__x { opacity: 1; } }
.tlb-fig.is-hover img { transform: scale(1.12); }
.tlb-fig.is-dragging img { transform: scale(1.1); }
.tlb-pitchview.is-3d .tlb-fig img { width: calc(var(--u, 4px) * 13); }
/* Drawing and animating: smaller figures leave room for lines and arrows */
.tlb-pitchview.is-compact:not(.is-3d) .tlb-fig img { width: calc(var(--u, 4px) * 5.4); }
.tlb-pitchview.is-compact:not(.is-3d) .tlb-fig__tag { padding: 0 2px; font-size: max(8px, calc(var(--u, 4px) * 1.7)); }
.tlb-pitchview.is-compact:not(.is-3d) .tlb-fig__tag > span, .tlb-pitchview.is-compact .tlb-fig__x { display: none; }
.tlb-pitchview.is-compact:not(.is-3d) .tlb-fig__cap { width: calc(var(--u, 4px) * 2.2); height: calc(var(--u, 4px) * 2.2); min-width: 11px; min-height: 11px; font-size: 8px; }
.tlb-pitchview.is-3d.is-compact .tlb-fig img { width: calc(var(--u, 4px) * 9); }
.tlb-fig.is-active img { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 3px var(--brand-button, #2F7D6A)) drop-shadow(0 0 2px var(--brand-button, #2F7D6A)); }
.tlb-pitchview.is-3d .tlb-fig__tag, .tlb-pitchview.is-3d .tlb-fig__cap { display: none; }
/* 3D name tags: flat layer in the stage, positioned by _placeTags() */
.tlb-tags { position: absolute; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.tlb-tag3d { position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px 1px 2px; border-radius: 999px; background: rgba(17, 24, 39, .82); color: #fff; font-size: 12px; font-weight: 700; line-height: 1.4; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.tlb-tag3d b { min-width: 1.5em; padding: 0 3px; border-radius: 999px; background: #fff; color: #111827; text-align: center; font-weight: 800; }
.tlb-tag3d i { width: 1.4em; height: 1.4em; border-radius: 999px; background: #facc15; color: #3b2f00; font-style: normal; font-size: 10px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.tlb-tag3d.is-absent { background: #dc2626; }
.tlb-fig__tag.is-num, .tlb-tag3d.is-num { padding: 1px 2px; }
.tlb-pitchview.is-3d .tlb-fig__x { display: none; }

.tlb-standee { position: absolute; transform-origin: 50% 100%; pointer-events: none; }
.tlb-standee img { display: block; height: calc(var(--u, 4px) * var(--sh, 6)); width: auto; max-width: none; background: transparent; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .35)); }
.tlb-empty { position: relative; width: calc(var(--u, 4px) * 8.6); height: calc(var(--u, 4px) * 8.6); min-width: 34px; min-height: 34px; border-radius: 999px; border: 2px dashed rgba(255, 255, 255, .9); background: rgba(255, 255, 255, .14); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; cursor: pointer; transition: transform .15s ease, background-color .15s ease; }
.tlb-empty:hover { background: rgba(255, 255, 255, .24); transform: scale(1.06); }
.tlb-empty span { font-size: max(14px, calc(var(--u, 4px) * 4.2)); font-weight: 300; }
.tlb-empty small { font-size: max(9px, calc(var(--u, 4px) * 2.1)); font-weight: 800; letter-spacing: .02em; }
.tlb-pitchview.is-3d .tlb-empty { display: none; }

.tlb-pick-chip { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 80; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 20px); padding: 6px 6px 6px 14px; border-radius: 999px; background: rgba(17, 24, 39, .88); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; }
.tlb-pick-chip span { overflow: hidden; text-overflow: ellipsis; }
.tlb-pick-chip button { width: 28px; height: 28px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .15); }
.tlb-empty-field { position: absolute; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 24px; }

/* Editing column */
.tlb-side { grid-area: side; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; padding: 2px 2px 12px; }
.tlb-group { display: flex; flex-direction: column; gap: 10px; }
.tlb-group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
/* Collapsible groups (tactics-board-ui.js): tap the head to fold */
.tlb-collapse-head { display: flex; align-items: center; gap: 8px; min-height: 36px; margin: -6px 0; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.tlb-collapse-head > .tlb-label, label.tlb-collapse-head, span.tlb-collapse-head { margin-right: auto; }
.tlb-collapse-head::after { content: ''; flex-shrink: 0; width: 7px; height: 7px; margin: -3px 4px 0 4px; border-right: 2px solid #9ca3af; border-bottom: 2px solid #9ca3af; transform: rotate(45deg); transition: transform .15s ease; }
.tlb-collapse-head:hover::after { border-color: #111827; }
.tlb-collapse-head:focus-visible { outline: 2px solid var(--brand-button, #2F7D6A); outline-offset: 2px; border-radius: 6px; }
.tlb-group.is-collapsed > .tlb-collapse-head::after { transform: rotate(-45deg); margin-top: 0; }
.tlb-group.is-collapsed > :not(.tlb-collapse-head) { display: none !important; }
.tlb-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6b7280; }
.tlb-count { font-size: 13px; color: #6b7280; font-variant-numeric: tabular-nums; }
.tlb-count b { color: #111827; }
.tlb-link { min-height: 32px; padding: 0 8px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--brand-button, #2F7D6A); }
.tlb-link:hover { background: color-mix(in srgb, var(--brand-button, #2F7D6A) 10%, white); }
.tlb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 16px; border-radius: 12px; background: #f3f4f6; font-size: 14px; font-weight: 600; color: #111827; transition: background-color .15s ease, opacity .15s ease; }
.tlb-btn:hover { background: #e5e7eb; }
.tlb-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.tlb-btn[disabled] { opacity: .45; cursor: not-allowed; }
.tlb-btn--brand { background: var(--brand-button, #2F7D6A); color: #fff; }
.tlb-btn--brand:hover { background: var(--brand-button, #2F7D6A); opacity: .92; }
.tlb-btn--danger { background: #fff; color: #dc2626; border: 1px solid #fecaca; }
.tlb-btn--danger:hover { background: #fef2f2; }
.tlb-btn--full { width: 100%; }
.tlb-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tlb-row > .tlb-btn { flex: 1 1 0; }

/* Formation dropdown */
.tlb-fdrop { position: relative; }
.tlb-fdrop__btn { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 14px 8px 10px; border-radius: 14px; border: 1px solid #e5e7eb; text-align: left; background: #fff; }
.tlb-fdrop__btn:hover, .tlb-fdrop__btn[aria-expanded="true"] { border-color: var(--brand-button, #2F7D6A); }
.tlb-fdrop__btn > span:not(.ttw-mini) { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.tlb-fdrop__btn b { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.tlb-fdrop__btn small, .tlb-fdrop__opt small { font-size: 12px; color: #6b7280; }
.tlb-fdrop__btn > svg { width: 18px; height: 18px; color: #6b7280; }
.tlb-fdrop__menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40; max-height: min(60vh, 520px); overflow-y: auto; padding: 6px; border-radius: 14px; background: #fff; border: 1px solid #e5e7eb; box-shadow: 0 24px 48px -24px rgba(15, 23, 42, .45); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.tlb-fdrop__grp { grid-column: 1 / -1; padding: 8px 8px 2px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6b7280; }
.tlb-fdrop__opt { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 8px; border-radius: 10px; text-align: left; }
.tlb-fdrop__opt:hover { background: #f3f4f6; }
.tlb-fdrop__opt[aria-selected="true"] { background: color-mix(in srgb, var(--brand-button, #2F7D6A) 12%, white); }
.tlb-fdrop__opt > span:not(.ttw-mini) { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.tlb-fdrop__opt b { font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tlb-fdrop__foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 4px 2px; border-top: 1px solid #f3f4f6; margin-top: 4px; }
.tlb-fdrop__foot .tlb-btn { min-height: 38px; font-size: 13px; padding: 0 12px; }

/* Player list and bench */
.tlb-players { display: flex; flex-direction: column; gap: 6px; }
.tlb-player { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 4px 10px 4px 4px; border-radius: 12px; border: 1px solid #e5e7eb; background: #fff; cursor: grab; user-select: none; transition: border-color .15s ease, opacity .15s ease; }
.tlb-player:hover { border-color: var(--brand-button, #2F7D6A); }
.tlb-player.is-on { opacity: .45; cursor: default; }
.tlb-player.is-selected { border-color: #facc15; box-shadow: 0 0 0 2px #facc15; }
.tlb-player.is-absent { border-color: #fecaca; background: #fef2f2; }
.tlb-player img { width: 30px; height: 42px; object-fit: contain; flex-shrink: 0; pointer-events: none; }
.tlb-player__name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.tlb-player__name b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tlb-player__name small { font-size: 12px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tlb-tag { flex-shrink: 0; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #f3f4f6; color: #6b7280; }
.tlb-tag--red { background: #fee2e2; color: #b91c1c; }
.tlb-tag--brand { background: color-mix(in srgb, var(--brand-button, #2F7D6A) 12%, white); color: var(--brand-button, #2F7D6A); }
.tlb-bench { min-height: 64px; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 14px; border: 1px dashed #d1d5db; }
.tlb-bench__empty { margin: auto; font-size: 13px; color: #9ca3af; }
.tlb-input { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid #e5e7eb; background: #fff; font: inherit; font-size: 14px; color: #111827; resize: vertical; }
.tlb-input:focus { outline: 2px solid var(--brand-button, #2F7D6A); outline-offset: 1px; border-color: transparent; }
.tlb-field-label { margin-bottom: -4px; font-size: 12px; font-weight: 600; color: #6b7280; }
.tlb-empty-card { max-width: 340px; padding: 22px 20px; border-radius: 18px; background: rgba(255, 255, 255, .96); box-shadow: 0 12px 32px rgba(0, 0, 0, .25); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tlb-empty-card h2 { margin: 0; font-size: 17px; font-weight: 700; color: #111827; }
.tlb-empty-card p { margin: 0 0 4px; font-size: 13px; line-height: 1.45; color: #6b7280; }
.tlb-textarea { width: 100%; min-height: 96px; padding: 10px 12px; border-radius: 12px; border: 1px solid #e5e7eb; font: inherit; font-size: 14px; resize: vertical; }
.tlb-textarea:focus { outline: 2px solid var(--brand-button, #2F7D6A); outline-offset: 1px; border-color: transparent; }

/* Drawings list */
.tlb-sheets { display: flex; flex-direction: column; gap: 6px; }
.tlb-sheet { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; border: 1px solid #e5e7eb; }
.tlb-sheet.is-on { border-color: var(--brand-button, #2F7D6A); background: color-mix(in srgb, var(--brand-button, #2F7D6A) 10%, white); }
.tlb-sheet__main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 4px 9px; border-radius: 9px; text-align: left; }
.tlb-sheet__main svg { width: 16px; height: 16px; color: #6b7280; flex-shrink: 0; }
.tlb-sheet__main span { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.tlb-sheet__main b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tlb-sheet__main small { font-size: 12px; color: #6b7280; }
.tlb-sheet__ic { flex-shrink: 0; width: 38px; height: 38px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: #6b7280; }
.tlb-sheet__ic:hover { background: #fff; color: #dc2626; }
.tlb-sheet__ic svg { width: 17px; height: 17px; }
.tlb-sheet__ic--play { color: var(--brand-button, #2F7D6A); }
.tlb-sheet__ic--play:hover { color: var(--brand-button, #2F7D6A); background: color-mix(in srgb, var(--brand-button, #2F7D6A) 10%, white); }

/* Tools, colors, material */
.tlb-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
/* Tools look like the exercise drawing editor: icon tile + label */
.tlb-tool { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 10px 0 8px; border-radius: 12px; border: 1px solid transparent; font-size: 14px; font-weight: 500; color: #4b5563; text-align: left; transition: background-color .15s ease, color .15s ease; }
.tlb-tool:hover { background: #f9fafb; color: #111827; }
.tlb-tool[aria-pressed="true"] { background: color-mix(in srgb, var(--brand-button, #2F7D6A) 10%, white); color: var(--brand-button, #2F7D6A); font-weight: 600; }
.tlb-tool svg { width: 18px; height: 18px; flex-shrink: 0; }
.tlb-tool__ic { flex-shrink: 0; width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: #f3f4f6; }
.tlb-tool:hover .tlb-tool__ic { background: #e5e7eb; }
.tlb-tool[aria-pressed="true"] .tlb-tool__ic { background: color-mix(in srgb, var(--brand-button, #2F7D6A) 16%, white); }
.tlb-tool__ic img { height: 26px; width: auto; background: transparent; }
.tlb-tools--3 .tlb-tool, .tlb-element .tlb-tool { border-color: #e5e7eb; }
.tlb-tools--3 .tlb-tool[aria-pressed="true"], .tlb-element .tlb-tool[aria-pressed="true"] { border-color: var(--brand-button, #2F7D6A); }

/* Direction of a player graphic */
.tlb-compass { display: grid; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(3, 72px); gap: 6px; justify-content: center; }
.tlb-compass__cell { display: flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid #e5e7eb; background: #fff; transition: border-color .15s ease, background-color .15s ease; }
.tlb-compass__cell:hover:not([disabled]) { border-color: var(--brand-button, #2F7D6A); }
.tlb-compass__cell[aria-pressed="true"] { border-color: var(--brand-button, #2F7D6A); box-shadow: 0 0 0 1px var(--brand-button, #2F7D6A); background: color-mix(in srgb, var(--brand-button, #2F7D6A) 8%, white); }
.tlb-compass__cell.is-center { background: #2f8b3d; border-color: #2f8b3d; cursor: default; }
.tlb-compass__cell img { height: 56px; width: auto; background: transparent; pointer-events: none; }
.tlb-compass__cell.is-center img { height: 64px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }

/* Position of a lineup player on a small pitch */
.tlb-posmap { position: relative; width: 100%; max-width: 260px; margin: 0 auto; aspect-ratio: 105 / 140; border-radius: 12px; background: #2f8b3d linear-gradient(to bottom, transparent calc(50% - 1px), rgba(255, 255, 255, .45) calc(50% - 1px), rgba(255, 255, 255, .45) calc(50% + 1px), transparent calc(50% + 1px)); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .45); }
.tlb-posmap::before, .tlb-posmap::after { content: ''; position: absolute; left: 22%; right: 22%; height: 14%; border: 2px solid rgba(255, 255, 255, .45); }
.tlb-posmap::before { top: 0; border-top: 0; }
.tlb-posmap::after { bottom: 0; border-bottom: 0; }
.tlb-posmap__pos { position: absolute; z-index: 1; transform: translate(-50%, -50%); min-width: 34px; height: 26px; padding: 0 5px; border-radius: 999px; background: rgba(255, 255, 255, .25); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .02em; transition: background-color .15s ease, transform .15s ease; }
.tlb-posmap__pos.is-group { background: rgba(255, 255, 255, .9); color: #14532d; }
.tlb-posmap__pos:hover { transform: translate(-50%, -50%) scale(1.08); background: #fff; color: #14532d; }
.tlb-posmap__pos[aria-pressed="true"] { background: #facc15; color: #3b2f00; box-shadow: 0 0 0 2px #fff; }
.tlb-tools--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tlb-tools--3 .tlb-tool { justify-content: center; padding: 0 6px; font-size: 13px; }
.tlb-colors { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.tlb-swatch { width: 36px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.tlb-swatch span { width: 20px; height: 20px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.tlb-swatch[aria-pressed="true"] span { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111827; }
.tlb-icbtn { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: #4b5563; }
.tlb-icbtn:hover { background: #f3f4f6; color: #111827; }
.tlb-icbtn svg { width: 20px; height: 20px; }
.tlb-material { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tlb-mtile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 6px; border-radius: 12px; border: 1px solid #e5e7eb; font-size: 11px; font-weight: 600; color: #374151; line-height: 1.2; text-align: center; }
.tlb-mtile:hover { border-color: var(--brand-button, #2F7D6A); }
.tlb-mtile[aria-pressed="true"] { border-color: var(--brand-button, #2F7D6A); box-shadow: 0 0 0 1px var(--brand-button, #2F7D6A); background: color-mix(in srgb, var(--brand-button, #2F7D6A) 8%, white); }
.tlb-mtile img { height: 34px; width: auto; max-width: 46px; object-fit: contain; background: transparent; pointer-events: none; }
.tlb-hint { margin: 0; font-size: 12px; color: #6b7280; }
/* Visibility per animation step */
.tlb-vislist { display: flex; flex-direction: column; border-top: 1px solid #f3f4f6; }
.tlb-visrow { display: flex; align-items: center; border-bottom: 1px solid #f3f4f6; }
.tlb-visrow__name { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 4px; font-size: 14px; color: #111827; text-align: left; }
.tlb-visrow__name i { width: 12px; height: 12px; border-radius: 999px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.tlb-visrow__name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tlb-visrow__eye { width: 44px; height: 44px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: #111827; flex-shrink: 0; }
.tlb-visrow__eye:hover { background: #f3f4f6; }
.tlb-visrow__eye svg { width: 20px; height: 20px; }
.tlb-visrow.is-off .tlb-visrow__name { color: #9ca3af; }
.tlb-visrow.is-off .tlb-visrow__eye { color: #9ca3af; }
.tlb-visrow.is-selected .tlb-visrow__name { font-weight: 600; }

/* Selected element */
.tlb-element { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; background: #f9fafb; border: 1px solid #e5e7eb; }

/* Tactic plays */
.tlb-plays { display: flex; flex-direction: column; gap: 6px; }
.tlb-play { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; border: 1px solid #e5e7eb; }
.tlb-play.is-linked { border-color: var(--brand-button, #2F7D6A); }
.tlb-play__thumb { position: relative; flex-shrink: 0; width: 44px; height: 58px; border-radius: 6px; overflow: hidden; background: #2D7A1C; }
.tlb-play__thumb img { width: 100%; height: 100%; object-fit: cover; background: transparent; }
.tlb-play__anim { position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px; border-radius: 999px; background: rgba(17, 24, 39, .85); color: #fff; display: flex; align-items: center; justify-content: center; }
.tlb-play__anim svg { width: 9px; height: 9px; }
.tlb-play__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tlb-play__body b { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tlb-play__acts { display: flex; gap: 4px; }
.tlb-play__acts button { flex: 1; min-height: 32px; padding: 0 8px; border-radius: 8px; font-size: 12px; font-weight: 600; background: #f3f4f6; color: #374151; }
.tlb-play__acts button:hover { background: #e5e7eb; }
.tlb-play__acts button[data-linked="1"] { background: #111827; color: #fff; }

/* Animation panel */
.tlb-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.tlb-stepbar { position: sticky; top: -2px; z-index: 5; display: flex; flex-direction: column; gap: 10px; margin: -2px -2px 0; padding: 4px 2px 12px; background: #fff; border-bottom: 1px solid #f3f4f6; }
.tlb-stepbar__play { display: flex; align-items: center; gap: 10px; }
.tlb-stepbar__play .tlb-scrub { flex: 1; min-width: 0; }
.tlb-icbtn--brand { width: 44px; height: 44px; border-radius: 999px; background: var(--brand-button, #2F7D6A); color: #fff; flex-shrink: 0; }
.tlb-icbtn--brand:hover { background: var(--brand-button, #2F7D6A); color: #fff; filter: brightness(1.08); }
.tlb-visall { display: inline-flex; gap: 2px; }
.tlb-visall button { min-height: 32px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #374151; }
.tlb-visall button:hover { background: #f3f4f6; color: #111827; }
.tlb-step { width: 44px; height: 44px; border-radius: 12px; font-weight: 800; font-size: 16px; background: #f3f4f6; }
.tlb-step[aria-pressed="true"] { background: var(--brand-button, #2F7D6A); color: #fff; }
.tlb-step--add { background: transparent; border: 1px dashed #d1d5db; color: #6b7280; font-size: 22px; font-weight: 400; }
.tlb-scrub { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #6b7280; font-variant-numeric: tabular-nums; }
.tlb-scrub input { flex: 1; min-width: 0; accent-color: #111827; }
.tlb-stepper { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 12px; border-radius: 12px; background: #f3f4f6; font-size: 13px; color: #6b7280; }
.tlb-stepper button { width: 34px; height: 34px; border-radius: 9px; font-size: 18px; font-weight: 600; color: #374151; }
.tlb-stepper button:hover { background: #fff; }
.tlb-stepper b { min-width: 44px; text-align: center; color: #111827; font-variant-numeric: tabular-nums; }
.tlb-guide { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 14px; background: #111827; color: #fff; font-size: 13px; line-height: 1.4; }
.tlb-guide i { flex-shrink: 0; width: 8px; height: 8px; margin-top: 5px; border-radius: 999px; background: #facc15; }
.tlb-guide button { flex-shrink: 0; margin-left: auto; width: 26px; height: 26px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .12); }
.tlb-guide button svg { width: 13px; height: 13px; }

/* Phones and tablets: toggle, stage, column stacked */
@media (max-width: 1023px) {
    .tlb-work { flex: none; grid-template-columns: minmax(0, 1fr); grid-template-areas: "seg" "stage" "side"; grid-template-rows: auto auto auto; padding: 12px 12px 24px; }
    .tlb-stage { height: auto; min-height: 0; padding: 12px 0; border-radius: 18px; }
    .tlb-pitchview { width: min(calc(100% - 16px), 520px); }
    .tlb-side { overflow: visible; }
    .tlb-zoom { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .tlb-seg__pill, .tlb-frame.is-cam { transition: none; }
}
