* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #000;
    color: #fff;
}

.app-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.header-bar {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.header-bar h1 {
    font-size: 1.5em;
    font-weight: 600;
    color: #fff;
}

.cache-status {
    font-size: 0.75em;
    color: #4CAF50;
    padding: 5px 10px;
    background: rgba(76, 175, 80, 0.2);
    border-radius: 12px;
}

.cache-status.cached {
    background: rgba(76, 175, 80, 0.3);
}

.controls-panel {
    background: #1a1a2e;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.control-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-label {
    font-size: 0.85em;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.control-btn {
    flex: 1;
    min-width: 80px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-family: inherit;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.control-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.control-btn:active {
    transform: scale(0.98);
}

.image-panel {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.image-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.main-image {
    max-width: 100%;
    max-height: calc(100vh - 250px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: high-quality;
}

.main-image.loaded {
    opacity: 1;
}

.image-label {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    backdrop-filter: blur(10px);
    z-index: 5;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 1em;
    display: none;
    z-index: 1;
}

.loading.show {
    display: block;
}

.footer-bar {
    background: #1a1a2e;
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-shrink: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-btn {
    padding: 10px 30px;
    background: rgba(102, 126, 234, 0.2);
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 20px;
    color: #fff;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.footer-btn:hover {
    background: rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.7);
}

.footer-btn:active {
    transform: scale(0.98);
}

/* Femto Modal */
.femto-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    overflow-y: auto;
}

.femto-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: #1a1a2e;
    border-radius: 15px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
    font-size: 1.5em;
    color: #fff;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 2em;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
    font-family: inherit;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 20px;
}

.femto-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.femto-item {
    text-align: center;
    width: 100%;
    max-width: 800px;
}

.femto-item h3 {
    margin-bottom: 15px;
    color: #fff;
    font-size: 1.1em;
}

.femto-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

/* Video Modal */
.video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1001;
    overflow-y: auto;
}

.video-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.video-modal-content {
    max-width: 1200px;
    width: 100%;
}

.video-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.video-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.video-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.video-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.video-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.video-btn:active {
    transform: scale(0.98);
}

.video-player-wrapper {
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    padding-top: 56.25%; /* 16:9 aspect ratio */
}

.video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* About Modal */
.about-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1002;
    overflow-y: auto;
}

.about-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.about-modal-content {
    max-width: 600px;
    width: 100%;
}

.about-content {
    color: #fff;
    line-height: 1.6;
    font-size: 1em;
}

.about-content p {
    margin-bottom: 15px;
}

.about-stats {
    margin-top: 20px;
    padding: 12px 0;
    text-align: center;
}

.view-count {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95em;
    margin: 0;
}

.view-count span {
    font-weight: 600;
    color: #667eea;
}

.about-contact {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

.about-contact p {
    margin-bottom: 10px;
}

.contact-link {
    color: #667eea;
    text-decoration: none;
    font-size: 1.2em;
    font-weight: 600;
    transition: color 0.2s ease;
}

.contact-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .header-bar h1 {
        font-size: 1.2em;
    }

    .cache-status {
        font-size: 0.7em;
        padding: 4px 8px;
    }

    .control-btn {
        min-width: 70px;
        padding: 10px 12px;
        font-size: 0.85em;
    }

    .main-image {
        max-height: calc(100vh - 220px);
    }

}

@media (orientation: landscape) and (max-height: 500px) {
    .header-bar {
        padding: 10px 15px;
    }

    .header-bar h1 {
        font-size: 1.1em;
    }

    .controls-panel {
        padding: 10px 15px;
        flex-direction: row;
        gap: 20px;
    }

    .control-section {
        flex: 1;
    }

    .button-group {
        flex-wrap: nowrap;
    }

    .control-btn {
        min-width: 60px;
        padding: 8px 10px;
        font-size: 0.8em;
    }

    .main-image {
        max-height: calc(100vh - 150px);
    }
}
