:root {
    --background: #1A1A1A;
    --surface: #2D2D2D;
    --primary: #FF8040;
    --primary-hover: #FF9966;
    --text: #E6E6E6;
    --text-secondary: #A0A0A0;
    --border: #404040;
    --error: #FF4D4D;
    --success: #22C55E;
}

body {
    background-color: var(--background);
    color: var(--text);
    margin: 0;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;  /* zmniejszamy z 0.875rem na 0.75rem */
}

.game-mode-selector {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.mode-button {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mode-button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Sekcja rankingu - kontener dla przycisków */
.ranking-section {
    margin: 1rem 0;
}

.ranking-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

/* Zunifikowane style dla przycisków rankingu */
#rankingToggle,
.admin-toggle {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    height: auto;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#rankingToggle:hover,
.admin-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Stan aktywny dla przycisku admina */
.admin-toggle.active {
    background: rgba(255, 128, 64, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.admin-toggle.active:hover {
    background: rgba(255, 128, 64, 0.15);
}

/* Panel administratora z animacjami */
.admin-panel {
    margin-top: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 1;
    max-height: 300px;
}

.admin-panel.hidden {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.admin-panel.visible {
    opacity: 1;
    max-height: 300px;
    margin-top: 1rem;
}

.admin-section {
    background: rgba(255, 128, 64, 0.08);
    border: 1px solid rgba(255, 128, 64, 0.25);
    border-radius: 0.75rem;
    overflow: hidden;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 128, 64, 0.12);
    border-bottom: 1px solid rgba(255, 128, 64, 0.2);
}

.admin-header h4 {
    margin: 0;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 500;
}

.close-admin-button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-admin-button:hover {
    background: rgba(255, 128, 64, 0.2);
    color: var(--primary-hover);
}

.admin-content {
    padding: 1rem;
}

.admin-description {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
}

.admin-button {
    font-size: 0.875rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 128, 64, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    transition: all 0.2s ease;
}

.admin-button:hover {
    background: rgba(255, 128, 64, 0.2);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
}

.admin-button.danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
    color: var(--error);
}

.admin-button.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ff6b6b;
    transform: translateY(-1px);
}

/* Responsive design */
@media (max-width: 640px) {
    .ranking-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    #rankingToggle,
    .admin-toggle {
        width: 100%;
    }
    
    .admin-content .buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .admin-button {
        width: 100%;
    }
    
    .admin-header {
        padding: 0.75rem;
    }
    
    .admin-content {
        padding: 0.75rem;
    }
}

/* Status bar i timer */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
}

.status-bar .buttons {    /* Dodaj tutaj */
    display: flex;
    gap: 1rem;
    margin: 0;
    align-items: center;
}

.round-info {
    color: var(--primary);
    font-weight: 500;
}

.timer {
    font-family: monospace;
    font-weight: 500;
    color: var(--primary);
    background: var(--surface);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Sekcja rankingu */
.ranking-section {
    margin: 1rem 0;
}

.ranking-content {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 0.75rem;
    margin-top: 1rem;
}

.ranking-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ranking-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.ranking-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.ranking-table th,
.ranking-table td {
    padding: 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.ranking-table th {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Input sections */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 32rem;
    margin: 2rem auto;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #3D3D3D;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    color: var(--text);
    transition: all 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 128, 64, 0.1);
}

/* Buttons */
.buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

button {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    cursor: pointer;
}

.primary-button {
    background: var(--primary);
    color: white;
    border: none;
}

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

.outline-button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.outline-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.header-buttons {
    display: flex;
    justify-content: left;
    gap: 1rem;
    margin: 2rem 0;  /* Zwiększamy margines górny i dolny */
}

/* Feedback and hints */
.feedback {
    text-align: center;
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 0.5rem;
}

.feedback.correct {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.feedback.incorrect {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.hint {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
    margin: 1rem 0;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: 1rem;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.congratulations {
    text-align: center;
}

.congratulations h2 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.new-record {
    color: #FFD700;
    font-weight: bold;
    animation: pulse 2s infinite;
}

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

/* Responsive design */
@media (max-width: 640px) {
    body {
        padding: 1rem;
    }

    .app-container {
        padding: 1rem;
    }

    .buttons {
        flex-direction: column;
    }

    .ranking-tabs {
        flex-direction: column;
    }

    .ranking-table {
        font-size: 0.875rem;
    }
}

.logout-container {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.loading-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.spinner {
    margin: 1rem auto;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.session-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    margin: 1rem;
}

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

/* Style dla modalu z instrukcją */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    color: var(--primary);
}

.close-button {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.close-button:hover {
    color: var(--primary);
}

.modal-body {
    margin-top: 1rem;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 1rem;
}

.instruction-text {
    line-height: 1.6;
    color: var(--text);
}