.deckLayout {
    display: flex;
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 20px;
    gap: 35px;
    min-height: calc(100vh - 110px);
}

.deckSidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border-thin);
    border-radius: 14px;
    padding: 24px;
    display: flex !important;
    flex-direction: column;
    gap: 16px;
    align-self: flex-start;
    position: sticky;
    top: 95px;
}

.btn-sidebar-back {
    align-self: flex-start;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brand-lime);
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--brand-lime-soft);
}

.btn-sidebar-back:hover {
    background: var(--brand-lime);
    color: var(--bg-dark);
}

.sidebar-image-container {
    width: 100%;
    height: 155px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-dark);
    border: 1px solid var(--border-thin);
}

.deckSidebarImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#deckTitle {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-main);
    word-wrap: break-word;
}

.deck-author-tag {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: -8px;
    margin-bottom: 8px;
}

.sidebar-actions-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--border-thin);
    padding-top: 16px;
}

.side-action-link {
    width: 100%;
    text-align: left;
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    display: flex;
    align-items: center;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.side-action-link:hover {
    background: var(--bg-panel-hover);
    color: var(--text-main);
}

.side-action-link.active {
    background: var(--brand-lime-soft) !important;
    color: var(--brand-lime) !important;
    border-left: 3px solid var(--brand-lime) !important;
    border-radius: 0 8px 8px 0; 
}

.side-action-link.danger-action {
    color: #ff5252;
    margin-top: 12px;
    border-top: 1px dashed var(--border-thin);
    border-radius: 8px;
}

.side-action-link.danger-action:hover {
    background: rgba(255, 82, 82, 0.08);
}

.deckContent {
    flex-grow: 1;
    min-width: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border-thin);
    border-radius: 14px;
    padding: 35px;
}

.deckContent h2 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-thin);
    padding-bottom: 14px;
}

#practiceContainer {
    overflow: hidden;
    perspective: 1000px;
    padding: 20px 0;
}

.practiceCard {
    width: 100%;
    max-width: 500px;
    height: 300px;
    margin: 0 auto;
    position: relative;
    cursor: pointer;
}

.cardInner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.practiceCard.flip .cardInner {
    transform: rotateY(180deg);
}

.practiceCard.slide-left {
    animation: slideOutInLeft 0.5s ease-in-out forwards;
}

.practiceCard.slide-left .cardInner {
    transition: none !important;
}

@keyframes slideOutInLeft {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    45% {
        transform: translateX(-120%);
        opacity: 0;
    }
    50% {
        transform: translateX(120%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.cardFront, .cardBack {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 16px;
    border: 1px solid var(--border-thin);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: 0 5px 10px #00E676;
}

.cardFront {
    background: #1b212c;
    color: var(--text-main);
}

.cardBack {
    background: #151922;
    color: var(--brand-lime);
    transform: rotateY(180deg);
}

.quizBtn {
    display: block;
    width: 100%;
    max-width: 620px;
    margin: 12px auto 0 auto;
    background: var(--bg-dark) !important;
    border: 1px solid var(--border-thin) !important;
    color: var(--text-main) !important;
    padding: 14px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.quizBtn:hover {
    border-color: var(--brand-lime) !important;
    background: var(--bg-panel-hover) !important;
}

#startPractice {
    background: var(--brand-lime);
    color: var(--bg-dark);
    padding: 12px 32px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
}

#nextCard {
    background: var(--brand-lime-soft);
    color: var(--brand-lime);
    border: 1px solid var(--brand-lime);
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 20px;
}

#nextCard:hover {
    background: var(--brand-lime);
    color: var(--bg-dark);
}

.cardItem {
    background: var(--bg-panel, #111); 
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column; 
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.cardItem h4 {
    font-size: 1.1rem;
    color: var(--text-main, #fff);
    margin: 0;
    word-break: break-word; 
    line-height: 1.4;
    width: 100%;
}

.cardItem p {
    font-size: 0.95rem;
    color: var(--text-muted, #aaa);
    margin: 0;
    word-break: break-word;
}

.cardItem .editBtn, 
.cardItem .deleteBtn {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    flex: 1;
    text-align: center;
}

.cardItem button {
    display: inline-block;
    margin-right: 8px;
}

@media (min-width: 768px) {
    .cardItem {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .cardItem h4 {
        width: 40%; 
    }

    .cardItem p {
        width: 40%; 
    }

    .cardItem .editBtn, 
    .cardItem .deleteBtn {
        flex: none;
        width: auto;
    }
}

.cardItem .editBtn { background: var(--bg-panel-hover); color: var(--text-main); }
.cardItem .deleteBtn { background: rgba(255, 82, 82, 0.1); color: #ff5252; }
.cardItem .deleteBtn:hover { background: #ff5252; color: white; }

#shareLink {
    width: 100%;
    max-width: 500px;
    background: var(--bg-dark);
    border: 1px solid var(--border-thin);
    color: var(--text-main);
    padding: 12px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

#copyLink {
    background: var(--brand-lime);
    color: var(--bg-dark);
    padding: 11px 20px;
    font-weight: 700;
    border-radius: 6px;
    font-size: 0.85rem;
}

#qrCode {
    display: block;
    margin: 20px 0;
    border: 6px solid white;
    border-radius: 8px;
}

.addCardModal, .editCardModal, .editDeckModal, .warningModal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100vh;
    background: rgba(9, 12, 16, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.cardMaker, .deckEditor, .warningBox {
    background: var(--bg-panel);
    border: 1px solid var(--border-thin);
    border-radius: 12px;
    padding: 28px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.cardMaker textarea {
    width: 100%; height: 100px;
    background: var(--bg-dark);
    border: 1px solid var(--border-thin);
    color: var(--text-main);
    border-radius: 6px; padding: 12px;
    margin-bottom: 12px; font-family: inherit; resize: vertical;
}

@media (max-width: 950px) {
    .deckLayout {
        flex-direction: column;
        padding: 0 15px;
        margin-top: -10px;
    }

    .deckSidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 270px !important;
        height: 100vh !important;
        z-index: 2000 !important;
        background: var(--bg-panel) !important;
        box-shadow: 25px 0 50px rgba(0,0,0,0.7);
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .deckSidebar.open {
        transform: translateX(0) !important;
    }

    .deckContent {
        padding: 20px;
    }

    .practiceCard {
        height: 260px;
    }

    .cardFront, .cardBack {
        font-size: 1.2rem;
    }
}

.edit-view-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

@media (min-width: 600px) {
    .edit-view-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.edit-actions-row {
    display: flex;
    gap: 12px;
}

.btn-primary, .btn-primary-outline, .btn-secondary {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background: var(--brand-lime, #a3e635);
    color: #0b0f19;
}

.btn-primary:hover {
    background: #bef264;
    transform: translateY(-1px);
}

.btn-primary-outline {
    background: transparent;
    color: var(--text-main, #fff);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted, #94a3b8);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-main, #fff);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.75);
    backdrop-filter: blur(8px); /* Frosted glass effect overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    box-sizing: border-box;
}

.modal-window {
    background: #151d30; /* Dark card surface */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPopIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-header h2 {
    margin: 0 0 6px 0;
    font-size: 1.35rem;
    color: var(--text-main, #fff);
}

.modal-subtitle {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-muted, #94a3b8);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field-label {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand-lime, #a3e635);
}

.modal-input {
    width: 100%;
    background: #0b0f19;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 12px;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.modal-input:focus {
    outline: none;
    border-color: var(--brand-lime, #a3e635);
}

textarea.modal-input {
    min-height: 100px;
    resize: vertical;
}

.form-tip {
    margin: 4px 0 0 0;
    font-size: 0.8rem;
    color: #64748b;
}

.file-upload-wrapper {
    background: #0b0f19;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
}

.modal-file-input {
    color: #94a3b8;
    font-size: 0.85rem;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-lime, #a3e635);
    cursor: pointer;
}

.checkbox-wrapper label {
    font-size: 0.9rem;
    color: var(--text-main, #e2e8f0);
    cursor: pointer;
}

.modal-footer {
    padding: 16px 24px 24px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}