:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #161616;
    --bg-card-hover: #1c1c1c;
    --bg-modal: #1a1a1a;
    --border-color: #2a2a2a;
    --border-hover: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent-primary: #FA9C1D;
    --accent-secondary: #ea580c;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #ffffff21;
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: content-box;
    transition: all 0.2s ease-in-out;
}

::-webkit-scrollbar-thumb:hover {
    background: #ffffff30;
    background-clip: content-box;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.header-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

header h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    text-transform: uppercase;
    font-style: italic;
}

.current-user {
    color: var(--text-secondary);
    font-size: 14px;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    width: 42px;
}

.btn-logout:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    height: 42px;
}

.btn-add:hover {
    opacity: 0.95;
}

.btn-add:active {
    opacity: 0.9;
}

.accounts-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.account-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    position: relative;
}

.account-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.account-card.dragging {
    opacity: 0.5;
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
    cursor: grabbing;
}

.account-card.drag-over {
    border-color: var(--accent-primary);
    background: rgba(249, 115, 22, 0.1);
}

.account-player {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 280px;
    flex-shrink: 0;
}

.player-header {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.account-avatar {
    width: 48px;
    height: 48px;
    border-radius: 2px 0 0 2px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-avatar-placeholder {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-primary);
}

.player-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 10px;
}

.player-info.has-namecard {
    height: 48px;
    border-radius: 0 2px 2px 0;
    padding: 6px 12px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.player-info.has-namecard::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, #28354F, transparent);
    pointer-events: none;
    z-index: 1;
}

.player-info.has-namecard .battletag,
.player-info.has-namecard .player-title {

    position: relative;
    z-index: 2;
}

.battletag {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.battletag:hover {
    transform: scale(1.02);
}

.player-title {
    font-size: 12px;
    color: var(--accent-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-credentials {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    margin-left: 4px;
}

.account-notes {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.4;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

.credential-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.credential-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 50px;
    flex-shrink: 0;
}

.credential-value {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.password-value {
    filter: blur(5px);
    transition: filter 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.password-value.revealed {
    filter: none;
    user-select: text;
}

.btn-copy {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-copy:hover {
    background: var(--bg-secondary);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-copy.copied {
    border-color: var(--success);
    color: var(--success);
}

.ranks-container {
    display: flex;
    gap: 8px;
    flex: 1;

    margin-left: 10px;
}

.ranks-container.empty {
    justify-content: center;
    align-items: center;
}

.rank-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    min-width: 60px;
    flex: 1;

}

.rank-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    width: 100%;
    text-align: center;
}

.rank-status svg {
    opacity: 0.7;
}

.rank-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80px;
    color: var(--text-muted);
    gap: 4px;
}

.rank-placeholder span {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
}

.rank-icons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.rank-icon {
    width: auto;
    height: 54px;
}

.tier-icon {
    height: 26px;
    width: auto;
    max-width: none;
}

.rank-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.account-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transition: var(--transition);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    padding-left: 12px;
    z-index: 10;
}

.account-card:hover .account-actions {
    opacity: 1;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-icon.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-icon.refresh:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state svg {
    opacity: 0.3;
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state span {
    font-size: 14px;
}

.empty-state.hidden {
    display: none;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 420px;
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(10px);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-small {
    max-width: 360px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.btn-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal form {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group label .required {
    color: var(--danger);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: none;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--bg-secondary) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.btn-cancel {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-cancel:hover {
    background: var(--bg-card);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-save {
    padding: 10px 24px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-save:hover {
    opacity: 0.95;
}

.btn-save.loading {
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-save.loading::after {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

.btn-delete {
    padding: 10px 24px;
    background: var(--danger);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.delete-message {
    padding: 24px 24px 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.modal-small .form-actions {
    padding: 24px;
    margin-top: 0;
}

.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    transform: translateX(120%);
    background: rgba(10, 10, 10, 0.8) !important;
    backdrop-filter: blur(8px);
    border: 1px solid;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    z-index: 2000;
    opacity: 0;
    display: flex;
    align-items: center;
    gap: 8px;

    width: auto;
    max-width: 400px;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast span {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    padding: 0;

}

.toast.info {
    border-color: var(--accent-primary);
}

.toast.info::before {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23f97316' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'%3E%3C/line%3E%3C/svg%3E");
    display: block;
    width: 20px;
    height: 20px;
}

.toast.success {
    border-color: var(--success);
}

.toast.success::before {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'%3E%3C/path%3E%3Cpolyline points='22 4 12 14.01 9 11.01'%3E%3C/polyline%3E%3C/svg%3E");
    display: block;
    width: 20px;
    height: 20px;
}

.toast.error {
    border-color: var(--danger);
}

.toast.error::before {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='15' y1='9' x2='9' y2='15'%3E%3C/line%3E%3Cline x1='9' y1='9' x2='15' y2='15'%3E%3C/line%3E%3C/svg%3E");
    display: block;
    width: 20px;
    height: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.account-card {
    animation: fadeIn 0.3s ease-out forwards;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-icon.refresh.loading svg {
    animation: spin 1s linear infinite;
}

.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.auth-card {
    background: transparent;
    padding: 0;
    width: 100%;
    max-width: 320px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 32px;
    font-size: 32px;

    font-style: italic;
    font-weight: 900;
    text-transform: uppercase;
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-switch a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    margin-left: 4px;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.btn-block {
    width: 100%;
    justify-content: center;
    margin-top: 24px;
}

@media (max-width: 900px) {
    .account-card {
        flex-wrap: wrap;
    }

    .ranks-container {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid var(--border-color);
        margin-left: 0;
    }

    .account-player {
        flex: 1;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 24px 16px;
    }

    header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .btn-add {
        width: 100%;
        justify-content: center;
    }

    .account-actions {
        opacity: 1;
    }

    .account-card {
        padding: 16px;
    }

    .account-player {
        min-width: auto;
        width: 100%;
    }

    .account-credentials {
        padding-left: 0;
    }

    .rank-item {
        min-width: 55px;
        padding: 6px 8px;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}