/* Home-screen view. Everything here applies only with html.hub; without it
   (no JavaScript) the page reads as the long-form portfolio. */

.screen-bar,
.hub-resume,
.sound-toggle {
    display: none;
}

.about-cta .btn {
    display: inline-block;
    margin-top: 1.6rem;
    text-decoration: none;
}

kbd {
    display: inline-block;
    padding: 0 0.35em;
    font-family: var(--font);
    font-size: inherit;
    font-style: normal;
    line-height: 1.35;
    border: 1px solid currentColor;
    border-radius: 0.3em;
    opacity: 0.85;
}

/* Stage */

.hub,
.hub body {
    height: 100%;
    overflow: hidden;
}

.hub body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    color: var(--paper-light);
    background:
        radial-gradient(ellipse at 72% 38%, rgba(229, 203, 120, 0.12), transparent 45%),
        repeating-linear-gradient(90deg, rgba(241, 234, 217, 0.025) 0 7vw, transparent 7vw 14vw),
        radial-gradient(ellipse at 50% 40%, #22322a 0%, #111813 75%);
}

.hub .masthead {
    position: relative;
    flex: none;
    color: var(--paper-light);
    background: transparent;
    backdrop-filter: none;
    border-bottom: 1px solid rgba(241, 234, 217, 0.14);
}

.hub .masthead-row {
    flex-direction: row;
    align-items: center;
    padding: 0.65rem 0;
}

.hub .masthead-meta,
.hub .masthead-nav {
    display: none;
}

.hub .hub-resume {
    display: inline-block;
    flex: none;
    margin-left: auto;
    padding: 0.15rem 0.85rem;
    font-style: italic;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
    background: var(--paper-light);
    border-radius: 99px;
    transition: background 0.2s ease, color 0.2s ease;
}

.hub .hub-resume:hover {
    color: var(--paper-light);
    background: var(--accent);
}

.hub .sound-toggle {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.2rem;
    height: 2.2rem;
    padding: 0;
    color: inherit;
    background: none;
    border: 1px solid rgba(241, 234, 217, 0.3);
    border-radius: 50%;
    cursor: pointer;
}

.hub .sound-toggle:hover {
    border-color: var(--paper-light);
}

.sound-toggle path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sound-toggle .spk {
    fill: currentColor;
}

.sound-toggle[aria-pressed="true"] .spk-off,
.sound-toggle[aria-pressed="false"] .spk-on {
    display: none;
}

.sound-toggle[aria-pressed="false"] {
    color: #c7c3b2;
}

.hub main {
    position: relative;
    flex: 1;
    min-height: 0;
}

.hub main > .intro,
.hub .chalk,
.hub .colophon {
    display: none;
}

.hub main > section {
    position: absolute;
    inset: 0;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.hub main > section.is-active {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.25s ease, visibility 0s;
}

/* Screens open as paper sheets over the stage */

.hub main > section:not(.home) {
    inset: clamp(0.4rem, 1.2vw, 0.9rem);
    padding: 0 0 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    color: var(--ink);
    background-color: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 1rem;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.75);
}

.hub main > section.is-active:not(.home) {
    animation: screen-in 0.45s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

@keyframes screen-in {
    from {
        opacity: 0;
        transform: translateY(2.5%) scale(0.985);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.hub .screen-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: clamp(0.8rem, 2.5vw, 1.8rem);
    padding: 0.6rem clamp(0.8rem, 2.5vw, 1.4rem);
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    border-bottom: 1.5px solid var(--ink);
    backdrop-filter: blur(6px);
}

.screen-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.9rem;
    font: inherit;
    font-size: var(--text);
    color: var(--paper-light);
    background: var(--ink);
    border: 0;
    border-radius: 99px;
    cursor: pointer;
}

.screen-back:hover {
    background: var(--accent);
}

.screen-name {
    font-style: italic;
    color: var(--ink-soft);
}

/* Squad: size the binder to the screen height */

.hub .binder-section {
    background-color: var(--paper-deep);
}

.hub .binder-section .wrap {
    width: auto;
    margin: 0 clamp(0.6rem, 2vw, 1.4rem);
}

.hub .binder-hint {
    margin: 0 0 0.6rem;
}

.hub .binder-page {
    margin: clamp(0.5rem, 1.2vw, 0.9rem);
    padding: clamp(0.6rem, 1.4vw, 1rem);
}

.hub .binder-bar {
    margin-bottom: 0.7rem;
}

.hub .slots {
    grid-template-columns: repeat(4, minmax(0, calc((100dvh - 24rem) / 2 * 5 / 7)));
    justify-content: center;
}

/* Kick off: fit the pitch to the screen */

.hub .kickoff .pitch {
    /* Everything around the canvas takes --pitch-chrome of the window; the
       setup row and scoreboard keep a minimum width so they never wrap. */
    --pitch-chrome: 27.5rem;
    --pitch-w: calc((100dvh - var(--pitch-chrome)) * 16 / 9);
    max-width: min(100%, max(36rem, var(--pitch-w)));
    margin: 1.2rem auto 0;
}

.hub .kickoff .pitch-stage {
    max-width: var(--pitch-w);
    margin: 0 auto;
}

@media (max-height: 760px) and (min-width: 761px) {
    .hub .kickoff .section-head,
    .hub .kickoff .pitch-hint {
        display: none;
    }

    .hub .kickoff .pitch {
        --pitch-chrome: 19rem;
        margin-top: 0.4rem;
    }
}

/* Home */

.hub .home {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    padding: clamp(0.8rem, 2vw, 1.6rem) clamp(1rem, 3vw, 2.4rem) 0;
}

.hub .home:not(.is-active) {
    transform: scale(0.97);
}

.home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
    gap: clamp(1rem, 3vw, 2.5rem);
    align-items: center;
    min-height: 0;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: clamp(0.6rem, 1.2vw, 1rem);
    height: 100%;
    max-height: 40rem;
}

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 0;
    padding: clamp(0.8rem, 1.5vw, 1.2rem);
    color: var(--ink);
    text-decoration: none;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 0.8rem;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.45);
    overflow: hidden;
    outline: none;
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.25, 1), box-shadow 0.25s ease, border-color 0.2s ease;
}

.tile.is-selected,
.tile:focus-visible {
    z-index: 2;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent), 0 16px 26px -8px rgba(0, 0, 0, 0.65);
    transform: translateY(-4px) scale(1.02);
}

.tile::after {
    content: "Enter \21B5";
    position: absolute;
    right: clamp(0.8rem, 1.5vw, 1.2rem);
    bottom: clamp(0.8rem, 1.5vw, 1.2rem);
    padding: 0 0.5rem;
    font-style: italic;
    color: var(--paper-light);
    background: var(--accent);
    border-radius: 99px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tile.is-selected::after {
    opacity: 1;
    transform: none;
}

@media (hover: none) {
    .tile::after {
        display: none;
    }
}

.tile-kicker {
    font-style: italic;
    color: var(--ink-soft);
}

.tile-title {
    font-size: var(--title);
    font-weight: 600;
    line-height: 1.02;
    letter-spacing: -0.02em;
}

.tile-sub {
    margin-top: 0.3rem;
    line-height: 1.3;
    color: var(--ink-soft);
}

.tile-art {
    position: absolute;
    top: clamp(0.7rem, 1.4vw, 1.1rem);
    right: clamp(0.7rem, 1.4vw, 1.1rem);
    transition: transform 0.4s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.tile.is-selected .tile-art {
    transform: rotate(-6deg) translateY(-2px);
}

/* Squad tile */

.tile-squad {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
    color: var(--paper-light);
    background:
        radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.08), transparent 55%),
        var(--page);
}

.tile-squad .tile-kicker,
.tile-squad .tile-sub {
    color: #c7c3b2;
}

.tile-squad .tile-sub {
    padding-right: 5.5rem;
}

.tile-squad .tile-art {
    top: 10%;
    right: 8%;
    display: flex;
    /* Stop above the kicker, title and subtitle on short screens. */
    height: min(58%, calc(84% - 9.5rem));
}

.tile-squad .tile-art img {
    height: 100%;
    width: auto;
    aspect-ratio: 5 / 7;
    object-fit: cover;
    object-position: top;
    margin-left: -18%;
    background: #fff;
    border: 3px solid var(--paper-light);
    border-radius: 0.6rem;
    box-shadow: 0 12px 22px -8px rgba(0, 0, 0, 0.7);
    transition: transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.tile-squad .tile-art img:nth-child(1) {
    transform: rotate(-10deg) translateY(6%);
}

.tile-squad .tile-art img:nth-child(3) {
    transform: rotate(10deg) translateY(6%);
}

.tile-squad.is-selected .tile-art {
    transform: none;
}

.tile-squad.is-selected .tile-art img:nth-child(1) {
    transform: rotate(-17deg) translate(-22%, 9%);
}

.tile-squad.is-selected .tile-art img:nth-child(2) {
    transform: translateY(-5%);
}

.tile-squad.is-selected .tile-art img:nth-child(3) {
    transform: rotate(17deg) translate(22%, 9%);
}

/* Small tile art */

.tile-crest,
.tile-crests i {
    display: grid;
    place-items: center;
    font-style: normal;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--paper-light);
    background: var(--ink);
    border: 2px solid var(--ink);
    border-radius: 50% 50% 46% 46% / 40% 40% 60% 60%;
    box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 4px var(--paper-light);
}

.tile-crest {
    width: 3.4rem;
    height: 3.4rem;
    background: var(--accent);
    box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 4px var(--paper-light);
}

.tile-crests {
    display: flex;
}

.tile-crests i {
    width: 3rem;
    height: 3rem;
    margin-left: -0.6rem;
}

/* The end crests sit over the middle one so BCPS and MS both read in full. */
.tile-crests i:first-child,
.tile-crests i:last-child {
    z-index: 1;
}

/* The latest club, Microsoft, sits last and in red. */
.tile-crests i:last-child {
    background: var(--accent);
    box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 4px var(--paper-light);
}

.tile-trophies .tile-art {
    width: 2.8rem;
}

.tile-pitch {
    width: 5.6rem;
    height: 3.4rem;
    background:
        linear-gradient(var(--ink), var(--ink)) 50% 0 / 1.5px 100% no-repeat,
        repeating-linear-gradient(90deg, rgba(27, 24, 18, 0.05) 0 0.7rem, transparent 0.7rem 1.4rem),
        var(--paper-light);
    border: 1.5px solid var(--ink);
}

.tile-car {
    position: absolute;
    left: 14%;
    top: 40%;
    width: 1.1rem;
    height: 0.6rem;
    background: var(--accent);
    border: 1.5px solid var(--ink);
    border-radius: 0.15rem;
}

.tile-ball {
    position: absolute;
    left: 48%;
    top: 40%;
    width: 0.65rem;
    height: 0.65rem;
    background: #fff;
    border: 1.5px solid var(--ink);
    border-radius: 50%;
}

.tile-kickoff.is-selected .tile-art {
    transform: none;
}

.tile-kickoff.is-selected .tile-car {
    animation: tile-drive 1.6s cubic-bezier(0.5, 0, 0.3, 1) infinite;
}

.tile-kickoff.is-selected .tile-ball {
    animation: tile-shot 1.6s cubic-bezier(0.2, 0.8, 0.3, 1) infinite;
}

@keyframes tile-drive {
    0% {
        transform: none;
    }
    40%,
    100% {
        transform: translateX(1.4rem);
    }
}

@keyframes tile-shot {
    0%,
    38% {
        transform: none;
    }
    80%,
    100% {
        transform: translateX(2.6rem);
    }
}

.tile-letter {
    width: 3.6rem;
    height: 2.5rem;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 58 40'><rect x='1.5' y='1.5' width='55' height='37' rx='3' fill='%23f8f3e6' stroke='%231b1812' stroke-width='3'/><path d='M3 4 L29 24 L55 4' fill='none' stroke='%231b1812' stroke-width='3' stroke-linejoin='round'/><circle cx='46' cy='30' r='5' fill='%23c8391f'/></svg>") center / contain no-repeat;
}

/* Hero card */

.hero {
    display: grid;
    place-items: center;
    height: 100%;
    min-height: 0;
    perspective: 1400px;
}

.hub .hero .player-wrap {
    position: relative;
    width: min(100%, 22rem, calc((100dvh - 15rem) * 5 / 7));
    margin: 0;
}

.hub .hero .player-wrap::before {
    content: "";
    position: absolute;
    inset: -18% -30%;
    z-index: -1;
    background: radial-gradient(closest-side, rgba(229, 203, 120, 0.35), rgba(200, 57, 31, 0.12) 55%, transparent);
    pointer-events: none;
}

.hub .hero .player-slot {
    animation: hero-sway 7s ease-in-out infinite;
}

.hub .hero .player-slot:hover,
.hub .hero .player-slot:focus-within {
    animation-play-state: paused;
}

@keyframes hero-sway {
    0%,
    100% {
        transform: rotateY(-8deg);
    }
    50% {
        transform: rotateY(8deg);
    }
}

.hub .hero .player-cap {
    margin-top: 0.8rem;
    text-align: center;
    color: #c7c3b2;
}

.hub .hero .player-cap .label {
    color: #c7c3b2;
}

.hero .c-flip.is-selected {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

/* Home footer: ticker, key hints */

.home-foot {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    margin-top: clamp(0.6rem, 1.5vw, 1rem);
    padding: 0.6rem 0 0.8rem;
    color: #c7c3b2;
    border-top: 1px solid rgba(241, 234, 217, 0.14);
}

.ticker {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}

.ticker-track {
    display: flex;
    width: max-content;
    list-style: none;
    animation: ticker 60s linear infinite;
}

.ticker-track li {
    padding-right: 2.6rem;
    white-space: nowrap;
}

.ticker-track li::before {
    content: "\2726";
    margin-right: 0.7rem;
    color: var(--accent);
}

.ticker:hover .ticker-track {
    animation-play-state: paused;
}

@keyframes ticker {
    to {
        transform: translateX(-50%);
    }
}

.hub-keys {
    display: flex;
    gap: 1.1rem;
    font-style: italic;
    white-space: nowrap;
}

.hub-keys kbd + kbd {
    margin-left: 0.15rem;
}

.pack-replay {
    flex: none;
    padding: 0;
    font: inherit;
    font-style: italic;
    color: inherit;
    background: none;
    border: 0;
    border-bottom: 1px solid currentColor;
    cursor: pointer;
}

.pack-replay:hover {
    color: var(--paper-light);
}

@media (hover: none) {
    .hub-keys,
    .screen-back kbd {
        display: none;
    }
}

@media (max-width: 1180px) {
    .hub-keys {
        display: none;
    }
}

@media (max-height: 820px) {
    .tile:not(.tile-squad) .tile-sub {
        display: none;
    }
}

@media (max-height: 680px) {
    .tile:not(.tile-squad) .tile-art {
        scale: 0.8;
        transform-origin: top right;
    }
}

/* Phone and narrow screens */

@media (max-width: 760px) {
    .hub .masthead-row {
        gap: 0.7rem;
    }

    .hub .hub-resume {
        margin-left: auto;
        padding: 0.1rem 0.7rem;
    }

    .hub .sound-toggle {
        width: 2rem;
        height: 2rem;
    }
}

@media (max-width: 480px) {
    .hub .hub-resume span {
        display: none;
    }

    .hub .home {
        padding: 0.7rem 0.8rem 0;
        overflow-y: auto;
    }

    .home-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
        align-items: stretch;
        gap: 0.9rem;
    }

    .hero {
        order: -1;
    }

    .hub .hero .player-wrap {
        width: min(48vw, calc((100dvh - 31rem) * 5 / 7));
        min-width: 8.5rem;
    }

    .hub .hero .player-cap {
        display: none;
    }

    .tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: none;
        grid-auto-rows: minmax(4.4rem, 1fr);
        max-height: none;
    }

    .tile-squad {
        grid-column: 1 / -1;
        grid-row: auto;
        min-height: 6.5rem;
    }

    .tile-transfer {
        grid-column: 1 / -1;
    }

    .tile-sub,
    .tile::after,
    .tile-crests i:not(:last-child) {
        display: none;
    }

    .tile-art {
        transform: scale(0.75);
        transform-origin: top right;
    }

    .tile.is-selected .tile-art {
        transform: scale(0.75) rotate(-6deg);
    }

    .tile-squad .tile-art {
        height: 78%;
        transform: none;
    }

    .home-foot {
        margin-top: 0.6rem;
    }

    .pack-replay {
        display: none;
    }
}

@media (max-width: 620px) {
    .hub main > section:not(.home) {
        inset: 0.3rem;
    }

    .hub .slots {
        display: flex;
        justify-content: flex-start;
        gap: 0.8rem;
        max-width: none;
        margin: 0 -0.3rem;
        padding: 0 0.3rem 0.4rem;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
    }

    .hub .slot {
        flex: 0 0 74%;
        scroll-snap-align: center;
    }
}

/* Pack opening */

.pack-intro {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--paper-light);
    background: radial-gradient(circle at 50% 45%, #2b3d31, #0a0f0c 72%);
}

.pack-intro[hidden] {
    display: none;
}

.pack-intro.is-leaving {
    animation: intro-out 0.45s ease forwards;
}

@keyframes intro-out {
    to {
        opacity: 0;
        transform: scale(1.04);
    }
}

.pack-stage {
    position: relative;
    display: grid;
    place-items: center;
    perspective: 1400px;
}

.pack-stage > * {
    grid-area: 1 / 1;
}

.pack,
.walkout-card {
    width: min(62vw, 19rem, calc(62dvh * 5 / 7));
}

.pack {
    position: relative;
    aspect-ratio: 5 / 7;
    padding: 0;
    font: inherit;
    color: var(--ink);
    background: linear-gradient(135deg, #f6c3e0, #b7ecff 35%, #fff3b0 62%, #c9f2d6 88%);
    border: 0;
    border-radius: 0.9rem;
    box-shadow: 0 34px 60px -18px rgba(0, 0, 0, 0.85), inset 0 0 0 3px rgba(255, 255, 255, 0.6);
    cursor: pointer;
    animation: pack-float 3.2s ease-in-out infinite;
}

.pack::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.65) 48%, transparent 60%) -150% 0 / 250% 100% no-repeat;
    mix-blend-mode: soft-light;
    animation: pack-sheen 2.8s ease-in-out infinite;
    pointer-events: none;
}

.pack:focus-visible {
    outline: 3px solid var(--paper-light);
    outline-offset: 6px;
}

@keyframes pack-float {
    0%,
    100% {
        transform: translateY(0) rotate(-1.5deg);
    }
    50% {
        transform: translateY(-10px) rotate(1.5deg);
    }
}

@keyframes pack-sheen {
    0%,
    30% {
        background-position: -150% 0;
    }
    100% {
        background-position: 250% 0;
    }
}

.pack-strip {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 11%;
    background:
        repeating-linear-gradient(90deg, rgba(27, 24, 18, 0.16) 0 3px, transparent 3px 7px),
        linear-gradient(135deg, #f6c3e0, #b7ecff);
    border-bottom: 2px dashed var(--ink);
    border-radius: 0.9rem 0.9rem 0 0;
}

.pack-face {
    position: absolute;
    inset: 16% 9% 8%;
    display: grid;
    place-content: center;
    gap: 0.4rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid var(--ink);
    border-radius: 0.6rem;
}

.pack-mark {
    font-size: var(--title);
    font-weight: 700;
    line-height: 1;
}

.pack-name {
    font-weight: 600;
}

.pack-sub {
    font-style: italic;
}

.pack-hint,
.pack-continue {
    position: absolute;
    top: calc(100% + 1.4rem);
    justify-self: center;
    white-space: nowrap;
}

.pack-hint {
    font-style: italic;
    color: #c7c3b2;
    transition: opacity 0.2s ease;
}

.pack-continue {
    margin: 0;
    color: var(--ink);
    background: var(--paper-light);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease 0.9s;
}

.pack-continue:hover {
    color: var(--paper-light);
}

.pack-skip {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.25rem 1rem;
    font: inherit;
    font-style: italic;
    color: #c7c3b2;
    background: none;
    border: 1px solid rgba(241, 234, 217, 0.3);
    border-radius: 99px;
    cursor: pointer;
}

.pack-skip:hover {
    color: var(--paper-light);
    border-color: var(--paper-light);
}

.is-tearing .pack {
    animation: pack-shake 0.45s ease both, pack-drop 0.5s ease-in 0.5s forwards;
}

.is-tearing .pack-strip {
    animation: strip-off 0.55s cubic-bezier(0.3, 0.6, 0.4, 1) 0.35s forwards;
}

.is-tearing .pack-hint {
    opacity: 0;
}

@keyframes pack-shake {
    20% {
        transform: rotate(-3deg) scale(1.02);
    }
    40% {
        transform: rotate(3deg) scale(1.03);
    }
    60% {
        transform: rotate(-2deg) scale(1.04);
    }
    80% {
        transform: rotate(2deg) scale(1.04);
    }
    100% {
        transform: scale(1.05);
    }
}

@keyframes strip-off {
    to {
        opacity: 0;
        transform: translate(45%, -220%) rotate(22deg);
    }
}

@keyframes pack-drop {
    to {
        opacity: 0;
        transform: translateY(75vh) rotate(8deg);
    }
}

.walkout {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.walkout::before,
.walkout::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 160vmax;
    height: 160vmax;
    margin: -80vmax 0 0 -80vmax;
    opacity: 0;
    pointer-events: none;
}

.walkout::before {
    background: repeating-conic-gradient(from 0deg, rgba(255, 236, 170, 0.16) 0deg 6deg, transparent 6deg 18deg);
    -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 45%);
    mask-image: radial-gradient(circle, #000 0%, transparent 45%);
}

.walkout::after {
    background: radial-gradient(circle, rgba(255, 244, 200, 0.9) 0%, rgba(246, 195, 224, 0.35) 10%, rgba(183, 236, 255, 0.15) 22%, transparent 38%);
}

.is-walkout .walkout::before {
    animation: rays-in 0.8s ease forwards, rays-spin 24s linear infinite;
}

.is-walkout .walkout::after {
    animation: flare-in 0.9s ease forwards;
}

@keyframes rays-in {
    to {
        opacity: 1;
    }
}

@keyframes rays-spin {
    to {
        rotate: 360deg;
    }
}

@keyframes flare-in {
    from {
        opacity: 0;
        transform: scale(0.2);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.walkout-step {
    grid-area: 1 / 1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: var(--title);
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: scale(2.6);
    transition: opacity 0.25s ease, transform 0.55s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.pack-intro[data-step="city"] [data-step="city"],
.pack-intro[data-step="position"] [data-step="position"],
.pack-intro[data-step="club"] [data-step="club"] {
    opacity: 1;
    transform: scale(1.6);
}

.walkout-crest {
    display: grid;
    place-items: center;
    flex: none;
    width: 3em;
    height: 3em;
    padding-bottom: 0.15em;
    font-size: 0.5em;
    letter-spacing: -0.04em;
    color: var(--paper-light);
    background: var(--ink);
    border: 2px solid var(--paper-light);
    border-radius: 50% 50% 46% 46% / 40% 40% 60% 60%;
    box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 4px var(--paper-light);
}

.walkout-card {
    opacity: 0;
    transform: translateY(18%) rotateY(180deg) scale(0.7);
    transition: opacity 0.3s ease, transform 1.1s cubic-bezier(0.2, 0.9, 0.25, 1.05);
    pointer-events: none;
}

.walkout-card .player-slot {
    width: 100%;
}

.is-reveal .walkout-card {
    opacity: 1;
    transform: none;
}

.is-reveal .pack-continue {
    opacity: 1;
    pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
    .hub main > section,
    .hub main > section.is-active:not(.home),
    .tile,
    .tile-art,
    .tile-squad .tile-art img {
        animation: none;
        transition: none;
    }

    .hub .hero .player-slot,
    .ticker-track,
    .tile-kickoff.is-selected .tile-car,
    .tile-kickoff.is-selected .tile-ball {
        animation: none;
    }

    .ticker {
        overflow-x: auto;
    }
}

/* Squad: formation view */

.squad-views,
.formation,
.inspect {
    display: none;
}

.hub .squad-views {
    display: flex;
    gap: 0.3rem;
    padding: 0.2rem;
    background: var(--paper-deep);
    border: 1.5px solid var(--ink);
    border-radius: 99px;
}

.squad-views button {
    padding: 0.2rem 0.9rem;
    font: inherit;
    font-size: var(--text);
    color: var(--ink-soft);
    background: none;
    border: 0;
    border-radius: 99px;
    cursor: pointer;
    white-space: nowrap;
}

.squad-views button[aria-selected="true"] {
    color: var(--paper-light);
    background: var(--ink);
}

.hub .binder-section[data-view="formation"] .formation {
    display: grid;
}

.hub .binder-section[data-view="formation"] .binder-hint,
.hub .binder-section[data-view="formation"] .binder {
    display: none;
}

.formation {
    --mini-w: min(8.6rem, calc((100dvh - 15.5rem) / 6.6));
    --mini-gap: calc(var(--mini-w) * 0.24);
    grid-template-columns: auto minmax(15rem, 24rem);
    justify-content: center;
    align-items: start;
    gap: clamp(1rem, 3vw, 2.5rem);
}

.hub .binder-section[data-view="formation"] {
    padding-bottom: 0.4rem;
}

.pitch-board {
    position: relative;
    display: grid;
    gap: var(--mini-gap);
    padding: calc(var(--mini-gap) * 0.9) calc(var(--mini-gap) * 1.6);
    background:
        linear-gradient(rgba(241, 234, 217, 0.32), rgba(241, 234, 217, 0.32)) 50% 50% / 100% 1.5px no-repeat,
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0 12.5%, transparent 12.5% 25%),
        radial-gradient(ellipse at 50% 45%, #2a4a35, #18291f 80%);
    border: 2px solid var(--ink);
    border-radius: 0.9rem;
    box-shadow: inset 0 0 0 0.45rem rgba(0, 0, 0, 0.12), 0 18px 34px -16px rgba(20, 14, 4, 0.55);
    overflow: hidden;
}

.pitch-board::before,
.pitch-board::after {
    content: "";
    position: absolute;
    left: 50%;
    width: 52%;
    height: 13%;
    border: 1.5px solid rgba(241, 234, 217, 0.32);
    transform: translateX(-50%);
    pointer-events: none;
}

.pitch-board::before {
    top: -1.5px;
}

.pitch-board::after {
    bottom: -1.5px;
}

.pitch-board .line {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-evenly;
    gap: var(--mini-gap);
}

.pitch-board .line[data-line="attack"],
.pitch-board .line[data-line="midfield"] {
    padding: 0 calc(var(--mini-w) * 0.35);
}

.chem {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.chem line {
    stroke: #8fd99a;
    stroke-width: 2.5;
    stroke-linecap: round;
    opacity: 0.55;
    transition: opacity 0.2s ease, stroke-width 0.2s ease;
}

.chem line.is-on {
    stroke-width: 4;
    opacity: 1;
    filter: drop-shadow(0 0 6px rgba(143, 217, 154, 0.8));
}

.chem line.is-dim {
    opacity: 0.12;
}

/* Mini player card */

.mini {
    position: relative;
    flex: none;
    width: var(--mini-w);
    aspect-ratio: 5 / 7;
    padding: 0;
    font: inherit;
    color: var(--ink);
    background: none;
    border: 0;
    container-type: inline-size;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.mini-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 3cqw;
    padding: 6cqw 6cqw 5cqw;
    text-align: left;
    background: var(--tone, #d6cfbd);
    border: 1.5px solid var(--ink);
    border-radius: 7cqw;
    box-shadow: 0 5cqw 9cqw -3cqw rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.mini.is-foil .mini-face::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, rgba(255, 120, 190, 0.3), rgba(110, 215, 255, 0.3) 38%, rgba(255, 240, 150, 0.32) 62%, rgba(170, 255, 200, 0.26)) 0 0 / 220% 220%;
    mix-blend-mode: soft-light;
    pointer-events: none;
    transition: background-position 0.6s ease;
}

.mini:not(.is-foil) .mini-face {
    filter: saturate(0.82);
}

.mini-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    line-height: 1;
}

.mini-pos {
    font-size: 17cqw;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.mini-no {
    font-size: 10cqw;
    opacity: 0.7;
}

.mini-art {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border: 1.5px solid var(--ink);
    border-radius: 4cqw;
}

.mini-art img {
    width: 100%;
    height: 100%;
}

.mini-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 11.5cqw;
    font-weight: 700;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.mini-fact {
    overflow: hidden;
    font-size: 9.5cqw;
    font-style: italic;
    line-height: 1.1;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.mini:hover,
.mini:focus-visible {
    z-index: 3;
    transform: translateY(-6%) scale(1.08);
}

.mini.is-foil:hover .mini-face::before {
    background-position: 100% 100%;
}

.mini:focus-visible {
    outline: none;
}

.mini:focus-visible .mini-face {
    box-shadow: 0 0 0 3px var(--accent), 0 5cqw 9cqw -3cqw rgba(0, 0, 0, 0.6);
}

.mini.is-dragging {
    z-index: 50;
    cursor: grabbing;
    transition: none;
}

.mini.is-returning {
    transition: transform 0.45s cubic-bezier(0.3, 1.45, 0.45, 1);
}

.mini.is-target .mini-face {
    box-shadow: 0 0 0 3px #8fd99a, 0 0 18px rgba(143, 217, 154, 0.7);
}

.formation.is-dragging .mini:not(.is-dragging):hover {
    transform: none;
}

.formation.is-dealing .mini {
    animation: mini-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.15) backwards;
    animation-delay: calc(var(--i) * 30ms);
}

.formation.is-dealing .chem {
    animation: chem-in 0.5s ease 0.45s backwards;
}

@keyframes mini-in {
    from {
        opacity: 0;
        transform: translateY(-30%) rotateY(90deg) scale(0.8);
    }
}

@keyframes chem-in {
    from {
        opacity: 0;
    }
}

/* Dugout: scout report, bench, reserves */

.dugout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-content: start;
}

.scout {
    padding: 0.9rem 1rem 1rem;
    background: var(--paper-light);
    border: 1.5px solid var(--ink);
    box-shadow: 4px 4px 0 var(--ink);
    height: clamp(13rem, calc(100dvh - 37rem), 17rem);
    overflow-y: auto;
}

.scout .label {
    margin-top: 0.4rem;
}

.scout .label:first-child {
    margin-top: 0;
}

.scout-name {
    font-size: var(--title);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.scout-body {
    margin-top: 0.3rem;
    line-height: 1.35;
}

.scout-hint {
    margin-top: 0.3rem;
    font-style: italic;
    color: var(--ink-soft);
    line-height: 1.35;
}

.scout-legend {
    margin-top: 0.3rem;
    list-style: none;
    line-height: 1.35;
}

.scout-legend strong {
    margin-right: 0.3rem;
}

.dugout-group .label {
    margin-bottom: 0.4rem;
}

.bench {
    --mini-w: min(6.4rem, calc((100dvh - 14.5rem) / 9.8));
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dugout-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.lineup-reset {
    justify-self: start;
    padding: 0;
    font: inherit;
    font-style: italic;
    color: var(--accent);
    background: none;
    border: 0;
    border-bottom: 1px solid currentColor;
    cursor: pointer;
}

@media (max-width: 620px) {
    .hub .squad-views + .screen-name {
        display: none;
    }

    .squad-views button {
        padding: 0.2rem 0.5rem;
    }

    .hub #binder .screen-bar {
        gap: 0.5rem;
    }
}

@media (max-width: 960px) {
    .formation {
        --mini-w: min(8rem, calc((100vw - 5rem) / 5));
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
    }

    .dugout {
        width: 100%;
    }

    .scout {
        height: auto;
    }

    .bench {
        --mini-w: min(6.4rem, calc((100vw - 4rem) / 4.6));
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.4rem;
    }
}

/* Inspect overlay */

.hub .inspect:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--paper-light);
}

.inspect-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 45%, rgba(43, 61, 49, 0.88), rgba(10, 15, 12, 0.94) 70%);
    backdrop-filter: blur(4px);
}

.inspect-meta,
.inspect-stage,
.inspect-close {
    position: relative;
}

.inspect-meta {
    font-style: italic;
    color: #c7c3b2;
    text-align: center;
}

.inspect-meta strong {
    margin-right: 0.3rem;
    font-style: normal;
    color: var(--paper-light);
}

.inspect-stage {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 3vw, 2rem);
    perspective: 1400px;
}

.inspect-slot {
    position: relative;
    width: min(24rem, 70vw, calc((100dvh - 9rem) * 5 / 7));
    aspect-ratio: 5 / 7;
    container-type: inline-size;
}

.inspect-slot .card {
    inset: 0;
}

.inspect-slot.is-in {
    animation: inspect-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

@keyframes inspect-in {
    from {
        opacity: 0;
        transform: rotateY(-35deg) scale(0.85);
    }
}

.inspect-nav,
.inspect-close {
    font: inherit;
    font-size: var(--text);
    color: var(--paper-light);
    background: none;
    border: 1px solid rgba(241, 234, 217, 0.35);
    border-radius: 99px;
    cursor: pointer;
}

.inspect-nav {
    width: 2.6rem;
    height: 2.6rem;
}

.inspect-close {
    padding: 0.25rem 1rem;
}

.inspect-nav:hover,
.inspect-close:hover {
    border-color: var(--paper-light);
    background: rgba(241, 234, 217, 0.08);
}

@media (hover: none) {
    .inspect-close kbd {
        display: none;
    }
}

@media (max-width: 620px) {
    .inspect-stage {
        gap: 0.4rem;
    }

    .inspect-nav {
        width: 2.2rem;
        height: 2.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mini,
    .chem line {
        transition: none;
    }

    .formation.is-dealing .mini,
    .formation.is-dealing .chem,
    .inspect-slot.is-in {
        animation: none;
    }
}

/* Warp between screens */

.warp {
    position: fixed;
    z-index: 120;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--ink);
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 1rem;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.75);
    pointer-events: none;
}

.warp[hidden] {
    display: none;
}

.warp.is-dark {
    color: var(--paper-light);
    background:
        radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.08), transparent 55%),
        var(--page);
}

.warp-band {
    position: absolute;
    top: -10%;
    bottom: -10%;
    left: 0;
    width: 45%;
    background: linear-gradient(90deg, transparent, rgba(200, 57, 31, 0.9) 25%, #e5cb78 50%, rgba(200, 57, 31, 0.9) 75%, transparent);
}

.warp.is-back .warp-band {
    display: none;
}

.warp-title {
    position: relative;
    display: grid;
    justify-items: center;
    text-align: center;
}

.warp-kicker {
    font-style: italic;
    color: var(--ink-soft);
}

.warp.is-dark .warp-kicker {
    color: #c7c3b2;
}

.warp-name {
    font-size: var(--title);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.tile.is-landing {
    animation: tile-land 0.5s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes tile-land {
    from {
        transform: scale(0.94);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tile.is-landing {
        animation: none;
    }
}

@media (max-width: 480px) {
    .hub .theme-label {
        display: none;
    }

    .hub .pf-tabs .pf-key {
        display: none;
    }

    .hub .pf-tabs button {
        padding: 0.2rem 0.55rem;
    }
}
