/* The sandbox's tokens on top of the site kit's. Every color is mixed from the kit's palette, so
   any theme reaches the pitch. The canvas reads the pitch tokens from here. */
:root {
    --grass: color-mix(in srgb, var(--hue-2) 16%, var(--neutral-2));
    --grass-stripe: color-mix(in srgb, var(--hue-2) 20%, var(--neutral-2));
    --pitch-line: color-mix(in srgb, var(--neutral-6) 45%, var(--grass));

    --size-slider-thumb: 18px;
    --size-slider-track: 4px;
}

:root[data-theme="light"] {
    --grass: color-mix(in srgb, var(--hue-2) 22%, var(--neutral-2));
    --grass-stripe: color-mix(in srgb, var(--hue-2) 27%, var(--neutral-2));
    --pitch-line: color-mix(in srgb, var(--bright) 75%, var(--grass));
}

/* -- Layout: controls, pitch and tactics side by side on desktop, one column on a phone -- */

.sandbox {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: var(--column-width) 1fr var(--column-width);
}

.column {
    display: flex;
    flex-direction: column;
    gap: var(--space-xlarge);
    min-height: 0;
    overflow: auto;
    padding: var(--space-xlarge);
    background: var(--neutral-2);
}

.column--arena {
    gap: var(--space-large);
    background: var(--neutral-1);
    overflow: hidden;
}

.large-title { margin: 0; }

.theme-button {
    align-self: start;
    margin-top: auto;
    color: var(--neutral-5);
}

.group { display: grid; gap: var(--space-medium); }

.group__title {
    margin: 0;
    font-size: var(--text-small);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--neutral-5);
}

.button-row { display: flex; gap: var(--space-medium); }
.button-row > button { flex: 1 1 0; min-width: 0; white-space: nowrap; }

/* -- Fields -- */

.field { display: flex; align-items: center; justify-content: space-between; gap: var(--space-medium); }
.field__label { color: var(--neutral-5); }

.field__input,
.field__select {
    width: 50%;
    padding: var(--space-small) var(--space-medium);
    border: 0;
    border-radius: var(--radius);
    background: var(--neutral-3);
    color: var(--neutral-6);
    font: inherit;
}

.segments { display: flex; gap: var(--space-small); }

.segments__button {
    flex: 1 1 0;
    padding: var(--space-small);
    border: 0;
    border-radius: var(--radius);
    background: var(--neutral-3);
    color: var(--neutral-5);
}

.segments__button.is-selected { background: var(--neutral-4); color: var(--neutral-6); }

/* -- Scoreboard -- */

.scoreboard {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: baseline;
    column-gap: var(--space-large);
}

.scoreboard__team { font-weight: 600; }
.scoreboard__team--home { justify-self: end; color: var(--self); }
.scoreboard__team--away { color: var(--opponent); }
.scoreboard__score { font-size: var(--text-display); font-weight: 700; font-variant-numeric: tabular-nums; }
.scoreboard__clock { grid-column: 2; justify-self: center; color: var(--neutral-5); font-variant-numeric: tabular-nums; }

/* -- Pitch -- */

.pitch-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pitch { display: block; border-radius: var(--radius); }

/* -- Tactics -- */

.tactics { gap: var(--space-large); }
.tactics__title { margin: 0; font-weight: 600; }
.tactics--home .tactics__title { color: var(--self); }
.tactics--away .tactics__title { color: var(--opponent); }

.dial { display: grid; gap: var(--space-small); }
.dial__labels { display: flex; justify-content: space-between; font-size: var(--text-small); color: var(--neutral-5); }
.dial__name { color: var(--neutral-6); }

.dial__input {
    width: 100%;
    height: var(--size-slider-thumb);
    margin: 0;
    background: none;
    appearance: none;
    -webkit-appearance: none;
}

.dial__input::-webkit-slider-runnable-track { height: var(--size-slider-track); border-radius: var(--radius-pill); background: var(--neutral-4); }
.dial__input::-moz-range-track { height: var(--size-slider-track); border-radius: var(--radius-pill); background: var(--neutral-4); }

.dial__input::-webkit-slider-thumb {
    width: var(--size-slider-thumb);
    height: var(--size-slider-thumb);
    margin-top: calc((var(--size-slider-track) - var(--size-slider-thumb)) / 2);
    border: 0;
    border-radius: 50%;
    background: var(--team-color);
    -webkit-appearance: none;
}

.dial__input::-moz-range-thumb {
    width: var(--size-slider-thumb);
    height: var(--size-slider-thumb);
    border: 0;
    border-radius: 50%;
    background: var(--team-color);
}

.tactics--home { --team-color: var(--self); }
.tactics--away { --team-color: var(--opponent); }

/* -- Statistics: one row per number, each side's share as a bar -- */

.statistics { display: grid; gap: var(--space-medium); }

.statistic { display: grid; grid-template-columns: 1fr auto 1fr; column-gap: var(--space-medium); row-gap: var(--space-small); font-size: var(--text-small); font-variant-numeric: tabular-nums; }
.statistic__value--home { color: var(--self); }
.statistic__value--away { justify-self: end; color: var(--opponent); }
.statistic__name { color: var(--neutral-5); text-align: center; }

.statistic__bar {
    grid-column: 1 / -1;
    display: flex;
    gap: var(--space-small);
    height: var(--size-slider-track);
}

.statistic__share { border-radius: var(--radius-pill); transition: flex-grow var(--duration-fade); }
.statistic__share--home { background: var(--self); }
.statistic__share--away { background: var(--opponent); }

/* -- Phone: one scrolling column, the pitch first -- */

@media (max-width: 760px) {
    .sandbox {
        position: static;
        display: flex;
        flex-direction: column;
    }

    .column { overflow: visible; padding: var(--space-large); }
    .column--arena { order: -1; padding-top: var(--space-large); }
    .pitch-stage { flex: none; }
    .theme-button { margin-top: 0; }
}
