:root {
    --brand: #f6c343;
    --brand-soft: rgba(246, 195, 67, 0.904);
    --text: #f8f8f8;
    --muted: #cfcfcf;
    --danger: #ff7a7a;
    --success: #61e294;
    --panel-bg: rgba(10, 12, 24, 0.13);
    --panel-border: rgba(255, 255, 255, 0.08);
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.2);
    --blur: 2px;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: #050608;
    font-family: var(--font);
    display: flex;
    flex-direction: column;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url('../img/bgacp.webp');
    background-size: cover;
    background-position: center;
    filter: brightness(0.45);
    z-index: -2;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;

    z-index: -1;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    color: #ffe29b;
}

header {
    width: 100%;
    padding: 1.2rem 2.7rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    border-bottom: rgba(51, 51, 51, 0.438) 1px solid;
    top: 0;
    z-index: 10;
    background-color: rgba(14, 14, 14, 0.73);

}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.brand img {
    width: 42px;
    height: 42px;
    border-radius: 12px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-title {
    font-size: 1.15rem;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 0.8rem;
}

.nav-links a,
.nav-links .nav-logout-btn {
    border: 1px solid var(--panel-border);
    padding: 0.55rem 1.5rem;
    border-radius: 999px;
    font-size: 0.95rem;
    transition: background 0.2s ease, color 0.2s ease;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
}

.nav-links a:hover,
.nav-links .nav-logout-btn:hover {
    background: var(--brand);
    color: #050505;
}

.nav-logout-form {
    margin: 0;
    display: inline-flex;
}

main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem 4rem;
    position: relative;
}

.dashboard-sidebar {
    position: fixed;
    left: 3rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 5;
}

.sidebar-btn {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    color: var(--muted);
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(var(--blur));
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.sidebar-btn:hover {
    color: var(--text);
    border-color: var(--brand);
}

.sidebar-btn.active {
    background: var(--brand-soft);
    color: var(--text);
    border-color: var(--brand);
}

.dashboard-section {
    display: none;
}

.dashboard-section.active {
    display: block;
}

@media (max-width: 1000px) {
    .dashboard-sidebar {
        position: static;
        transform: none;
        flex-direction: row;
        justify-content: center;
        margin-bottom: 1.5rem;
        left: auto;
        top: auto;
    }
}

.auth-panel {
    width: min(450px, 90vw);
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 28px;
    padding: 2.5rem 2.55rem;
    backdrop-filter: blur(var(--blur));
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.45);
}

.auth-panel--dashboard {
    width: min(760px, 94vw);
}

.panel-header {
    text-align: center;
    margin-top: -10px;
    margin-bottom: 1.5rem;
}

.panel-header img {
    width: 64px;
    height: 64px;
    margin-bottom: 0.5rem;
}

.panel-header h1 {
    margin: 0;
    font-size: 1.25rem;
}

.panel-subtitle {
    color: var(--muted);
    font-size: 0.95rem;
}

.switcher {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    padding: 0.25rem;
    margin-bottom: 1.5rem;
    gap: 0.25rem;
}

.switcher button {
    background: transparent;
    border: none;
    color: var(--muted);
    font-weight: 600;
    padding: 0.65rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.switcher button.active {
    background: var(--brand-soft);
    color: var(--text);
}

form {
    display: none;
    flex-direction: column;
    gap: 1rem;
}

form.active {
    display: flex;
}

label {
    font-size: 0.9rem;
    color: var(--muted);
}

.input-field {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.input-field input {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    padding: 0.7rem 1rem;
    font-size: 1rem;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.input-field input:focus {
    outline: none;
    border-color: var(--brand);
    transform: translateY(-1px);
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
}

.checkbox input {
    accent-color: var(--brand);
}

.primary-btn {
    width: 100%;
    padding: 0.65rem 1rem;
    border-radius: 14px;
    border: none;
    background: linear-gradient(120deg, #f6c343, #f0903c);
    color: #050505;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 15px 40px rgba(246, 195, 67, 0.35);
}

.feedback {
    border-radius: 14px;
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    opacity: 1;
    max-height: 200px;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
}

.feedback-hidden {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.feedback.success {
    background: rgba(97, 226, 148, 0.15);
    border: 1px solid rgba(97, 226, 148, 0.4);
}

.feedback.error {
    background: rgba(255, 122, 122, 0.12);
    border: 1px solid rgba(255, 122, 122, 0.4);
}

.character-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.character-card {
    display: grid;
    grid-template-columns: minmax(90px, 1.4fr) minmax(70px, 1fr) auto auto auto;
    align-items: center;
    gap: 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 14px;
    padding: 0.7rem 1rem;
}

.character-name {
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.character-class {
    font-size: 0.85rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.character-level {
    font-size: 0.85rem;
    color: var(--brand);
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

.character-status {
    font-size: 0.72rem;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    text-align: center;
    justify-self: start;
}

.character-status.online {
    background: rgba(97, 226, 148, 0.15);
    color: var(--success);
    border: 1px solid rgba(97, 226, 148, 0.4);
}

.character-status.offline {
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    border: 1px solid var(--input-border);
}

.send-to-town-form {
    margin: 0;
    display: block;
    justify-self: end;
}

.send-to-town-btn {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(246, 195, 67, 0.55);
    background: rgba(246, 195, 67, 0.12);
    color: var(--brand);
    cursor: pointer;
    white-space: nowrap;
}

.send-to-town-btn:disabled {
    color: var(--muted);
    cursor: not-allowed;
}

.dashboard-divider {
    border-top: 1px solid var(--panel-border);
    margin: 1.5rem 0 1.25rem;
}

.section-heading {
    font-size: 1rem;
    margin: 0 0 1rem;
    color: var(--text);
}

.terms-link {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
}

.terms-link button {
    background: none;
    border: none;
    color: var(--brand);
    font-weight: 600;
    cursor: pointer;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 50;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-dialog {
    max-width: 640px;
    width: 100%;
    background: linear-gradient(135deg, rgba(34, 34, 34, 0.95), rgba(10, 10, 10, 0.9));
    border-radius: 24px;
    border: 1px solid var(--panel-border);
    padding: 2rem;
    color: #f2f2f2;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 30px 120px rgba(0, 0, 0, 0.6);
    position: relative;
}

.modal-dialog::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    pointer-events: none;
}

.modal-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

.modal-header button {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.modal-header button:hover {
    color: var(--text);
    transform: scale(1.05);
}

.modal-body {
    max-height: calc(80vh - 96px);
    overflow-y: auto;
    padding-right: 0.75rem;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.25);
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

.modal section {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal section:last-of-type {
    border-bottom: none;
}

.modal h4 {
    margin: 0 0 0.45rem;
    font-size: 1rem;
    color: var(--brand);
    letter-spacing: 0.02em;
}

.modal ul {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.modal ul li + li {
    margin-top: 0.4rem;
}


@media (max-width: 720px) {
    header {
        padding: 1rem 1.5rem;
    }

    .auth-panel {
        padding: 2rem 1.75rem;
    }

    .switcher {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        font-size: 0.85rem;
    }
}

@media (max-width: 600px) {
    .brand {
        gap: 0.5rem;
    }

    .brand-title {
        font-size: 0.95rem;
    }

    .brand-subtitle {
        font-size: 0.7rem;
    }

    .nav-links a {
        font-size: 0.8rem;
    }
    
    .nav-return {
        padding: 0.45rem 1.1rem;
        font-size: 0.8rem !important;
    }
}

@media screen and (min-width: 340px) and (max-width: 400px) {
    .brand {
        gap: 0.5rem;
    }

    .brand-title {
        font-size: 0.75rem;
    }

    .brand-subtitle {
        font-size: 0.5rem;
    }

    .nav-links a {
        font-size: 0.7rem;
    }
    
    .nav-return {
        padding: 0.45rem 1.1rem;
        font-size: 0.6rem !important;
    }
}


/* =========================================================
   L2G-OLD ACP — Mobile dashboard layout fix
   Keep desktop unchanged. On phones, stack the dashboard
   navigation above the content and keep character cards inside
   the viewport.
   ========================================================= */
@media (max-width: 600px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    main {
        width: 100%;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding: 1rem 0.75rem 3rem;
    }

    .dashboard-sidebar {
        position: static;
        transform: none;
        width: 100%;
        max-width: 760px;
        margin: 0 auto 1rem;
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0.55rem;
    }

    .sidebar-btn {
        width: 100%;
        min-height: 46px;
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
        line-height: 1.2;
        white-space: normal;
    }

    .auth-panel,
    .auth-panel--dashboard {
        width: 100%;
        max-width: 760px;
        min-width: 0;
        margin: 0 auto;
        padding: 1.75rem 1rem 2rem;
        border-radius: 24px;
    }

    .panel-header {
        margin-bottom: 1.2rem;
    }

    .panel-header img {
        width: 58px;
        height: 58px;
    }

    .panel-header h1 {
        font-size: 1.2rem;
    }

    .panel-subtitle {
        font-size: 0.88rem;
        line-height: 1.45;
    }

    .character-list {
        width: 100%;
        min-width: 0;
    }

    .character-card {
        width: 100%;
        min-width: 0;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto auto;
        gap: 0.45rem 0.65rem;
        padding: 0.75rem 0.8rem;
        overflow: hidden;
    }

    .character-name {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    .character-level {
        grid-column: 2;
        grid-row: 1;
        white-space: nowrap;
    }

    .character-class {
        grid-column: 1 / -1;
        grid-row: 2;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .character-status {
        grid-column: 1;
        grid-row: 3;
        justify-self: start;
        white-space: nowrap;
    }

    .send-to-town-form {
        grid-column: 2;
        grid-row: 3;
        justify-self: end;
        display: block;
    }

    .send-to-town-btn {
        max-width: 100%;
        white-space: nowrap;
        padding: 0.45rem 0.7rem;
        font-size: 0.75rem;
    }

    .section-heading {
        font-size: 1.1rem;
    }

    .input-field input,
    .input-field select,
    .input-field textarea,
    .primary-btn {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
}

@media (min-width: 601px) {
    /* Explicitly preserve the existing desktop dashboard behaviour. */
    .dashboard-sidebar {
        position: fixed;
        left: 3rem;
        top: 50%;
        transform: translateY(-50%);
        flex-direction: column;
    }
}
