/* ==========================================================================
   Bowling (/bowling) — builds on /assets/site.css (accent: cyan).
   ========================================================================== */

/* ---------- Hero ---------- */

.b-hero { padding-top: 72px; border-bottom: 1px solid var(--line); overflow: hidden; }
.b-hero__inner { display: flex; gap: 48px; align-items: flex-end; flex-wrap: wrap; }
.b-hero__copy { flex: 999 1 540px; min-width: 0; display: flex; flex-direction: column; gap: 26px; padding-bottom: 88px; }
.b-hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }

.sheen {
    background: linear-gradient(90deg, var(--text) 0%, var(--text) 40%, var(--accent) 50%, var(--text) 60%, var(--text) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: sheen 6s linear infinite;
}
@keyframes sheen { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Animated lane */
.lane { flex: 1 1 380px; position: relative; height: 520px; display: flex; justify-content: center; }
.lane__floor, .lane__gutter { position: absolute; bottom: 0; width: 420px; max-width: 100%; height: 100%; }
.lane__floor {
    clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
    background: linear-gradient(to top, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--accent) 2%, transparent) 85%);
}
.lane__gutter { background: color-mix(in srgb, var(--accent) 50%, transparent); }
.lane__gutter--l { clip-path: polygon(40% 0, 40.6% 0, 1.5% 100%, 0 100%); }
.lane__gutter--r { clip-path: polygon(59.4% 0, 60% 0, 100% 100%, 98.5% 100%); }

.lane__arrows { position: absolute; bottom: 150px; display: flex; gap: 22px; align-items: flex-start; }
.lane__arrows span {
    width: 0; height: 0;
    border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 14px solid var(--accent);
    animation: arrows 1.8s ease-in-out infinite;
}
.lane__arrows span:nth-child(2), .lane__arrows span:nth-child(6) { margin-top: -10px; animation-delay: .15s; }
.lane__arrows span:nth-child(3), .lane__arrows span:nth-child(5) { margin-top: -20px; animation-delay: .3s; }
.lane__arrows span:nth-child(4) { margin-top: -30px; animation-delay: .45s; }
@keyframes arrows { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.lane__pins { position: absolute; top: 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lane__pins div { display: flex; gap: 9px; }
.lane__pins span {
    width: 9px; height: 22px; border-radius: 5px 5px 4px 4px; background: var(--text);
    animation: knock 3.6s ease-out infinite;
}
.lane__pins span:nth-child(odd) { animation-name: knock2; }
@keyframes knock  { 0%, 56% { transform: none; opacity: 1; } 62%, 90% { transform: translateY(-14px) rotate(-60deg); opacity: .12; } 100% { transform: none; opacity: 1; } }
@keyframes knock2 { 0%, 56% { transform: none; opacity: 1; } 62%, 90% { transform: translate(4px, -10px) rotate(55deg); opacity: .12; } 100% { transform: none; opacity: 1; } }

.lane__strike {
    position: absolute; top: 118px; padding: 6px 12px; border-radius: 999px;
    font-family: var(--mono); font-size: 15px; letter-spacing: .3em; text-transform: uppercase;
    color: var(--accent); border: 1px solid var(--accent); background: rgba(7, 8, 10, .85);
    opacity: 0; animation: strike 3.6s ease-out infinite;
}
@keyframes strike {
    0%, 58% { opacity: 0; transform: scale(.6); }
    64% { opacity: 1; transform: scale(1.08); }
    70%, 86% { opacity: 1; transform: scale(1); }
    92%, 100% { opacity: 0; transform: scale(1); }
}

.lane__ball {
    position: absolute; bottom: 36px; left: 50%; width: 64px; height: 64px; border-radius: 50%;
    background: radial-gradient(circle at 34% 28%, #C5F1FD, var(--accent) 42%, #0A4F66 100%);
    box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 60%, transparent);
    animation: roll 3.6s cubic-bezier(.45, .05, .6, 1) infinite;
}
.lane__ball i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--bg); }
.lane__ball i:nth-child(1) { top: 18px; left: 26px; }
.lane__ball i:nth-child(2) { top: 15px; left: 37px; }
.lane__ball i:nth-child(3) { top: 28px; left: 33px; width: 8px; height: 8px; }
@keyframes roll {
    0%   { transform: translate(-50%, 0) scale(1) rotate(0); opacity: 0; }
    6%   { opacity: 1; }
    58%  { transform: translate(-50%, -360px) scale(.38) rotate(540deg); opacity: 1; }
    64%  { opacity: 0; }
    100% { transform: translate(-50%, -360px) scale(.38); opacity: 0; }
}

/* ---------- Player ---------- */

.player { display: flex; gap: 20px; flex-wrap: wrap; }
.player__main { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

.player-card {
    flex: 1 1 320px; border-radius: 24px; overflow: hidden;
    background: var(--surface); border: 1px solid var(--line);
    display: flex; flex-direction: column;
}
.player-card__media { position: relative; height: 340px; background: var(--surface-2); overflow: hidden; }
.player-card__media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; transition: transform 1s var(--ease); }
.player-card:hover .player-card__media img { transform: scale(1.04); }
.player-card__media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--surface) 0%, rgba(13, 15, 18, 0) 55%); }
.player-card__tag {
    position: absolute; left: 20px; top: 20px; z-index: 1;
    padding: 6px 12px; border-radius: 999px; background: rgba(7, 8, 10, .8);
    border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
    font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
}
.player-card__facts { margin: 0; padding: 8px 24px 24px; }
.player-card__facts div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.player-card__facts div:last-child { border-bottom: 0; }
.player-card__facts dt { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.player-card__facts dd { margin: 0; font-family: var(--mono); font-size: 14px; text-align: right; }

.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.tile {
    padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 10px;
    transition: transform .5s var(--ease), border-color .4s;
}
.tile:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.tile--accent { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.tile--accent .label { color: var(--accent); }
.tile__value { font-family: var(--mono); font-size: 40px; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }

/* Scorecard */
.scorecard { padding: 28px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 20px; }
.scorecard__head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.scorecard__scroll { overflow-x: auto; }
.scorecard__table {
    width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0;
    border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; overflow: hidden;
    font-family: var(--mono); table-layout: fixed;
}
.scorecard__table th {
    padding: 6px 0; font-size: 11px; font-weight: 400; color: var(--muted);
    background: rgba(255, 255, 255, .03); border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.scorecard__table th + th, .scorecard__table td + td { border-left: 1px solid rgba(255, 255, 255, .12); }
.scorecard__table th:nth-child(10) { width: 13%; }
.scorecard__table th:last-child { width: 12%; }
.scorecard__table td { padding: 0; vertical-align: top; }
.frame__boxes { display: flex; justify-content: flex-end; height: 28px; }
.frame__box {
    width: 28px; display: grid; place-items: center; font-size: 13px; color: var(--dim);
    border-left: 1px solid rgba(255, 255, 255, .12); border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.frame__box.is-mark { color: var(--accent); }
.frame__total { height: 42px; display: grid; place-items: center; font-size: 15px; color: var(--text); }
.scorecard__final { background: color-mix(in srgb, var(--accent) 8%, transparent); text-align: center; vertical-align: middle !important; }
.scorecard__final .label { display: block; font-size: 10px; }
.scorecard__final strong { font-size: 22px; font-weight: 500; color: var(--accent); }

/* ---------- Team ---------- */

.team { position: relative; overflow: hidden; }
.team__orbit {
    position: absolute; right: -180px; top: -180px; width: 620px; height: 620px; border-radius: 50%;
    border: 1px dashed color-mix(in srgb, var(--accent) 20%, transparent);
    animation: orbit 24s linear infinite; pointer-events: none;
}
.team .container { position: relative; display: flex; flex-direction: column; gap: 56px; }

.team__head { display: flex; gap: 48px; align-items: center; flex-wrap: wrap; }
.crest {
    flex: none; width: 200px; height: 200px; border-radius: 40px; display: grid; place-items: center;
    background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
    box-shadow: 0 0 80px color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent);
}
.crest svg { animation: bob 4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.team__title { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.team__name { margin: 0; font-size: clamp(56px, 8vw, 104px); line-height: .9; font-weight: 700; letter-spacing: -.055em; }

.team__facts { border-top: 1px solid rgba(255, 255, 255, .1); border-bottom: 1px solid rgba(255, 255, 255, .1); }
.team__facts .stat { gap: 8px; padding-top: 28px; padding-bottom: 28px; }
.team__fact { font-family: var(--mono); font-size: 18px; }
.team__sub { font-size: 36px; }
.team__fact small { font-size: 13px; color: var(--muted); }

/* ---------- Notices ---------- */

.notice { margin: 24px 0 0; padding: 14px 18px; border-radius: 14px; font-size: 15px; }
.notice--ok  { background: rgba(91, 228, 155, .1); color: #9EF0C2; border: 1px solid rgba(91, 228, 155, .3); }
.notice--err { background: rgba(255, 107, 91, .1); color: #FFB3A9; border: 1px solid rgba(255, 107, 91, .3); }
.notice code { font-family: var(--mono); font-size: 13px; }

/* ---------- Skill tiers ---------- */

.tier {
    display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
    font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
    border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap;
}
.tier--1 { color: #C9CED6; }
.tier--2 { color: #A8E8FA; border-color: rgba(76, 201, 240, .3); }
.tier--3 { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.tier--4 { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.tier--5 { color: var(--bg); background: linear-gradient(90deg, var(--accent), #F5B841); border-color: transparent; }
.tier-legend { list-style: none; margin: 16px 0 0; padding: 0; display: flex; gap: 16px; flex-wrap: wrap; }
.tier-legend li { display: flex; align-items: center; gap: 8px; }

/* ---------- Score history ---------- */

.history { padding: 28px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; }
.history__head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.history__chart { color: var(--accent); height: 120px; }
.history__chart .spark { width: 100%; height: 100%; overflow: visible; }
.trend { font-family: var(--mono); font-size: 12px; }
.trend--up { color: var(--ok); }
.trend--down { color: #FF8A7A; }

/* ---------- Leaderboard ---------- */

.board-wrap { display: flex; flex-direction: column; gap: 20px; }
.board__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.leaderboard { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 15px; }
.leaderboard th {
    padding: 10px 12px; text-align: left; font-family: var(--mono); font-size: 11px; font-weight: 400;
    letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line-2);
}
.leaderboard td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.leaderboard tbody tr { transition: background-color .3s; }
.leaderboard tbody tr:hover { background: rgba(255, 255, 255, .03); }
.leaderboard .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.leaderboard .strong { font-size: 18px; color: var(--text); }
.leaderboard .rank { font-family: var(--mono); color: var(--muted); width: 40px; }
.leaderboard tr.is-lead .rank { color: var(--accent); }
.leaderboard tr.is-me { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.leaderboard .form { width: 130px; color: var(--accent); }
.leaderboard .form .spark { width: 110px; height: 28px; display: block; overflow: visible; }

.who { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.who__name { display: flex; flex-direction: column; min-width: 0; }
.who__name strong { font-weight: 600; white-space: nowrap; }
.who__name small { font-size: 12px; color: var(--muted); }
.avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-sm--empty {
    display: grid; place-items: center; background: var(--surface-2);
    border: 1px dashed rgba(255, 255, 255, .25); font-family: var(--mono); font-size: 12px; color: var(--muted);
}
.is-me .avatar-sm { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- Recent nights ---------- */

.empty { margin: 0; padding: 24px; border-radius: 16px; border: 1px dashed var(--line-2); color: var(--muted); }
.empty a { color: var(--accent); }
.nights { display: flex; flex-direction: column; }
.night { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 24px; padding: 20px 0; border-top: 1px solid var(--line); }
.night__date { display: flex; flex-direction: column; gap: 2px; }
.night__day { font-family: var(--mono); font-size: 34px; line-height: 1; letter-spacing: -.03em; }
.night__body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.night__meta { font-size: 14px; color: var(--muted); }
.night__scores { display: flex; flex-wrap: wrap; gap: 8px; }
.night__player {
    display: inline-flex; align-items: baseline; gap: 10px; padding: 8px 12px; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--line); font-size: 14px;
}
.night__player small { color: var(--muted); font-size: 12px; }
.night__player.is-winner { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.night__player.is-winner strong { color: var(--accent); }

.manage { margin-top: 8px; }
.manage summary { cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; color: var(--muted); font-size: 14px; }
.manage summary:hover { color: var(--text); }
.manage__form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding-top: 12px; }
.manage__form .field { flex: 1 1 220px; }

/* ---------- Log form ---------- */

.log {
    display: flex; gap: 48px; flex-wrap: wrap; padding: 48px; border-radius: 28px;
    background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.log__intro { flex: 1 1 280px; display: flex; flex-direction: column; gap: 16px; }
.log__intro p { margin: 0; line-height: 1.6; }
.log__form { flex: 999 1 600px; min-width: 0; }
.log__form fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.log__form fieldset[disabled] { opacity: .5; }
.log__row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.log__row--submit { align-items: end; grid-template-columns: minmax(0, 1fr) auto; }
.log__tools { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }

.scores-grid { display: flex; flex-direction: column; gap: 8px; overflow-x: auto; }
.scores-grid__head, .scores-grid__row {
    display: grid; gap: 8px; align-items: center;
    grid-template-columns: minmax(170px, 1.6fr) repeat(var(--cols, 3), minmax(72px, 1fr));
    min-width: calc(170px + var(--cols, 3) * 80px);
}
.scores-grid__head { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.score-input { min-height: 46px; padding: 8px 10px; text-align: center; font-family: var(--mono); font-size: 16px; -moz-appearance: textfield; }
.score-input::-webkit-outer-spin-button, .score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.scores-grid[data-games="1"] { --cols: 1; } .scores-grid[data-games="2"] { --cols: 2; } .scores-grid[data-games="3"] { --cols: 3; }
.scores-grid[data-games="4"] { --cols: 4; } .scores-grid[data-games="5"] { --cols: 5; } .scores-grid[data-games="6"] { --cols: 6; }
.scores-grid[data-games="1"] .game-col[data-col="2"],
.scores-grid[data-games="1"] .game-col[data-col="3"],
.scores-grid[data-games="2"] .game-col[data-col="3"],
.scores-grid:not([data-games="4"]):not([data-games="5"]):not([data-games="6"]) .game-col[data-col="4"],
.scores-grid:not([data-games="5"]):not([data-games="6"]) .game-col[data-col="5"],
.scores-grid:not([data-games="6"]) .game-col[data-col="6"] { display: none; }

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
    .b-hero { padding-top: 48px; }
    .b-hero__copy { padding-bottom: 24px; }
    .lane { height: 420px; }
    .log { padding: 24px; }
    .night { grid-template-columns: 1fr; }
    .night__date { flex-direction: row; align-items: baseline; gap: 10px; }
}
.score-input.is-invalid { border-color: var(--coral); }

/* ---------- League (personal profile) ---------- */

.league-badge { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.league-log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.league-log li {
    display: grid; grid-template-columns: 110px minmax(0, 1fr) auto 56px; gap: 16px; align-items: center;
    min-height: 48px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.league-log__date { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.league-log__vs { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.league-log__games { color: var(--muted); font-size: 13px; }
.league-log__series { text-align: right; font-size: 15px; }
@media (max-width: 560px) {
    .league-log li { grid-template-columns: 1fr auto; padding: 8px 0; }
    .league-log__games { grid-column: 1; }
}
.log--league { border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.games-row { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.tile__note { margin-top: -4px; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--dim); }
