/* CSS Variables for Color Palette */
:root {
    --primary-color: #8B4513;
    --secondary-color: #D2691E;
    --accent-color: #FF8C00;
    --highlight-color: #FFA500;
    --gold-color: #FFD700;
    --white: #FFFFFF;
    --light-gray: #F5F5F5;
    --gray: #CCCCCC;
    --dark-gray: #666666;
    --black: #333333;
    --success-color: #4CAF50;
    --error-color: #F44336;
    --warning-color: #FF9800;
    
    /* Layout */
    --header-height: 80px;
    --bottom-nav-height: 70px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(139, 69, 19, 0.08);
    --shadow-md: 0 4px 16px rgba(139, 69, 19, 0.12);
    --shadow-lg: 0 8px 32px rgba(139, 69, 19, 0.16);
    --shadow-glow: 0 0 20px rgba(255, 140, 0, 0.3);
    
    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--black);
    background: linear-gradient(180deg, var(--light-gray) 0%, #EDE7E3 100%);
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: var(--header-height);
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    overflow-x: hidden;
}

/* ==================== HEADER ==================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid rgba(139, 69, 19, 0.1);
    z-index: 100;
    display: flex;
    align-items: center;
}
.black-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 30px;
background-color: #000000;
z-index: 1001;
}
.header .container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header__logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    border-radius: 16px;
}

.header__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}

.header__nav {
    display: none;
}

/* ==================== BOTTOM NAV ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: var(--white);
    border-top: 1px solid rgba(139, 69, 19, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding-top: 8px;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
    margin-bottom: 80px;
}

.bottom-nav__button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 4px;
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav__button,
.bottom-nav .nav__button {
    color: var(--dark-gray);
    border: none;
    background: none;
    transform: none;
}

.bottom-nav__button.nav__button--active,
.bottom-nav .nav__button--active {
    color: var(--primary-color);
    transform: none;
    background: none;
}

.bottom-nav__icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: var(--transition-fast);
}

.bottom-nav__button.nav__button--active .bottom-nav__icon {
    background: linear-gradient(135deg, var(--accent-color), var(--highlight-color));
    box-shadow: var(--shadow-glow);
}

.bottom-nav__button.nav__button--active .bottom-nav__icon svg {
    stroke: var(--white);
}

.bottom-nav__icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.bottom-nav__label {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ==================== MAIN CONTENT ==================== */
.main {
    min-height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
    min-height: calc(100dvh - var(--header-height) - var(--bottom-nav-height));
}

.main > .container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

/* ==================== SECTIONS ==================== */
.section {
    margin-bottom: 24px;
}

.section__header {
    margin-bottom: 16px;
}

.section__header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.section__subtitle {
    font-size: 0.875rem;
    color: var(--dark-gray);
}

.section__header .button {
    margin-top: 12px;
    width: 100%;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    border: none;
    transition: var(--transition-normal);
}

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

.card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.card__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--black);
    margin-bottom: 2px;
}

.card__subtitle {
    font-size: 0.8rem;
    color: var(--dark-gray);
}

.card__content {
    margin-bottom: 16px;
}

.card__actions {
    display: flex;
    gap: 8px;
}

.card__actions .button {
    flex: 1;
    justify-content: center;
}

/* ==================== COMMAND CARDS ==================== */
.commands-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.command-card {
    position: relative;
    overflow: hidden;
}

.command-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-color), var(--gold-color));
    border-radius: 4px 0 0 4px;
}

.command-card__level {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--gold-color), var(--highlight-color));
    color: var(--black);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.command-card__difficulty {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.difficulty--easy {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success-color);
}

.difficulty--medium {
    background: rgba(255, 152, 0, 0.15);
    color: var(--warning-color);
}

.difficulty--hard {
    background: rgba(244, 67, 54, 0.15);
    color: var(--error-color);
}

.command-card__description {
    font-size: 0.875rem;
    color: var(--dark-gray);
    margin-bottom: 12px;
    line-height: 1.4;
}

.command-card__progress {
    margin-bottom: 12px;
}

/* ==================== PROGRESS BAR ==================== */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--light-gray);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--gold-color));
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
    font-size: 0.75rem;
    color: var(--dark-gray);
    text-align: right;
}

/* ==================== STATS SUMMARY ==================== */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--white);
    padding: 16px 12px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-card__number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card__label {
    font-size: 0.7rem;
    color: var(--dark-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==================== PROGRESS GRID ==================== */
.progress-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==================== SESSIONS LIST ==================== */
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.session-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.session-card__date {
    font-size: 0.75rem;
    color: var(--dark-gray);
    text-align: center;
    min-width: 50px;
}

.session-card__content {
    flex: 1;
    min-width: 0;
}

.session-card__command {
    font-weight: 600;
    color: var(--black);
    font-size: 0.95rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-card__details {
    font-size: 0.8rem;
    color: var(--dark-gray);
}

.session-card__success {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.success--low {
    background: rgba(244, 67, 54, 0.15);
    color: var(--error-color);
}

.success--medium {
    background: rgba(255, 152, 0, 0.15);
    color: var(--warning-color);
}

.success--high {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success-color);
}

/* ==================== ACHIEVEMENTS ==================== */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.achievement-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: none;
    transition: var(--transition-normal);
}

.achievement-card--unlocked {
    background: linear-gradient(135deg, 
        rgba(255, 215, 0, 0.2) 0%, 
        rgba(255, 165, 0, 0.15) 100%);
    border: 2px solid var(--gold-color);
}

.achievement-card--locked {
    opacity: 0.5;
    filter: grayscale(0.5);
}

.achievement-card__icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
}

.achievement-card__title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--black);
    margin-bottom: 4px;
}

.achievement-card__description {
    font-size: 0.75rem;
    color: var(--dark-gray);
    line-height: 1.3;
}

/* ==================== BUTTONS ==================== */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.button--primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.button--primary:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.2);
}

.button--secondary {
    background: var(--light-gray);
    color: var(--dark-gray);
}

.button--secondary:active {
    background: var(--gray);
}

.button--success {
    background: linear-gradient(135deg, var(--success-color), #45a049);
    color: var(--white);
}

.button--small {
    padding: 8px 14px;
    font-size: 0.8rem;
}

/* ==================== MODAL ==================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal--active {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal__content {
    background: var(--white);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: var(--safe-area-bottom);
}

.modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--light-gray);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
}

.modal__header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--black);
}

.modal__close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-gray);
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    color: var(--dark-gray);
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal__close:active {
    background: var(--gray);
}

/* ==================== FORMS ==================== */
.form {
    padding: 20px;
}

.form__group {
    margin-bottom: 20px;
}

.form__label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--black);
    margin-bottom: 8px;
}

.form__input,
.form__textarea,
.form__select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--light-gray);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--black);
    background: var(--white);
    transition: var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
}

.form__input:focus,
.form__textarea:focus,
.form__select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(255, 140, 0, 0.1);
}

.form__input::placeholder,
.form__textarea::placeholder {
    color: var(--gray);
}

.form__textarea {
    resize: vertical;
    min-height: 100px;
}

.form__select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 44px;
}

.form__actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.form__actions .button {
    flex: 1;
}

/* ==================== LOADING ==================== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.loading__spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--light-gray);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.loading p {
    color: var(--dark-gray);
    font-size: 0.9rem;
}

/* ==================== ERROR ==================== */
.error {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 32px 20px;
    text-align: center;
    margin: 20px 0;
    border: 2px solid rgba(244, 67, 54, 0.2);
}

.error__content h3 {
    color: var(--error-color);
    font-size: 1.125rem;
    margin-bottom: 8px;
}

.error__message {
    color: var(--dark-gray);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--dark-gray);
}

.empty-state h3 {
    font-size: 1.125rem;
    color: var(--black);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ==================== FOOTER ==================== */
.footer {
    background: var(--primary-color);
    color: var(--white);
    text-align: center;
    padding: 16px 20px;
    padding-bottom: calc(16px + var(--bottom-nav-height) + var(--safe-area-bottom));
    font-size: 0.8rem;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(100%);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== DESKTOP STYLES ==================== */
@media (min-width: 769px) {
    :root {
        --header-height: 70px;
        --bottom-nav-height: 0px;
    }
    
    body {
        padding-bottom: 40px;
    }
    
    .header .container {
        max-width: 1200px;
    }
    
    .header__logo {
        width: 100px;
        height: 100px;
    }
    
    .header__title {
        font-size: 1.35rem;
    }
    
    .header__nav {
        display: flex;
        gap: 8px;
    }
    
    .nav__button {
        background: transparent;
        border: 2px solid transparent;
        color: var(--dark-gray);
        padding: 10px 20px;
        border-radius: var(--radius-md);
        font-size: 0.9rem;
        font-weight: 500;
        cursor: pointer;
        transition: var(--transition-fast);
    }
    
    .nav__button:hover {
        color: var(--primary-color);
        background: rgba(139, 69, 19, 0.05);
    }
    
    .nav__button--active {
        background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
        color: var(--white);
        transform: none;
    }
    
    .bottom-nav {
        display: none;
    }
    
    .main > .container {
        max-width: 800px;
        padding: 32px 20px;
    }
    
    .commands-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .progress-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .achievements-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
    }
    
    .modal--active {
        align-items: center;
    }
    
    .modal__content {
        border-radius: var(--radius-xl);
        max-width: 480px;
    }
    
    .footer {
        padding: 20px;
        padding-bottom: 20px;
        font-size: 0.875rem;
    }
}

/* ==================== ACCESSIBILITY ==================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.button:focus-visible,
.nav__button:focus-visible,
.form__input:focus-visible,
.form__textarea:focus-visible,
.form__select:focus-visible,
.bottom-nav__button:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* ==================== PRINT ==================== */
@media print {
    .header, .bottom-nav, .footer, .modal, .button {
        display: none !important;
    }
    
    body {
        padding: 0;
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}
