:root {
    --brand-dark: #103e32;
    --brand: #087d52;
    --brand-lime: #b8e34b;
    --brand-tint: #eaf5dc;
}

body {
    background: #f7f9f6;
}

/* ---------- Field ---------- */
.field-wrap {
    background: #fff;
    border-radius: .75rem;
    padding: 1.5rem;
}

#field {
    position: relative;
    width: 100%;
    max-width: 600px;
    /* lets the player dots size themselves from the field width (cqw) */
    container-type: inline-size;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .08) 0, rgba(255, 255, 255, 0) 55%, rgba(0, 0, 0, .22) 100%),
        repeating-linear-gradient(90deg,
            #2a9d47 0, #2a9d47 7.14%,
            #24903f 7.14%, #24903f 14.28%);
    /* white outer rim drawn as a shadow so it doesn't shift player positions */
    box-shadow:
        inset 0 0 0 10px rgba(14, 92, 38, .55),
        inset 0 0 40px rgba(0, 0, 0, .2),
        0 0 0 6px #fff,
        0 10px 28px rgba(16, 62, 50, .22);
    user-select: none;
    touch-action: none;
}

/* boundary rope */
#field .boundary {
    position: absolute;
    inset: 4.5%;
    border: 1.5px solid rgba(255, 255, 255, .9);
    border-radius: 50%;
    pointer-events: none;
}

/* 30-yard circle */
#field .inner-circle {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#field .inner-circle path {
    fill: none;
    stroke: #fff;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-dasharray: 0 2;
}

/* pitch */
#field .pitch {
    position: absolute;
    left: 48.6%;
    width: 2.8%;
    top: 43%;
    height: 14%;
    background: #e2b67f;
    border-radius: 2px;
    pointer-events: none;
}

#field .crease {
    position: absolute;
    left: 45%;
    width: 10%;
    height: 1px;
    background: rgba(255, 255, 255, .8);
    pointer-events: none;
}

#field .crease.top {
    top: 44.5%;
}

#field .crease.bottom {
    top: 55.5%;
}

/* ---------- Player dots ----------
   Sized from the field width (1cqw = 1% of #field), so dots and names
   scale with the circle: ~31px dot on a 640px field. */
.player {
    --dot: clamp(22px, 4.8cqw, 36px);
    position: absolute;
    width: var(--dot);
    height: var(--dot);
    margin-left: calc(var(--dot) / -2);
    margin-top: calc(var(--dot) / -2);
    border-radius: 50%;
    background: #0d6efd;
    border: 2px solid #fff;
    color: #fff;
    font-size: calc(var(--dot) * .4);
    font-weight: 700;
    line-height: calc(var(--dot) - 4px);
    text-align: center;
    cursor: grab;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
    z-index: 5;
}

.player.ui-draggable-dragging {
    cursor: grabbing;
    z-index: 10;
    transform: scale(1.15);
}

.player.wk {
    background: #fd7e14;
}

/* the keeper can't be dragged */
.player.locked {
    cursor: not-allowed;
}

/* little red "ball" dot shown before the bowler's name */
.bowler-mark {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #dc3545;
    border: 1px solid #fff;
    margin-right: 4px;
    vertical-align: 0;
}

/* player 2 = main bowler, full red dot */
.player.bowler {
    background: #dc3545;
}

/* can-bowl tick: a clear outline so the empty box stands out on white */
.player-input .bowler-check {
    width: 1.05em;
    height: 1.05em;
    background-color: #fff;
    border: 1.5px solid #8fa08c;
    cursor: pointer;
}

.player-input .bowler-check:hover:not(:disabled) {
    border-color: var(--brand);
}

/* no name yet: still visible, just faded */
.player-input .bowler-check:disabled {
    opacity: .55;
    cursor: not-allowed;
}

[data-bs-theme="dark"] .player-input .bowler-check:not(:checked) {
    background-color: #111827;
    border-color: #6b7280;
}

[data-bs-theme="dark"] .player-input .bowler-check:hover:not(:disabled):not(:checked) {
    border-color: #4ade80;
}

.player .label {
    position: absolute;
    top: calc(var(--dot) - 1px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: clamp(11px, 2.35cqw, 16px);
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    background: rgba(0, 0, 0, .55);
    padding: 1px 4px;
    border-radius: 3px;
    pointer-events: none;
    text-align: center;
}

.player .pos-name {
    display: block;
    font-size: clamp(9px, 1.7cqw, 12px);
    font-weight: 500;
    font-style: italic;
    color: #ffe08a;
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: -1px;
    margin-right: 4px;
}

/* ---------- Header ---------- */
.site-header {
    position: relative;
    overflow: hidden;
    background: #fff;
    border-bottom: 1px solid #e3e9e1;
}

/* lime swoosh across the top of the header */
.site-header::before {
    content: "";
    position: absolute;
    top: -70px;
    right: 8%;
    width: 46%;
    height: 110px;
    border-radius: 0 0 50% 50% / 0 0 100% 100%;
    background: linear-gradient(90deg, rgba(181, 230, 85, 0) 0, rgba(181, 230, 85, .55) 55%, rgba(20, 108, 60, .35) 100%);
    transform: rotate(-6deg);
    pointer-events: none;
}

.site-header .navbar-brand {
    color: #1f2937;
}

.site-header .navbar {
    position: relative;
    padding-top: .3rem;
    padding-bottom: .3rem;
}

.site-header .navbar-brand {
    padding: 0;
}

.site-header .brand-logo {
    height: 46px;
    width: auto;
    max-width: 60vw;
    object-fit: contain;
    flex-shrink: 0;
}

/* Copy link / New field */
.btn-header {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem 1rem;
    border-radius: 999px;
    font-weight: 600;
    color: #1f2937;
    background: #fff;
    border: 1px solid #d9e0d6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.btn-header:hover,
.btn-header:focus-visible {
    color: var(--brand-dark);
    background: #f6faf3;
    border-color: #b9c9b3;
}

.btn-header svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-header-primary {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand-dark);
    box-shadow: 0 2px 6px rgba(16, 62, 50, .18);
}

.btn-header-primary:hover,
.btn-header-primary:focus-visible {
    color: #fff;
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.btn-header-primary svg {
    stroke-width: 2.2;
}

/* page hint next to the logo, split by a thin divider */
.site-header .header-tagline {
    margin: 0 0 0 1.25rem;
    padding-left: 1.25rem;
    border-left: 1px solid #dfe5dc;
    font-size: .92rem;
    font-weight: 500;
    color: #374151;
}

/* ---------- Save status pill ---------- */

.save-status {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .75rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 500;
    background: #f5f7f4;
    color: #6b7280;
    border: 1px solid #e3e9e1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.save-status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.save-status.is-saved {
    background: #ecfdf3;
    color: #15803d;
    border-color: #bbf7d0;
}

.save-status.is-dirty {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

/* ---------- Field toolbar: phase tabs | tools ---------- */
/* one row above the field card: [tabs] | [tools] */
/* "Copy from Powerplay" pushed to the far right of the toolbar */
.field-toolbar .btn-copy-pp {
    margin-left: auto;
}

.field-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin-bottom: .6rem;
}

.phase-switch {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: #fff;
    border: 1px solid #e3e9e1;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .07);
}

.phase-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    border: 0;
    border-radius: 11px;
    background: transparent;
    padding: .45rem 1.1rem;
    color: #1f2937;
    font-size: .9rem;
    font-weight: 700;
    line-height: 1.2;
    transition: background-color .15s, color .15s, box-shadow .15s;
}

.phase-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.phase-btn:hover {
    color: var(--brand-dark);
    background: rgba(255, 255, 255, .7);
}

.phase-btn:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

.phase-btn.active {
    color: #fff;
    background: var(--brand-dark);
    box-shadow: 0 2px 6px rgba(16, 62, 50, .2);
}

.field-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.btn-tool {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .9rem;
    font-size: .875rem;
    font-weight: 600;
    white-space: nowrap;
    color: #1f2937;
    background: #fff;
    border: 1px solid #dde3da;
    border-radius: 999px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .07);
}

.btn-tool:hover,
.btn-tool:focus-visible {
    color: var(--brand-dark);
    background: #f6faf3;
    border-color: #b9c9b3;
}

.btn-tool svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Floating field actions (left of the circle) ---------- */
.field-tools {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    z-index: 3;
}

.btn-float {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    width: 132px;
    padding: .5rem .9rem;
    font-size: .875rem;
    font-weight: 600;
    color: #1f2937;
    background: rgba(255, 255, 255, .96);
    border: 1px solid #e2e7e0;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(16, 62, 50, .08);
    white-space: nowrap;
}

.btn-float:hover,
.btn-float:focus-visible {
    color: var(--brand-dark);
    background: #fff;
    border-color: #c5d3c0;
}

.btn-float svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    fill: none;
    stroke: var(--brand);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Download is the main action: pale lime */
.btn-float-primary {
    color: var(--brand-dark);
    background: #eef8d6;
    border-color: #cde68a;
}

.btn-float-primary:hover,
.btn-float-primary:focus-visible {
    background: #e4f4c0;
    border-color: var(--brand-lime);
}

/* ---------- Outside-circle counter (top-right of the field area) ---------- */
.outside-chip {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .96);
    border: 1px solid #e2e7e0;
    color: #374151;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(16, 62, 50, .08);
    pointer-events: none;
    z-index: 4;
}

.outside-chip-slots {
    display: inline-flex;
    gap: 3px;
}

.outside-chip-slots i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1.5px solid #d1d5db;
}

.outside-chip-slots i.filled {
    background: #ffc107;
    border-color: #e0a800;
}

.outside-chip-slots i.extra {
    background: #dc3545;
    border-color: #b02a37;
}

.outside-chip.is-over {
    background: #fff1f2;
    color: #b02a37;
}

/* ---------- Field extras ---------- */
#field.is-empty::after {
    content: "Add player names to place them on the field";
    position: absolute;
    left: 50%;
    top: 72%;
    transform: translateX(-50%);
    padding: 4px 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .9);
    color: #374151;
    font-size: 13px;
    white-space: nowrap;
    pointer-events: none;
}

/* fielder outside the 30-yard circle */
.player.outside {
    box-shadow: 0 0 0 3px #ffc107, 0 2px 4px rgba(0, 0, 0, .35);
}

.legend-dot.legend-out {
    background: #0d6efd;
    box-shadow: 0 0 0 2px #ffc107;
}

/* ---------- Field indicators (legend card) ---------- */
.field-indicators {
    width: 160px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .96);
    border: 1px solid #e2e7e0;
    box-shadow: 0 2px 8px rgba(16, 62, 50, .08);
    font-size: 12px;
    font-weight: 500;
    color: #1f2937;
    pointer-events: none;
    z-index: 3;
}

.field-indicators-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.field-indicators-head svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
}

.field-indicators ul {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.field-indicators li {
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
}

.field-indicators .legend-dot {
    width: 11px;
    height: 11px;
    margin: 0;
    flex-shrink: 0;
}

/* matches the small red "can bowl" mark on the field */
.field-indicators .legend-dot.legend-can-bowl {
    background: #f06a7e;
}

.field-indicators .legend-dot.legend-out {
    box-shadow: 0 0 0 1.5px #fff, 0 0 0 3px #ffc107;
}

/* ---------- Cards (Playing XI, controls, field) ---------- */
#playersForm.card,
.field-card {
    border: 1px solid #e3e9e1;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(15, 60, 30, .08) !important;
    overflow: hidden;
}

#playersForm .card-footer {
    background: #fff;
    border-top: 1px solid #edf1eb;
    padding: .75rem 1.25rem;
}

/* saved / unsaved already shows in the header pill; only errors appear here */
#saveMsg:not(.text-danger) {
    display: none;
}

#playersForm .card-body {
    padding: .85rem 1.25rem .6rem;
}

#playersForm .card-body > p {
    font-size: .8rem;
    line-height: 1.35;
}

/* dark green Playing XI header */
.xi-header {
    min-height: 50px;
    padding: .35rem 1.25rem;
    color: #fff;
    background: var(--brand-dark);
    border-bottom: 0;
}

.xi-title {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    gap: .6rem;
    margin: 0 .75rem 0 0;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: text;
}

.xi-title svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

/* small "PLAYING XI" label above the team name box */
.xi-title-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.xi-kicker {
    font-size: .68rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--brand-lime);
}

/* dashed box so it reads as a field you can type in */
.xi-name-box {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: 1px .5rem;
    background: rgba(255, 255, 255, .08);
    border: 1px dashed rgba(255, 255, 255, .4);
    border-radius: 8px;
    transition: border-color .15s, background-color .15s;
}

.xi-title:hover .xi-name-box {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .6);
}

.xi-name-box:focus-within {
    background: rgba(255, 255, 255, .12);
    border-style: solid;
    border-color: var(--brand-lime);
}

.xi-title .xi-name {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.6;
    color: #fff;
    background: transparent;
    border: 0;
    outline: 0;
    text-overflow: ellipsis;
}

.xi-title .xi-name::placeholder {
    font-weight: 500;
    color: rgba(255, 255, 255, .6);
    opacity: 1;
}

.xi-title .xi-edit {
    width: 14px;
    height: 14px;
    stroke-width: 1.5;
    stroke-linejoin: round;
    opacity: .75;
}

.xi-name-box:focus-within .xi-edit {
    opacity: 1;
    color: var(--brand-lime);
}

.xi-count {
    padding: .12rem .7rem;
    border-radius: 999px;
    font-weight: 700;
    color: var(--brand-dark);
    background: var(--brand-tint);
    box-shadow: inset 0 0 0 2px var(--brand-lime);
    /* keep "5 / 11" on one line next to the team name */
    flex-shrink: 0;
    white-space: nowrap;
}

/* player rows: tag | name | can-bowl tick */
.player-input .input-group-text,
.player-input .form-control {
    border-color: #e3e9e1;
}

.player-input > .input-group-text:first-child {
    width: 64px;
    justify-content: center;
    color: #1f2937;
    background: var(--brand-tint);
    border-radius: 10px 0 0 10px;
}

.player-input > .input-group-text:last-child {
    background: #fff;
    border-radius: 0 10px 10px 0;
}

.player-input .player-name {
    padding-top: .3rem;
    padding-bottom: .3rem;
}

.player-input .player-name:focus {
    border-color: #8cc263;
    box-shadow: none;
}

/* no focus glow on the can-bowl tick */
.player-input .bowler-check:focus {
    box-shadow: none;
}

.player-input .bowler-check:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.btn-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    padding: .55rem 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: var(--brand-dark);
    border: 0;
    box-shadow: 0 2px 8px rgba(16, 62, 50, .2);
}

.btn-save:hover,
.btn-save:focus-visible,
.btn-save:disabled {
    color: #fff;
    background: var(--brand-dark);
}

.btn-save svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linejoin: round;
}

/* lime tick after "Save team", visible for 3s after a save */
.btn-save .save-tick {
    display: none;
    stroke: var(--brand-lime);
    stroke-width: 2.4;
    stroke-linecap: round;
}

.btn-save.just-saved .save-tick {
    display: block;
    animation: save-tick-in .25s ease-out;
}

@keyframes save-tick-in {
    from { opacity: 0; transform: scale(.5); }
    to { opacity: 1; transform: scale(1); }
}

/* ---------- Field card header: green bar matching Playing XI ---------- */
/* the Ready-made menu opens from this header, so the card must not clip it */
.field-card {
    overflow: visible;
}

.planner .field-card .field-header {
    display: flex;
    align-items: center;
    min-height: 50px;
    padding: .35rem .75rem;
    background: var(--brand-dark);
    border-bottom: 0;
    border-radius: 19px 19px 0 0;
}

.planner .field-card .field-header .field-toolbar {
    width: 100%;
    margin: 0;
}

/* slimmer tabs and buttons so the bar stays low */
.planner .field-card .field-header .phase-btn {
    padding: .3rem 1rem;
}

.planner .field-card .field-header .btn-tool {
    padding: .3rem .85rem;
}

/* tabs on the dark bar: translucent track, lime active tab */
.planner .field-card .field-header .phase-switch {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .14);
    box-shadow: none;
}

.planner .field-card .field-header .phase-btn {
    color: rgba(255, 255, 255, .82);
}

.planner .field-card .field-header .phase-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.planner .field-card .field-header .phase-btn.active {
    color: var(--brand-dark);
    background: var(--brand-lime);
    box-shadow: none;
}

.planner .field-card .field-header .phase-btn.active::after {
    display: none;
}

.planner .field-card .field-header .phase-btn:focus-visible {
    outline-color: var(--brand-lime);
}

.planner .field-card .field-header .field-actions {
    border-left-color: rgba(255, 255, 255, .16);
}

/* stadium photo behind the field, washed out so it stays in the background */
.field-card .card-body {
    padding: .75rem 1rem;
    border-radius: 0 0 19px 19px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .9) 0, rgba(255, 255, 255, .55) 40%, rgba(255, 255, 255, .4) 100%),
        url("../img/field-bg.png") center bottom / cover no-repeat,
        #eef4ea;
}

/* ---------- Planner layout ----------
   Field on the left, Playing XI on the right. On desktop both fill the
   window below the header (≈112px = header + page padding + footer) and
   the field grows to fit; all 11 names fit on a normal screen. On a short
   window the list scrolls inside its card so Save stays in view. */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

/* mobile / tablet: tools in a row above the field, counter centred */
.field-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem;
}

.field-stage .field-tools {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    order: -2;
}

.field-stage .outside-chip {
    position: static;
    order: -1;
}

.field-area {
    width: 100%;
}

/* full-width layout (field page + header) so the side cards have room;
   both share the same max width so their edges line up */
.planner,
.site-container {
    max-width: 1800px;
}

/* below the field on smaller screens: items in a wrapping row */
.field-stage .field-indicators {
    width: auto;
    max-width: 100%;
}

.field-stage .field-indicators ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px 14px;
}

@media (min-width: 992px) {
    .planner {
        --panel-h: max(600px, calc(100vh - 112px));
        --panel-h: max(600px, calc(100dvh - 112px));
    }

    /* toolbar on top, field card takes the rest of the height */
    .planner .field-col {
        display: flex;
        flex-direction: column;
        height: var(--panel-h);
    }

    .planner .field-card {
        flex: 1 1 auto;
        min-height: 0;
    }

    .planner .field-card .card-body {
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    /* [tools] [field area]; counter pinned top-right */
    .planner .field-stage {
        flex: 1 1 auto;
        min-height: 0;
        flex-direction: row;
        align-items: stretch;
        gap: .75rem;
    }

    .planner .field-stage .field-tools {
        flex-direction: column;
        flex-wrap: nowrap;
        justify-content: center;
        order: 0;
    }

    .planner .field-stage .outside-chip {
        position: absolute;
        order: 0;
    }

    /* indicators card pinned right, under the counter; the stage keeps a
       strip clear for it so it never sits on the circle */
    .planner .field-stage {
        padding-right: 172px;
    }

    .planner .field-stage .field-indicators {
        position: absolute;
        top: 42px;
        right: 0;
        width: 160px;
    }

    .planner .field-stage .field-indicators ul {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 7px;
    }

    /* the field is the largest square that fits the space left over */
    .planner .field-area {
        flex: 1 1 auto;
        min-width: 0;
        container-type: size;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .planner #field {
        /* 14px leaves room for the white rim drawn outside the circle */
        width: calc(min(100cqw, 100cqh) - 14px);
        max-width: none;
        margin: 0;
    }

    /* line between the phase tabs and the tools */
    .planner .field-actions {
        padding-left: .6rem;
        border-left: 1px solid #dfe5dc;
    }

    .side-panel {
        position: sticky;
        top: .5rem;
        height: var(--panel-h);
    }

    .side-panel #playersForm {
        flex: 1 1 auto;
        min-height: 0;
    }

    .side-panel #playersForm .card-body {
        overflow-y: auto;
    }
}

/* hide scrollbars on the field page (scrolling by wheel / touch / keys still works) */
html:has(.planner),
.side-panel #playersForm .card-body {
    scrollbar-width: none;
}

html:has(.planner)::-webkit-scrollbar,
.side-panel #playersForm .card-body::-webkit-scrollbar {
    display: none;
}

/* ---------- Playing XI ---------- */
.player-input .player-name:focus {
    position: relative;
    z-index: 3;
}

/* ---------- Footer ---------- */
.site-footer {
    padding: .5rem 0;
    background: var(--brand-dark);
    border-top: 1px solid var(--brand-lime);
    font-size: .8rem;
    line-height: 1.4;
}

/* copyright left, links right - one thin line */
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .25rem 1rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: rgba(255, 255, 255, .82);
    text-decoration: none;
}

.footer-links a:hover,
.footer-links a:focus-visible {
    color: var(--brand-lime);
}

/* " – " between links */
.footer-links a + a::before {
    content: "\2013";
    display: inline-block;
    margin: 0 .5rem;
    color: rgba(255, 255, 255, .3);
}

.footer-copy {
    color: rgba(255, 255, 255, .6);
}

/* phones: stack centred if it doesn't fit */
@media (max-width: 575.98px) {
    .footer-inner {
        justify-content: center;
    }
}

/* ---------- Content pages (About, Privacy, Terms, Contact) ---------- */
.content-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.75rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: .75rem;
    color: #374151;
}

.content-page-head {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.content-page h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    color: #1f2937;
}

.content-page-intro {
    margin: .35rem 0 0;
    color: #6b7280;
}

.content-page section {
    margin-top: 1.5rem;
}

.content-page h2 {
    margin-bottom: .5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
}

.content-page ul {
    padding-left: 1.2rem;
}

.content-page li {
    margin-bottom: .35rem;
}

/* ---------- Contact page: white card on the stadium photo ---------- */
.contact-page {
    padding: 2rem 0 2.5rem;
    background:
        linear-gradient(180deg, rgba(247, 249, 246, .85) 0, rgba(247, 249, 246, .35) 45%, rgba(247, 249, 246, .15) 100%),
        url("../img/field-bg.png") center bottom / cover no-repeat,
        #eef4ea;
}

.contact-card {
    max-width: 1120px;
    margin: 0 auto;
    padding: 1.75rem 2rem 2rem;
    background: #fff;
    border: 1px solid #e3e9e1;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(16, 62, 50, .1);
}

.contact-head {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 1.1rem;
    margin: -1.75rem -2rem 1.5rem;
    padding: 1.75rem 2rem 1.25rem;
    border-radius: 20px 20px 0 0;
    /* soft lime wash behind the stumps on the right */
    background: radial-gradient(ellipse 45% 100% at 92% 40%, rgba(184, 227, 75, .25), transparent 70%);
}

.contact-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #eef8d6;
    box-shadow: 0 0 0 6px rgba(184, 227, 75, .18);
}

.contact-badge svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: var(--brand-dark);
    stroke-width: 2;
    stroke-linejoin: round;
}

.contact-head-text {
    position: relative;
    z-index: 1;
    max-width: 640px;
}

.contact-head h1 {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    color: var(--brand-dark);
}

/* short green bar under the heading */
.contact-head h1::after {
    content: "";
    display: block;
    width: 64px;
    height: 4px;
    margin: .4rem 0 .65rem;
    border-radius: 4px;
    background: var(--brand);
}

.contact-head p {
    margin: 0;
    color: #4b5563;
}

.contact-art {
    position: absolute;
    right: 2rem;
    top: .75rem;
    width: 150px;
    height: auto;
}

.contact-form .form-label {
    margin-bottom: .4rem;
    font-size: .92rem;
    font-weight: 700;
    color: #1f2937;
}

.contact-form .req {
    color: #dc3545;
}

/* inputs with an icon on the left */
.icon-field {
    position: relative;
}

.icon-field > svg {
    position: absolute;
    top: 50%;
    left: .9rem;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    fill: none;
    stroke: var(--brand);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
    z-index: 2;
}

.icon-field-top > svg {
    top: 1.1rem;
    transform: none;
}

/* keep the icon level with the box when an error message shows underneath */
.icon-field:has(.invalid-feedback) > svg {
    top: calc(1.5rem - 1px);
}

.icon-field-top:has(.invalid-feedback) > svg {
    top: 1.1rem;
}

.contact-form .icon-field .form-control,
.contact-form .icon-field .form-select {
    min-height: 48px;
    padding-left: 2.6rem;
    border-color: #d6ddd3;
    border-radius: 10px;
}

.contact-form .icon-field .form-control:focus,
.contact-form .icon-field .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(8, 125, 82, .12);
}

.contact-form textarea {
    padding-top: .75rem;
    resize: vertical;
}

.btn-contact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    min-width: 220px;
    padding: .75rem 1.75rem;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: var(--brand-dark);
    border: 0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(16, 62, 50, .2);
}

.btn-contact:hover,
.btn-contact:focus-visible {
    color: #fff;
    background: var(--brand);
}

.btn-contact svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1;
    stroke-linejoin: round;
}

/* honeypot field, kept off screen */
.contact-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---------- Error pages (404, 419, 429, 500, 503) ---------- */
.error-page {
    max-width: 520px;
    margin: 2rem auto;
    padding: 2.5rem 1.75rem;
    text-align: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: .75rem;
}

.error-ball {
    width: 56px;
    height: 56px;
}

.error-code {
    margin: 1rem 0 0;
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    color: #d1d5db;
}

.error-title {
    margin: .5rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

.error-message {
    margin: 0 auto 1.5rem;
    color: #6b7280;
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
}

/* ---------- Ready-made fields menu ---------- */
.preset-menu {
    min-width: 290px;
    padding: .35rem 0;
    border-color: #e5e7eb;
    border-radius: .6rem;
}

.preset-menu .dropdown-header {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #9ca3af;
}

.preset-item {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: .75rem;
    padding: .45rem 1rem;
    white-space: normal;
}

.preset-item .preset-name {
    font-weight: 600;
    color: #1f2937;
}

.preset-item .preset-desc {
    grid-column: 1 / -1;
    font-size: .78rem;
    color: #6b7280;
}

.preset-item .preset-out {
    align-self: center;
    padding: .05rem .45rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    color: #92400e;
    background: #fef3c7;
}

.preset-item .preset-out.is-over {
    color: #b02a37;
    background: #fde2e4;
}

/* ---------- Confirm popup ---------- */
.confirm-modal .modal-content {
    border: 0;
    border-radius: .9rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .2);
}

.confirm-modal .modal-body {
    padding: 1.75rem 1.5rem 1rem;
}

.confirm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin-bottom: .75rem;
    border-radius: 50%;
    background: #fde2e4;
    color: #dc3545;
}

.confirm-icon svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.confirm-title {
    margin-bottom: .4rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
}

.confirm-message {
    margin: 0;
    font-size: .9rem;
    color: #6b7280;
}

.confirm-modal .modal-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
    padding: 0 1.5rem 1.5rem;
    border-top: 0;
}

.confirm-modal .modal-footer > * {
    margin: 0;
}


/* ---------- Theme toggle ---------- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    color: #4b5563;
    background: #fff;
    border: 1px solid #d9e0d6;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    color: #111827;
    background: #f3f4f6;
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-toggle .icon-sun,
[data-bs-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

[data-bs-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

/* header logo: normal in light mode, white version in dark mode */
.site-header .brand-logo-dark,
[data-bs-theme="dark"] .site-header .brand-logo-light {
    display: none;
}

[data-bs-theme="dark"] .site-header .brand-logo-dark {
    display: block;
}

/* =====================================================================
   Dark mode. Bootstrap handles its own components (cards, forms,
   dropdowns, modals); these override this file's custom colours.
   The cricket field itself keeps its green colours.
   ===================================================================== */
[data-bs-theme="dark"] {
    --bs-body-bg: #111827;
    --bs-body-color: #e5e7eb;
    --bs-tertiary-bg: #1f2937;
    --bs-secondary-color: #9ca3af;
    --bs-border-color: #374151;
    color-scheme: dark;
}

[data-bs-theme="dark"] body {
    background: #0b1120;
}

[data-bs-theme="dark"] .card {
    --bs-card-bg: #111827;
}

[data-bs-theme="dark"] .site-header {
    background: #111827;
    border-bottom-color: #1f2937;
}

[data-bs-theme="dark"] .site-header .navbar-brand {
    color: #f3f4f6;
}

[data-bs-theme="dark"] .site-header .header-tagline {
    color: #d1d5db;
    border-left-color: #374151;
}

[data-bs-theme="dark"] .theme-toggle {
    color: #fbbf24;
    background: #1f2937;
    border-color: #374151;
}

[data-bs-theme="dark"] .site-header::before {
    opacity: .35;
}

[data-bs-theme="dark"] .btn-header {
    color: #e5e7eb;
    background: #1f2937;
    border-color: #374151;
}

[data-bs-theme="dark"] .btn-header:hover,
[data-bs-theme="dark"] .btn-header:focus-visible {
    color: #fff;
    background: #273449;
}

[data-bs-theme="dark"] .btn-header-primary {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
}

[data-bs-theme="dark"] .theme-toggle:hover,
[data-bs-theme="dark"] .theme-toggle:focus-visible {
    background: #1f2937;
}

/* save status pill */
[data-bs-theme="dark"] .save-status {
    background: #1f2937;
    color: #9ca3af;
    border-color: #374151;
}

[data-bs-theme="dark"] .save-status.is-saved {
    background: #052e1a;
    color: #4ade80;
    border-color: #14532d;
}

[data-bs-theme="dark"] .save-status.is-dirty {
    background: #3b0d12;
    color: #f87171;
    border-color: #7f1d1d;
}

/* phase tabs */
[data-bs-theme="dark"] .phase-switch {
    background: #1f2937;
    border-color: #374151;
}

[data-bs-theme="dark"] .planner .field-actions {
    border-left-color: #374151;
}

[data-bs-theme="dark"] .phase-btn {
    color: #9ca3af;
}

[data-bs-theme="dark"] .phase-btn:hover {
    color: #f3f4f6;
    background: rgba(255, 255, 255, .06);
}

[data-bs-theme="dark"] .phase-btn.active {
    color: #fff;
    background: var(--brand);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .5);
}

/* cards, Playing XI, legend */
[data-bs-theme="dark"] #playersForm.card,
[data-bs-theme="dark"] .field-card {
    border-color: #1f2937;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .4) !important;
}

[data-bs-theme="dark"] #playersForm .card-footer {
    background: #111827;
    border-top-color: #1f2937;
}

[data-bs-theme="dark"] .xi-count {
    color: #d9f99d;
    background: rgba(0, 0, 0, .25);
}

[data-bs-theme="dark"] .player-input .input-group-text,
[data-bs-theme="dark"] .player-input .form-control {
    border-color: #374151;
}

[data-bs-theme="dark"] .player-input > .input-group-text:first-child {
    color: #d9f99d;
    background: #1c3324;
}

[data-bs-theme="dark"] .player-input > .input-group-text:last-child {
    background: #1f2937;
}

/* same stadium photo, dimmed for night */
[data-bs-theme="dark"] .field-card .card-body {
    background:
        linear-gradient(180deg, rgba(17, 24, 39, .95) 0, rgba(17, 24, 39, .8) 40%, rgba(17, 24, 39, .7) 100%),
        url("../img/field-bg.png") center bottom / cover no-repeat,
        #111827;
}

[data-bs-theme="dark"] .field-indicators {
    color: #e5e7eb;
    background: rgba(31, 41, 55, .92);
    border-color: #374151;
}

[data-bs-theme="dark"] .field-indicators-head {
    color: #9ca3af;
}

[data-bs-theme="dark"] .field-indicators .legend-dot.legend-out {
    box-shadow: 0 0 0 1.5px #1f2937, 0 0 0 3px #ffc107;
}

/* field tool buttons */
[data-bs-theme="dark"] .btn-tool {
    color: #d1d5db;
    background: #1f2937;
    border-color: #374151;
}

[data-bs-theme="dark"] .btn-tool:hover,
[data-bs-theme="dark"] .btn-tool:focus-visible {
    color: #fff;
    background: #273449;
    border-color: #4b5563;
}

[data-bs-theme="dark"] .btn-float {
    color: #e5e7eb;
    background: rgba(31, 41, 55, .92);
    border-color: #374151;
}

[data-bs-theme="dark"] .btn-float:hover,
[data-bs-theme="dark"] .btn-float:focus-visible {
    color: #fff;
    background: #273449;
}

[data-bs-theme="dark"] .btn-float svg {
    stroke: #4ade80;
}

[data-bs-theme="dark"] .btn-float-primary {
    color: #d9f99d;
    background: rgba(54, 83, 20, .85);
    border-color: #4d7c0f;
}

/* ready-made menu */
[data-bs-theme="dark"] .preset-menu {
    border-color: #374151;
}

[data-bs-theme="dark"] .preset-item .preset-name {
    color: #f3f4f6;
}

[data-bs-theme="dark"] .preset-item .preset-desc {
    color: #9ca3af;
}

[data-bs-theme="dark"] .preset-item .preset-out {
    color: #fbbf24;
    background: #2d1f04;
}

[data-bs-theme="dark"] .preset-item .preset-out.is-over {
    color: #fca5a5;
    background: #3b0d12;
}

/* confirm popup */
[data-bs-theme="dark"] .confirm-modal .modal-content {
    background: #1f2937;
}

[data-bs-theme="dark"] .confirm-icon {
    background: #3b0d12;
    color: #f87171;
}

[data-bs-theme="dark"] .confirm-title {
    color: #f3f4f6;
}

[data-bs-theme="dark"] .confirm-message {
    color: #9ca3af;
}

/* footer */
[data-bs-theme="dark"] .site-footer {
    background: #0b2a22;
    border-top-color: rgba(184, 227, 75, .5);
}

[data-bs-theme="dark"] .footer-links a {
    color: rgba(255, 255, 255, .75);
}

[data-bs-theme="dark"] .footer-links a + a::before {
    color: rgba(255, 255, 255, .25);
}

[data-bs-theme="dark"] .footer-links a:hover,
[data-bs-theme="dark"] .footer-links a:focus-visible {
    color: var(--brand-lime);
}

[data-bs-theme="dark"] .footer-copy {
    color: rgba(255, 255, 255, .5);
}

/* content + error pages */
[data-bs-theme="dark"] .content-page,
[data-bs-theme="dark"] .error-page {
    background: #111827;
    border-color: #1f2937;
    color: #d1d5db;
}

[data-bs-theme="dark"] .content-page-head {
    border-bottom-color: #1f2937;
}

[data-bs-theme="dark"] .content-page h1,
[data-bs-theme="dark"] .content-page h2,
[data-bs-theme="dark"] .error-title {
    color: #f3f4f6;
}

[data-bs-theme="dark"] .content-page-intro,
[data-bs-theme="dark"] .error-message {
    color: #9ca3af;
}

[data-bs-theme="dark"] .error-code {
    color: #374151;
}

[data-bs-theme="dark"] .contact-page {
    background:
        linear-gradient(180deg, rgba(11, 17, 32, .95) 0, rgba(11, 17, 32, .8) 45%, rgba(11, 17, 32, .7) 100%),
        url("../img/field-bg.png") center bottom / cover no-repeat,
        #0b1120;
}

[data-bs-theme="dark"] .contact-card {
    background: #111827;
    border-color: #1f2937;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}

[data-bs-theme="dark"] .contact-badge {
    background: rgba(54, 83, 20, .6);
}

[data-bs-theme="dark"] .contact-badge svg {
    stroke: #d9f99d;
}

[data-bs-theme="dark"] .contact-head h1,
[data-bs-theme="dark"] .contact-form .form-label {
    color: #f3f4f6;
}

[data-bs-theme="dark"] .contact-head p {
    color: #9ca3af;
}

[data-bs-theme="dark"] .icon-field > svg {
    stroke: #4ade80;
}

[data-bs-theme="dark"] .contact-form .icon-field .form-control,
[data-bs-theme="dark"] .contact-form .icon-field .form-select {
    border-color: #374151;
}

[data-bs-theme="dark"] .btn-contact {
    background: var(--brand);
}

[data-bs-theme="dark"] .btn-contact:hover,
[data-bs-theme="dark"] .btn-contact:focus-visible {
    background: #0a9a65;
}

/* field at night: deep, muted turf lit from the centre (like floodlights),
   fading into the dark card instead of a bright green disc */
[data-bs-theme="dark"] #field {
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .06) 0, rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, .35) 100%),
        repeating-linear-gradient(90deg,
            #1d5c36 0, #1d5c36 7.14%,
            #1a5331 7.14%, #1a5331 14.28%);
    box-shadow:
        inset 0 0 50px rgba(0, 0, 0, .45),
        0 0 0 1px rgba(74, 222, 128, .12),
        0 0 40px rgba(34, 197, 94, .08);
}

[data-bs-theme="dark"] #field .boundary {
    border-color: rgba(255, 255, 255, .45);
}

[data-bs-theme="dark"] #field .inner-circle path {
    stroke: rgba(255, 255, 255, .6);
}

[data-bs-theme="dark"] #field .pitch {
    background: #b8946a;
    box-shadow: 0 0 12px rgba(184, 148, 106, .25);
}

[data-bs-theme="dark"] #field .crease {
    background: rgba(255, 255, 255, .55);
}

/* on-field chips: dark glass instead of white pills */
[data-bs-theme="dark"] .outside-chip,
[data-bs-theme="dark"] #field.is-empty::after {
    background: rgba(17, 24, 39, .85);
    color: #e5e7eb;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
    backdrop-filter: blur(4px);
}

[data-bs-theme="dark"] .outside-chip-slots i {
    border-color: #4b5563;
}

[data-bs-theme="dark"] .outside-chip.is-over {
    background: rgba(127, 29, 29, .9);
    color: #fecaca;
    border-color: rgba(248, 113, 113, .4);
}

/* player name tags: a touch darker so they read well on the deep turf */
[data-bs-theme="dark"] .player .label {
    background: rgba(3, 7, 18, .72);
}

/* ---------- Phones ---------- */
@media (max-width: 575.98px) {
    .field-actions .btn-tool {
        padding-left: .5rem;
        padding-right: .5rem;
    }

    .phase-btn {
        gap: .35rem;
        padding: .6rem .4rem;
        font-size: .9rem;
    }

    .phase-btn svg {
        width: 16px;
        height: 16px;
    }

    .site-header .brand-logo {
        height: 36px;
    }

    .btn-header {
        padding: .4rem .7rem;
    }

    /* give the field as much width as possible */
    .field-card .card-body {
        padding: .75rem .5rem;
    }

    /* tabs on their own row, tools share the row below */
    .phase-switch {
        display: flex;
        width: 100%;
    }

    .phase-btn {
        flex: 1 1 0;
    }

    .field-actions {
        width: 100%;
    }

    .field-actions > .btn,
    .field-actions > .dropdown {
        flex: 1 1 auto;
    }

    .field-actions > .dropdown > .btn,
    .field-actions .btn-tool {
        width: 100%;
        justify-content: center;
    }

    .btn-float {
        width: auto;
        padding: .4rem .75rem;
    }

    #field.is-empty::after {
        font-size: 11px;
    }

    .content-page {
        padding: 1.25rem;
    }

    .btn-contact {
        width: 100%;
    }

    .contact-page {
        padding: 1rem 0 1.5rem;
    }

    .contact-card {
        padding: 1.25rem 1.1rem 1.5rem;
    }

    .contact-head {
        margin: -1.25rem -1.1rem 1.25rem;
        padding: 1.25rem 1.1rem 1rem;
    }

    .contact-badge {
        width: 48px;
        height: 48px;
    }

    .contact-badge svg {
        width: 24px;
        height: 24px;
    }
}

/* stumps illustration only where there is room beside the heading */
@media (max-width: 991.98px) {
    .contact-art {
        display: none;
    }
}

/* ---------- Home page ---------- */
.home-hero {
    padding: 3.5rem 0 3rem;
    background: radial-gradient(ellipse at 80% 40%, rgba(25, 135, 84, .08), transparent 60%);
}

.home-kicker {
    display: inline-block;
    padding: .25rem .75rem;
    margin-bottom: 1rem;
    border-radius: 999px;
    background: #e8f5ee;
    color: #146c43;
    font-size: .8rem;
    font-weight: 600;
}

.home-title {
    font-size: clamp(2rem, 4.5vw, 3rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.02em;
    margin-bottom: 1rem;
}

.home-lead {
    font-size: 1.1rem;
    color: var(--bs-secondary-color);
    max-width: 34rem;
    margin: 0 auto 1.75rem;
}

@media (min-width: 992px) {
    .home-lead {
        margin-left: 0;
    }
}

.btn-start {
    box-shadow: 0 6px 16px rgba(25, 135, 84, .25);
}

.home-perks {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem 1.25rem;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 1.25rem 0 0;
    font-size: .875rem;
    color: var(--bs-secondary-color);
}

@media (min-width: 992px) {
    .home-perks {
        justify-content: flex-start;
    }
}

.home-perks li::before {
    content: "\2713";
    margin-right: .35rem;
    color: #198754;
    font-weight: 700;
}

/* field picture */
.home-field {
    display: block;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, .15));
}

.home-field .hf-stripe-a { fill: #2a9d47; }
.home-field .hf-stripe-b { fill: #24903f; }
.home-field .hf-shade { stop-opacity: .18; }
.home-field .hf-line { stroke: rgba(255, 255, 255, .9); }
.home-field .hf-line-fill { fill: rgba(255, 255, 255, .8); }
.home-field .hf-pitch { fill: #e2b67f; }

.home-field .hf-ring {
    fill: none;
    stroke: #fff;
    stroke-width: 1;
    stroke-linecap: round;
    stroke-dasharray: 0 2;
}

.home-field .hf-chip rect { fill: rgba(255, 255, 255, .95); }

.home-field .hf-chip text {
    fill: #374151;
    font-size: 2.2px;
    font-weight: 600;
    text-anchor: middle;
    dominant-baseline: central;
}

.home-field .hf-player circle {
    fill: #0d6efd;
    stroke: #fff;
    stroke-width: .5;
}

.home-field .hf-player.wk circle { fill: #fd7e14; }
.home-field .hf-player.bowler circle { fill: #dc3545; }
.home-field .hf-player.out circle { stroke: #ffc107; stroke-width: .7; }

.home-field .hf-player text {
    fill: #fff;
    font-size: 2.1px;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: central;
}

/* sections */
.home-section {
    padding: 3rem 0;
}

.home-section-title {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.75rem;
}

.step-card {
    height: 100%;
    padding: 1.5rem;
    border-radius: 14px;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-bottom: .85rem;
    border-radius: 50%;
    background: #198754;
    color: #fff;
    font-weight: 700;
}

.step-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: .35rem;
}

.step-card p {
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .925rem;
}

.home-features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.home-features .feature {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: 1rem 1.1rem;
    border-left: 3px solid #198754;
    border-radius: 0 10px 10px 0;
    background: var(--bs-tertiary-bg);
}

.home-features .feature strong {
    font-size: .95rem;
}

.home-features .feature span {
    font-size: .85rem;
    color: var(--bs-secondary-color);
}

.home-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: .75rem 1.25rem;
    margin-top: 2.5rem;
    padding: 1.25rem;
    border-radius: 14px;
    background: #e8f5ee;
    font-weight: 600;
    text-align: center;
}

@media (max-width: 991.98px) {
    .home-features {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575.98px) {
    .home-hero {
        padding: 2rem 0 1.5rem;
    }

    .home-section {
        padding: 2rem 0;
    }

    .home-features {
        grid-template-columns: 1fr;
    }

    .home-field {
        max-width: 320px;
    }
}

/* home page in dark mode */
[data-bs-theme="dark"] .home-hero {
    background: radial-gradient(ellipse at 80% 40%, rgba(34, 197, 94, .07), transparent 60%);
}

[data-bs-theme="dark"] .home-kicker,
[data-bs-theme="dark"] .home-cta {
    background: rgba(25, 135, 84, .15);
    color: #75b798;
}

[data-bs-theme="dark"] .home-cta {
    color: #e5e7eb;
}

[data-bs-theme="dark"] .step-card {
    background: #111827;
    border-color: #1f2937;
}

[data-bs-theme="dark"] .home-features .feature {
    background: #111827;
}

[data-bs-theme="dark"] .home-field {
    filter: drop-shadow(0 0 30px rgba(34, 197, 94, .1));
}

[data-bs-theme="dark"] .home-field .hf-stripe-a { fill: #1d5c36; }
[data-bs-theme="dark"] .home-field .hf-stripe-b { fill: #1a5331; }
[data-bs-theme="dark"] .home-field .hf-shade { stop-opacity: .4; }
[data-bs-theme="dark"] .home-field .hf-line { stroke: rgba(255, 255, 255, .45); }
[data-bs-theme="dark"] .home-field .hf-line-fill { fill: rgba(255, 255, 255, .55); }
[data-bs-theme="dark"] .home-field .hf-ring { stroke: rgba(255, 255, 255, .6); }
[data-bs-theme="dark"] .home-field .hf-pitch { fill: #b8946a; }
[data-bs-theme="dark"] .home-field .hf-chip rect { fill: rgba(17, 24, 39, .9); }
[data-bs-theme="dark"] .home-field .hf-chip text { fill: #e5e7eb; }

/* ---------- Field options: ☰ button + sidebar (small screens) ----------
   Below 768px the header keeps only the phase tabs and a ☰ button; the
   options move into a sidebar that slides in from the right. */
.field-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    flex-shrink: 0;
    color: #fff;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 11px;
}

.field-menu-btn:hover,
.field-menu-btn:focus-visible {
    color: var(--brand-dark);
    background: var(--brand-lime);
    border-color: var(--brand-lime);
}

.field-menu-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

@media (max-width: 767.98px) {
    /* tabs + ☰ on one row */
    .field-card .field-header .field-toolbar {
        flex-wrap: nowrap;
    }

    .field-card .field-header .phase-switch {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
    }

    /* these live in the sidebar on small screens */
    .field-card .field-actions,
    .field-card .btn-copy-pp,
    .field-card .field-tools {
        display: none !important;
    }
}

.field-options {
    --bs-offcanvas-width: min(320px, 86vw);
}

.field-options .offcanvas-header {
    color: #fff;
    background: var(--brand-dark);
}

.field-options .offcanvas-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.field-options .btn-close {
    filter: invert(1) grayscale(1) brightness(2);
}

.field-options-label {
    margin: 0 0 .5rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #6b7280;
}

.field-options-list {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    margin-bottom: 1.25rem;
}

.field-option {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    padding: .65rem .85rem;
    font-size: .95rem;
    font-weight: 600;
    text-align: left;
    color: #1f2937;
    background: #fff;
    border: 1px solid #e2e7e0;
    border-radius: 12px;
}

.field-option:hover,
.field-option:focus-visible {
    border-color: var(--brand);
    background: #f6faf3;
}

.field-option svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    fill: none;
    stroke: var(--brand);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.field-option-primary {
    color: var(--brand-dark);
    background: #eef8d6;
    border-color: #cde68a;
}

/* ready-made list copied from the toolbar menu */
.field-options-presets {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid #e2e7e0;
    border-radius: 12px;
    overflow: hidden;
}

.field-options-presets .dropdown-header {
    padding: .5rem .85rem .25rem;
}

.field-options-presets .dropdown-divider {
    margin: .25rem 0;
}

.field-options-presets .preset-item {
    width: 100%;
    background: transparent;
    border: 0;
    text-align: left;
}

.field-options-presets .preset-item:hover,
.field-options-presets .preset-item:focus-visible {
    background: #f6faf3;
}

[data-bs-theme="dark"] .field-options-label {
    color: #9ca3af;
}

[data-bs-theme="dark"] .field-option,
[data-bs-theme="dark"] .field-options-presets {
    color: #e5e7eb;
    background: #1f2937;
    border-color: #374151;
}

[data-bs-theme="dark"] .field-option:hover,
[data-bs-theme="dark"] .field-options-presets .preset-item:hover {
    background: #273449;
}

[data-bs-theme="dark"] .field-option svg {
    stroke: #4ade80;
}

[data-bs-theme="dark"] .field-option-primary {
    color: #d9f99d;
    background: rgba(54, 83, 20, .85);
    border-color: #4d7c0f;
}

/* ---------- Custom URL popup ---------- */
.custom-url-modal .modal-dialog {
    max-width: 600px;
}

.custom-url-modal .modal-content {
    position: relative;
    padding: 1.1rem 1.5rem 1.25rem;
    border: 0;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(16, 62, 50, .25);
}

.custom-url-close {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
}

.custom-url-head {
    text-align: center;
}

.custom-url-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: .5rem;
    border-radius: 50%;
    background: #eef8d6;
    box-shadow: 0 0 0 4px rgba(184, 227, 75, .18);
}

.custom-url-badge svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: var(--brand-dark);
    stroke-width: 2.2;
    stroke-linecap: round;
}

.custom-url-title {
    margin: 0 0 .2rem;
    font-size: 1.4rem;
    font-weight: 800;
    color: #111827;
}

.custom-url-sub {
    margin: 0 0 .85rem;
    font-size: .92rem;
    color: #374151;
}

/* pale lime panel around the input */
.custom-url-box {
    padding: .75rem .9rem .85rem;
    background: #f8fcef;
    border: 1px solid #e1efc4;
    border-radius: 14px;
}

.custom-url-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .45rem;
    font-weight: 700;
    color: #111827;
}

.custom-url-label svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--brand);
    stroke-width: 1.4;
}

.custom-url-input {
    position: relative;
    display: flex;
    align-items: stretch;
}

.custom-url-prefix {
    display: inline-flex;
    align-items: center;
    padding: 0 .9rem;
    font-weight: 500;
    color: #374151;
    background: #eceeec;
    border: 1px solid #dfe3de;
    border-right: 0;
    border-radius: 10px 0 0 10px;
    white-space: nowrap;
}

.custom-url-input input {
    flex: 1 1 auto;
    min-width: 0;
    height: 42px;
    padding: 0 2.6rem 0 .9rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: #111827;
    background: #fff;
    border: 2px solid #d6ddd3;
    border-radius: 0 10px 10px 0;
    outline: 0;
}

.custom-url-input input:focus {
    border-color: var(--brand);
}

.custom-url-input.is-ok input {
    border-color: var(--brand-dark);
}

/* green ticked circle inside the input when the URL is free */
.custom-url-ok {
    position: absolute;
    top: 50%;
    right: .75rem;
    display: none;
    width: 22px;
    height: 22px;
    transform: translateY(-50%);
}

.custom-url-ok circle {
    fill: var(--brand);
}

.custom-url-ok path {
    fill: none;
    stroke: #fff;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.custom-url-input.is-ok .custom-url-ok {
    display: block;
}

/* red crossed circle in the same spot when the URL can't be used (taken, reserved, wrong format) */
.custom-url-bad {
    position: absolute;
    top: 50%;
    right: .75rem;
    display: none;
    width: 22px;
    height: 22px;
    transform: translateY(-50%);
}

.custom-url-bad circle {
    fill: #dc3545;
}

/* hover passes through the icons to the input, whose tooltip gives the reason */
.custom-url-ok,
.custom-url-bad {
    pointer-events: none;
}

.custom-url-bad path {
    fill: none;
    stroke: #fff;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.custom-url-input.is-bad .custom-url-bad {
    display: block;
}

.custom-url-input.is-bad input {
    border-color: #dc3545;
}

/* small spinner in the tick's spot while the URL is being checked */
.custom-url-spin {
    position: absolute;
    top: 50%;
    right: .8rem;
    display: none;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    border: 2.5px solid #d6ddd3;
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: custom-url-spin .7s linear infinite;
}

.custom-url-input.is-checking .custom-url-spin {
    display: block;
}

@keyframes custom-url-spin {
    to { transform: rotate(360deg); }
}

[data-bs-theme="dark"] .custom-url-spin {
    border-color: #374151;
    border-top-color: #4ade80;
}

/* tips row */
.custom-url-tips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .3rem 1rem;
    margin: .65rem 0 0;
    font-size: .8rem;
    color: #374151;
}

.custom-url-tips > span:not(.custom-url-tips-label)::before {
    content: "\2022";
    margin-right: .4rem;
    color: #6b7280;
}

.custom-url-tips-label {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .15rem .55rem .15rem .35rem;
    font-weight: 700;
    color: var(--brand-dark);
    background: #eef8d6;
    border-radius: 999px;
}

.custom-url-tips-label svg {
    width: 16px;
    height: 16px;
    fill: var(--brand-lime);
    stroke: var(--brand-dark);
    stroke-width: 1.2;
}

/* error bar (shown only when the URL can't be used) */
.custom-url-status {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-top: .65rem;
    padding: .55rem .85rem;
    font-size: .9rem;
    font-weight: 600;
    border-radius: 10px;
}

.custom-url-status[hidden] {
    display: none;
}

.custom-url-status svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.custom-url-status.is-error {
    color: #b02a37;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.custom-url-status.is-error .icon-err circle {
    fill: #dc3545;
}

.custom-url-status.is-error .icon-err path {
    fill: none;
    stroke: #fff;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.custom-url-actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    margin-top: 1rem;
}

.custom-url-cancel,
.custom-url-save {
    min-width: 130px;
    padding: .6rem 1.4rem;
    font-weight: 700;
    border-radius: 999px;
}

.custom-url-cancel {
    color: #111827;
    background: #fff;
    border: 1px solid #d6ddd3;
}

.custom-url-cancel:hover {
    background: #f6faf3;
    border-color: #b9c9b3;
}

.custom-url-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    color: #fff;
    background: var(--brand-dark);
    border: 0;
}

.custom-url-save:hover,
.custom-url-save:focus-visible {
    color: #fff;
    background: var(--brand);
}

.custom-url-save:disabled {
    color: #fff;
    background: var(--brand-dark);
    opacity: .5;
}

.custom-url-save svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

@media (max-width: 575.98px) {
    .custom-url-modal .modal-content {
        padding: 1.25rem 1.1rem 1.25rem;
    }

    .custom-url-title {
        font-size: 1.35rem;
    }

    .custom-url-prefix {
        padding: 0 .6rem;
        font-size: .85rem;
    }

    .custom-url-actions > .btn {
        flex: 1 1 0;
        min-width: 0;
    }
}

[data-bs-theme="dark"] .custom-url-modal .modal-content {
    background: #111827;
}

[data-bs-theme="dark"] .custom-url-title,
[data-bs-theme="dark"] .custom-url-label,
[data-bs-theme="dark"] .custom-url-input input {
    color: #f3f4f6;
}

[data-bs-theme="dark"] .custom-url-sub,
[data-bs-theme="dark"] .custom-url-tips {
    color: #9ca3af;
}

[data-bs-theme="dark"] .custom-url-badge,
[data-bs-theme="dark"] .custom-url-tips-label {
    color: #d9f99d;
    background: rgba(54, 83, 20, .6);
}

[data-bs-theme="dark"] .custom-url-badge svg {
    stroke: #d9f99d;
}

[data-bs-theme="dark"] .custom-url-box {
    background: #1a2233;
    border-color: #2b3648;
}

[data-bs-theme="dark"] .custom-url-prefix {
    color: #d1d5db;
    background: #273449;
    border-color: #374151;
}

[data-bs-theme="dark"] .custom-url-input input {
    background: #0b1120;
    border-color: #374151;
}

[data-bs-theme="dark"] .custom-url-input input:focus,
[data-bs-theme="dark"] .custom-url-input.is-ok input {
    border-color: #4ade80;
}

[data-bs-theme="dark"] .custom-url-ok circle {
    fill: #22c55e;
}

[data-bs-theme="dark"] .custom-url-input.is-bad input {
    border-color: #f87171;
}

[data-bs-theme="dark"] .custom-url-status.is-error {
    color: #fca5a5;
    background: #3b0d12;
    border-color: #7f1d1d;
}

[data-bs-theme="dark"] .custom-url-cancel {
    color: #e5e7eb;
    background: #1f2937;
    border-color: #374151;
}

[data-bs-theme="dark"] .custom-url-save {
    background: var(--brand);
}
