:root {
    --ink: #111a30;
    --ink-soft: #43506a;
    --navy: #101a31;
    --navy-2: #1c2948;
    --paper: #f4f1e9;
    --card: #fffdf8;
    --line: #dfe1dc;
    --gold: #f2b84b;
    --gold-dark: #a36b07;
    --green: #27805b;
    --green-soft: #e7f4ed;
    --red: #b3443c;
    --red-soft: #fbecea;
    --blue-soft: #e9f0f9;
    --shadow: 0 22px 60px rgba(16, 26, 49, .10);
    --radius: 20px;
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
}

* { box-sizing: border-box; }

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

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 4% 0%, rgba(242, 184, 75, .16), transparent 28rem),
        radial-gradient(circle at 96% 32%, rgba(77, 152, 121, .10), transparent 28rem),
        var(--paper);
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

.hidden { display: none !important; }
.muted { color: var(--ink-soft); }
.success-text { color: var(--green) !important; }
.danger-text { color: var(--red) !important; }

.app-shell { min-height: 100vh; }

.topbar {
    position: sticky;
    z-index: 30;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 12px clamp(18px, 4vw, 56px);
    color: #fff;
    background: rgba(16, 26, 49, .96);
    border-bottom: 1px solid rgba(255, 255, 255, .09);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 13px;
    color: var(--navy);
    background: var(--gold);
    font-size: 23px;
    font-weight: 900;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .08);
}

.brand-copy { display: grid; line-height: 1; }
.brand-copy strong { font-size: 17px; letter-spacing: -.02em; }
.brand-copy small { margin-top: 4px; color: #b7c1d6; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.brand-large { color: var(--ink); font-size: 20px; font-weight: 800; }
.brand-large .brand-mark { color: var(--navy); }

.topbar-actions { display: flex; align-items: center; gap: 12px; }
.actor-chip { max-width: 220px; overflow: hidden; padding: 8px 12px; border: 1px solid rgba(255,255,255,.15); border-radius: 999px; color: #e7ebf3; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.connection { display: inline-flex; align-items: center; gap: 7px; color: #afbdd3; font-size: 12px; }
.connection i { width: 8px; height: 8px; border-radius: 50%; background: #70d9a7; box-shadow: 0 0 0 4px rgba(112,217,167,.12); }
.connection.offline i { background: #e1746c; box-shadow: 0 0 0 4px rgba(225,116,108,.12); }

.center-view {
    display: grid;
    min-height: calc(100vh - 72px);
    place-content: center;
    justify-items: center;
    color: var(--ink-soft);
}

.loader { width: 36px; height: 36px; border: 3px solid #d4d7d3; border-top-color: var(--gold-dark); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, 520px);
    gap: clamp(36px, 7vw, 100px);
    width: min(1180px, calc(100% - 40px));
    min-height: calc(100vh - 72px);
    margin: 0 auto;
    padding: clamp(48px, 8vh, 100px) 0;
    align-items: center;
}

.login-story h1 {
    max-width: 720px;
    margin: 14px 0 22px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(46px, 6.2vw, 82px);
    font-weight: 600;
    line-height: .98;
    letter-spacing: -.055em;
}

.eyebrow { margin: 0 0 9px; color: var(--gold-dark); font-size: 12px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.lead { max-width: 650px; color: var(--ink-soft); font-size: clamp(17px, 2vw, 21px); line-height: 1.62; }
.trust-list { display: grid; gap: 13px; margin-top: 32px; color: #334058; font-size: 14px; }
.trust-list span { display: flex; align-items: center; gap: 12px; }
.trust-list i { display: inline-grid; flex: 0 0 auto; width: 28px; height: 28px; place-items: center; border: 1px solid #cfd4d2; border-radius: 50%; color: var(--gold-dark); font-style: normal; font-weight: 800; }

.card { background: rgba(255, 253, 248, .96); border: 1px solid rgba(16, 26, 49, .09); border-radius: var(--radius); box-shadow: var(--shadow); }
.login-card { min-height: 560px; padding: clamp(22px, 4vw, 34px); }
.login-form { display: grid; gap: 19px; padding-top: 31px; }
.login-form h2, .installer-card h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 32px; letter-spacing: -.025em; }
.form-note { margin: -8px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; border-radius: 13px; background: #ebebe6; }
.segmented button { min-height: 40px; padding: 7px 9px; border: 0; border-radius: 10px; color: #687187; background: transparent; cursor: pointer; font-size: 12px; font-weight: 750; }
.segmented button.active { color: var(--ink); background: #fff; box-shadow: 0 4px 14px rgba(16,26,49,.08); }

label { display: grid; gap: 7px; color: #364159; font-size: 12px; font-weight: 750; }
input, select, textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    border: 1px solid #cfd3d1;
    border-radius: 11px;
    outline: none;
    color: var(--ink);
    background: #fff;
    font-size: 15px;
    font-weight: 500;
    transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #7083a9; box-shadow: 0 0 0 4px rgba(70, 94, 142, .10); }
input::placeholder, textarea::placeholder { color: #a4a9b1; }
input:disabled, select:disabled, textarea:disabled { color: #7c8390; background: #efefeb; cursor: not-allowed; }

.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: 11px;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    transition: transform .12s, box-shadow .12s, opacity .12s, background .12s;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { opacity: .46; cursor: not-allowed; }
.button.primary { color: var(--navy); background: var(--gold); box-shadow: 0 8px 20px rgba(176, 117, 12, .18); }
.button.primary:hover:not(:disabled) { background: #f6c45f; box-shadow: 0 10px 24px rgba(176, 117, 12, .22); }
.button.secondary { color: #fff; background: var(--navy-2); }
.button.outline { border-color: #c8cdd2; color: #33405a; background: #fff; }
.button.warning { color: #76500b; border-color: #e5c06e; background: #fff8e6; }
.button.warning:hover:not(:disabled) { background: #ffefc4; }
.button.danger { color: var(--red); border-color: #e8b8b4; background: #fff; }
.button.ghost { color: inherit; border-color: rgba(255,255,255,.18); background: transparent; }
.button.compact { min-height: 36px; padding: 7px 12px; }
.button.tiny { min-height: 32px; padding: 5px 9px; border-radius: 8px; font-size: 11px; }
.button.wide { width: 100%; }

.authenticated { width: min(1320px, calc(100% - 36px)); margin: 0 auto; padding: 32px 0 70px; }
.league-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.league-heading h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(30px, 4vw, 45px); letter-spacing: -.04em; }
.league-heading p { margin: 6px 0 0; color: var(--ink-soft); }
.status-badge { display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 999px; color: #556077; background: #e6e7e3; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.status-badge.running { color: #176a49; background: #dff1e7; }
.status-badge.paused { color: #8d5f0b; background: #faedc9; }
.status-badge.completed { color: #334b81; background: #e2e9f7; }

.phase-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 26px; }
.phase-item { position: relative; overflow: hidden; padding: 13px 14px; border: 1px solid #d6d9d5; border-radius: 13px; color: #7b8290; background: rgba(255,255,255,.52); font-size: 12px; font-weight: 800; }
.phase-item::after { position: absolute; inset: auto 0 0; height: 3px; background: transparent; content: ""; }
.phase-item.active { color: var(--ink); border-color: #e0b35b; background: #fff8e8; }
.phase-item.active::after { background: var(--gold); }
.phase-item.done { color: var(--green); border-color: #bedccc; background: #eef8f2; }
.phase-item.done::after { background: var(--green); }
.phase-item span { display: inline-grid; width: 22px; height: 22px; margin-right: 6px; place-items: center; border-radius: 7px; background: rgba(16,26,49,.07); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(310px, .75fr); gap: 22px; align-items: start; }
.host-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); gap: 22px; align-items: start; }
.panel { padding: clamp(19px, 3vw, 28px); }
.panel + .panel { margin-top: 18px; }
.panel-header { display: flex; align-items: start; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.panel-header h2, .panel h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.panel-header p { margin: 5px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset + fieldset { margin-top: 25px; padding-top: 23px; border-top: 1px solid var(--line); }
legend { margin-bottom: 15px; color: var(--ink); font-size: 14px; font-weight: 850; }
.stack-form { display: grid; gap: 21px; }
.help-text { margin: 8px 0 0; color: #727a8a; font-size: 12px; line-height: 1.5; }

.team-list { display: grid; gap: 10px; }
.team-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(0, .85fr) 86px auto; gap: 9px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.team-row.excluded { border-style: dashed; background: #f4f4f0; }
.team-order { display: grid; align-self: center; justify-items: center; color: var(--ink-soft); font-size: 11px; font-weight: 800; }
.team-order strong { color: var(--ink); font-size: 17px; }
.team-selection { align-self: center; justify-items: center; gap: 5px; text-align: center; }
.team-selection span { color: var(--ink-soft); font-size: 10px; }
.team-selection input { width: 22px; min-height: 22px; margin: 0; padding: 0; accent-color: var(--green); cursor: pointer; }
.team-actions { display: flex; align-items: center; gap: 5px; align-self: center; }
.activation-dot { display: inline-flex; align-items: center; gap: 6px; margin-top: 5px; color: #777f8e; font-size: 10px; font-weight: 750; }
.activation-dot i { width: 7px; height: 7px; border-radius: 50%; background: #b4b7bc; }
.activation-dot.ready { color: var(--green); }
.activation-dot.ready i { background: #43a879; }
.add-team-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 9px; margin-top: 15px; align-items: end; }
.setup-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; padding: 17px 19px; border-radius: 15px; color: #e7ecf7; background: var(--navy); }
.setup-footer p { margin: 4px 0 0; color: #aeb9ce; font-size: 12px; }
.setup-footer-actions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; }
.setup-footer-actions .button { white-space: nowrap; }

.auction-stage { position: relative; overflow: hidden; min-height: 480px; padding: clamp(24px, 5vw, 48px); color: #fff; background: var(--navy); }
.auction-stage::before { position: absolute; width: 420px; height: 420px; right: -210px; top: -190px; border: 74px solid rgba(242,184,75,.08); border-radius: 50%; content: ""; }
.auction-stage > * { position: relative; }
.auction-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.role-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid rgba(255,255,255,.15); border-radius: 999px; color: #c7d0df; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.role-pill strong { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; color: var(--navy); background: var(--gold); }
.timer { min-width: 86px; color: #fff; font-variant-numeric: tabular-nums; font-size: 30px; font-weight: 850; letter-spacing: -.04em; text-align: right; }
.timer.danger { color: #ff9188; animation: pulse .75s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .66; } }
.player-hero { margin: 62px 0 38px; }
.player-hero .club { margin: 0 0 8px; color: var(--gold); font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.player-hero h2 { max-width: 720px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(45px, 8vw, 78px); line-height: .98; letter-spacing: -.055em; }
.player-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.player-meta span { padding: 7px 10px; border-radius: 8px; color: #c2cada; background: rgba(255,255,255,.07); font-size: 12px; }
.price-line { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding-top: 25px; border-top: 1px solid rgba(255,255,255,.13); }
.price-label { color: #9eabc1; font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .1em; }
.current-price { margin-top: 3px; color: var(--gold); font-family: Georgia, serif; font-size: 58px; font-weight: 700; line-height: 1; letter-spacing: -.04em; }
.current-price small { color: #aeb8c9; font-family: inherit; font-size: 17px; letter-spacing: 0; }
.anonymous-state { max-width: 250px; text-align: right; }
.anonymous-state strong { display: block; font-size: 14px; }
.anonymous-state span { display: block; margin-top: 5px; color: #aeb8c9; font-size: 12px; line-height: 1.45; }
.anonymous-state.mine strong { color: #79daa9; }

.bid-panel { margin-top: 16px; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.bid-panel h3 { margin: 0 0 4px; font-size: 17px; }
.bid-panel p { margin: 0 0 16px; color: var(--ink-soft); font-size: 12px; }
.quick-bids { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick-bid { min-height: 52px; border: 1px solid #d4d7d4; border-radius: 11px; color: var(--ink); background: #fff; cursor: pointer; font-size: 12px; font-weight: 800; }
.quick-bid strong { display: block; color: var(--green); font-size: 15px; }
.custom-bid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; margin-top: 9px; }
.bid-lock { padding: 15px; border-radius: 12px; color: #246f51; background: var(--green-soft); font-size: 13px; font-weight: 750; text-align: center; }

.waiting-stage { display: grid; min-height: 480px; place-content: center; justify-items: center; padding: 40px; text-align: center; }
.waiting-stage .timer { margin: 16px 0; color: var(--ink); font-size: 74px; text-align: center; }
.waiting-stage h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(31px, 5vw, 48px); letter-spacing: -.04em; }
.waiting-stage p { max-width: 520px; color: var(--ink-soft); line-height: 1.55; }
.turn-name { color: var(--gold-dark); font-weight: 850; }
.transition-check, .intermission-icon {
    display: grid;
    width: 66px;
    height: 66px;
    margin-bottom: 18px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--green);
    box-shadow: 0 12px 30px rgba(39,128,91,.24);
    font-size: 32px;
    font-weight: 900;
}
.intermission-icon { color: var(--navy); background: var(--gold); font-size: 22px; letter-spacing: .08em; }
.next-role-banner { display: grid; min-width: min(360px, 100%); margin: 22px 0 8px; padding: 15px 24px; border: 1px solid #e3bd71; border-radius: 14px; background: #fff7e3; }
.next-role-banner span { color: #8e6b29; font-size: 10px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.next-role-banner strong { margin-top: 3px; color: var(--ink); font-family: Georgia, serif; font-size: 25px; }
.intermission-stage .timer { color: var(--gold-dark); }
.final-reveal-stage { position: relative; overflow: hidden; }
.final-reveal-stage::before { position: absolute; width: 270px; height: 270px; border: 1px solid rgba(194,145,47,.18); border-radius: 50%; content: ''; box-shadow: 0 0 0 45px rgba(194,145,47,.05), 0 0 0 90px rgba(194,145,47,.025); pointer-events: none; }
.final-reveal-stage > * { position: relative; z-index: 1; }
.final-reveal-icon { display: grid; width: 76px; height: 76px; margin-bottom: 20px; place-items: center; border: 1px solid #e3bd71; border-radius: 50%; color: #fff; background: linear-gradient(145deg, var(--navy), #263b62); box-shadow: 0 14px 32px rgba(16,26,49,.22); font-family: Georgia, serif; font-size: 40px; }
.final-reveal-banner { background: linear-gradient(135deg, #fff9eb, #fff); box-shadow: 0 10px 28px rgba(142,107,41,.1); }
.final-reveal-banner strong { font-size: clamp(20px, 3vw, 27px); }
.goalkeeper-waiting-stage .timer { color: var(--green); }
.goalkeeper-icon { display: grid; width: 66px; height: 66px; margin-bottom: 18px; place-items: center; border-radius: 18px; color: #fff; background: var(--green); box-shadow: 0 12px 30px rgba(39,128,91,.24); font-size: 20px; font-weight: 900; }
.goalkeeper-choice-stage { padding: clamp(24px, 4vw, 38px); }
.goalkeeper-choice-stage > p { color: var(--ink-soft); line-height: 1.55; }
.goalkeeper-choice-head { display: flex; align-items: start; justify-content: space-between; gap: 22px; margin-bottom: 16px; }
.goalkeeper-choice-head h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(30px, 5vw, 48px); letter-spacing: -.04em; }
.goalkeeper-choice-head .timer { flex: 0 0 auto; color: var(--green); }
.goalkeeper-options { display: grid; gap: 9px; margin: 24px 0 18px; }
.goalkeeper-option { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; cursor: pointer; }
.goalkeeper-option:has(input:checked) { border-color: #75b699; background: var(--green-soft); }
.goalkeeper-option input { width: 21px; min-height: 21px; margin: 0; padding: 0; accent-color: var(--green); }
.goalkeeper-option strong, .goalkeeper-option small { display: block; }
.goalkeeper-option strong { color: var(--ink); font-size: 15px; }
.goalkeeper-option small { margin-top: 3px; color: var(--ink-soft); font-size: 11px; }
.goalkeeper-option b { color: var(--green); font-size: 13px; }
.goalkeeper-actions { display: flex; flex-wrap: wrap; gap: 9px; }

.search-box { width: min(680px, 100%); margin-top: 20px; text-align: left; }
.search-box input { min-height: 54px; border-color: #bdc3c4; padding-left: 17px; font-size: 17px; }
.player-results { display: grid; width: 100%; max-height: 330px; gap: 7px; margin-top: 9px; overflow: auto; }
.player-results-count { position: sticky; z-index: 2; top: 0; padding: 8px 10px; border-radius: 9px; color: #556077; background: rgba(244,241,233,.96); font-size: 11px; font-weight: 800; text-align: center; }
.player-result { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; text-align: left; }
.player-result strong { display: block; font-size: 14px; }
.player-result small { color: var(--ink-soft); font-size: 11px; }
.player-result .button { min-height: 36px; }

.finance-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.finance-card { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.finance-card span { display: block; color: #737c8d; font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.finance-card strong { display: block; margin-top: 4px; font-family: Georgia, serif; font-size: 29px; }
.finance-card.remaining { color: var(--green); background: #f1f8f4; }
.roster-groups { display: grid; gap: 13px; }
.roster-group { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.roster-group-title { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; color: #4a566d; background: #f0f1ed; font-size: 11px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.roster-player { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; padding: 10px 12px; border-top: 1px solid #eceeea; }
.roster-player strong { display: block; font-size: 13px; }
.roster-player small { color: #7c8492; font-size: 10px; }
.roster-price { color: var(--green); font-size: 12px; font-weight: 850; }
.empty-roster { padding: 12px; color: #969ba3; font-size: 12px; text-align: center; }
.privacy-card { padding: 21px; color: #cbd3e2; background: var(--navy); }
.privacy-card .lock-icon { display: grid; width: 42px; height: 42px; margin-bottom: 15px; place-items: center; border-radius: 13px; color: var(--navy); background: var(--gold); font-size: 20px; }
.privacy-card h3 { margin: 0 0 8px; color: #fff; }
.privacy-card p { margin: 0; color: #aeb8c9; font-size: 13px; line-height: 1.6; }
.host-team-line { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 9px 7px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: #4a566d; font-size: 11px; font-weight: 800; }
.host-team-line strong { color: var(--green); }
.host-team-line em { color: #8b7040; font-size: 9px; font-style: normal; }
.host-team-line.excluded { border-style: dashed; opacity: .72; background: #f2f2ee; }
.host-team-line.withdrawn { border-color: #ddb9b5; background: #fbefed; opacity: 1; }
.excluded-notice { margin-bottom: 15px; }

.host-controls { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.host-control-help { margin: 7px 2px 0; color: var(--ink-soft); font-size: 11px; }
.last-assignment { margin-top: 12px; padding: 12px 14px; border: 1px solid #d9dcd8; border-radius: 11px; color: var(--ink-soft); background: rgba(255,255,255,.55); font-size: 12px; }
.emergency-notice { margin-bottom: 16px; padding: 14px 17px; border: 1px solid #e0b4af; border-radius: 13px; color: #713934; background: #fff0ee; box-shadow: 0 10px 28px rgba(113,57,52,.08); font-size: 13px; line-height: 1.55; }
.emergency-panel { border-color: #ddb9b5; background: #fffaf8; }
.emergency-actions { display: grid; grid-template-columns: 1fr; gap: 9px; margin-top: 11px; }
.emergency-history { margin-top: 20px; padding-top: 17px; border-top: 1px solid #eadbd7; }
.emergency-history h3 { margin: 0 0 10px; font-size: 13px; }
.emergency-log-item { display: grid; gap: 9px; padding: 11px 0; border-top: 1px solid #eee5e2; }
.emergency-log-item:first-of-type { border-top: 0; }
.emergency-log-item strong, .emergency-log-item span { display: block; }
.emergency-log-item strong { font-size: 12px; }
.emergency-log-item span { margin-top: 3px; color: var(--ink-soft); font-size: 10px; }
.emergency-log-item em { font-style: normal; font-weight: 850; }
.emergency-log-item em.pending { color: #9a6506; }
.emergency-log-item em.restored { color: var(--green); }
.emergency-log-item em.final { color: #6d7480; }
.emergency-log-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.emergency-modal form { display: grid; gap: 15px; }
.emergency-modal h2 span { color: var(--red); }
.emergency-modal .alert { margin: 0; }
.emergency-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 3px; }

.modal.manual-roster-modal {
    box-sizing: border-box;
    width: min(1180px, calc(100vw - 24px));
    max-width: none;
    height: calc(100vh - 24px);
    height: min(900px, calc(100dvh - 24px));
    max-height: none;
    overflow: hidden;
}
.manual-roster-shell {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100%;
    min-height: 0;
}
.manual-roster-header { padding: 24px 64px 16px 28px; border-bottom: 1px solid var(--line); background: #fffdf8; }
.manual-roster-header > .alert { margin: 12px 0 0; padding: 10px 13px; }
.manual-roster-content { min-height: 0; padding: 18px 28px 30px; overflow: auto; overscroll-behavior: contain; }
.manual-roster-footer {
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 20px;
    border-top: 1px solid #d8d8d1;
    background: #fffdf8;
    box-shadow: 0 -10px 28px rgba(16, 26, 49, .08);
}
.manual-pending-copy { display: grid; min-width: 0; gap: 3px; }
.manual-pending-copy strong { font-size: 13px; }
.manual-pending-copy span { color: var(--ink-soft); font-size: 10px; line-height: 1.4; }
.manual-footer-actions { display: flex; flex: 0 0 auto; gap: 9px; }
.manual-footer-actions .button { min-height: 42px; }
.manual-footer-actions .button.primary { min-width: 180px; }
.manual-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 18px; }
.manual-toolbar span { color: var(--ink-soft); font-size: 10px; }
.manual-finance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; }
.manual-finance-grid > div { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f8f7f2; }
.manual-finance-grid span { color: var(--ink-soft); font-size: 11px; }
.manual-finance-grid strong { font-size: 22px; }
.manual-reason { margin: 0 0 18px; }
.manual-edit-help { display: grid; gap: 3px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid #cfd8e9; border-radius: 12px; color: #354564; background: #f2f6fd; }
.manual-edit-help strong { font-size: 12px; }
.manual-edit-help span { font-size: 10px; line-height: 1.45; }
.manual-roster-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; align-items: start; }
.manual-role-group { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.manual-role-title { display: flex; align-items: center; justify-content: space-between; padding: 11px 13px; color: #fff; background: var(--navy-2); font-size: 12px; }
.manual-role-title span { color: var(--gold); font-weight: 850; }
.manual-role-title span.is-overfilled { padding: 2px 6px; border-radius: 6px; color: #fff; background: var(--red); }
.manual-role-group > .empty-roster { padding: 17px 13px; }
.manual-roster-player {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) auto;
    gap: 7px 12px;
    align-items: center;
    padding: 11px 12px;
    border-top: 1px solid #ecece7;
    transition: background .15s, opacity .15s;
}
.manual-roster-player:first-of-type { border-top: 0; }
.manual-player-copy { display: grid; min-width: 0; gap: 3px; }
.manual-player-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.manual-player-copy span { color: var(--ink-soft); font-size: 10px; }
.manual-player-actions { display: grid; grid-template-columns: 82px 36px; gap: 8px; align-items: end; }
.manual-credit-field { gap: 3px !important; font-size: 9px !important; }
.manual-roster-player label { gap: 3px; font-size: 9px; }
.manual-roster-player input { min-height: 36px; padding: 5px 7px; text-align: center; font-size: 13px; font-weight: 800; }
.manual-delete-player {
    display: inline-grid;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    border: 1px solid #8e2e28;
    border-radius: 8px;
    color: #fff;
    background: var(--red);
    box-shadow: 0 5px 12px rgba(164, 54, 45, .18);
    cursor: pointer;
    font-size: 25px;
    font-weight: 700;
    line-height: 1;
    transition: transform .12s, background .12s, opacity .12s;
}
.manual-delete-player:hover:not(:disabled) { transform: translateY(-1px); background: #8e2e28; }
.manual-delete-player:disabled { opacity: .42; cursor: not-allowed; }
.manual-delete-player.is-selected { background: #711f1a; box-shadow: inset 0 0 0 2px #f3c2bd, 0 5px 12px rgba(113, 31, 26, .20); }
.manual-player-draft-status { grid-column: 1 / -1; min-height: 13px; color: #7b8190; font-size: 9px; line-height: 1.35; }
.manual-roster-player.has-price-draft { background: #fff9e9; }
.manual-roster-player.has-price-draft input { border-color: #d3a342; background: #fffdf7; box-shadow: 0 0 0 3px rgba(211, 163, 66, .10); }
.manual-roster-player.has-invalid-price { background: #fff1ef; }
.manual-roster-player.has-invalid-price input { border-color: var(--red); box-shadow: 0 0 0 3px rgba(164, 54, 45, .10); }
.manual-roster-player.has-invalid-price .manual-player-draft-status { color: var(--red); font-weight: 800; }
.manual-roster-player.is-pending-removal { background: #fff0ee; }
.manual-roster-player.is-pending-removal .manual-player-copy { opacity: .55; }
.manual-roster-player.is-pending-removal .manual-player-copy strong { text-decoration: line-through; }
.manual-roster-player.is-pending-removal .manual-player-draft-status { color: #8e2e28; font-weight: 800; }
.manual-add-panel, .manual-history { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.manual-add-panel .panel-header { margin-bottom: 12px; }
.manual-add-panel h3, .manual-history h3 { margin: 0; font-size: 15px; }
.manual-player-filters { display: grid; grid-template-columns: 180px minmax(220px, 1fr) 120px; gap: 9px; align-items: end; }
.manual-pending-additions { margin-top: 12px; overflow: hidden; border: 1px solid #dfbd71; border-radius: 12px; background: #fffaf0; }
.manual-pending-additions-head { padding: 10px 12px; border-bottom: 1px solid #ead5a6; background: #fff2d2; }
.manual-pending-additions-head > div { display: grid; gap: 2px; }
.manual-pending-additions-head strong { color: #76510d; font-size: 12px; }
.manual-pending-additions-head span { color: #8c6a28; font-size: 9px; }
.manual-pending-addition {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 82px 36px;
    gap: 7px 9px;
    align-items: end;
    padding: 10px 11px;
    border-top: 1px solid #eee0bf;
}
.manual-pending-addition:first-of-type { border-top: 0; }
.manual-pending-addition input { min-height: 36px; padding: 5px 7px; text-align: center; font-size: 13px; font-weight: 800; }
.manual-pending-addition .manual-player-draft-status { grid-column: 1 / -1; color: #85601c; font-weight: 750; }
.manual-pending-addition.has-invalid-price { background: #fff1ef; }
.manual-pending-addition.has-invalid-price input { border-color: var(--red); box-shadow: 0 0 0 3px rgba(164, 54, 45, .10); }
.manual-pending-addition.has-invalid-price .manual-player-draft-status { color: var(--red); }
.manual-player-results { max-height: 330px; margin-top: 12px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.manual-result-count { position: sticky; z-index: 1; top: 0; margin: 0 !important; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #f4f4ef; font-size: 10px !important; font-weight: 800; }
.manual-player-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 11px; border-top: 1px solid #ecece7; }
.manual-player-result:first-of-type { border-top: 0; }
.manual-player-result > div { display: grid; gap: 2px; }
.manual-player-result strong { font-size: 12px; }
.manual-player-result span { color: var(--ink-soft); font-size: 10px; }
.manual-player-result.is-pending { background: #fff8e8; }
.manual-player-result.is-pending strong { color: #76510d; }
.manual-history-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, .7fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid #ecece7; }
.manual-history-row > div { display: grid; gap: 3px; }
.manual-history-row strong { font-size: 12px; }
.manual-history-row span, .manual-history-row small { color: var(--ink-soft); font-size: 10px; }

.reveal-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.reveal-header h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(31px, 5vw, 46px); letter-spacing: -.04em; }
.reveal-header p { margin: 7px 0 0; color: var(--ink-soft); }
.reveal-actions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; }
.reveal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.revealed-team { padding: 20px; }
.revealed-team-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.revealed-team h3 { margin: 0; font-size: 19px; }
.revealed-team-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: 12px; }
.team-totals { flex: 0 0 auto; text-align: right; }
.team-totals strong { display: block; color: var(--green); font-size: 16px; }
.team-totals span { color: #7a8190; font-size: 10px; }

.modal { width: min(470px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 30px 100px rgba(0,0,0,.28); }
.modal::backdrop { background: rgba(9,15,29,.65); backdrop-filter: blur(4px); }
.modal form { position: relative; padding: 30px; }
.modal h2 { margin: 0; font-family: Georgia, serif; font-size: 28px; }
.modal p:not(.eyebrow) { color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.modal-close { position: absolute; top: 14px; right: 15px; width: 34px; height: 34px; border: 0; border-radius: 50%; color: #697184; background: #efefeb; cursor: pointer; font-size: 23px; }
.invite-code { margin: 23px 0 14px; padding: 20px; border: 1px dashed #c29843; border-radius: 13px; color: var(--navy); background: #fff7e4; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(28px, 8vw, 42px); font-weight: 900; letter-spacing: .13em; text-align: center; }
.purchase-modal { overflow: hidden; text-align: center; }
.purchase-modal form { padding: 38px 34px 32px; }
.purchase-modal .eyebrow { margin-top: 18px; }
.purchase-modal h2 { font-size: clamp(32px, 8vw, 46px); line-height: 1.02; }
.purchase-check { display: grid; width: 78px; height: 78px; margin: 0 auto; place-items: center; border-radius: 50%; color: #fff; background: var(--green); box-shadow: 0 16px 34px rgba(39,128,91,.28); font-size: 40px; font-weight: 900; animation: purchase-pop .35s cubic-bezier(.2,.9,.3,1.25); }
.purchase-details { margin: 10px 0 0 !important; font-weight: 750; }
.purchase-price { margin: 22px 0 16px; color: var(--gold-dark); font-family: Georgia, serif; font-size: 64px; font-weight: 800; line-height: 1; }
.purchase-price small { color: var(--ink-soft); font-family: inherit; font-size: 18px; }
.purchase-private { margin: 0 0 22px; padding: 12px; border-radius: 11px; color: #246f51 !important; background: var(--green-soft); }
@keyframes purchase-pop { from { opacity: 0; transform: scale(.62); } }

.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; width: min(390px, calc(100% - 36px)); gap: 8px; }
.toast { padding: 13px 15px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; color: #fff; background: #1b2742; box-shadow: 0 16px 40px rgba(16,26,49,.25); font-size: 13px; animation: toast-in .2s ease-out; }
.toast.error { background: #8e352f; }
.toast.success { background: #246e50; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.alert { padding: 13px 15px; border-radius: 11px; font-size: 13px; line-height: 1.5; }
.alert.error { color: #873c36; border: 1px solid #edc0bc; background: var(--red-soft); }
.alert.info { color: #3b537f; border: 1px solid #c7d4e8; background: var(--blue-soft); }

.installer-page { display: grid; min-height: 100vh; place-items: center; }
.installer-shell { display: grid; width: min(850px, calc(100% - 32px)); min-height: 100vh; margin: 0 auto; place-items: center; padding: 40px 0; }
.installer-card { width: 100%; padding: clamp(27px, 6vw, 54px); }
.installer-card .brand { margin-bottom: 42px; }
.installer-card > p { max-width: 660px; color: var(--ink-soft); line-height: 1.65; }
.installer-card .stack-form { margin-top: 30px; }
.installer-card fieldset { padding: 20px; border: 1px solid var(--line); border-radius: 14px; }
.installer-card fieldset + fieldset { margin-top: 0; }
.guide-card { display: grid; gap: 27px; }
.guide-card section { padding-top: 4px; }
.guide-card section + section { padding-top: 25px; border-top: 1px solid var(--line); }
.guide-card h2 { margin: 0 0 11px; font-size: 22px; letter-spacing: -.025em; }
.guide-card h3 { margin: 20px 0 8px; font-size: 16px; }
.guide-card p, .guide-card li { color: var(--ink-soft); font-size: 14px; line-height: 1.65; }
.guide-card ol, .guide-card ul { display: grid; gap: 9px; margin: 12px 0 0; padding-left: 22px; }
.guide-card code { padding: 2px 6px; border-radius: 6px; color: #33476d; background: #edf0f4; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.guide-card a { color: #275b9a; }
.guide-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.guide-summary div { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.guide-summary span { display: block; color: #808796; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.guide-summary strong { display: block; margin-top: 4px; font-size: 13px; }

@media (max-width: 940px) {
    .login-layout, .dashboard-grid, .host-grid { grid-template-columns: 1fr; }
    .login-layout { width: min(650px, calc(100% - 32px)); }
    .login-story { padding-top: 10px; }
    .login-story h1 { font-size: clamp(44px, 11vw, 68px); }
    .trust-list { grid-template-columns: repeat(3, 1fr); }
    .trust-list span { align-items: start; font-size: 11px; }
    .reveal-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .topbar { min-height: 64px; padding: 10px 14px; }
    .brand-copy { display: none; }
    .brand-mark { width: 39px; height: 39px; }
    .connection span { display: none; }
    .actor-chip { max-width: 125px; }
    .authenticated { width: min(100% - 24px, 1320px); padding-top: 22px; }
    .league-heading { align-items: start; }
    .league-heading h1 { font-size: 30px; }
    .phase-strip { gap: 5px; }
    .phase-item { padding: 10px 6px; text-align: center; font-size: 9px; }
    .phase-item span { display: grid; margin: 0 auto 4px; }
    .form-grid.two, .form-grid.four { grid-template-columns: 1fr; }
    .guide-summary { grid-template-columns: repeat(2, 1fr); }
    .trust-list { grid-template-columns: 1fr; }
    .login-layout { padding: 35px 0 55px; }
    .login-story h1 { font-size: 45px; }
    .login-card { min-height: auto; padding: 20px; }
    .segmented button { padding-inline: 4px; font-size: 10px; }
    .panel { padding: 17px; }
    .team-row { grid-template-columns: 28px minmax(0, 1fr); }
    .team-row > label:nth-of-type(2) { grid-column: 2; }
    .team-selection { grid-column: 1 / -1; grid-template-columns: auto auto; justify-content: end; justify-items: start; }
    .team-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .add-team-form { grid-template-columns: 1fr; }
    .setup-footer { align-items: stretch; flex-direction: column; }
    .setup-footer-actions { display: grid; }
    .auction-stage { min-height: 440px; padding: 22px; }
    .player-hero { margin: 52px 0 33px; }
    .player-hero h2 { font-size: 47px; }
    .current-price { font-size: 48px; }
    .price-line { align-items: start; flex-direction: column; }
    .anonymous-state { text-align: left; }
    .quick-bids { grid-template-columns: repeat(2, 1fr); }
    .waiting-stage { min-height: 420px; padding: 26px 17px; }
    .waiting-stage .timer { font-size: 62px; }
    .goalkeeper-choice-head { align-items: start; flex-direction: column; }
    .goalkeeper-choice-head .timer { font-size: 46px; }
    .goalkeeper-actions { align-items: stretch; flex-direction: column; }
    .emergency-actions, .emergency-modal-actions { grid-template-columns: 1fr; }
    .modal.manual-roster-modal {
        width: calc(100vw - 10px);
        height: calc(100vh - 10px);
        height: calc(100dvh - 10px);
        border-radius: 14px;
    }
    .manual-roster-header { padding: 18px 52px 12px 16px; }
    .manual-roster-header h2 { font-size: 23px; line-height: 1.05; }
    .manual-roster-header > .alert { font-size: 10px; line-height: 1.4; }
    .manual-roster-content { padding: 14px 12px 22px; }
    .manual-roster-footer { align-items: stretch; flex-direction: column; gap: 10px; padding: 11px 12px; }
    .manual-footer-actions { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
    .manual-footer-actions .button { width: 100%; min-width: 0 !important; padding-inline: 8px; font-size: 11px; }
    .manual-finance-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .manual-finance-grid > div { padding: 9px 7px; }
    .manual-finance-grid span { font-size: 8px; }
    .manual-finance-grid strong { font-size: 18px; }
    .manual-roster-grid, .manual-player-filters { grid-template-columns: 1fr; }
    .manual-toolbar { align-items: stretch; flex-direction: column; }
    .manual-roster-player { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 9px; padding: 10px; }
    .manual-player-actions { grid-template-columns: 72px 36px; gap: 7px; }
    .manual-history-row { grid-template-columns: 1fr; }
    .reveal-header { align-items: stretch; flex-direction: column; }
    .reveal-header .button { width: 100%; }
    .topbar .button.compact { min-height: 34px; padding: 6px 9px; font-size: 11px; }
}

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