:root {
    --color-black: #050505;
    --color-panel: #0b0b0b;
    --color-white: #ffffff;
    --color-text: #101010;
    --color-muted: #777777;
    --color-border: #e5e5e5;
    --color-input: #fffed1;
    --color-accent: #ffffff;
    --color-available: #dff5e5;
    --color-available-text: #176b38;
    --color-unavailable: #eeeeee;
    --color-unavailable-text: #777777;
    --color-error: #b42318;
    --color-success: #16794b;
    --shadow-soft: 0 22px 46px rgba(0, 0, 0, .14);
    --font: Inter, Arial, Helvetica, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--color-black);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--color-text);
    background: var(--color-white);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.shirt-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas:
        "form preview"
        "details preview";
    background: linear-gradient(90deg, var(--color-white) 0 50%, var(--color-black) 50% 100%);
}

.form-panel,
.details-panel {
    background: var(--color-white);
}

.form-panel {
    grid-area: form;
    display: grid;
    align-items: center;
    justify-items: center;
    padding: 56px clamp(24px, 5vw, 96px) 28px;
}

.details-panel {
    grid-area: details;
    display: grid;
    justify-items: center;
    padding: 0 clamp(24px, 5vw, 96px) 56px;
}

.form-shell,
.details-shell {
    width: min(100%, 520px);
}

.brand {
    width: 96px;
    margin: 0 0 28px;
    text-align: center;
    text-transform: uppercase;
    color: #777;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 5px;
}

.brand-logo {
    display: block;
    width: 72px;
    height: auto;
    margin: 0 auto 10px;
}

.intro-copy {
    margin-bottom: 28px;
}

.intro-copy h1 {
    max-width: 540px;
    margin: 0 0 14px;
    font-size: clamp(42px, 5.4vw, 72px);
    line-height: .9;
    font-weight: 900;
    letter-spacing: 0;
}

.intro-copy p {
    max-width: 520px;
    margin: 0;
    color: var(--color-muted);
    font-size: 16px;
    line-height: 1.6;
}

.intro-copy small {
    display: block;
    max-width: 500px;
    margin-top: 10px;
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
}

.field-group {
    margin-bottom: 8px;
}

.field-group label,
.field-group > span {
    display: block;
    margin-bottom: 4px;
    color: #151515;
    font-size: 13px;
    font-weight: 400;
}

input,
select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-input);
    color: #151515;
    padding: 0 16px;
    font-weight: 400;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #111 50%),
        linear-gradient(135deg, #111 50%, transparent 50%);
    background-position:
        calc(100% - 20px) 21px,
        calc(100% - 14px) 21px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

input:focus,
select:focus,
button:focus-visible {
    border-color: #111;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, .1);
}

.field-help,
.field-error {
    min-height: 0;
    margin: 3px 0 0;
    font-size: 12px;
    line-height: 1.45;
}

.field-help {
    color: var(--color-muted);
}

.field-error {
    color: var(--color-error);
    font-weight: 400;
}

.message {
    margin-bottom: 18px;
    border-radius: 10px;
    padding: 13px 14px;
    background: #f8f8f8;
    color: #151515;
    font-weight: 400;
    line-height: 1.45;
}

.message.is-error {
    background: #fff1ef;
    color: var(--color-error);
}

.message.is-success {
    background: #e9f8ef;
    color: var(--color-success);
}

.numbers-section {
    animation: riseIn .28s ease both;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-end;
    margin: 18px 0 14px;
}

.eyebrow {
    display: block;
    margin-bottom: 8px;
    color: #9d9d9d;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.section-heading h2,
.preview-copy h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1;
    font-weight: 900;
}

#numbersStatus {
    max-width: 190px;
    margin: 0;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 400;
    text-align: right;
}

.number-grid {
    max-height: 300px;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 7px;
    padding: 2px 4px 2px 0;
    scrollbar-color: #cfcfcf transparent;
}

.number-button {
    aspect-ratio: 1;
    min-width: 0;
    border: 1px solid #a8d9b5;
    border-radius: 8px;
    background: var(--color-available);
    color: var(--color-available-text);
    font-size: 14px;
    font-weight: 400;
    transition: transform .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
}

.number-button:not(.is-unavailable):hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(23, 107, 56, .16);
}

.number-button.is-unavailable {
    border-color: #d8d8d8;
    background: var(--color-unavailable);
    color: var(--color-unavailable-text);
    cursor: not-allowed;
}

.number-button.is-selected {
    border-color: #000;
    background: #000;
    color: #fff;
    box-shadow: 0 10px 22px rgba(0, 0, 0, .2);
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 12px;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 400;
}

.legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 99px;
    display: inline-block;
}

.legend-dot.is-available {
    background: var(--color-available);
    border: 1px solid #a8d9b5;
}

.legend-dot.is-unavailable {
    background: var(--color-unavailable);
    border: 1px solid #d8d8d8;
}

.legend-dot.is-selected {
    background: #000;
    border: 1px solid #000;
}

.details-shell {
    animation: riseIn .28s ease both;
}

.privacy-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 8px 0 10px;
    color: #333;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
}

.privacy-check input {
    width: 17px;
    min-width: 17px;
    height: 17px;
    min-height: 17px;
    margin-top: 1px;
    padding: 0;
    accent-color: #000;
}

.primary-button,
.secondary-button {
    min-height: 50px;
    border-radius: 999px;
    border: 0;
    padding: 0 22px;
    font-size: 14px;
    font-weight: 400;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.primary-button {
    width: 100%;
    background: #000;
    color: #fff;
    box-shadow: var(--shadow-soft);
}

.primary-button:not(:disabled):hover,
.secondary-button:hover {
    transform: translateY(-1px);
}

.primary-button:disabled {
    cursor: not-allowed;
    opacity: .42;
    box-shadow: none;
}

.secondary-button {
    background: #f1f1f1;
    color: #111;
}

.preview-panel {
    position: relative;
    grid-area: preview;
    min-height: 100vh;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: clamp(36px, 6vw, 96px);
    background:
        radial-gradient(circle at 72% 22%, rgba(255, 255, 255, .08), transparent 28%),
        #000;
}

.powered-by {
    position: absolute;
    right: clamp(18px, 3vw, 42px);
    bottom: clamp(16px, 3vw, 34px);
    color: rgba(255, 255, 255, .18);
    font-size: 10px;
    line-height: 1;
    text-decoration: none;
    letter-spacing: .2px;
    transition: color .2s ease;
}

.powered-by:visited {
    color: rgba(255, 255, 255, .18);
}

.powered-by:hover {
    color: rgba(255, 255, 255, .34);
}

.preview-card {
    width: min(92%, 760px);
    min-height: min(68vh, 560px);
    display: grid;
    grid-template-columns: minmax(190px, .7fr) minmax(280px, 1.05fr);
    gap: clamp(18px, 3vw, 34px);
    align-items: center;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 28px;
    background: linear-gradient(145deg, #151515, #050505 64%, #0d0d0d);
    box-shadow: 0 36px 86px rgba(0, 0, 0, .46);
    padding: clamp(32px, 4vw, 54px);
    transform: translateX(-4vw) rotate(-7deg);
}

.preview-copy,
.jersey-stage {
    transform: rotate(7deg);
}

.preview-copy .eyebrow {
    color: #a7a7a7;
}

.preview-copy h2 {
    color: #fff;
    font-size: clamp(36px, 4vw, 58px);
    line-height: .95;
}

.preview-copy p {
    max-width: 340px;
    margin: 18px 0 0;
    color: #9b9b9b;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.55;
}

.jersey-stage {
    display: grid;
    place-items: center;
    min-width: 0;
}

.jersey {
    width: min(100%, 370px);
    height: auto;
    overflow: visible;
}

.jersey-shadow {
    fill: rgba(255, 255, 255, .03);
    transform: translate(10px, 12px);
}

.jersey-body {
    fill: url(#jerseyBody);
    stroke: rgba(255, 255, 255, .18);
    stroke-width: 2;
}

.cava-cut {
    fill: #060606;
    opacity: .96;
}

.trim {
    fill: none;
    stroke: #f6f6f6;
    stroke-linecap: round;
    stroke-width: 7;
}

.side-panel {
    fill: var(--color-accent);
    opacity: .18;
}

.jersey-name,
.jersey-number,
.jersey-years,
.star-strip text {
    fill: #fff;
    font-family: var(--font);
    font-weight: 400;
    letter-spacing: 0;
}

.jersey-name {
    font-size: 18px;
    letter-spacing: .5px;
}

.jersey-number {
    fill: #070707;
    stroke: #fff;
    stroke-width: 1.5;
    font-size: 92px;
    paint-order: stroke fill;
}

.jersey-number-stroke {
    fill: none;
    stroke: #fff;
    stroke-linejoin: round;
    stroke-width: 6;
}

.jersey-number.is-empty {
    fill: #fff;
    stroke: none;
    font-size: 48px;
}

.jersey-years {
    fill: rgba(255, 255, 255, .6);
    font-size: 11px;
    letter-spacing: 7px;
}

.star-strip text {
    fill: #fff;
    font-size: 12px;
    opacity: .95;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(0, 0, 0, .62);
    animation: fadeIn .18s ease both;
}

.modal-backdrop[hidden],
[hidden] {
    display: none !important;
}

.modal-card {
    width: min(100%, 480px);
    border-radius: 18px;
    background: #fff;
    padding: 28px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .34);
    animation: riseIn .2s ease both;
}

.modal-card h2 {
    margin: 0 0 18px;
    font-size: 30px;
    line-height: 1;
    font-weight: 900;
}

.modal-card p {
    color: var(--color-muted);
    font-weight: 400;
    line-height: 1.55;
}

.summary-list {
    display: grid;
    grid-template-columns: minmax(110px, auto) 1fr;
    gap: 8px 14px;
    margin: 0;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 14px;
    background: #fafafa;
}

.summary-list dt,
.summary-list dd {
    margin: 0;
    font-size: 13px;
}

.summary-list dt {
    color: var(--color-muted);
    font-weight: 400;
}

.summary-list dd {
    color: #111;
    font-weight: 400;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 22px;
}

.success-box {
    margin-top: 18px;
    border-radius: 14px;
    background: #e9f8ef;
    color: var(--color-success);
    padding: 18px;
    line-height: 1.45;
}

.success-box strong {
    display: block;
    margin-bottom: 8px;
    font-size: 18px;
    font-weight: 400;
}

.success-box p {
    margin: 0 0 12px;
}

.success-box code {
    display: block;
    margin-bottom: 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .7);
    padding: 10px 12px;
    color: #0f5b35;
    font-weight: 400;
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (max-width: 1180px) {
    .shirt-page {
        grid-template-columns: minmax(0, .95fr) minmax(360px, 1.05fr);
    }

    .preview-card {
        width: 92%;
        grid-template-columns: 1fr;
        min-height: auto;
        transform: translateX(-3vw) rotate(-4deg);
    }

    .preview-copy,
    .jersey-stage {
        transform: rotate(4deg);
    }

    .number-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }
}

@media (min-width: 861px) {
    .shirt-page {
        display: block;
        background: linear-gradient(90deg, var(--color-white) 0 50%, var(--color-black) 50% 100%);
    }

    .form-panel,
    .details-panel {
        width: 50%;
    }

    .form-panel {
        min-height: 100vh;
    }

    .shirt-page.has-details .form-panel {
        min-height: auto;
        align-items: start;
        padding-bottom: 14px;
    }

    .shirt-page.has-details .details-panel {
        padding-top: 0;
    }

    .preview-panel {
        position: fixed;
        inset: 0 0 0 50%;
        width: 50%;
        height: 100vh;
        min-height: 100vh;
        z-index: 1;
    }
}

@media (max-width: 860px) {
    body {
        background: var(--color-white);
    }

    .shirt-page {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        background: var(--color-white);
    }

    .form-panel,
    .details-panel {
        padding: 34px 20px 20px;
    }

    .preview-panel {
        order: 2;
        min-height: auto;
        padding: 30px 20px 54px;
    }

    .details-panel {
        order: 3;
        padding-top: 22px;
        padding-bottom: 38px;
    }

    .form-panel {
        order: 1;
    }

    .brand {
        margin-bottom: 22px;
    }

    .intro-copy h1 {
        font-size: 48px;
    }

    .number-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        max-height: none;
        overflow: visible;
        gap: 8px;
    }

    .preview-card {
        width: min(100%, 520px);
        grid-template-columns: 1fr;
        border-radius: 20px;
        padding: 28px 20px;
        transform: none;
    }

    .preview-copy,
    .jersey-stage {
        transform: none;
    }

    .preview-copy h2 {
        font-size: 38px;
    }

    .jersey {
        width: min(100%, 310px);
    }

    .modal-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 430px) {
    .form-panel,
    .details-panel {
        padding-left: 16px;
        padding-right: 16px;
    }

    .intro-copy h1 {
        font-size: 42px;
    }

    .section-heading {
        display: block;
    }

    #numbersStatus {
        max-width: none;
        margin-top: 8px;
        text-align: left;
    }

    .number-button {
        border-radius: 7px;
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
