:root {
    color-scheme: dark;
    --bg: #0b0b0f;
    --card: rgba(255, 255, 255, 0.06);
    --line: rgba(255, 255, 255, 0.12);
    --text: #f5f7fb;
    --muted: rgba(245, 247, 251, 0.68);
    --blue: #2563eb;
    --blue-2: #3b82f6;
    --danger: #ff8d8d;
    --ok: #34d399;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(ellipse at 15% 0%, rgba(37, 99, 235, 0.28), transparent 46%),
        radial-gradient(ellipse at 90% 10%, rgba(99, 56, 176, 0.28), transparent 42%),
        var(--bg);
}

.wrap {
    width: min(640px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 56px;
}

.brand {
    height: 34px;
    width: auto;
    display: block;
    margin-bottom: 18px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 28px 24px;
}

h1 {
    font-size: 40px;
    line-height: 1.05;
    letter-spacing: -0.04em;
    margin: 0 0 12px;
}

h2 {
    font-size: 28px;
    letter-spacing: -0.03em;
    margin: 0 0 8px;
}

p { line-height: 1.5; }

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

.lead { font-size: 18px; color: var(--muted); margin: 0 0 22px; }

button, .choice {
    font: inherit;
    cursor: pointer;
}

.primary, .secondary, .choice {
    display: block;
    width: 100%;
    border-radius: 999px;
    padding: 14px 18px;
    font-weight: 700;
    text-align: center;
}

.primary {
    border: 0;
    color: white;
    background: linear-gradient(135deg, var(--blue), var(--blue-2));
}

.primary:disabled,
.primary[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.25);
}

.secondary, .choice {
    border: 1px solid var(--line);
    color: white;
    background: rgba(255, 255, 255, 0.04);
    text-decoration: none;
}

.stack { display: grid; gap: 12px; margin-top: 18px; }

.date-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }

input, select {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #121218;
    color: white;
    padding: 12px 14px;
    font: inherit;
}

input[readonly] {
    opacity: 0.85;
    cursor: default;
    color: rgba(245, 247, 251, 0.88);
}

.name-input-wrap {
    position: relative;
    display: block;
}

.name-input-wrap input {
    padding-right: 44px;
}

.name-status {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    pointer-events: none;
}

.name-status.ok { color: var(--ok); }
.name-status.taken { color: var(--danger); }
.name-status.checking { color: var(--muted); font-size: 14px; }
.name-status.idle { opacity: 0; }

.error { color: var(--danger); font-size: 13px; font-weight: 600; margin: 0; }

.row-error { margin-top: -4px; }

.summary {
    display: grid;
    gap: 8px;
    margin: 16px 0;
    padding: 0;
    list-style: none;
}

.summary li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.summary span { color: var(--muted); }

.check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-weight: 500;
}

.check input { width: auto; margin-top: 3px; }

.preview {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 12px;
}

.preview th, .preview td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.preview-scroll {
    overflow-x: visible;
    margin: 12px 0 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.preview-scroll .preview {
    margin: 0;
    min-width: 0;
}

.preview-heading {
    margin: 18px 0 0;
    font-size: 16px;
}

.preview input {
    width: 100%;
    min-width: 0;
    margin: 0 0 4px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font: inherit;
}

.preview td.readonly,
.preview-value .readonly {
    color: var(--muted);
    white-space: normal;
}

.preview td.preview-actions,
.preview-card .preview-actions {
    width: 1%;
    white-space: nowrap;
    vertical-align: middle;
}

.preview-stack {
    display: grid;
    gap: 12px;
    margin: 12px 0 4px;
}

.preview-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    display: grid;
    gap: 10px;
}

.preview-field {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.preview-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
}

.preview-value {
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    min-width: 0;
}

.preview-card .preview-actions {
    margin-top: 4px;
}

.manual-accordion-list {
    display: grid;
    gap: 10px;
}

.manual-accordion {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.manual-accordion-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 14px 16px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.manual-accordion-toggle:hover {
    background: rgba(255, 255, 255, 0.04);
}

.manual-accordion-title {
    display: grid;
    gap: 2px;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.manual-accordion-title strong {
    font-size: 16px;
    letter-spacing: -0.02em;
}

.manual-accordion-title .muted {
    font-size: 13px;
    font-weight: 500;
}

.manual-accordion-chevron {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 16px;
    line-height: 1;
}

.manual-accordion-body {
    margin: 0;
    padding: 0 16px 16px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.manual-accordion-body input {
    overflow-wrap: anywhere;
}

.preview-delete {
    display: inline-block;
    width: auto;
    margin: 0;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 141, 141, 0.35);
    background: rgba(255, 141, 141, 0.12);
    color: #ffb4b4;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.preview-delete:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.preview-delete:hover:not(:disabled) {
    background: rgba(255, 141, 141, 0.2);
}

.back {
    margin-top: 14px;
    background: transparent;
    color: var(--muted);
    border: 0;
    padding: 8px 0;
    font-weight: 600;
}

.counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }

.count {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    padding: 12px;
    text-align: center;
}

.count strong { display: block; font-size: 22px; }

.count span { color: var(--muted); font-size: 12px; }

.connected-club {
    margin: 16px 0 4px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(99, 56, 176, 0.14));
}

.connected-club-label {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(147, 197, 253, 0.95);
}

.connected-club strong {
    display: block;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.connected-club .muted {
    margin: 4px 0 0;
    font-size: 13px;
}

.example-toggle-wrap {
    margin: 16px 0 4px;
}

.example-toggle,
.example-hide {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 600;
}

.example-arrow {
    font-size: 12px;
    color: var(--muted);
}

.example-panel {
    margin-top: 12px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.example-panel .muted {
    margin: 0 0 8px;
    font-size: 13px;
}

.example-panel .example-table {
    margin: 0 0 12px;
}

.example-panel .example-table .preview {
    min-width: 560px;
}

.example-hide {
    margin-top: 0;
}

/* Exact poster landing */
body.is-landing.is-poster {
    background: #050814;
    overflow: hidden;
}

body.is-landing.is-poster .brand {
    display: none;
}

body.is-landing.is-poster .wrap {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.is-landing.is-poster .card {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    flex: none;
    width: min(100vw, calc(100vh * 910 / 1024));
    height: min(100vh, calc(100vw * 1024 / 910));
    display: block;
    align-items: stretch;
    justify-content: stretch;
}

.landing-poster {
    position: relative;
    width: 100%;
    height: 100%;
}

.landing-poster img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: fill;
    pointer-events: none;
    user-select: none;
}

.landing-poster .error,
.landing-poster .muted {
    position: absolute;
    left: 12%;
    right: 12%;
    top: 8%;
    z-index: 2;
    text-align: center;
    background: rgba(5, 8, 20, 0.72);
    border-radius: 12px;
    padding: 8px 12px;
}

.poster-hit {
    position: absolute;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: transparent;
    font-size: 0;
    cursor: pointer;
    padding: 0;
}

.poster-hit:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 3px;
}

.poster-connect {
    left: 12.1%;
    top: 45.8%;
    width: 64.7%;
    height: 6.5%;
}

.poster-signin {
    left: 18.5%;
    top: 73.0%;
    width: 62%;
    height: 6.3%;
}

.poster-update {
    left: 18.5%;
    top: 79.9%;
    width: 62%;
    height: 6.8%;
}

/* Landing hero */
body.is-landing {
    background: #050812;
    min-height: 100vh;
}

body.is-landing::before {
    content: "";
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(100vw, calc(100vh * 910 / 1024));
    background: url("/link-tournament/hero-scene.jpg") center / cover no-repeat;
    -webkit-mask-image: linear-gradient(
        90deg,
        transparent 0%,
        rgba(0, 0, 0, 0.04) 8%,
        rgba(0, 0, 0, 0.12) 18%,
        rgba(0, 0, 0, 0.28) 32%,
        rgba(0, 0, 0, 0.48) 46%,
        rgba(0, 0, 0, 0.68) 60%,
        rgba(0, 0, 0, 0.86) 74%,
        #000 88%,
        #000 100%
    );
    mask-image: linear-gradient(
        90deg,
        transparent 0%,
        rgba(0, 0, 0, 0.04) 8%,
        rgba(0, 0, 0, 0.12) 18%,
        rgba(0, 0, 0, 0.28) 32%,
        rgba(0, 0, 0, 0.48) 46%,
        rgba(0, 0, 0, 0.68) 60%,
        rgba(0, 0, 0, 0.86) 74%,
        #000 88%,
        #000 100%
    );
    pointer-events: none;
    z-index: 0;
}

body.is-landing .wrap {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    margin: 0;
    padding: 88px 24px 40px;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

body.is-landing .brand {
    position: absolute;
    top: 28px;
    left: 24px;
    height: 41px;
    margin: 0;
    z-index: 2;
}

body.is-landing .card {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: max(24px, min(8vw, 96px));
    padding-right: max(40%, min(48vw, 560px));
    position: relative;
    z-index: 1;
}

.landing-shell {
    width: min(552px, 100%);
    display: grid;
    gap: 16px;
}

.landing-hero-card {
    background: rgba(18, 22, 36, 0.52);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 32px;
    padding: 41px 37px 32px;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.landing-eyebrow {
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(226, 232, 240, 0.72);
    text-align: center;
}

.landing-title {
    margin: 0 0 16px;
    font-size: clamp(39px, 5.75vw, 55px);
    line-height: 1.08;
    letter-spacing: -0.04em;
    text-align: center;
    font-weight: 800;
}

.landing-title span {
    color: #3b82f6;
}

.landing-lead {
    margin: 0 0 25px;
    font-size: 20px;
    line-height: 1.55;
    color: rgba(245, 247, 251, 0.88);
    text-align: center;
}

.landing-cta {
    margin: 0 0 25px;
    font-size: 18px;
    padding: 18px 25px;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.35);
}

.landing-perks {
    list-style: none;
    margin: 0;
    padding: 21px 4px 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.landing-perks li {
    display: grid;
    justify-items: center;
    gap: 9px;
    text-align: center;
    padding: 0 9px;
    position: relative;
    font-size: 14px;
    font-weight: 600;
    color: rgba(245, 247, 251, 0.9);
    line-height: 1.3;
}

.landing-perks li:not(:last-child)::after {
    content: "";
    position: absolute;
    right: 0;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: rgba(255, 255, 255, 0.14);
}

.landing-perk-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.16);
    border: 1px solid rgba(147, 197, 253, 0.28);
}

.landing-perk-icon svg {
    width: 25px;
    height: 25px;
}

.landing-secondary {
    display: grid;
    gap: 12px;
}

.landing-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    width: 100%;
    border-radius: 999px;
    padding: 16px 21px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(10, 14, 24, 0.55);
    color: rgba(245, 247, 251, 0.86);
    text-decoration: none;
    font: inherit;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.landing-bar strong {
    color: #60a5fa;
    font-weight: 700;
}

.landing-bar:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

body.is-landing .connected-club {
    margin: 0 0 16px;
}

@media (max-width: 640px) {
    h1 { font-size: 34px; }
    .card { padding: 22px 16px; }
    .counts { grid-template-columns: 1fr; }
    .date-row { grid-template-columns: 1fr; }

    body.is-landing::before {
        inset: auto;
        top: 0;
        left: 0;
        width: 100%;
        height: min(48vh, calc(100vw * 1024 / 910));
        background-position: center top;
        background-size: contain;
        -webkit-mask-image: linear-gradient(
            180deg,
            #000 0%,
            #000 42%,
            rgba(0, 0, 0, 0.72) 62%,
            rgba(0, 0, 0, 0.35) 80%,
            transparent 100%
        );
        mask-image: linear-gradient(
            180deg,
            #000 0%,
            #000 42%,
            rgba(0, 0, 0, 0.72) 62%,
            rgba(0, 0, 0, 0.35) 80%,
            transparent 100%
        );
    }

    body.is-landing .wrap {
        width: 100%;
        padding: 76px 16px 32px;
        justify-content: flex-start;
    }

    body.is-landing .brand {
        left: 16px;
        top: 20px;
        height: 35px;
    }

    body.is-landing .card {
        align-items: flex-start;
        justify-content: flex-start;
        padding: min(48vh, calc(100vw * 1024 / 910)) 0 0;
    }

    .landing-shell {
        width: 100%;
    }

    .landing-hero-card {
        padding: 32px 23px 25px;
        border-radius: 25px;
    }

    .landing-title {
        font-size: 37px;
    }

    .landing-lead {
        font-size: 17px;
    }

    .landing-perks {
        gap: 4px;
    }

    .landing-perks li {
        font-size: 13px;
        padding: 0 5px;
    }

    .landing-bar {
        flex-wrap: wrap;
        font-size: 16px;
        padding: 15px 16px;
    }
}
