:root {
    --gold: #ffd700;
    --green: #247a43;
    --red: #a51d2d;
    --lyrics-size: 32px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: radial-gradient(
        ellipse at top, #246b43, #081e14
    );
    color: white;
    font-family: Arial, sans-serif;
    text-align: center;
}

main {
    max-width: 1200px;
    margin: auto;
    padding: 15px;
}

h1 {
    color: var(--gold);
    font-size: clamp(24px, 5vw, 38px);
    margin: 10px 0;
}

h2 {
    font-size: clamp(20px, 4vw, 30px);
    margin: 12px 0;
}

button, select, input {
    font-family: inherit;
    font-size: 18px;
}

button {
    min-height: 48px;
    padding: 12px 18px;
    border: 1px solid #e8c45a;
    border-radius: 10px;
    background: var(--green);
    color: white;
    font-weight: bold;
    cursor: pointer;
    touch-action: manipulation;
}

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

button:disabled {
    opacity: 0.35;
    cursor: default;
}

button.red {
    background: var(--red);
}

button.gold {
    background: #d5ad36;
    color: #172013;
}

button.secondary {
    background: #34483c;
}

select {
    width: 100%;
    min-height: 52px;
    padding: 12px;
    color: white;
    background: #193d29;
    border: 1px solid var(--gold);
    border-radius: 10px;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
}

.panel {
    background: #0003;
    border: 1px solid #ffffff30;
    border-radius: 14px;
    padding: 15px;
    margin: 15px 0;
}

.statusbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
    padding: 10px;
    background: #0004;
    border-radius: 10px;
}

.connected {
    color: #8dff9c;
}

.disconnected {
    color: #ff8888;
}

#songTitle {
    color: var(--gold);
}

#countdown {
    font-size: clamp(80px, 25vw, 200px);
    color: var(--gold);
    font-weight: bold;
    line-height: 1.2;
}

#lyrics {
    min-height: 220px;
    max-height: 55vh;
    overflow-y: auto;
    padding: 20px 10px;
    background: #0004;
    border-radius: 14px;
    font-size: var(--lyrics-size);
    line-height: 1.5;
    overscroll-behavior: contain;
}

.lyric {
    opacity: 0.45;
    padding: 8px 4px;
    transition: opacity 0.2s;
    overflow-wrap: break-word;
}

.lyric.active {
    opacity: 1;
    color: var(--gold);
    font-weight: bold;
    background: #ffffff12;
    border-radius: 8px;
}

.lyric.next {
    opacity: 0.85;
}

#lyrics.static-lyrics {
    text-align: left;
}

#lyrics.static-lyrics .lyric {
    opacity: 1;
    padding: .22em 0;
}

.font-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 10px 0;
}

.font-controls button {
    min-width: 55px;
}

.trailer-option {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 12px;
    font-size: 17px;
}

input[type="checkbox"] {
    width: 24px;
    height: 24px;
    accent-color: var(--green);
}

#progress {
    width: 100%;
    height: 12px;
    accent-color: var(--gold);
}

#greeting {
    color: var(--gold);
    font-size: clamp(36px, 9vw, 80px);
    font-weight: bold;
    padding: 30px 10px;
}

#loginOverlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #00150fee;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 380px;
    padding: 25px;
    border-radius: 16px;
    border: 2px solid var(--gold);
    background: #123d28;
}

.login-box input {
    width: 100%;
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
    border: 1px solid var(--gold);
    text-align: center;
}

.login-box button {
    width: 100%;
}

#loginError {
    color: #ff9999;
}

a {
    color: var(--gold);
}

.hidden, [hidden] {
    display: none !important;
}

@media (max-width: 600px) {
    main {
        padding: 10px;
    }

    .controls button {
        flex: 1 1 42%;
    }

    .panel {
        padding: 10px;
    }

    #lyrics {
        max-height: 55dvh;
    }
}

@media (orientation: landscape)
and (max-height: 550px) {
    h1 {
        font-size: 22px;
        margin: 4px 0;
    }

    #lyrics {
        min-height: 120px;
        max-height: 60dvh;
    }

    .controls {
        margin: 6px 0;
    }
}

/* Master: compact playlist and lyric-first player view. */
.master-main {
    max-width: 58rem;
}

.master-statusbar {
    position: sticky;
    top: 0;
    z-index: 20;
    margin-bottom: .5rem;
}

.selection-help,
.empty-songs {
    color: #f5d68c;
}

.selection-actions {
    display: flex;
    justify-content: flex-end;
    margin: .35rem 0;
}

.now-playing {
    margin: .45rem 0 .65rem;
    padding: .55rem;
    background: #0004;
    border: 1px solid #ffffff30;
    border-radius: .55rem;
}

.now-playing strong {
    display: block;
    color: var(--gold);
    margin-bottom: .35rem;
}

.list-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .35rem;
}

.song-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .35rem;
    text-align: left;
}

.song-pick {
    width: 100%;
    min-height: 0;
    padding: .55rem .7rem;
    border-radius: .45rem;
    background: #203629;
    font-size: clamp(1rem, 3.5vw, 1.25rem);
    line-height: 1.2;
    text-align: left;
}

.song-pick:hover,
.song-pick:focus-visible {
    background: #2c4938;
}

.song-number {
    display: inline-block;
    min-width: 2.3rem;
    color: var(--gold);
}

.song-note {
    margin-left: .4rem;
    color: #ffc3c3;
    font-size: .82em;
}

.player-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .4rem 0;
    background: #101814;
    border-bottom: 1px solid #ffffff30;
}

button.compact {
    min-height: 2.25rem;
    padding: .35rem .6rem;
    border-radius: .45rem;
    font-size: .95rem;
}

.compact-trailer {
    margin: 0;
    padding: .2rem .35rem;
    font-size: .9rem;
}

.compact-trailer input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
}

button.danger-link {
    background: transparent;
    border-color: #a55;
    color: #ffc3c3;
}

.song-heading {
    padding: .35rem 0;
}

.song-heading h1 {
    margin: .2rem 0;
    font-size: clamp(1.35rem, 5vw, 2.2rem);
}

.master-player #progress {
    max-width: 34rem;
}

.master-player #lyrics {
    min-height: 55vh;
    max-height: none;
    padding: .7rem .45rem;
}

@media (max-width: 600px) {
    .player-toolbar {
        justify-content: flex-start;
    }

    .master-player #lyrics {
        min-height: 50dvh;
    }
}
