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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tv-container {
    width: 95vw;
    height: 95vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tv-header {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    padding: 30px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tv-header h1 {
    font-size: 48px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

.tv-content {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    overflow-y: auto;
    background: #f7fafc;
}

.player-section,
.category-section,
.song-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #4299e1;
}

.lyrics-section {
    flex: 1;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    border-left: 4px solid #48bb78;
}

.label {
    font-size: 16px;
    font-weight: 600;
    color: #718096;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.player-name,
.category-name,
.song-info {
    font-size: 36px;
    font-weight: 700;
    color: #2d3748;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
    text-align: center;
    animation: fadeIn 0.5s ease-in;
}

.song-info {
    font-size: 28px;
}

.lyrics-text {
    flex: 1;
    font-size: 32px;
    line-height: 1.8;
    color: #2d3748;
    background: #f7fafc;
    padding: 30px;
    border-radius: 10px;
    overflow-y: auto;
    animation: fadeIn 0.5s ease-in;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* Individual lyric lines displayed vertically */
.lyric-line {
    text-align: center;
    width: 100%;
    padding: 10px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    animation: slideIn 0.3s ease-out;
    transition: all 0.3s ease;
}

.lyric-line:hover {
    background: #edf2f7;
    transform: scale(1.02);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.music-player {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border: 2px solid #e2e8f0;
}

.music-player iframe {
    border-radius: 8px;
}

.voice-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #ed8936;
}

.voice-text {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.voice-btn {
    padding: 20px 40px;
    font-size: 24px;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.voice-btn:hover {
    background: #3182ce;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.voice-btn.recording {
    background: #f56565;
    animation: pulse-recording 1.5s ease-in-out infinite;
}

@keyframes pulse-recording {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.voice-transcript {
    width: 100%;
    min-height: 100px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    font-size: 24px;
    line-height: 1.6;
}

.final-transcript {
    color: #2d3748;
    font-weight: 600;
}

.interim-transcript {
    color: #718096;
    font-style: italic;
}

.error {
    color: #e53e3e;
}

/* Responsive for smaller screens */
@media (max-width: 1024px) {
    .tv-header h1 {
        font-size: 36px;
    }
    
    .player-name,
    .category-name {
        font-size: 28px;
    }
    
    .song-info {
        font-size: 24px;
    }
    
    .lyrics-text {
        font-size: 24px;
    }
    
    .tv-content {
        padding: 20px;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .tv-header h1 {
        font-size: 28px;
    }
    
    .label {
        font-size: 16px;
    }
    
    .player-name,
    .category-name {
        font-size: 24px;
    }
    
    .song-info {
        font-size: 20px;
    }
    
    .lyrics-text {
        font-size: 20px;
    }
}

/* Scrollbar styling */
.lyrics-text::-webkit-scrollbar {
    width: 10px;
}

.lyrics-text::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.lyrics-text::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.lyrics-text::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

/* Audio activation button */
.audio-activation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px 60px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    z-index: 2000;
    border: 3px solid #4299e1;
}

.enable-audio-btn {
    padding: 20px 50px;
    font-size: 24px;
    font-weight: 600;
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.4);
}

.enable-audio-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.5);
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
}

.enable-audio-btn:active {
    transform: translateY(-1px);
}

/* Word validation styles */
.word-correct {
    color: #48bb78;
    font-weight: 600;
}

.word-incorrect {
    color: #f56565;
    font-weight: 600;
}

.word-blank {
    color: #718096;
    font-weight: 400;
}

.guess-line {
    display: block;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 12px 4px;
    text-align: center;
    white-space: nowrap;
    scrollbar-width: thin;
}

.verification-line {
    font-size: clamp(22px, 3.5vw, 56px);
    line-height: 1.3;
}

.verification-line span {
    display: inline;
}

.initials-line {
    font-size: clamp(20px, 3.2vw, 52px);
    font-weight: 800;
    letter-spacing: 0.03em;
}

/* Microphone controls */
.mic-controls {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    max-width: min(360px, calc(100vw - 40px));
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    background: rgba(13, 16, 31, 0.94);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.32);
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
}

.mic-btn {
    background: #48bb78;
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

.mic-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(72, 187, 120, 0.4);
}

.mic-btn.muted {
    background: #f56565;
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
}

.mic-btn.muted:hover {
    box-shadow: 0 6px 16px rgba(245, 101, 101, 0.4);
}

.mic-btn[data-status="starting"],
.mic-btn[data-status="retrying"],
.mic-btn[data-status="idle"] {
    background: #d88925;
    box-shadow: 0 4px 12px rgba(216, 137, 37, 0.3);
}

.mic-btn.error {
    background: #c23b58;
    box-shadow: 0 4px 12px rgba(194, 59, 88, 0.3);
}

.mic-detail {
    flex: 1 1 100%;
    color: #b7bdd0;
    font-size: 12px;
    line-height: 1.35;
}

.retry-mic-btn {
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    cursor: pointer;
    font-weight: 700;
}

.retry-mic-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

#micIcon {
    font-size: 24px;
}

#micStatus {
    font-size: 16px;
}

/* Broadcast layout */
:root {
    --show-violet: #7567ff;
    --show-pink: #ff4f91;
    --show-ink: #101326;
    --show-panel: rgba(24, 28, 51, 0.82);
}

body {
    background:
        radial-gradient(circle at 15% 10%, rgba(117, 103, 255, 0.35), transparent 34%),
        radial-gradient(circle at 90% 85%, rgba(255, 79, 145, 0.22), transparent 32%),
        #090b16;
}

.tv-container {
    width: min(96vw, 1600px);
    height: 94vh;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    background: rgba(13, 16, 31, 0.94);
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.55);
}

.tv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 34px;
    background: rgba(13, 16, 31, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}

.tv-header h1 {
    font-size: clamp(30px, 3vw, 48px);
    letter-spacing: -0.05em;
    animation: none;
}

.show-kicker {
    display: block;
    margin-bottom: 2px;
    color: #a89fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.scoreboard {
    display: grid;
    grid-template-columns: auto auto;
    column-gap: 12px;
    align-items: baseline;
    min-width: 210px;
    padding: 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    text-align: right;
}

.scoreboard #scorePlayerName {
    grid-column: 1 / -1;
    color: #c8ccdc;
    font-size: 13px;
    font-weight: 700;
}

.scoreboard strong {
    font-size: 36px;
    line-height: 1;
}

.scoreboard > span:last-child {
    color: #aeb4ca;
    font-size: 14px;
}

.tv-content {
    padding: 24px 34px 30px;
    gap: 22px;
    background: transparent;
}

.round-meta {
    display: grid;
    grid-template-columns: 0.8fr 1fr 1.6fr;
    gap: 14px;
}

.choice-showcase {
    display: none;
}

.choice-showcase.visible {
    display: block;
    padding: 18px 20px;
    border: 1px solid rgba(66, 224, 164, 0.28);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(66, 224, 164, 0.09), transparent 42%),
        rgba(18, 24, 43, 0.92);
}

.choice-showcase-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
}

.choice-showcase h2 {
    margin: 0;
    color: white;
    font-size: clamp(24px, 3vw, 44px);
    line-height: 1.05;
}

.choice-showcase-header > span {
    color: #aeb4ca;
    font-size: clamp(13px, 1.2vw, 18px);
    font-weight: 800;
    text-align: right;
}

.choice-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.mode-songs .choice-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.mode-selected-song .choice-card-grid {
    grid-template-columns: minmax(0, 1fr);
}

.choice-card {
    position: relative;
    min-height: 110px;
    overflow: hidden;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.075);
    color: white;
    opacity: 1;
    transform: translateY(0);
}

.choice-showcase.entering .choice-card {
    animation: choiceCardIn 420ms cubic-bezier(.2, .8, .2, 1) both;
    animation-delay: var(--choice-delay);
}

.choice-card.selected {
    border-color: rgba(66, 224, 164, 0.7);
    background: linear-gradient(135deg, rgba(66, 224, 164, 0.22), rgba(255, 255, 255, 0.08));
    box-shadow: 0 14px 42px rgba(66, 224, 164, 0.16);
}

.choice-card::after {
    content: "";
    position: absolute;
    right: -60px;
    bottom: -80px;
    width: 180px;
    height: 180px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
}

.choice-index {
    display: block;
    margin-bottom: 18px;
    color: #42e0a4;
    font-size: 13px;
    font-weight: 950;
}

.choice-card strong {
    display: block;
    overflow-wrap: anywhere;
    font-size: clamp(20px, 2vw, 34px);
    line-height: 1.08;
}

.choice-card small {
    display: block;
    margin-top: 8px;
    color: #c8ccdc;
    font-size: clamp(13px, 1.2vw, 18px);
    font-weight: 750;
}

@keyframes choiceCardIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.player-section,
.category-section,
.song-section {
    min-width: 0;
    padding: 15px 18px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-left: 0;
    border-radius: 14px;
    background: var(--show-panel);
    box-shadow: none;
}

.label {
    margin-bottom: 6px;
    color: #8f96af;
    font-size: 11px;
    font-weight: 800;
}

.player-name,
.category-name,
.song-info {
    overflow: hidden;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: white;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    animation: none;
    font-size: clamp(18px, 2vw, 28px);
}

.song-info {
    font-size: clamp(17px, 1.7vw, 24px);
}

.lyrics-section {
    position: relative;
    min-height: 0;
    padding: 24px;
    border: 1px solid rgba(117, 103, 255, 0.45);
    border-left: 1px solid rgba(117, 103, 255, 0.45);
    border-radius: 20px;
    background:
        linear-gradient(135deg, rgba(117, 103, 255, 0.12), transparent 45%),
        rgba(20, 23, 44, 0.94);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.lyrics-text {
    justify-content: center;
    padding: 12px 26px;
    background: transparent;
    color: white;
    font-size: clamp(30px, 4vw, 64px);
    font-weight: 750;
    line-height: 1.35;
    text-align: center;
    animation: none;
}

.lyric-line {
    padding: 5px 14px;
    background: transparent;
    box-shadow: none;
    color: #f5f6ff;
}

.lyric-line:not(:last-child) {
    color: #8f96af;
    font-size: 0.68em;
}

.karaoke-display {
    display: grid;
    grid-template-rows: minmax(0, auto) minmax(0, 1fr) minmax(0, auto);
    align-items: center;
    width: 100%;
    height: 100%;
    min-height: 0;
    gap: clamp(12px, 2vh, 28px);
}

.lyrics-past {
    width: min(100%, 1100px);
    max-height: 3.25em;
    justify-self: center;
    overflow-y: auto;
    padding: 0 10px;
    color: #8f96af;
    font-size: clamp(18px, 2vw, 34px);
    font-weight: 650;
    line-height: 1.45;
    scrollbar-width: thin;
    scrollbar-color: rgba(117, 103, 255, 0.75) rgba(255, 255, 255, 0.08);
}

.lyrics-past::-webkit-scrollbar {
    width: 8px;
}

.lyrics-past::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
}

.lyrics-past::-webkit-scrollbar-thumb {
    background: rgba(117, 103, 255, 0.75);
    border-radius: 999px;
}

.lyrics-past-line {
    padding: 2px 0;
    text-align: center;
}

.lyrics-current {
    align-self: center;
    width: min(100%, 1200px);
    justify-self: center;
    color: #ffffff;
    font-size: clamp(34px, 5vw, 76px);
    font-weight: 950;
    line-height: 1.18;
    text-align: center;
    text-wrap: balance;
}

.lyrics-current.empty {
    color: rgba(255, 255, 255, 0.35);
}

.lyrics-next {
    min-height: 1.5em;
    width: min(100%, 1100px);
    justify-self: center;
    color: #c8ccdc;
    font-size: clamp(22px, 2.8vw, 42px);
    font-weight: 750;
    line-height: 1.28;
    text-align: center;
    opacity: 0.76;
    text-wrap: balance;
}

.lyrics-next.empty {
    opacity: 0;
}

.karaoke-display.guessing {
    grid-template-rows: auto minmax(0, 1fr) 0;
}

.karaoke-display.guessing .lyrics-current {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.karaoke-display.guessing .guess-line {
    white-space: normal;
}

.word-correct {
    color: #42e0a4;
}

.word-incorrect {
    color: #ff6b89;
}

.word-blank {
    color: #7e86a1;
}

.round-result-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1500;
    width: min(80vw, 900px);
    padding: 28px 36px;
    border-radius: 20px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
    pointer-events: none;
    color: white;
    text-align: center;
    font-size: clamp(28px, 4vw, 58px);
    font-weight: 900;
    transition: 220ms ease;
}

.round-result-banner.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.round-result-banner.correct {
    background: linear-gradient(135deg, #108a65, #20bd88);
    box-shadow: 0 24px 80px rgba(32, 189, 136, 0.38);
}

.round-result-banner.incorrect {
    background: linear-gradient(135deg, #b82f50, #ed4b70);
    box-shadow: 0 24px 80px rgba(237, 75, 112, 0.35);
}

.audio-activation {
    border: 1px solid rgba(117, 103, 255, 0.5);
    background: #171a31;
    color: white;
}

.audio-activation p {
    color: #aeb4ca !important;
}

@media (max-width: 900px) {
    .round-meta {
        grid-template-columns: 1fr 1fr;
    }

    .song-section {
        grid-column: 1 / -1;
    }

    .scoreboard {
        min-width: 160px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
