/* Ball flight simulation + calibration overlay */
.sim-layout {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 16px;
    margin-top: 20px;
}

/* Beside the weather column: tuck the image up under the team name. */
@media (min-width: 768px) {
    .sim-layout {
        margin-top: 3px;
    }
}

.sim-map {
    flex: 0 1 400px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.sim-frame {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    overflow: hidden;
}

.sim-stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 400px;
    height: 400px;
    text-align: center;
    transform-origin: top left;
}

.sim-panel {
    width: 400px;
    max-width: 100%;
    flex: 0 0 400px;
    margin: 0;
    text-align: left;
    color: #dddddd;
    font-size: 13px;
    line-height: 1.4;
}

.sim-panel[hidden] { display: none; }

.sim-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--app-color);
    margin: 0 0 2px;
    padding: 2px 0;
    cursor: pointer;
    list-style: none;
    outline: none;
    user-select: none;
}

.sim-title:hover { color: var(--app-color); filter: brightness(1.12); }
.sim-title::-webkit-details-marker { display: none; }
.sim-title::marker { content: ""; }

.sim-title-text { flex: 0 0 auto; }

.sim-note {
    flex: 1 1 auto;
    text-align: right;
    font-size: 10px;
    font-weight: 400;
    line-height: 1.25;
    color: #8a8f98;
    padding-right: 2px;
}

.sim-title::before {
    content: "\25BE";
    font-size: 24px;
    line-height: .75;
    color: var(--app-color);
    flex: 0 0 auto;
}

.sim-panel[open] .sim-title::before { content: "\25B4"; }

.sim-title:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }

.sim-wx {
    color: #9a9a9a;
    font-size: 12px;
    margin-bottom: 8px;
    min-height: 16px;
}

.sim-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 5px 0;
}

.sim-row > span {
    width: 92px;
    flex: 0 0 92px;
    color: #bdbdbd;
}

.sim-row input[type=range] {
    flex: 1 1 auto;
    min-width: 0;
    accent-color: var(--app-color);
}

.sim-row output {
    width: 54px;
    flex: 0 0 54px;
    text-align: right;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
}

.sim-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 0 8px;
}

.sim-btn {
    background: var(--app-color);
    color: #141414;
    border: 0;
    border-radius: 4px;
    padding: 7px 16px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.sim-btn:hover { background: var(--app-color); filter: brightness(1.12); }
.sim-btn:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
.sim-btn:disabled { opacity: .45; cursor: default; }

.sim-btn-secondary {
    background: transparent;
    color: #dddddd;
    border: 1px solid rgba(255, 255, 255, .35);
    font-weight: 600;
}

.sim-btn-secondary:hover {
    background: rgba(255, 255, 255, .1);
    color: #ffffff;
}

.sim-wind {
    color: #9a9a9a;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.sim-wind input { accent-color: var(--app-color); }

.sim-out {
    color: #ffffff;
    font-size: 12px;
    min-height: 34px;
    font-variant-numeric: tabular-nums;
}

.sim-out b { color: var(--app-color); font-weight: 600; }

.sim-help {
    margin-top: 4px;
    color: #b5b5b5;
    font-size: 12px;
}

.sim-help summary {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #cfcfcf;
    list-style: none;
    padding: 3px 0;
    outline: none;
}

.sim-help summary::-webkit-details-marker { display: none; }

.sim-help summary::before {
    content: "\25B8";
    flex: 0 0 auto;
    width: 12px;
    font-size: 24px;
    line-height: .75;
    color: var(--app-color);
}

.sim-help[open] summary::before { content: "\25BE"; }

.sim-help p {
    margin: 4px 0 0 12px;
    line-height: 1.5;
}

.cal-chip {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 8;
    background: rgba(0, 0, 0, .58);
    border: 1px solid rgba(255, 255, 255, .38);
    border-radius: 14px;
    color: #ffffff;
    font-size: 11px;
    line-height: 1;
    padding: 6px 10px;
    cursor: pointer;
}

.cal-chip:hover { background: rgba(0, 0, 0, .78); }
.cal-chip:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
.cal-chip.on { background: var(--app-color); border-color: var(--app-color); color: #141414; font-weight: 700; }

.cal-tools {
    position: absolute;
    top: 40px;
    right: 8px;
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.cal-tools[hidden] { display: none; }

.cal-tools button {
    background: rgba(0, 0, 0, .62);
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 4px;
    color: #ffffff;
    font-size: 11px;
    padding: 5px 8px;
    cursor: pointer;
}

.cal-tools button:hover { background: rgba(0, 0, 0, .82); }
.cal-tools button:focus-visible { outline: 2px solid #ffffff; outline-offset: 1px; }

.cal-status {
    color: var(--app-color);
    font-size: 11px;
    background: rgba(0, 0, 0, .6);
    padding: 3px 6px;
    border-radius: 3px;
}

.cal-status:empty { display: none; }

#simcanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 400px;
    height: 400px;
    z-index: 4;
    pointer-events: auto;
    touch-action: none;
}

/* Narrow-phone layout */
@media (max-width: 479px) {
    .team-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    #btngrouptable .btn-group {
        flex: 1 1 100%;
    }

    #btngrouptable .btn-group .btn {
        flex: 1 1 0;
        padding-left: 8px;
        padding-right: 8px;
    }

    #btngrouptable #refresh {
        flex: 1 1 100%;
        margin-left: 0;
    }
}
