* { box-sizing: border-box; }
html, body { background: #0f1623; color: var(--text-primary); font-family: 'Inter', system-ui, sans-serif; font-size: 14px; margin: 0; }
a { color: #60a5fa; text-decoration: none; }
a:hover { color: #93bbfd; }
.page { max-width: 1440px; margin: 0 auto; padding: 24px 20px 48px; }

/* ── Breadcrumb ── */
.breadcrumb-bar { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; display: flex; align-items: center; gap: 6px; }
.breadcrumb-bar a { color: var(--text-secondary); }
.breadcrumb-bar a:hover { color: var(--text-primary); }
.breadcrumb-sep { color: var(--text-dim); }

/* ── Header ── */
.match-header { background: #1a2332; border-radius: 12px; padding: 20px 24px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.match-meta { display: flex; justify-content: center; align-items: center; gap: 12px; color: var(--text-secondary); font-size: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.meta-league { color: #60a5fa; font-weight: 600; }
.meta-sep { color: var(--border-light); }
.meta-id { font-family: 'JetBrains Mono', 'SF Mono', monospace; color: var(--text-muted); font-size: 11px; }
.status-badge--live { background: #dc2626; color: #fff; font-size: 10px; font-weight: 700; border-radius: 4px; padding: 3px 10px; letter-spacing: .05em; animation: pulse 1.5s infinite; }
.badge-done { background: var(--border-light); color: var(--text-secondary); font-size: 10px; font-weight: 600; border-radius: 4px; padding: 3px 10px; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.55} }

.teams-row { display: flex; align-items: center; justify-content: center; gap: 20px; }
.team-block { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; max-width: 360px; min-width: 0; }
.team-block--radiant { align-items: flex-end; }
.team-block--dire    { align-items: flex-start; }
.team-name-logo-row { display: flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; }
.team-header__logo { width: 48px; height: 48px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); flex-shrink: 0; }
.team-header__name { font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.winner-mark { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; height: 18px; line-height: 18px; }
.winner-mark--show { color: #facc15; visibility: visible; }
.winner-mark--hide { visibility: hidden; }
.score-center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.score-block { font-size: 2rem; font-weight: 800; text-align: center; min-width: 60px; line-height: 1; letter-spacing: -.02em; }
.score-sub { font-size: 10px; color: var(--text-muted); text-align: center; text-transform: uppercase; letter-spacing: .08em; }

/* ── Matchup Panel (inside match-header) ── */
.matchup-panel__teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: start; margin-top: 18px; }
.matchup-panel__vs { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 0 4px; align-self: center; }
.vs-text { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.adv-indicator { display: flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.adv-indicator--radiant { color: var(--color-radiant); }
.adv-indicator--dire    { color: var(--color-dire); }
.adv-indicator__arrow { font-size: 13px; line-height: 1; }
.adv-indicator__num { font-size: 11px; }
.team-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.team-rank-sum { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 5px; background: #0f1623; display: inline-block; }
.team-rank-sum.radiant { color: var(--color-radiant); }
.team-rank-sum.dire    { color: var(--color-dire); }

/* ── Hero Card ── */
.hero-card { background: #0f1623; border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; }
.hero-card--radiant { border-top: 2px solid var(--color-radiant); }
.hero-card--dire    { border-top: 2px solid var(--color-dire); }
.hero-card__img-wrap { width: 100%; height: 56px; overflow: hidden; background: #1a2332; flex-shrink: 0; }
.hero-card__img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.hero-card__img-placeholder { width: 100%; height: 56px; background: #293548; }
.hero-card__body { padding: 6px 6px 5px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.hero-card__adv { font-size: 12px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; line-height: 1.2; }
.hero-card__adv-bar { height: 3px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; }
.hero-card__adv-fill { height: 100%; border-radius: 2px; }
.hero-card__kda { font-size: 10px; color: var(--text-secondary); text-align: center; font-variant-numeric: tabular-nums; }
.hero-card__kda-sep { color: var(--text-muted); margin: 0 1px; }
.hero-card__gold { display: flex; align-items: center; justify-content: center; gap: 3px; font-size: 10px; color: #d4a843; font-variant-numeric: tabular-nums; }
.hero-card__player { font-size: 10px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.hero-card__rank-row { display: flex; align-items: center; justify-content: space-between; gap: 3px; flex-wrap: nowrap; }
.hero-card__rank-num { font-size: 9px; font-weight: 700; }
.hero-card__rank-num.known   { color: #a5b4fc; }
.hero-card__rank-num.unknown { color: var(--text-dim); }
.hero-card__pos-select { appearance: none; -webkit-appearance: none; background: #1a2332; color: var(--text-secondary); border: 1px solid #3d4f65; border-radius: 4px; padding: 2px 5px; font-size: 10px; font-weight: 600; width: 28px; text-align: center; flex-shrink: 0; cursor: pointer; transition: border-color .15s, color .15s; }
.hero-card__pos-select:hover { border-color: #60a5fa; color: var(--text-primary); }
.hero-card__pos-select:focus { outline: none; border-color: #60a5fa; box-shadow: 0 0 0 2px rgba(96,165,250,.15); }

/* ── Matrix title ── */
.matrix-title { font-size: 13px; font-weight: 700; color: #c9d1d9; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; }

/* ── Matrix ── */
.match-layout__matrix-section { background: #1a2332; border-radius: 12px; padding: 20px 22px; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.no-picks { text-align: center; color: var(--text-muted); padding: 48px 0; font-size: 13px; }

.total-bar { display: flex; align-items: baseline; justify-content: center; gap: 12px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.total-bar__value { font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.total-desc { font-size: 13px; color: #8b949e; }

/* table */
.matrix-wrap { overflow-x: auto; width: 100%; border-radius: 8px; }
.matrix-table { border-collapse: collapse; width: 100%; table-layout: fixed; }
.matrix-table th, .matrix-table td { border: 1px solid rgba(255,255,255,.06); }

/* corner */
.matrix__corner { background: #0f1623; padding: 8px; vertical-align: middle; text-align: center; }
.swap-btn { background: #293548; border: 1px solid #3d4f65; color: var(--text-primary); border-radius: 6px; padding: 8px 16px; font-size: 12px; cursor: pointer; white-space: nowrap; font-weight: 600; transition: all .15s; }
.swap-btn:hover { background: #3d4f65; border-color: #60a5fa; transform: scale(1.02); }

/* col headers (top team) */
.matrix__col-header { background: #0d2818; padding: 8px 4px; text-align: center; border-bottom: 2px solid var(--color-radiant) !important; transition: background .15s; }
.matrix__col-header:hover { background: #143d24; }
.matrix__col-header img { width: 100%; max-width: 58px; height: 33px; object-fit: cover; border-radius: 3px; }
.m-col-name { font-size: 10px; color: #6ee7b7; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }

/* team info cell */
.m-team-cell { background: #0a1a0a; padding: 10px 12px; text-align: center; vertical-align: middle; }
.m-team-logo { width: 36px; height: 36px; object-fit: contain; display: block; margin: 0 auto 4px; }
.m-team-name { font-size: 10px; font-weight: 700; color: #6ee7b7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* row headers (side team) */
.matrix__row-header { background: #1f0a0a; padding: 8px 8px; border-right: 2px solid var(--color-dire) !important; transition: background .15s; }
.matrix__row-header:hover { background: #2d1111; }
.matrix__row-header img { width: 52px; height: 29px; object-fit: cover; border-radius: 3px; display: block; }
.m-row-name { font-size: 10px; color: #fca5a5; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }

/* data cells */
.matrix__cell { padding: 12px 4px; text-align: center; font-size: 1rem; font-weight: 700; color: #fff;
              text-shadow: 1px 1px 3px rgba(0,0,0,.7); cursor: pointer; transition: filter .15s, transform .1s;
              font-variant-numeric: tabular-nums; }
.matrix__cell:hover { filter: brightness(1.2); z-index: 1; position: relative; }
.matrix__cell--selected { box-shadow: inset 0 0 0 2px #facc15; }
/* crosshair highlight — applied via Alpine */
.matrix__cell.crosshair { filter: brightness(1.3); transform: scale(1.04); z-index: 2; position: relative; }

/* sum cells */
.matrix__sum       { padding: 8px 4px; text-align: center; font-size: 12px; font-weight: 700; background: #0f1623; font-variant-numeric: tabular-nums; }
.matrix__sum-label { padding: 8px 8px; font-size: 10px; color: var(--text-muted); background: #0f1623; text-align: center; }

/* side team footer row */
.m-side-team-cell { padding: 8px 10px; text-align: left; background: #1f0a0a; border-top: 2px solid var(--color-dire); }
.m-side-team-cell img { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; margin-right: 6px; }
.m-side-team-cell span { font-size: 11px; color: #fca5a5; font-weight: 700; }

/* cell info card */
.cell-info { margin-bottom: 16px; background: #0f1623; border-radius: 10px; padding: 14px 16px; position: relative; border: 1px solid rgba(255,255,255,.06); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.cell-info__row { display: grid; grid-template-columns: 50px 1fr 64px 94px; align-items: center; gap: 8px; font-size: 12px; }
.cell-info__row + .cell-info__row { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.06); }
.cell-info__img { width: 50px; height: 28px; object-fit: cover; border-radius: 3px; }
.cell-info__name { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-info__name.green { color: var(--color-radiant); }
.cell-info__name.red   { color: var(--color-dire); }
.cell-info__advantage { font-weight: 700; font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.cell-info__matches { color: #8b949e; font-size: 10px; text-align: right; white-space: nowrap; }
.ci-date { font-size: 10px; color: var(--text-muted); margin-top: 8px; }
.ci-close { position: absolute; top: 8px; right: 10px; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 4px 8px; border-radius: 4px; transition: all .15s; }
.ci-close:hover { color: var(--text-primary); background: rgba(255,255,255,.06); }

/* ── Drag-and-drop ── */
.matrix__col-header--dragging { opacity: 0.3; }
.matrix__row-header--dragging { opacity: 0.3; }
.matrix__col-header--drag-over { box-shadow: inset 3px 0 0 var(--color-purple) !important; }
.matrix__row-header--drag-over { box-shadow: inset 0 3px 0 var(--color-purple) !important; }
.matrix__col-header[draggable="true"], .matrix__row-header[draggable="true"] { cursor: grab; }
.matrix__col-header[draggable="true"]:active, .matrix__row-header[draggable="true"]:active { cursor: grabbing; }
.player-row__position-badge { font-size: 9px; font-weight: 700; color: var(--color-purple); background: #1e1b4b; border-radius: 3px; padding: 1px 5px; margin-top: 3px; display: inline-block; }

/* ── Fetch winner ── */
.fetch-winner-wrap { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.btn-fetch-winner { background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 6px 16px; font-size: 13px; cursor: pointer; }
.btn-fetch-winner:disabled { opacity: .5; cursor: not-allowed; }
.fetch-winner-error { font-size: 12px; color: var(--danger, #e74c3c); }

/* ── Calculator link ── */
.action-link--calculator { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #8b949e; margin-top: 14px; padding: 6px 12px; background: #293548; border-radius: 6px; transition: all .15s; }
.action-link--calculator:hover { color: var(--text-primary); background: #3d4f65; }

@media (max-width: 768px) {
    .page { padding: 12px 10px 32px; }
    .match-header { padding: 14px 14px; }

    /* ── Header teams row: 3-column grid instead of flex-wrap ── */
    .teams-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: start; }
    .team-block { max-width: none; flex: unset; width: 100%; }
    .team-header__logo { width: 36px; height: 36px; }
    .team-header__name { font-size: 0.9rem; }
    .score-block { font-size: 1.5rem; }
    .score-center { gap: 2px; }

    /* Rank badge: above logo, name spans both rows */
    .team-name-logo-row { display: grid; gap: 3px 6px; align-items: center; overflow: visible; }
    .team-block--radiant .team-name-logo-row { grid-template-columns: 1fr auto; }
    .team-block--radiant .team-header__name  { grid-column: 1; grid-row: 1 / span 2; }
    .team-block--radiant .team-rank-sum      { grid-column: 2; grid-row: 1; justify-self: end; }
    .team-block--radiant .team-header__logo  { grid-column: 2; grid-row: 2; justify-self: end; }
    .team-block--dire .team-name-logo-row    { grid-template-columns: auto 1fr; }
    .team-block--dire .team-rank-sum         { grid-column: 1; grid-row: 1; justify-self: start; }
    .team-block--dire .team-header__logo     { grid-column: 1; grid-row: 2; justify-self: start; }
    .team-block--dire .team-header__name     { grid-column: 2; grid-row: 1 / span 2; }
    .team-rank-sum { font-size: 11px; padding: 2px 6px; }

    /* ── Matchup panel (hero cards + VS) ── */
    .matchup-panel__teams { grid-template-columns: 1fr; gap: 6px; }
    .matchup-panel__vs { padding: 2px 0; flex-direction: row; justify-content: center; gap: 8px; }

    /* Arrow: rotate ▶/◀ to ▼/▲ for vertical layout */
    .adv-indicator__arrow { display: inline-block; transform: rotate(90deg); }

    /* Hero cards: tighter on mobile */
    .hero-card__img-wrap { height: 44px; }
    .hero-card__body { padding: 4px 4px 3px; }

    /* ── Matrix ── */
    .match-layout__matrix-section { padding: 14px 12px; }
    .matrix-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .matrix__cell { font-size: .85rem; padding: 8px 3px; min-width: 52px; min-height: 44px; }
    /* sticky first column on mobile */
    .matrix-table td:first-child,
    .matrix-table th:first-child { position: sticky; left: 0; z-index: 3; }
    .matrix__row-header { min-width: 70px; }
    .matrix__corner { min-width: 70px; }
    .m-side-team-cell { min-width: 70px; }
    .matrix__col-header img { max-width: 44px; height: 25px; }
    .m-col-name { font-size: 9px; }
    .matrix__row-header img { width: 42px; height: 24px; }
    .m-row-name { font-size: 9px; max-width: 60px; }
    .m-team-logo { width: 26px; height: 26px; }
    .m-team-name { font-size: 9px; }
    .cell-info__row { grid-template-columns: 42px 1fr 54px 80px; gap: 4px; font-size: 11px; }
    .cell-info__img { width: 42px; height: 24px; }
    .breadcrumb-bar { font-size: 11px; }
    .swap-btn { padding: 6px 12px; }
}
