* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background-color: #000;
    height: 100%;
    width: 100%;
    font-family: 'Arial', sans-serif;
    color: rgba(255, 255, 255, 0.9);
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Main layout structure */
.header {
    width: 100%;
    padding: 15px 0;
    text-align: center;
}

.header h2 {
    font-size: 28px;
    margin: 0;
    color: white;
}

.main-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-sizing: border-box;
}

.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 10px 20px;
}

/* QR code section */
.qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    gap: 20px;
}

.qr-container {
    display: grid;
    background-color: #000;
    padding: 0;
    aspect-ratio: 1;
    width: min(70vw, 400px);
    height: min(70vw, 400px);
    max-width: 400px;
    max-height: 400px;
    position: relative;
    transition: opacity 0.3s ease-in-out;
    opacity: 1;
    gap: 0;
}

.current-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.7);
    padding: 12px 20px;
    border-radius: 5px;
    backdrop-filter: blur(5px);
    text-align: center;
    color: white;
    width: 100%;
    max-width: 400px;
    transition: opacity 0.3s ease-in-out;
    opacity: 1;
    margin-top: 15px;
}

.character-display, .morse-display {
    display: flex;
    gap: 5px;
    justify-content: center;
}

#currentChar, #currentMorse {
    font-weight: bold;
    color: #fff;
}

/* Control panel at bottom */
.control-panel {
    width: 100%;
    max-width: 800px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.input-row {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-bottom: 15px;
}

.input-row input {
    flex: 1;
    padding: 12px 15px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transition: all 0.3s ease;
}

.input-row input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.primary-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Bottom controls */
.bottom-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.speed-label {
    font-size: 14px;
    opacity: 0.8;
    white-space: nowrap;
}

.speed-buttons {
    display: flex;
    gap: 5px;
}

.speed-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.speed-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.speed-btn.active {
    background: rgba(100, 200, 255, 0.4);
    box-shadow: 0 0 10px rgba(100, 200, 255, 0.3);
}

.playback-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

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

.control-btn.active {
    background: rgba(100, 200, 255, 0.4);
    box-shadow: 0 0 10px rgba(100, 200, 255, 0.7);
}

/* Pause button when paused */
.control-btn#pauseBtn.active {
    background-color: rgba(255, 0, 0, 0.3);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.7);
}

/* Loop button when active */
.control-btn#loopBtn.active {
    background-color: rgba(0, 255, 0, 0.3);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.7);
}

/* Audio button when active */
.control-btn#audioBtn.active {
    background-color: rgba(255, 165, 0, 0.3);
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.7);
}

.control-btn .material-icons {
    color: white;
    font-size: 24px;
}

.credits {
    font-size: 12px;
    opacity: 0.7;
    text-align: right;
}

.credits a {
    color: #ff6600;
    text-decoration: none;
}

.credits a:hover {
    text-decoration: underline;
}

/* QR code cell styling */
.qr-cell {
    width: 100%;
    height: 100%;
    transition: background-color 0.2s;
}

.qr-cell.black {
    background-color: #000;
}

.qr-cell.white {
    background-color: #fff;
}

/* When QR code or character info is hidden */
.qr-container.hidden,
.current-info.hidden {
    opacity: 0;
}

/* Fullscreen styling */
:fullscreen body {
    overflow: hidden;
    cursor: none; /* Hide cursor after inactivity */
}

:fullscreen body.show-controls {
    cursor: auto; /* Show cursor when controls are visible */
}

:fullscreen .header,
:fullscreen .control-panel {
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

:fullscreen body.show-controls .header,
:fullscreen body.show-controls .control-panel {
    opacity: 1;
    pointer-events: auto;
}

/* Special styling for QR code and current info in fullscreen mode */
:fullscreen .qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 20px;
}

:fullscreen .qr-container {
    position: relative;
    max-width: 70vmin;
    max-height: 70vmin;
}

:fullscreen .current-info {
    position: relative;
    bottom: 0;
    opacity: 1; /* Keep visible even when controls are hidden */
    width: auto;
    max-width: 70vmin;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 5;
}

/* Show fullscreen button even in fullscreen mode */
:fullscreen .playback-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 100;
    display: flex;
    gap: 10px;
}

:fullscreen .fullscreen-btn {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

:fullscreen body.show-controls .playback-controls {
    opacity: 1;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .content-wrapper {
        padding: 5px;
        justify-content: flex-start;
    }
    
    .header {
        padding: 5px 0;
    }
    
    .header h2 {
        font-size: 22px;
    }
    
    .qr-section {
        margin-bottom: 0;
    }
    
    .qr-container {
        width: min(65vw, 220px);
        height: min(65vw, 220px);
        margin: 5px auto;
    }
    
    .current-info {
        max-width: 280px;
        padding: 6px 10px;
        margin-top: 5px;
        font-size: 12px;
    }
    
    .control-panel {
        padding: 10px;
        margin-top: 0;
        width: 100%;
    }
    
    .input-row {
        flex-direction: column;
        gap: 5px;
        margin-bottom: 8px;
    }
    
    .input-row input {
        padding: 8px 10px;
        font-size: 14px;
    }
    
    .primary-btn {
        width: 100%;
        padding: 8px;
    }
    
    .bottom-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 5px;
        width: 100%;
    }
    
    .speed-control {
        grid-column: span 2;
        margin-bottom: 5px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .speed-label {
        font-size: 12px;
        margin-right: 5px;
        display: block;
        width: 100%;
        text-align: center;
        margin-bottom: 5px;
    }
    
    .speed-buttons {
        display: flex;
        justify-content: center;
        gap: 5px;
    }
    
    .speed-btn {
        padding: 5px 8px;
        font-size: 12px;
        flex: 1;
        max-width: 80px;
    }
    
    .playback-controls {
        grid-column: span 2;
        display: flex;
        justify-content: space-between;
        width: 100%;
        margin: 5px 0;
    }
    
    .control-btn {
        width: 36px;
        height: 36px;
    }
    
    .control-btn .material-icons {
        font-size: 18px;
    }
    
    .credits {
        grid-column: span 2;
        width: 100%;
        text-align: center;
        margin-top: 5px;
        font-size: 10px;
    }
    
    .footer {
        padding: 5px;
        font-size: 9px;
        line-height: 1.2;
    }
    
    .footer p {
        margin: 2px 0;
    }
}

/* Small phones optimization */
@media (max-height: 700px) and (max-width: 420px) {
    .header {
        padding: 5px 0;
    }
    
    .header h2 {
        font-size: 20px;
        margin: 0;
    }
    
    .main-container {
        padding-top: 5px;
    }
    
    .qr-container {
        width: min(65vw, 250px);
        height: min(65vw, 250px);
    }
    
    .control-panel {
        padding: 10px;
        margin-top: 5px;
    }
    
    .bottom-controls {
        gap: 10px;
    }
    
    .speed-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .control-btn {
        width: 36px;
        height: 36px;
    }
    
    .footer {
        padding: 5px 15px;
        font-size: 10px;
    }
    
    .footer p {
        margin: 3px 0;
    }
}

.footer {
    width: 100%;
    text-align: center;
    padding: 10px 20px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 10px;
    word-wrap: break-word;
    max-width: 100%;
    overflow-wrap: break-word;
}

.footer p {
    margin-bottom: 5px;
}

.footer p:last-child {
    margin-bottom: 0;
}

/* Additional footer styles for mobile */
@media (max-width: 768px) {
    .footer {
        font-size: 11px;
        padding: 10px 15px;
        line-height: 1.4;
    }
} 