.play {
    --pitch-turf: #f8dcb4;
    --pitch-endzone: #ecc597;
    --pitch-grid: rgba(0, 0, 0, 0.16);
    --play-home: var(--ink);
    --play-away: var(--accent);
    --play-ball: #5a3418;

    box-sizing: border-box;
    width: 100%;
    max-width: 1200px;
    margin: 20px 0 10px 0;
}

.play-board {
    position: relative;
    width: 100%;
}

.play-pitch {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-select: none;
}

.play-pitch.vertical {
    max-width: 480px;
    margin: 0 auto;
}

.is-editing .play-pitch {
    touch-action: none;
    cursor: crosshair;
}

/* Pitch */

.pitch-turf { fill: var(--pitch-turf); }
.pitch-endzone { fill: var(--pitch-endzone); }
.pitch-hatch { stroke: rgba(0, 0, 0, 0.12); stroke-width: 2; }
.pitch-endzone-hatch { fill: url(#play-hatch); }
.pitch-grid { stroke: var(--pitch-grid); stroke-width: 1; }
.pitch-wide { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 6 5; opacity: 0.55; }
.pitch-line { stroke: var(--ink); stroke-width: 2.5; }
.pitch-scrimmage { stroke: var(--ink); stroke-width: 3.5; }
.pitch-border { fill: none; stroke: var(--ink); stroke-width: 4; }

/* Players and the ball */

.piece-mark {
    fill: none;
    stroke-width: 4.5;
    stroke-linecap: round;
}

.piece-x .piece-mark { stroke: var(--play-home); }
.piece-o .piece-mark { stroke: var(--play-away); }
.piece-down .piece-mark { opacity: 0.4; }

.piece-number, .piece-state {
    font-family: var(--label-font);
    font-size: 12px;
    font-weight: bold;
    paint-order: stroke;
    stroke: var(--pitch-turf);
    stroke-width: 3px;
    stroke-linejoin: round;
}

.piece-number { text-anchor: end; }
.piece-x .piece-number, .piece-x .piece-state, .piece-x .piece-position { fill: var(--play-home); }
.piece-o .piece-number, .piece-o .piece-state, .piece-o .piece-position { fill: var(--play-away); }

.piece-position {
    font-family: var(--label-font);
    font-size: 11px;
    font-weight: bold;
    text-anchor: middle;
    paint-order: stroke;
    stroke: var(--pitch-turf);
    stroke-width: 3px;
    stroke-linejoin: round;
}

.play-tip {
    position: absolute;
    z-index: 2;
    display: flex;
    flex-direction: column;
    max-width: 260px;
    padding: 5px 9px;
    border: 1px solid black;
    background-color: var(--paper);
    color: black;
    font-size: 1.05em;
    line-height: 1.3;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.play-positions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 1.1em;
}

.play-positions-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.play-positions-toggle input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
}

.play-positions-key {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 18px;
}

.play-positions-key .play-positions-icon {
    flex: none;
    width: 2.4em;
    height: 2.1em;
}

.play-positions-icon .piece-position {
    font-size: 15px;
    transform: translateY(-3px);
}

.ball-body { fill: var(--play-ball); stroke: var(--ink); stroke-width: 1.5; }
.ball-laces { stroke: var(--pitch-turf); stroke-width: 1.2; fill: none; }

/* Arrows */

.arrow-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.arrow-pass .arrow-line { stroke-dasharray: 8 6; stroke-linecap: butt; }
.arrow-bar { stroke-width: 4; stroke-linecap: round; }
.arrow-x .arrow-line, .arrow-x .arrow-bar { stroke: var(--play-home); }
.arrow-o .arrow-line, .arrow-o .arrow-bar { stroke: var(--play-away); }
.arrow-x .arrow-head { fill: var(--play-home); }
.arrow-o .arrow-head { fill: var(--play-away); }
.arrow-draft { opacity: 0.55; }
.arrow-bounce .arrow-line { stroke: var(--play-ball); stroke-width: 2; stroke-dasharray: 2 4; }
.arrow-bounce .arrow-head { fill: var(--play-ball); }

/* Editor highlights */

.square-hover { fill: rgba(0, 0, 0, 0.07); stroke: rgba(0, 0, 0, 0.35); stroke-width: 1.5; }
.square-start { fill: rgba(137, 54, 24, 0.12); }
.square-selected { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 5 4; }

/* Playback */

.play-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.play-controls[hidden], .play-editor[hidden], .play-caption[hidden], .play [hidden] {
    display: none;
}

.play-button {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid black;
    background-color: var(--paper-dark);
    color: black;
    font-family: inherit;
    font-size: 1.15em;
    cursor: pointer;
}

.play-button:hover:not(:disabled) {
    background-color: #c9a577;
}

.play-button:disabled {
    opacity: 0.45;
    cursor: default;
}

.play-toggle {
    min-width: 96px;
    font-weight: bold;
}

.play-step {
    min-width: 100px;
    font-size: 1.2em;
    font-style: italic;
}

/* Room for two lines whether or not there's a caption, so what's below stays put. */
.play-caption {
    max-width: 900px;
    min-height: 2.6em;
    margin: 12px auto 0 auto;
    font-size: 1.6em;
    line-height: 1.3;
    text-align: center;
}

.play-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 18px;
    margin-top: 12px;
    font-size: 1.1em;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.legend-icon {
    width: 2.2em;
    height: 1.8em;
}

/* Editor */

.play-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 12px 0;
}

.play-fields, .play-context, .play-steps, .play-share {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 14px;
}

.play-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 1.1em;
}

.play-field-wide {
    flex: 1 1 320px;
}

.play-editor > .play-field-wide {
    flex: 0 0 auto;
}

.play-field input, .play-field select, .play-field textarea {
    box-sizing: border-box;
    min-height: 38px;
    padding: 4px 8px;
    border: 1px solid black;
    background-color: var(--paper-dark);
    color: black;
    font-family: inherit;
    font-size: 1.1em;
}

.play-field textarea {
    resize: vertical;
}

.play-field input[type=number] {
    width: 90px;
}

.play-field select {
    max-width: 340px;
}

.play-tools {
    flex-wrap: wrap;
    align-self: flex-start;
}

.play-hint {
    flex: 1 1 280px;
    align-self: center;
    font-size: 1.15em;
    font-style: italic;
}

.play-selected {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    font-size: 1.1em;
}

.play-history {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.play-step-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.play-steps {
    align-items: center;
}

.play-step-button {
    min-width: 38px;
    padding: 0 8px;
}

.play-step-button[aria-current] {
    background-color: black;
    color: var(--paper);
}

.play-copy-row {
    display: flex;
    gap: 6px;
}

.play-copy-row input {
    flex: 1 1 auto;
    min-width: 0;
}

.play-editor .fine-print {
    margin: 0;
    font-size: 1.1em;
}

/* Blood Bowl III replays */

.play-replay-loader {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 4px 14px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.18);
}

.play-replay-loader .fine-print {
    flex: 1 1 320px;
    margin: 0;
    font-size: 1.05em;
}

.play-replay-loader input[type=file] {
    max-width: 100%;
    font-family: inherit;
    font-size: 1em;
}

.play-path {
    font-family: var(--label-font);
    font-size: 0.9em;
    font-style: normal;
    word-break: break-all;
}

.play-replay-message {
    flex: 1 1 100%;
    margin: 0;
    font-size: 1.15em;
    font-style: italic;
}

.play-replay-message:empty {
    display: none;
}

.play-replay-status {
    margin: 0 0 10px 0;
    text-align: center;
}

.play-scoreline {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 4px 16px;
    font-family: var(--label-font);
    font-size: 1.2em;
    font-weight: bold;
}

.play-score-team {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow-wrap: break-word; /* Only splits a word too long for the column. */
}

.play-score-home {
    justify-content: flex-end;
    text-align: right;
}

.play-score-away {
    justify-content: flex-start;
    text-align: left;
}

.play-score-active span {
    text-decoration: underline 2px;
    text-underline-offset: 4px;
}

.play-score-points {
    font-size: 1.6em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.play-replay-status .legend-icon {
    flex: none;
    width: 1.7em;
    height: 1.4em;
}

.play-score-turn {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0 6px;
    margin: 2px 0 0 0;
    font-size: 1.15em;
    font-style: italic;
}

.play-score-mover {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

@media (max-width: 640px) {
    .play-scoreline {
        gap: 4px 10px;
        font-size: 1em;
    }

    .play-score-separator {
        display: none;
    }

    .play-score-mover {
        flex-basis: 100%;
        justify-content: center;
    }
}

.play-replay-seek {
    width: 100%;
    accent-color: var(--accent);
}

@media only screen and (max-width: 640px) {
    .play-caption {
        font-size: 1.3em;
    }

    .play-history {
        margin-left: 0;
    }

    .play-tools span {
        padding: 0 9px;
        font-size: 1em;
    }
}

.play-dice {
    width: 100%;
}

.play-dice-table {
    margin: 8px auto 0 auto;
    font-size: 1.1em;
}

.play-dice-table caption {
    padding: 4px 0;
    font-family: var(--label-font);
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
}

.play-dice-table td:first-child {
    white-space: nowrap;
}

.play-dice-table .play-dice-team {
    border-left: 2px solid var(--ink);
}
