* {
    box-sizing: border-box;
}

body {
    background-color: #000;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

#app {
    width: 100%;
    max-width: 1280px;
    height: 95vh;
    background: #111;
    position: relative;
    border: 1px solid #333;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    margin: 0 auto;
}

.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: #111;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.screen.hidden,
.hidden {
    display: none !important;
}

.top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
    padding: 6px 10px;
}

.main-command-bar {
    min-height: 58px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent),
        #151519;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 9px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.main-navigation,
.main-nav-group {
    display: flex;
    align-items: center;
}

.main-navigation {
    flex: 1;
    min-width: 0;
    gap: 10px;
}

.main-nav-group {
    gap: 6px;
}

.main-nav-divider {
    flex: 0 0 1px;
    width: 1px;
    height: 30px;
    margin: 0 2px;
    background: linear-gradient(transparent, rgba(255, 255, 255, 0.2), transparent);
}

.main-nav-btn {
    position: relative;
    min-width: 104px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.025);
    color: #aeb0bd;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 650;
    cursor: pointer;
    transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.main-nav-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.06);
}

.main-nav-btn:focus-visible,
.main-settings-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.main-nav-icon {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    color: currentColor;
}

.location-nav-btn {
    color: #c9b88f;
}

.location-nav-btn:hover {
    color: #f1d895;
    border-color: rgba(218, 181, 95, 0.38);
    background: rgba(218, 181, 95, 0.07);
}

.section-nav-btn {
    color: #b6b8c6;
}

.section-nav-btn.active {
    color: #fff;
    border-color: rgba(112, 121, 255, 0.64);
    background: linear-gradient(180deg, rgba(100, 108, 255, 0.28), rgba(100, 108, 255, 0.12));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 5px 16px rgba(60, 66, 190, 0.22);
}

.section-nav-btn.active::after {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: -7px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.gold-counter {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--gold);
    background: rgba(255, 215, 0, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.gold-counter-icon {
    width: 19px;
    height: 19px;
}

.main-settings-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 50%;
    color: #b9b6c2;
    transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.main-settings-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
}

.tabs {
    display: flex;
    width: 100%;
    background: #1e1e24;
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 0 0 auto;
}

.view-content {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    min-height: 0;
    /* Ensure child can't push parent beyond flex container */
}

.view-content.hidden {
    display: none;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid #333;
}

@media (max-width: 900px) {
    .main-command-bar {
        flex-wrap: wrap;
        min-height: 0;
    }

    .main-navigation {
        order: 2;
        flex: 1 0 100%;
    }

    .main-nav-group {
        flex: 1;
    }

    .main-nav-btn {
        flex: 1 1 0;
        min-width: 0;
        padding-inline: 8px;
    }

    .top-bar-right {
        order: 1;
        margin-left: auto;
    }
}

@media (max-width: 700px) {
    .main-command-bar {
        gap: 8px;
        padding: 8px;
    }

    .main-navigation {
        gap: 6px;
        justify-content: center;
    }

    .main-nav-group {
        justify-content: space-evenly;
        gap: 4px;
    }

    .main-nav-divider {
        margin: 0;
    }

    .main-nav-btn {
        flex: 0 0 44px;
        width: 44px;
        min-width: 44px;
        min-height: 44px;
        padding: 0;
    }

    .main-nav-btn span {
        display: none;
    }

    .section-nav-btn.active::after {
        left: 9px;
        right: 9px;
    }
}
