.dashboard {
    --streetle-blue: #3498db;
    --streetle-blue-dark: #2980b9;
    --panel: rgba(255, 255, 255, 0.82);
    --border: rgba(73, 86, 98, 0.26);
    --ink: #2f3b45;
    --muted: #687683;
    min-height: 100vh;
    margin: -8px;
    padding: 1.25rem;
    color: var(--ink);
    background:
      linear-gradient(rgba(255, 255, 255, 0.58), rgba(245, 248, 250, 0.64)),
      url("/madrid.png") center / cover fixed;
    box-sizing: border-box;
}

.dashboard *,
.dashboard *::before,
.dashboard *::after {
    box-sizing: border-box;
}

.dashboard [hidden] {
    display: none !important;
}

.dashboard-shell {
    width: min(62rem, 100%);
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    align-items: stretch;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.dashboard .dashboard-header .back {
    display: grid;
    min-width: 3.4rem;
    padding: 0;
    place-items: center;
    border: 1px solid #a9dcf8;
    border-radius: 8px;
    font-size: 1.3rem;
    box-shadow: none;
}

.dashboard-heading {
    position: relative;
    flex: 1;
    min-height: 5.7rem;
    padding: 1rem 1.3rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    backdrop-filter: blur(7px);
}

.dashboard-account-link {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    color: #075f9a;
    font-size: 0.9rem;
    font-weight: 700;
}

.dashboard-heading h1 {
    margin: 0.1rem 0 0;
    color: var(--ink);
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    line-height: 1.05;
}

.dashboard-panel {
    margin-bottom: 1rem;
    padding: 1.2rem 1.4rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
    backdrop-filter: blur(7px);
    box-shadow: 0 6px 22px rgba(31, 48, 59, 0.12);
}

.dashboard-panel h2 {
    margin: 0 0 0.9rem;
    color: var(--ink);
    font-size: 1.3rem;
}

.new-game-form {
    display: block;
}

.new-game-fields {
    display: grid;
    gap: 0.5rem;
}

.new-game-row {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
}

.new-game-label {
    color: #52616c;
    font-size: 0.95rem;
    font-weight: 650;
    text-align: right;
}

.new-game-control {
    min-width: 0;
}

.destination-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.return-to-start-action {
    display: flex;
}

.stepped-slider {
    display: grid;
    grid-template-columns: 4rem minmax(10rem, 1fr) 4rem;
    align-items: center;
    gap: 0.55rem;
    width: min(100%, 30rem);
    padding: 0.15rem 0;
}

.stepped-slider-end {
    color: #52616c;
    font-size: 0.78rem;
    font-weight: 700;
}

.stepped-slider-end:first-child {
    text-align: right;
}

.stepped-slider-track {
    position: relative;
    height: 1.6rem;
}

.stepped-slider-track input[type="range"] {
    position: absolute;
    z-index: 2;
    top: 0.1rem;
    left: 0;
    width: 100%;
    height: 1.4rem;
    margin: 0;
    padding: 0;
    appearance: none;
    border: 0;
    outline: 0;
    background: transparent;
    cursor: pointer;
}

.stepped-slider-track input[type="range"]::-webkit-slider-runnable-track {
    height: 0.3rem;
    border-radius: 999px;
    background: var(--streetle-blue);
}

.stepped-slider-track input[type="range"]::-webkit-slider-thumb {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: -0.475rem;
    appearance: none;
    border: 0;
    border-radius: 50%;
    background: var(--streetle-blue-dark);
    box-shadow: none;
}

.stepped-slider-track input[type="range"]::-moz-range-track {
    height: 0.3rem;
    border: 0;
    border-radius: 999px;
    background: var(--streetle-blue);
}

.stepped-slider-track input[type="range"]::-moz-range-thumb {
    width: 1.25rem;
    height: 1.25rem;
    border: 0;
    border-radius: 50%;
    background: var(--streetle-blue-dark);
    box-shadow: none;
}

.stepped-slider-track input[type="range"]:focus-visible::-webkit-slider-thumb {
    background: #126b9f;
    box-shadow: none;
}

.stepped-slider-track input[type="range"]:focus-visible::-moz-range-thumb {
    background: #126b9f;
    box-shadow: none;
}

.stepped-slider-ticks {
    position: absolute;
    z-index: 1;
    top: 0.4rem;
    right: 0.675rem;
    left: 0.675rem;
    height: 0.8rem;
    pointer-events: none;
}

.stepped-slider-tick {
    position: absolute;
    top: 50%;
    left: var(--stepped-slider-position);
    width: 2px;
    height: 0.8rem;
    transform: translate(-50%, -50%);
    border-radius: 1px;
    background: var(--streetle-blue-dark);
}

.new-game-control > input[type="text"],
.new-game-control > select {
    width: min(100%, 30rem);
    height: 2.35rem;
    padding: 0.3rem 0.55rem;
    border: 1px solid #aebbc4;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.94);
    color: #33434e;
    font-size: 1rem;
}

.new-game-control > input[type="text"]:focus,
.new-game-control > select:focus,
.library-search input:focus {
    border-color: var(--streetle-blue);
    outline: 3px solid rgba(52, 152, 219, 0.2);
}

.destination-control {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.destination-control > input[type="text"] {
    flex: 0 1 30rem;
    width: min(100%, 30rem);
}

.dashboard .btn {
    appearance: none;
    border: 1px solid #a9dcf8;
    box-shadow: none;
    cursor: pointer;
}

.dashboard .btn:focus-visible,
.remove-destination:focus-visible,
.return-to-start-toggle:focus-visible {
    outline: 3px solid rgba(52, 152, 219, 0.28);
    outline-offset: 2px;
}

.dashboard .primary-action,
.dashboard .secondary-action {
    min-height: 2.35rem;
    padding: 0.42rem 0.9rem;
    font-size: 1rem;
}

.new-game-submit {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: min(100%, 30rem);
    padding-top: 0.2rem;
}

.new-game-panel > turbo-frame#streets {
    display: block;
    width: min(30rem, calc(100% - 8.25rem));
    max-height: 15rem;
    overflow-y: auto;
    margin: 0.55rem 0 0 8.25rem;
    border: 1px solid #9fd5f3;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 5px 16px rgba(34, 78, 105, 0.2);
}

.new-game-panel > turbo-frame#streets .streets {
    width: 100% !important;
    border: 0 !important;
    border-collapse: collapse;
}

.new-game-panel > turbo-frame#streets td {
    padding: 0.45rem 0.6rem;
    color: #33434e;
}

.new-game-panel > turbo-frame#streets tr + tr td {
    border-top: 1px solid #dceaf2;
}

.new-game-panel > turbo-frame#streets tr:hover td {
    background: #eaf7fe;
}

.remove-destination {
    min-height: 2.2rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid #9fd5f3;
    border-radius: 5px;
    color: #126b9f;
    background: rgba(255, 255, 255, 0.86);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.remove-destination:hover {
    border-color: #70bfe9;
    background: #eaf7fe;
}

.range-control > input[type="text"] {
    width: 7rem;
}

.panel-heading-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 0.9rem;
}

.panel-heading-row h2 {
    margin-bottom: 0;
}

.library-search {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.library-search label {
    color: var(--muted);
    font-size: 0.83rem;
    font-weight: 700;
}

.library-search input {
    width: min(18rem, 34vw);
    padding: 0.47rem 0.65rem;
    border: 1px solid #9facb5;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.92);
    font-size: 0.95rem;
}

.library-empty {
    padding: 1rem;
    border: 1px dashed #91a0aa;
    text-align: center;
}

.status-section {
    overflow: hidden;
    margin-top: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.52);
}

.status-section > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.78rem 0.9rem;
    color: #33444f;
    background: rgba(255, 255, 255, 0.62);
    font-weight: 750;
    cursor: pointer;
    list-style-position: inside;
}

.section-count {
    display: inline-grid;
    min-width: 1.75rem;
    min-height: 1.75rem;
    padding: 0.2rem;
    place-items: center;
    border-radius: 999px;
    color: #3d596b;
    background: rgba(52, 152, 219, 0.14);
    font-size: 0.78rem;
}

.city-group {
    padding: 0.65rem 0.9rem 0.8rem;
}

.city-group + .city-group {
    border-top: 1px solid var(--border);
}

.city-group h3 {
    margin: 0 0 0.45rem;
    color: #4b5c68;
    font-size: 0.84rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.game-library-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.game-library-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3.6rem;
    padding: 0.55rem 0.7rem;
    border-top: 1px solid rgba(78, 94, 105, 0.14);
    background: rgba(255, 255, 255, 0.38);
}

.game-library-item:first-child {
    border-top: 0;
}

.game-library-item:hover {
    background: rgba(255, 255, 255, 0.74);
}

.game-library-main {
    min-width: 0;
}

.game-library-title {
    display: block;
    overflow: hidden;
    color: #075f9a;
    font-size: 1rem;
    font-weight: 720;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-library-title:visited {
    color: #075f9a;
}

.game-library-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.8rem;
    margin-top: 0.25rem;
    color: var(--muted);
    font-size: 0.77rem;
}

.game-library-summary {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.55rem;
}

.game-status {
    padding: 0.24rem 0.45rem;
    border-radius: 999px;
    color: #53616b;
    background: rgba(86, 102, 113, 0.12);
    font-size: 0.7rem;
    font-weight: 750;
    white-space: nowrap;
}

.game-status.is-active {
    color: #075f9a;
    background: rgba(52, 152, 219, 0.14);
}

.dashboard .game-stats {
    margin-left: 0;
    border-color: rgba(73, 86, 98, 0.28);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

.dashboard .game-stats > span {
    padding: 0.3rem 0.42rem;
    border-color: rgba(73, 86, 98, 0.2);
    font-size: 0.74rem;
}

@media (max-width: 760px) {
    .new-game-panel > turbo-frame#streets {
        width: calc(100% - 8.25rem);
    }

    .panel-heading-row,
    .game-library-item {
        align-items: stretch;
        flex-direction: column;
    }

    .library-search {
        align-items: stretch;
        flex-direction: column;
    }

    .library-search input {
        width: 100%;
    }

    .game-library-summary {
        justify-content: space-between;
    }
}

@media (max-width: 540px) {
    .dashboard {
        padding: 0.65rem;
    }

    .dashboard-heading,
    .dashboard-panel {
        padding-right: 0.85rem;
        padding-left: 0.85rem;
    }

    .new-game-row {
        grid-template-columns: 1fr;
        gap: 0.22rem;
    }

    .new-game-label {
        text-align: left;
    }

    .new-game-submit {
        width: 100%;
    }

    .new-game-panel > turbo-frame#streets {
        width: 100%;
        margin-left: 0;
    }

    .destination-control {
        align-items: stretch;
        flex-direction: column;
    }

    .destination-control > input[type="text"] {
        flex-basis: auto;
    }

    .remove-destination {
        align-self: flex-start;
    }

    .game-stats {
        overflow-x: auto;
        max-width: 100%;
    }
}
