:root {
    --primary: #004d61;
    --accent: #ff9800;
    --text: #333;
    --white: #ffffff;
    --bg-gradient: linear-gradient(135deg, #004d61 0%, #00796b 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Poppins', sans-serif;
    background: #f0f4f8;
    transition: background 0.3s, color 0.3s;
    overflow-x: hidden;
}

body.hymn-active {
    background: #121212;
}

/* Splash Screen */
#splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
}

.rotating-logo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    animation: rotate 3s linear infinite;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

#splash h1 {
    color: white;
    margin-top: 20px;
    letter-spacing: 5px;
}

/* Main Container */
#main-app {
    display: none;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    background: linear-gradient(rgba(0, 77, 97, 0.6), rgba(0, 77, 97, 0.6)), url('../images/bg-instruments.jpg') no-repeat center center fixed;
    background-size: cover;
    position: relative;
    width: 100%;
    overflow-y: auto;
}

.app-header {
    text-align: center;
    margin-bottom: 20px;
}

.app-header img {
    width: 70px;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.app-header h2 {
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    font-weight: 800;
    letter-spacing: 2px;
}

.search-display {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 10px 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

#hymn-input {
    font-size: 3.5rem;
    border: none;
    flex-grow: 1;
    text-align: left;
    color: var(--primary);
    background: transparent;
    font-weight: 800;
    outline: none;
    width: 0;
    /* Allow flex to control width */
}

.go-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 15px;
    font-weight: 800;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 77, 97, 0.2);
    transition: transform 0.1s, background 0.2s;
}

.go-btn:active {
    transform: scale(0.95);
    background: #003a4a;
}

#hymn-input::placeholder {
    color: #ccc;
    font-size: 1.5rem;
    font-weight: 400;
}

/* Dial Pad */
.dial-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
    justify-items: center;
    align-items: center;
}

.digit {
    background: var(--card-bg);
    border-radius: 50%;
    aspect-ratio: 1/1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
    width: 100%;
    max-width: 80px;
    margin: 0 auto;
}

.digit:active {
    transform: scale(0.9);
}

.digit.search-btn {
    background: var(--accent);
    color: #fff;
    grid-column: span 3;
    aspect-ratio: auto;
    border-radius: 20px;
    padding: 15px;
    margin-top: 10px;
    font-size: 1.3rem;
    letter-spacing: 1px;
    font-weight: 700;
}

.digit.backspace {
    color: #e74c3c;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #hymn-input {
        font-size: 3rem;
    }

    .dial-pad {
        gap: 10px;
    }

    .digit {
        font-size: 1.8rem;
    }

    .digit.search-btn {
        font-size: 1.2rem;
    }

    .app-header img {
        width: 60px;
    }

    .app-header h2 {
        font-size: 1.5rem;
    }
}

@media (max-height: 700px) {
    .app-header {
        margin-bottom: 10px;
    }

    .search-display {
        padding: 15px;
        margin-bottom: 15px;
    }

    #hymn-input {
        font-size: 2.5rem;
    }

    .dial-pad {
        gap: 10px;
    }

    .digit {
        font-size: 1.6rem;
    }

    .digit.search-btn {
        padding: 12px;
        margin-top: 5px;
        font-size: 1.1rem;
    }

    .search-display {
        padding: 10px;
        margin-bottom: 10px;
    }

    #hymn-input {
        font-size: 2.2rem;
    }

    .go-btn {
        padding: 10px 18px;
        font-size: 1rem;
    }
}

@media (max-width: 360px) {
    .dial-pad {
        gap: 8px;
    }

    .digit {
        font-size: 1.4rem;
    }

    .app-header h2 {
        font-size: 1.2rem;
    }

    .search-display {
        padding: 8px;
    }

    #hymn-input {
        font-size: 2rem;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-body h3 {
        font-size: 1.1rem;
    }

    .modal-body p {
        font-size: 0.85rem;
    }

    #install-button {
        padding: 12px 30px;
        font-size: 0.9rem;
    }
}

.hymn-content {
    background: var(--card-bg);
    height: 100%;
    border-radius: 25px 25px 0 0;
    padding: 30px 20px;
    overflow-y: auto;
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    color: var(--text);
    box-sizing: border-box;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.hymn-content.dark-theme {
    background: #121212;
    color: #e0e0e0;
}

.hymn-content.dark-theme .hymn-header h2 {
    color: #4db6ac;
}

.hymn-content.dark-theme .hymn-header h3 {
    color: #b0bec5;
}

.hymn-content.dark-theme .chorus {
    background: rgba(255, 255, 255, 0.05);
    border-left: 5px solid #ff9800;
}

.hymn-content.dark-theme .stanza-num {
    color: #ff9800;
}

.hymn-header {
    border-bottom: 2px solid var(--accent);
    padding-bottom: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.hymn-header h2 {
    margin: 0;
    color: var(--primary);
    font-weight: 800;
    font-size: 1.8rem;
}

.hymn-header h3 {
    margin: 10px 0 0;
    font-size: 1.2rem;
    opacity: 0.9;
    color: var(--text);
}

.stanza {
    margin-bottom: 30px;
    line-height: 1.6;
}

.stanza-num {
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 8px;
    display: block;
    font-size: 1.2rem;
}

.chorus {
    font-style: italic;
    background: rgba(128, 128, 128, 0.1);
    padding: 20px;
    border-left: 5px solid var(--accent);
    border-radius: 0 10px 10px 0;
    margin: 25px 0;
}

.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: var(--card-bg);
    color: var(--primary);
    padding: 12px;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 1001;
    display: none;
    transition: all 0.3s ease;
}

.back-btn.dark-btn {
    background: #333;
    color: #fff;
}

/* PWA Install Modal */
#install-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 10001;
}

#install-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    background: #fff;
    border-radius: 25px;
    z-index: 10002;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.modal-content {
    display: flex;
    flex-direction: column;
}

.modal-header {
    background: var(--bg-gradient);
    padding: 30px;
    text-align: center;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-header img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
}

#close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 25px;
    text-align: center;
    max-height: 60vh;
    overflow-y: auto;
}

#ios-instructions li {
    margin-bottom: 8px;
    line-height: 1.4;
}

#ios-instructions i {
    font-size: 1.1rem;
    vertical-align: middle;
}

.modal-body h3 {
    margin: 0 0 10px;
    color: var(--primary);
    font-weight: 700;
}

.modal-body p {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.feature-list {
    display: flex;
    justify-content: space-around;
    margin-bottom: 10px;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.feature-item i {
    color: var(--accent);
    font-size: 1.2rem;
}

.feature-item span {
    font-size: 0.75rem;
    color: #888;
}

.modal-footer {
    padding: 20px;
    text-align: center;
    background: #f9f9f9;
}

#install-button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 77, 97, 0.3);
    transition: transform 0.2s;
    width: 100%;
}

#install-button:active {
    transform: scale(0.95);
}

/* Scrollbar styling for dark mode */
.hymn-content.dark-theme::-webkit-scrollbar {
    width: 8px;
}

.hymn-content.dark-theme::-webkit-scrollbar-track {
    background: #121212;
}

.hymn-content.dark-theme::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}


.hymn-content.dark-theme::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Radio Button Styles */
.dial-pad .digit.radio-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
    aspect-ratio: auto;
    border-radius: 20px;
    padding: 10px;
    margin-top: 10px;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 60px;
}

.dial-pad .digit.radio-btn i {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.dial-pad .digit.radio-btn span {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.dial-pad .digit.search-btn {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}