/* ScrimMate v1.2.0: match history, AI Coach chat, admin AI panel, map recorder, modern practice scheduling. */

/* ---------- Scrims: 3-way mode switch ---------- */
.scrims-mode-switch--3 { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.scrims-mode-switch--3 .scrims-mode-btn { min-width: 0; justify-content: center; padding: 0 6px; gap: 5px; font-size: .86rem; }
.scrims-mode-switch--3 .scrims-mode-btn em { min-width: 18px; padding: 2px 5px; font-size: .68rem; }
.scrims-mode-switch--3 .scrims-mode-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- History ---------- */
.sm-hx { display: grid; gap: 12px; margin-top: 8px; }
.sm-hx-filters { display: grid; gap: 10px; padding: 12px; border-radius: var(--sm-radius-card, 22px); background: var(--sm-glass); border: 1px solid var(--sm-line); }
.sm-hx-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 44px; border-radius: 14px; background: var(--surface-container-high, #202633); border: 1px solid var(--sm-line); }
.sm-hx-search svg { width: 18px; height: 18px; flex: 0 0 auto; opacity: .7; fill: currentColor; }
.sm-hx-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: inherit; font: inherit; outline: none; min-height: 42px; }
.sm-hx-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-container-high, #202633); }
.sm-hx-seg button { min-height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--sm-muted); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
.sm-hx-seg button.is-on { background: var(--sm-accent); color: #111; }
.sm-hx-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.sm-hx-chips::-webkit-scrollbar { display: none; }
.sm-hx-pill { flex: 0 0 auto; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--sm-line); background: transparent; color: var(--sm-text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.sm-hx-pill.is-on { border-color: var(--sm-accent); background: color-mix(in srgb, var(--sm-accent) 16%, transparent); color: var(--sm-text); }
.sm-hx-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sm-hx-select { flex: 1 1 120px; min-width: 0; }
.sm-hx-select select { width: 100%; min-height: 40px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--sm-line); background: var(--surface-container-high, #202633); color: inherit; font: inherit; font-size: 13px; }
.sm-hx-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; font-size: 13px; color: var(--sm-muted); cursor: pointer; }
.sm-hx-toggle input { width: 18px; height: 18px; accent-color: var(--sm-accent); }
.sm-hx-count { margin: 0; font-size: 13px; color: var(--sm-muted); }
.sm-hx-day { margin: 10px 2px 2px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--sm-muted); }
.sm-hx-card { display: grid; gap: 6px; width: 100%; text-align: left; padding: 14px; border-radius: 18px; border: 1px solid var(--sm-line); background: var(--sm-glass); color: inherit; font: inherit; cursor: pointer; transition: transform var(--sm-motion-fast, 140ms), border-color var(--sm-motion-fast, 140ms); }
.sm-hx-card:active { transform: scale(.99); }
.sm-hx-card.is-win { border-color: color-mix(in srgb, var(--sm-accent) 60%, transparent); }
.sm-hx-card.is-ghost { min-height: 110px; cursor: default; background: linear-gradient(90deg, var(--sm-glass), var(--sm-glass-raised), var(--sm-glass)); background-size: 200% 100%; animation: sm-hx-shimmer 1.4s linear infinite; }
@keyframes sm-hx-shimmer { to { background-position: -200% 0; } }
.sm-hx-ghosts { display: grid; gap: 10px; }
.sm-hx-card__top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sm-hx-card__top time { margin-left: auto; font-size: 12px; color: var(--sm-muted); }
.sm-hx-src { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.sm-hx-src.is-practice { background: color-mix(in srgb, #70e0ad 20%, transparent); color: var(--sm-success); }
.sm-hx-src.is-public { background: color-mix(in srgb, #54a0ff 22%, transparent); color: #8cc0ff; }
.sm-hx-type { font-size: 12px; color: var(--sm-muted); white-space: nowrap; }
.sm-hx-title { font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.sm-hx-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--sm-muted); min-width: 0; overflow-wrap: anywhere; }
.sm-hx-meta svg { width: 15px; height: 15px; flex: 0 0 auto; fill: currentColor; opacity: .8; }
.sm-hx-my { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 2px; }
.sm-hx-my span { display: grid; place-items: center; padding: 6px 4px; border-radius: 12px; background: var(--surface-container-high, #202633); }
.sm-hx-my b { font-size: 15px; }
.sm-hx-my small { font-size: 10.5px; color: var(--sm-muted); }
.sm-hx-note { margin: 0; font-size: 12px; color: var(--sm-muted); }
.sm-hx-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.sm-hx-chip { padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.sm-hx-chip.is-ok { background: color-mix(in srgb, #70e0ad 16%, transparent); color: var(--sm-success); }
.sm-hx-chip.is-wait { background: color-mix(in srgb, #f6c445 18%, transparent); color: var(--sm-accent); }
.sm-hx-chip.is-bad { background: color-mix(in srgb, #ff4d5e 18%, transparent); color: var(--sm-danger); }
.sm-hx-open { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--sm-accent); }
.sm-hx-open svg { width: 15px; height: 15px; fill: currentColor; }
.sm-hx-empty { display: grid; justify-items: center; gap: 6px; padding: 28px 12px; text-align: center; color: var(--sm-muted); }
.sm-hx-empty svg { width: 40px; height: 40px; fill: currentColor; opacity: .6; }
.sm-hx-empty h3 { margin: 0; color: var(--sm-text); font-size: 16px; }
.sm-hx-empty p { margin: 0 0 6px; font-size: 13px; }

/* ---------- AI Coach in the inbox ---------- */
.sm-convo--coach { background: color-mix(in srgb, var(--sm-accent) 8%, transparent); border-radius: 16px; }
.sm-coach-av { display: grid !important; place-items: center; background: linear-gradient(135deg, #f6c445, #10b981); color: #111; font-weight: 900; }
.sm-coach-av svg { width: 26px; height: 26px; fill: currentColor; }

/* ---------- AI Coach chat ---------- */
.sm-aichat { display: flex; flex-direction: column; gap: 10px; min-height: calc(100dvh - 140px); }
.sm-aichat__top { display: flex; align-items: center; gap: 8px; }
.sm-aichat__title { display: grid; flex: 1; min-width: 0; }
.sm-aichat__title small { color: var(--sm-muted); font-size: 12px; }
.sm-aichat__log { flex: 1; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: calc(100dvh - 300px); min-height: 240px; padding: 4px 2px; overscroll-behavior: contain; }
.sm-aichat__intro { display: grid; justify-items: center; gap: 4px; padding: 14px 10px 10px; text-align: center; color: var(--sm-muted); }
.sm-aichat__intro h3 { margin: 4px 0 0; color: var(--sm-text); font-size: 16px; }
.sm-aichat__intro p { margin: 0; font-size: 13px; max-width: 34ch; }
.sm-aichat__hero { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: linear-gradient(135deg, #f6c445, #10b981); color: #111; }
.sm-aichat__hero svg { width: 30px; height: 30px; fill: currentColor; }
.sm-aichat__msg { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.sm-aichat__msg.is-own { justify-content: flex-end; }
.sm-aichat__msg.is-pending { opacity: .7; }
.sm-aichat__av { display: grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #f6c445, #10b981); color: #111; font-size: 10px; font-weight: 900; }
.sm-aichat__av svg { width: 17px; height: 17px; fill: currentColor; }
.sm-aichat__bubble { margin: 0; max-width: min(82%, 520px); padding: 10px 13px; border-radius: 18px 18px 18px 6px; background: var(--sm-glass-raised); border: 1px solid var(--sm-line); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; white-space: normal; }
.sm-aichat__msg.is-own .sm-aichat__bubble { border-radius: 18px 18px 6px 18px; background: var(--sm-accent); color: #111; border-color: transparent; }
.sm-aichat__li { display: block; padding-left: 14px; position: relative; }
.sm-aichat__li::before { content: ''; position: absolute; left: 3px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .7; }
.sm-aichat__typing { display: inline-flex; gap: 4px; align-items: center; min-height: 20px; }
.sm-aichat__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--sm-muted); animation: sm-aichat-dot 1s infinite ease-in-out; }
.sm-aichat__typing i:nth-child(2) { animation-delay: .15s; }
.sm-aichat__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes sm-aichat-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }
.sm-aichat__typing-wrap { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.sm-aichat__typing-wrap small { font-size: 12px; color: var(--sm-muted); line-height: 1.3; }
.sm-aichat__msg.is-typing { animation: sm-aichat-in .2s ease-out; }
@keyframes sm-aichat-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sm-aichat__typing i, .sm-aichat__msg.is-typing { animation: none; } }
.sm-aichat__chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.sm-aichat__chips::-webkit-scrollbar { display: none; }
.sm-aichat__chips .sm-chip { flex: 0 0 auto; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--sm-line); background: var(--sm-glass); color: inherit; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.sm-aichat__form { display: flex; align-items: flex-end; gap: 8px; padding: 6px; border-radius: 22px; background: var(--sm-glass-raised); border: 1px solid var(--sm-line); }
.sm-aichat__form textarea { flex: 1; min-width: 0; min-height: 40px; max-height: 140px; resize: none; border: 0; background: transparent; color: inherit; font: inherit; font-size: 15px; padding: 9px 10px; outline: none; }
.sm-aichat__send { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--sm-accent); color: #111; cursor: pointer; }
.sm-aichat__send svg { width: 20px; height: 20px; fill: currentColor; }
.sm-aichat__send:disabled { opacity: .5; }
.sm-aichat__foot { margin: 0; font-size: 11.5px; color: var(--sm-muted); text-align: center; }

/* ---------- Admin AI ---------- */
.sm-adm-ai-err { padding: 8px 10px; border-radius: 12px; background: color-mix(in srgb, #ff4d5e 12%, transparent); color: var(--sm-text); overflow-wrap: anywhere; }
.sm-adm-ai-ctrl { display: grid; gap: 10px; margin-top: 10px; }
.sm-adm-switch { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; cursor: pointer; }
.sm-adm-switch input { width: 22px; height: 22px; accent-color: var(--sm-accent); }
.sm-adm-ai-limits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sm-adm-ai-limits .sm-field span { font-size: 12px; }

/* ---------- Map viewer / recorder ---------- */
.mapview { position: relative; width: 100%; border-radius: 16px; overflow: hidden; background: #0b0d12; }
.mapsvg { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; touch-action: manipulation; cursor: crosshair; }
.mapctl { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 6px; }
.mapctl button { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; border: 1px solid rgb(255 255 255 / .18); background: rgb(10 13 19 / .72); color: #fff; cursor: pointer; }
.mapctl button svg { width: 20px; height: 20px; fill: currentColor; }
.map-marker-sheet { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 8px 10px; border-radius: 12px; background: rgb(10 13 19 / .85); color: #fff; font-size: 13px; }
.mp-quick-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0 6px; }
.chip-btn.mp-quick { min-height: 48px; justify-content: center; font-size: 14px; font-weight: 800; border-radius: 14px; }
.chip-btn span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #111; font-size: 11px; font-weight: 900; }
.chip-btn.on { border-color: var(--sm-accent) !important; background: color-mix(in srgb, var(--sm-accent) 16%, transparent) !important; color: var(--sm-text, var(--on-surface)) !important; }
.mp-more summary { cursor: pointer; padding: 4px 0; color: var(--sm-muted); }
.mp-more .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ---------- Practice scheduling (modern) ---------- */
.ss-modern { display: grid; gap: 12px; }
.ss-hero { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 20px; background: linear-gradient(135deg, color-mix(in srgb, var(--sm-accent) 22%, transparent), color-mix(in srgb, #10b981 16%, transparent)); border: 1px solid var(--sm-line); }
.ss-hero b { display: block; font-size: 16px; }
.ss-hero small { color: var(--sm-muted); font-size: 12.5px; }
.ss-hero__icon { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 14px; background: var(--sm-accent); color: #111; }
.ss-hero__icon svg { width: 24px; height: 24px; fill: currentColor; }
.ss-card { display: grid; gap: 10px; padding: 14px; border-radius: 20px; background: var(--sm-glass); border: 1px solid var(--sm-line); min-width: 0; }
.ss-card__head { display: flex; align-items: center; gap: 10px; }
.ss-card__head h4 { margin: 0; font-size: 15px; }
.ss-step { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-container-high, #202633); color: var(--sm-accent); font-size: 13px; font-weight: 900; }
.ss-label { margin: 2px 0 -2px; font-size: 13px; font-weight: 600; color: var(--sm-muted); }
.ss-hint { margin: -4px 0 0; font-size: 12.5px; color: var(--sm-muted); }
.ss-type--tiles .ss-tile { flex-direction: row; align-items: center; min-height: 58px; padding: 10px 12px; }
.ss-tile__icon { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 11px; background: var(--surface-container-high, #202633); color: var(--sm-accent); }
.ss-tile__icon svg { width: 20px; height: 20px; fill: currentColor; }
.ss-tile__text { display: grid; min-width: 0; line-height: 1.25; }
.ss-tile:has(input:checked) .ss-tile__icon { background: var(--sm-accent); color: #111; }
.ss-tile:has(input:focus-visible) { outline: 2px solid var(--sm-accent); outline-offset: 2px; }
.ss-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.ss-pills label { position: relative; cursor: pointer; }
.ss-pills input { position: absolute; opacity: 0; pointer-events: none; }
.ss-pills span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--sm-line); background: transparent; font-size: 13px; font-weight: 600; }
.ss-pills input:checked + span { border-color: var(--sm-accent); background: color-mix(in srgb, var(--sm-accent) 16%, transparent); }
.ss-pills input:focus-visible + span { outline: 2px solid var(--sm-accent); outline-offset: 2px; }
.ss-footer { position: sticky; bottom: 0; display: grid; gap: 8px; padding: 10px 0 2px; background: linear-gradient(to top, var(--surface, #0f1218) 70%, transparent); }
.ss-summary { margin: 0; font-size: 12.5px; color: var(--sm-muted); text-align: center; overflow-wrap: anywhere; }
.ss-summary:empty { display: none; }

/* v1.2.0 match detail: marks shown directly on the map */
.sm-mmi { display: grid; gap: 8px; }
.sm-mmi__frame { position: relative; display: block; width: 100%; padding: 0; border: 1px solid var(--outline-variant, var(--sm-line)); border-radius: .75rem; overflow: hidden; background: #0b0d12; cursor: zoom-in; }
.sm-mmi__svg { display: block; width: 100%; height: auto; max-height: 22rem; aspect-ratio: 1 / 1; }
.sm-mmi__zoom { position: absolute; right: 8px; bottom: 8px; padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 11.5px; font-weight: 700; pointer-events: none; }
.sm-mmi figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 2px 0 0; }
.sm-mmi figcaption small { font-weight: 500; color: var(--on-surface-variant, var(--sm-muted)); font-size: 12.5px; }
.sm-mmi__legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--on-surface-variant, var(--sm-muted)); }
.sm-mmi__legend span, .sm-mmi__list li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.sm-mmi__legend i, .sm-mmi__list i { display: inline-grid; place-items: center; flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #111; color: #111; font-style: normal; font-size: 11px; font-weight: 800; }
.sm-mmi__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sm-mmi__list li { font-size: 13px; }
.sm-mmi__list b { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.sm-mmi__list span { min-width: 0; color: var(--on-surface-variant, var(--sm-muted)); overflow-wrap: anywhere; }
.sm-mmi__more { color: var(--on-surface-variant, var(--sm-muted)); font-size: 12px; }

/* v1.2.0 squad: all past matches */
.sm-sqm { display: grid; gap: 12px; }
.sm-sqm > .text-btn { justify-self: start; }
.sm-sqm-head h2 { margin: 2px 0; overflow-wrap: anywhere; }
.sm-sqm-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.sm-sqm-sum span { display: grid; place-items: center; gap: 2px; padding: 10px 4px; border-radius: 14px; background: var(--sm-glass); border: 1px solid var(--sm-line); text-align: center; }
.sm-sqm-sum b { font-size: 17px; }
.sm-sqm-sum small { font-size: 11px; color: var(--sm-muted); }
[data-sqm-list] { display: grid; gap: 10px; }
.sm-sqm-card { padding: 0; cursor: default; overflow: hidden; }
.sm-sqm-toggle { display: grid; gap: 6px; width: 100%; padding: 14px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.sm-sqm-caret svg { transition: transform var(--sm-motion-fast, 140ms); }
.sm-sqm-card.is-open .sm-sqm-caret svg { transform: rotate(180deg); }
.sm-sqm-more { display: grid; gap: 8px; padding: 0 14px 14px; border-top: 1px solid var(--sm-line); }
.sm-sqm-more h4 { margin: 10px 0 0; font-size: 13px; }
.sm-sqm-table td, .sm-sqm-table th { white-space: nowrap; }
.sm-sqm-table td:first-child { white-space: normal; overflow-wrap: anywhere; }
.sm-sqm-guest { padding: 1px 6px; border-radius: 999px; background: var(--surface-container-high, #202633); color: var(--sm-muted); font-size: 10.5px; }
.sm-ts__all { margin: 0 0 8px; }

/* v1.2.0 host follow: strip on Scrims › Public, section headings, Follow toggle */
.sm-ff-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; padding: 10px 12px; border-radius: 18px; background: var(--sm-glass); border: 1px solid var(--sm-line); min-width: 0; }
.sm-ff-strip.is-empty { border-style: dashed; }
.sm-ff-icon { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 12px; background: var(--sm-glass-raised); color: var(--sm-accent, #ffb020); font-size: 18px; }
.sm-ff-icon svg { width: 20px; height: 20px; }
.sm-ff-text { display: grid; gap: 2px; flex: 1 1 160px; min-width: 0; }
.sm-ff-text b { font-size: 14px; }
.sm-ff-text small { font-size: 12px; opacity: .75; overflow-wrap: anywhere; }
.sm-ff-strip > .btn { flex: 0 0 auto; }
.sm-ff-section { grid-column: 1 / -1; margin: 6px 2px 0; font-size: 14px; font-weight: 700; letter-spacing: .02em; }
.sm-ff-section small { font-weight: 500; opacity: .65; margin-left: 4px; }
.sm-ff-none { display: grid; gap: 3px; margin: 6px 0 10px; padding: 10px 12px; border-radius: 16px; border: 1px dashed var(--sm-line); background: var(--sm-glass); }
.sm-ff-none small { font-size: 12px; opacity: .75; }
.sm-ff-btn { white-space: nowrap; }
.sm-ff-btn.is-on { background: transparent; border: 1px solid var(--sm-accent, #ffb020); color: var(--sm-accent, #ffb020); }
.sm-ff-host { padding: 0; min-height: 0; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.scrim-detail-subtitle .sm-ff-btn { margin-left: 6px; vertical-align: middle; }

/* Card action rows without a favorite star (organization members: Move squad / Make co-owner / Remove, admin rows, ...):
   buttons wrap onto the next line. They used to fall into the 40px favorite-star grid column and overlapped. */
.sm-team-card .sm-card-actions:not(:has(> .sm-fav-btn)) { display: flex; flex-wrap: wrap; gap: 8px; }
.sm-team-card .sm-card-actions:not(:has(> .sm-fav-btn)) .btn { flex: 0 1 auto; min-width: 0; padding: 6px 14px; }
