/* Splash Screen - Shows immediately while app loads */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.splash-title {
    color: #bb86fc;
    font-size: 2rem;
    font-weight: bold;
    margin: 0;
    animation: fadeInDown 0.6s ease;
}

.splash-subtitle {
    color: #888;
    font-size: 0.9rem;
    margin: 0;
    animation: fadeIn 0.8s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(187, 134, 252, 0.2);
    border-top-color: #bb86fc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    text-align: center;
    overflow-x: hidden;
}

/* Progress Container */
.progress-container {
    width: 100%;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 20px 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(187, 134, 252, 0.2);
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 15px;
}

.toc-button {
    background: rgba(187, 134, 252, 0.1);
    border: 1px solid rgba(187, 134, 252, 0.3);
    border-radius: 8px;
    color: #bb86fc;
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    min-width: 44px;
    min-height: 44px;
}

.toc-button:hover {
    background: rgba(187, 134, 252, 0.2);
    transform: scale(1.05);
}

.toc-button:active {
    transform: scale(0.95);
}

.progress-stats {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.95rem;
    flex: 1;
    justify-content: center;
}

#progress-text {
    color: #bb86fc;
    font-weight: 600;
}

#progress-percent {
    color: #888;
    font-size: 0.85rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #bb86fc 0%, #9c5fd8 100%);
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    box-shadow: 0 0 10px rgba(187, 134, 252, 0.5);
}

/* Main Container */
.container {
    max-width: 600px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
    flex: 1;
}

h2 {
    color: #bb86fc;
    margin: 20px 0 10px;
    font-size: 1.8rem;
    animation: fadeIn 0.3s ease;
}

.progress {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 20px;
}

/* Card Design with Swipe Support */
.card {
    background: linear-gradient(145deg, #1e1e1e 0%, #2a2a2a 100%);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    border: 1px solid rgba(187, 134, 252, 0.2);
    margin-bottom: 20px;
    flex-grow: 1;
    touch-action: pan-y;
    position: relative;
}

.card:hover {
    box-shadow: 0 12px 35px rgba(187, 134, 252, 0.3);
}

.card:active {
    transform: scale(0.98);
}

.card.swiping {
    transition: none;
}

.card.transitioning {
    animation: cardSlide 0.3s ease;
}

@keyframes cardSlide {
    0% {
        opacity: 0;
        transform: translateX(30px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Blur Effect */
.content {
    font-size: 1.5rem;
    line-height: 1.8;
    font-weight: bold;
    filter: blur(12px);
    transition: filter 0.3s ease;
    user-select: none;
    white-space: pre-wrap;
}

.content.revealed {
    filter: blur(0);
}

.hint {
    font-size: 0.75rem;
    color: #666;
    margin-top: 20px;
}

/* Buttons */
.controls {
    margin-top: auto;
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
    margin-bottom: 10px;
}

button {
    padding: 15px 20px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    flex: 1;
    transition: all 0.2s ease;
    touch-action: manipulation;
    min-height: 44px;
}

.btn-prev {
    background: linear-gradient(145deg, #2a2a2a 0%, #333 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-prev:hover {
    background: linear-gradient(145deg, #333 0%, #3a3a3a 100%);
    transform: translateY(-2px);
}

.btn-next {
    background: linear-gradient(145deg, #bb86fc 0%, #9c5fd8 100%);
    color: #000;
    box-shadow: 0 4px 15px rgba(187, 134, 252, 0.3);
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(187, 134, 252, 0.4);
}

.btn-reset {
    background: linear-gradient(145deg, #cf6679 0%, #b84e5e 100%);
    color: white;
    width: 100%;
    flex: none;
    box-shadow: 0 4px 15px rgba(207, 102, 121, 0.3);
}

.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(207, 102, 121, 0.4);
}

button:active {
    transform: scale(0.95);
}

/* Table of Contents Modal */
.toc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.toc-modal.active {
    display: flex;
}

.toc-content {
    background: linear-gradient(145deg, #1e1e1e 0%, #2a2a2a 100%);
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(187, 134, 252, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.toc-header h3 {
    margin: 0;
    color: #bb86fc;
    font-size: 1.5rem;
}

.toc-close {
    background: none;
    border: none;
    color: #888;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toc-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.toc-search {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.toc-search input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #e0e0e0;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.toc-search input:focus {
    outline: none;
    border-color: #bb86fc;
    background: rgba(255, 255, 255, 0.08);
}

.toc-search input::placeholder {
    color: #666;
}

.toc-list {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    flex: 1;
    min-height: 0;
}

.toc-list::-webkit-scrollbar {
    width: 8px;
}

.toc-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.toc-list::-webkit-scrollbar-thumb {
    background: rgba(187, 134, 252, 0.5);
    border-radius: 10px;
}

.toc-list::-webkit-scrollbar-thumb:hover {
    background: rgba(187, 134, 252, 0.7);
}

.bab-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 50px;
}

.bab-item:hover {
    background: rgba(187, 134, 252, 0.1);
    border-color: rgba(187, 134, 252, 0.3);
    transform: translateX(5px);
}

.bab-item.current {
    background: rgba(187, 134, 252, 0.15);
    border-color: rgba(187, 134, 252, 0.5);
}

.bab-item.completed {
    opacity: 0.7;
}

.bab-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.bab-number {
    font-weight: bold;
    color: #bb86fc;
    font-size: 1.1rem;
    min-width: 70px;
    text-align: left;
}

.bab-status {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.bab-status.completed {
    color: #4caf50;
}

.bab-status.in-progress {
    color: #ffc107;
}

.bab-status.not-started {
    color: #666;
}

/* Celebration Animation */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #bb86fc;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Feedback Section */
.feedback-trigger {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(145deg, #bb86fc 0%, #9c5fd8 100%);
    color: #000;
    border: none;
    border-radius: 50px;
    padding: 15px 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(187, 134, 252, 0.4);
    transition: all 0.3s ease;
    z-index: 900;
    min-height: 44px;
}

.feedback-trigger:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(187, 134, 252, 0.5);
}

.feedback-trigger:active {
    transform: translateY(-1px);
}

.feedback-trigger svg {
    flex-shrink: 0;
}

.feedback-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1001;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.feedback-modal.active {
    display: flex;
}

.feedback-content {
    background: linear-gradient(145deg, #1e1e1e 0%, #2a2a2a 100%);
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(187, 134, 252, 0.3);
    animation: slideUp 0.3s ease;
    box-sizing: border-box;
}

.feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.feedback-header h3 {
    margin: 0;
    color: #bb86fc;
    font-size: 1.5rem;
}

.feedback-close {
    background: none;
    border: none;
    color: #888;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.feedback-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.feedback-description {
    padding: 0 25px;
    margin: 20px 0;
    color: #bbb;
    line-height: 1.6;
    font-size: 0.95rem;
}

.feedback-form {
    padding: 0 25px 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #bb86fc;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #e0e0e0;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #bb86fc;
    background: rgba(255, 255, 255, 0.08);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #666;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group select {
    cursor: pointer;
}

.form-actions {
    margin-top: 25px;
}

.btn-submit {
    width: 100%;
    background: linear-gradient(145deg, #bb86fc 0%, #9c5fd8 100%);
    color: #000;
    border: none;
    border-radius: 12px;
    padding: 15px 20px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(187, 134, 252, 0.3);
    transition: all 0.3s ease;
    min-height: 50px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(187, 134, 252, 0.4);
}

.btn-submit:active {
    transform: translateY(0);
}

.feedback-success {
    display: none;
    text-align: center;
    padding: 40px 25px;
    animation: fadeIn 0.5s ease;
}

.feedback-success.active {
    display: block;
}

.feedback-success svg {
    margin-bottom: 20px;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

.feedback-success h4 {
    color: #4caf50;
    font-size: 1.5rem;
    margin: 0 0 10px;
}

.feedback-success p {
    color: #bbb;
    line-height: 1.6;
    margin-bottom: 20px;
}

.btn-close-success {
    background: linear-gradient(145deg, #bb86fc 0%, #9c5fd8 100%);
    color: #000;
    border: none;
    border-radius: 12px;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
}

.btn-close-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(187, 134, 252, 0.4);
}

.btn-close-success:active {
    transform: translateY(0);
}

/* Responsive Font Sizes */
@media (max-width: 480px) {
    .content {
        font-size: 1.3rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    /* Full-screen TOC on mobile */
    .toc-content {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        animation: slideUp 0.2s ease;
    }

    .toc-header {
        padding: 15px 20px;
    }

    .toc-header h3 {
        font-size: 1.3rem;
    }

    .toc-search {
        padding: 12px 20px;
    }

    .toc-search input {
        font-size: 16px;
        /* Prevents zoom on iOS */
        padding: 14px 15px;
    }

    .toc-list {
        padding: 5px 15px 15px;
    }

    .bab-item {
        padding: 16px 15px;
        margin: 6px 0;
        min-height: 56px;
        /* Better touch target */
    }

    .bab-number {
        font-size: 1.05rem;
        min-width: 75px;
    }

    .bab-status {
        font-size: 1.4rem;
    }

    .progress-stats {
        font-size: 0.85rem;
    }

    #progress-percent {
        display: none;
    }

    .progress-container {
        padding: 12px 15px 8px;
    }

    .toc-button {
        padding: 8px;
        min-width: 42px;
        min-height: 42px;
    }

    .feedback-trigger {
        bottom: 85px;
        right: 15px;
        padding: 16px;
        font-size: 0.9rem;
        border-radius: 50%;
        z-index: 950;
        box-shadow: 0 6px 25px rgba(187, 134, 252, 0.6);
    }

    .feedback-trigger span {
        display: none;
    }

    .feedback-modal {
        padding: 0;
    }

    .feedback-content {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
    }

    .feedback-header {
        padding: 20px;
        position: sticky;
        top: 0;
        background: linear-gradient(145deg, #1e1e1e 0%, #2a2a2a 100%);
        z-index: 10;
    }

    .feedback-header h3 {
        font-size: 1.3rem;
    }

    .feedback-description {
        padding: 0 20px;
        font-size: 0.9rem;
        margin: 15px 0;
        line-height: 1.5;
    }

    .feedback-form {
        padding: 0 20px 30px;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        /* Prevents zoom on iOS */
        padding: 14px 15px;
    }

    .form-group textarea {
        min-height: 140px;
    }

    .btn-submit {
        padding: 16px 20px;
        font-size: 1.05rem;
    }
}

@media (max-width: 360px) {
    .content {
        font-size: 1.1rem;
    }

    .card {
        padding: 20px;
        min-height: 250px;
    }

    .bab-item {
        padding: 14px 12px;
    }

    .bab-number {
        font-size: 1rem;
        min-width: 70px;
    }

    .toc-header h3 {
        font-size: 1.2rem;
    }
}