* {
    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, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 20px;
}

header {
    text-align: center;
    background: white;
    color: #2d3748;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

header h1 {
    font-size: 24px;
}

.btn-management {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: #e2e8f0;
    color: #2d3748;
    padding: 8px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-management:hover {
    background: #cbd5e0;
}

.section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.section h2 {
    color: #2d3748;
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

input[type="text"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #4299e1;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.btn-primary,
.btn-danger,
.btn-secondary {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-primary {
    background: #4299e1;
    color: white;
}

.btn-primary:hover {
    background: #3182ce;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(66, 153, 225, 0.2);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
    font-size: 14px;
    padding: 8px 16px;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-full {
    width: 100%;
}

.select-full {
    width: 100%;
    margin-bottom: 15px;
}

.players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.player-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
}

.player-chip.active {
    background: #4299e1;
    color: white;
    border-color: #4299e1;
}

.player-chip button {
    background: #fc8181;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.current-display {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin-top: 10px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.category-btn {
    padding: 15px 10px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    text-align: center;
    font-weight: 500;
    color: #2d3748;
}

.category-btn:hover {
    background: #edf2f7;
    transform: translateY(-2px);
    border-color: #cbd5e0;
}

.category-btn.selected {
    background: #4299e1;
    color: white;
    border-color: #4299e1;
}

.songs-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.song-item {
    padding: 15px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.song-item:hover {
    background: #edf2f7;
    transform: translateX(5px);
    border-color: #cbd5e0;
}

.song-item.selected {
    background: #4299e1;
    color: white;
    border-color: #4299e1;
}

.song-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 5px;
}

.song-artist {
    font-size: 14px;
    opacity: 0.8;
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: #999;
    font-style: italic;
}

.lyrics-actions {
    margin-bottom: 15px;
}

.lyrics-actions button {
    width: 100%;
}

.music-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group input[type="text"] {
    width: 100%;
}

.time-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-group-inline {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group-inline label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group-inline input[type="number"] {
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
}

.music-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.music-status {
    padding: 10px;
    background: #f7fafc;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.music-status.playing {
    background: #c6f6d5;
    color: #22543d;
}

.music-status.ready {
    background: #dcfce7;
    color: #166534;
}

.music-status.warning {
    background: #fef3c7;
    color: #92400e;
}

.target-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.target-picker label {
    font-weight: 700;
    color: #333;
    font-size: 14px;
}

.target-picker select {
    min-height: 46px;
}

.target-picker-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.game-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.used-categories {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    background: #f0f4f8;
    color: #4a5568;
    font-size: 13px;
}

.used-categories:empty {
    display: none;
}

.category-btn.locked,
.song-item.locked {
    transform: none;
}

.synced-lyrics-panel,
.target-phrase-panel {
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f7fafc;
}

.manual-lyrics-panel {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: white;
}

.manual-lyrics-panel summary {
    cursor: pointer;
    font-weight: 800;
}

.loading-panel {
    margin-bottom: 15px;
    padding: 20px;
    border-radius: 8px;
    background: #f7fafc;
    text-align: center;
}

.empty-copy {
    color: #718096;
    font-style: italic;
}

.warning-copy {
    color: #b45309;
    font-weight: 700;
}

.synced-lyrics-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lyric-line {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 8px;
    font-size: 13px;
}

.lyric-time {
    color: var(--primary-dark);
    font-weight: 800;
}

.target-phrase {
    color: var(--ink);
    font-size: 18px;
    font-weight: 900;
    line-height: 1.35;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    header h1 {
        font-size: 20px;
    }
    
    .section {
        padding: 15px;
    }
}

/* Loading spinner animation */
.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #5865f2;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#lyricsLoadingIndicator p {
    margin: 0;
    padding: 0;
}

/* 2026 control-room refresh */
:root {
    --ink: #172033;
    --muted: #68738a;
    --surface: rgba(255, 255, 255, 0.94);
    --line: #e5e9f2;
    --primary: #6557e8;
    --primary-dark: #4c3fd0;
    --success: #139b72;
    --danger: #db4161;
}

body {
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 0%, rgba(101, 87, 232, 0.16), transparent 32rem),
        linear-gradient(180deg, #f7f8fc 0%, #eef1f7 100%);
}

.container {
    max-width: 760px;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 22px 24px;
    background: #171b2c;
    color: white;
}

.admin-header h1 {
    font-size: 28px;
    letter-spacing: -0.04em;
}

.eyebrow {
    display: block;
    margin-bottom: 4px;
    color: #8f84ff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.btn-management {
    position: static;
    transform: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-management:hover {
    background: rgba(255, 255, 255, 0.18);
}

.section {
    border: 1px solid rgba(229, 233, 242, 0.8);
    background: var(--surface);
    box-shadow: 0 10px 32px rgba(30, 38, 67, 0.07);
}

.current-player-section {
    position: sticky;
    top: 8px;
    z-index: 20;
    border-color: rgba(101, 87, 232, 0.3);
}

.current-player-info {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.current-player-info h3 {
    font-size: 24px;
}

.players-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.player-chip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
}

.player-chip.active {
    background: #efedff;
    color: var(--ink);
    border-color: var(--primary);
}

.player-identity {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.player-name {
    overflow: hidden;
    font-weight: 800;
    text-overflow: ellipsis;
}

.player-status {
    color: var(--muted);
    font-size: 11px;
}

.score-editor {
    display: inline-grid;
    grid-template-columns: 34px 48px 34px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: white;
}

.score-editor button,
.score-editor input {
    width: 100%;
    height: auto;
    min-width: 0;
    padding: 8px 0;
    border: 0;
    border-radius: 0;
    background: white;
    color: var(--ink);
    text-align: center;
    font-size: 16px;
    font-weight: 800;
}

.score-editor button {
    cursor: pointer;
}

.score-editor button:hover {
    background: #f0eeff;
    color: var(--primary);
}

.score-editor input {
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
    appearance: textfield;
}

.score-editor input::-webkit-inner-spin-button {
    appearance: none;
}

.section-title-row,
.answer-input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-title-row h2 {
    margin: 0;
    padding: 0;
    border: 0;
}

.status-badge {
    flex: none;
    padding: 7px 10px;
    border-radius: 999px;
    background: #f0f2f7;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.status-badge.active {
    background: #e9e6ff;
    color: var(--primary-dark);
}

.answer-input-row {
    margin-top: 18px;
}

.heard-answer {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid #dcd8ff;
    border-radius: 12px;
    background: #f6f4ff;
}

.heard-answer-label {
    display: block;
    margin-bottom: 5px;
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.heard-answer p {
    margin: 0;
    color: var(--ink);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.45;
}

.heard-answer p.empty {
    color: var(--muted);
    font-size: 14px;
    font-style: italic;
    font-weight: 500;
}

.decision-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.btn-success {
    padding: 12px 20px;
    border: 0;
    border-radius: 8px;
    background: var(--success);
    color: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
}

.btn-success:hover:not(:disabled) {
    background: #0f805f;
    transform: translateY(-1px);
}

.current-player-display {
    padding: 4px 0;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none !important;
    box-shadow: none !important;
}

.helper-text {
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
}

.success-text {
    color: var(--success);
    font-weight: 700;
}

.error-text {
    color: var(--danger);
    font-weight: 700;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

@media (max-width: 620px) {
    .players-list,
    .decision-buttons {
        grid-template-columns: 1fr;
    }

    .player-chip {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .current-player-section {
        top: 4px;
    }
}

@media (max-width: 430px) {
    .admin-header {
        align-items: flex-start;
    }

    .btn-management {
        padding: 8px 10px;
        font-size: 12px;
    }

    .answer-input-row {
        align-items: stretch;
        flex-direction: column;
    }
}
