/******************************************************************************
 * Which Is Bigger? — Dataset Controls — Version 0.2.26 Alpha
 ******************************************************************************/

#dataset-button {
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    min-width:132px;
    height:44px;
    padding:4px 12px;
    border:1px solid rgba(18,85,114,.42);
    border-radius:10px;
    background:rgba(247,240,218,.95);
    color:var(--map-ink);
    box-shadow:0 4px 8px rgba(64,48,28,.36);
    line-height:1;
    transform:none;
}

#dataset-button:hover {
    background:#fff9e8;
    transform:none;
}

#dataset-button:disabled {
    opacity:.55;
    cursor:not-allowed;
}

.dataset-button-caption {
    margin-bottom:3px;
    font-size:10px;
    font-weight:700;
    letter-spacing:.08em;
    text-transform:uppercase;
}

#dataset-button-label {
    max-width:15ch;
    overflow:hidden;
    font-size:15px;
    text-overflow:ellipsis;
    white-space:nowrap;
}

#dataset-overlay {
    position:fixed;
    inset:0;
    z-index:100;
    display:grid;
    place-items:center;
    padding:16px;
    background:rgba(0,0,0,.72);
}

#dataset-overlay[hidden] {
    display:none;
}

#dataset-dialog {
    width:min(343px,calc(100vw - 32px));
    height:min(635px,calc(100svh - 32px));
    max-height:calc(100svh - 32px);
    display:flex;
    flex-direction:column;
    overflow:hidden;
    border:1px solid rgba(18,85,114,.42);
    border-radius:16px;
    background:#f6eed8;
    color:var(--map-ink);
    box-shadow:0 20px 54px rgba(0,0,0,.58);
}

.dataset-dialog-header {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:15px 16px 10px;
}

#dataset-dialog-title {
    margin:0;
    font-size:1.35rem;
    line-height:1;
}

#dataset-dialog-close {
    width:36px;
    height:36px;
    padding:0;
    border-radius:50%;
    background:transparent;
    color:var(--map-ink);
    font-size:1.55rem;
    line-height:1;
    transform:none;
}

#dataset-dialog-close:hover {
    background:rgba(7,60,109,.1);
    transform:none;
}

.dataset-bulk-actions {
    display:flex;
    gap:8px;
    padding:0 16px 10px;
}

.dataset-bulk-actions button {
    flex:1;
    padding:8px 10px;
    border:1px solid rgba(18,85,114,.3);
    border-radius:8px;
    background:rgba(255,255,255,.42);
    color:var(--map-ink);
    font-size:.76rem;
    transform:none;
}

#dataset-options {
    flex:1 1 auto;
    min-height:0;
    overflow-y:auto;
    overscroll-behavior:contain;
    margin:0 12px;
    padding:3px 4px;
    border-block:1px solid rgba(18,85,114,.2);
}

.dataset-option {
    display:flex;
    align-items:center;
    gap:11px;
    min-height:48px;
    padding:8px 5px;
    cursor:pointer;
}

.dataset-option + .dataset-option {
    border-top:1px solid rgba(18,85,114,.12);
}

.dataset-option input {
    width:21px;
    height:21px;
    margin:0;
    accent-color:#0875d1;
}

.dataset-option-unavailable {
    color:rgba(38,50,56,.48);
    cursor:not-allowed;
}

.dataset-option-unavailable input {
    opacity:.55;
    cursor:not-allowed;
}

.dataset-option-copy {
    display:flex;
    flex-direction:column;
    gap:2px;
    line-height:1.1;
}

.dataset-option-copy strong {
    font-size:.95rem;
}

.dataset-option-copy small {
    color:#9a4c22;
    font-size:.68rem;
    font-weight:700;
}

.dataset-option-unavailable .dataset-option-copy small {
    color:inherit;
}

#dataset-selection-error {
    min-height:1.1em;
    margin:7px 16px 0;
    color:#b42318;
    font-size:.72rem;
    font-weight:700;
}

.dataset-dialog-actions {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:9px;
    padding:8px 16px 15px;
}

.dataset-dialog-actions button {
    min-height:42px;
    padding:9px 12px;
    border-radius:9px;
    font-size:.9rem;
    transform:none;
}

#dataset-cancel {
    border:1px solid rgba(18,85,114,.3);
    background:rgba(255,255,255,.5);
    color:var(--map-ink);
}

#dataset-apply:disabled {
    opacity:.45;
    cursor:not-allowed;
}

body.dataset-dialog-open {
    overflow:hidden!important;
}

/* The wrapper is layout-neutral on desktop so the established HUD geometry
   continues to treat Difficulty and Places as independent controls. */
#selection-controls {
    display:contents;
}

/* The desktop Places and Difficulty controls use equal 175px widths with a
   10px gap, matching the Start button's full 360px width. */
@media (min-width:901px) {
    #round-control #difficulty-control {
        width:175px!important;
        margin-left:185px!important;
    }

    #round-control #difficulty-button,
    #round-control #difficulty-menu {
        width:175px!important;
        max-width:175px!important;
    }

    #round-control #dataset-button {
        position:absolute!important;
        left:0!important;
        top:0!important;
        width:175px!important;
        height:54px!important;
    }
}

/* Pair Places with Difficulty on mobile. Menu is centered independently and
   Sound keeps its established 8px offset to the right of Menu. */
@media (max-width:900px) {
    html:not(.desktop-canvas-mode) #selection-controls {
        order:4!important;
        position:relative!important;
        top:-8px!important;
        width:min(88vw,340px)!important;
        display:flex!important;
        align-items:stretch!important;
        align-self:center!important;
        gap:10px!important;
        margin:0 auto 10px!important;
    }

    html:not(.desktop-canvas-mode) #selection-controls #difficulty-control,
    html:not(.desktop-canvas-mode) #selection-controls #dataset-button {
        position:relative!important;
        top:auto!important;
        left:auto!important;
        right:auto!important;
        width:auto!important;
        min-width:0!important;
        max-width:none!important;
        flex:1 1 0!important;
        margin:0!important;
        transform:none!important;
    }

    html:not(.desktop-canvas-mode) #selection-controls #difficulty-button,
    html:not(.desktop-canvas-mode) #selection-controls #dataset-button {
        width:100%!important;
        height:40px!important;
        min-height:40px!important;
    }

    html:not(.desktop-canvas-mode) #selection-controls #difficulty-menu {
        width:100%!important;
        max-width:100%!important;
    }

    html:not(.desktop-canvas-mode) #menu-control {
        width:max-content!important;
        max-width:100%!important;
        display:block!important;
        margin-left:auto!important;
        margin-right:auto!important;
    }

    html:not(.desktop-canvas-mode) #menu-control #menu-button {
        position:static!important;
        width:auto!important;
        height:30px!important;
        min-height:0!important;
    }

    html:not(.desktop-canvas-mode) #menu-control #sound-toggle-button {
        position:absolute!important;
        left:calc(100% + 8px)!important;
        right:auto!important;
        top:0!important;
        width:30px!important;
        height:30px!important;
        min-height:0!important;
        aspect-ratio:1 / 1!important;
    }

    .dataset-button-caption {
        font-size:8px;
    }

    #dataset-button-label {
        font-size:13px;
    }
}

@media (max-width:900px) and (max-height:760px) and (hover:none),
       (max-width:900px) and (max-height:760px) and (pointer:coarse) {
    html:not(.desktop-canvas-mode) #selection-controls #difficulty-button,
    html:not(.desktop-canvas-mode) #selection-controls #dataset-button {
        height:34px!important;
        min-height:34px!important;
    }
}

@media (max-width:900px) and (max-height:760px) {
    .dataset-dialog-header {
        padding-top:11px;
    }

    .dataset-option {
        min-height:43px;
        padding-top:6px;
        padding-bottom:6px;
    }

    .dataset-dialog-actions {
        padding-bottom:11px;
    }
}

/* desktop-canvas-mode may remain active below 901px, so repeat the fixed
   design-canvas geometry without relying on a viewport-width media query. */
html.desktop-canvas-mode #round-control #difficulty-control {
    width:175px!important;
    margin-left:185px!important;
}

html.desktop-canvas-mode #round-control #difficulty-button,
html.desktop-canvas-mode #round-control #difficulty-menu {
    width:175px!important;
    max-width:175px!important;
}

html.desktop-canvas-mode #round-control #dataset-button {
    position:absolute!important;
    left:0!important;
    top:0!important;
    width:175px!important;
    height:54px!important;
}
