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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --disabled-color: #9ca3af;
    --disabled-bg: #f3f4f6;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --background: #ffffff;
    --error-color: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 1rem;
    color: var(--text-primary);
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--background);
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 1.5rem;
    text-align: center;
}

header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    margin-bottom: 0.75rem;
}

.reference-link {
    margin-top: 0.75rem;
}

.reference-link a {
    color: white;
    text-decoration: none;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    transition: background 0.2s;
}

.reference-link a:hover {
    background: rgba(255, 255, 255, 0.3);
}

.password-section,
.name-section,
.voting-section {
    padding: 2rem 1.5rem;
}

.password-section label,
.name-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.password-section input,
.name-section input {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}

.password-section input:focus,
.name-section input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.password-section button,
.name-section button {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.password-section button:hover:not(:disabled),
.name-section button:hover:not(:disabled) {
    background: var(--primary-hover);
}

.password-section button:disabled,
.name-section button:disabled {
    background: var(--disabled-color);
    cursor: not-allowed;
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

.hidden {
    display: none !important;
}

.user-info {
    background: var(--disabled-bg);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
}

.user-info p {
    color: var(--text-secondary);
}

.user-info strong {
    color: var(--primary-color);
}

.topics-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.topic-item {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s;
    background: var(--background);
}

.topic-item.available {
    cursor: pointer;
}

.topic-item.available:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.topic-item.available:active {
    transform: translateY(0);
}

.topic-item.chosen {
    background: var(--disabled-bg);
    border-color: var(--disabled-color);
    cursor: not-allowed;
}

.topic-item.selected-by-user {
    background: #ecfdf5;
    border-color: var(--success-color);
}

.topic-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.topic-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.topic-item.chosen .topic-status {
    color: var(--disabled-color);
}

.topic-item.selected-by-user .topic-status {
    color: var(--success-color);
    font-weight: 600;
}

.custom-topic-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
}

.divider {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    position: relative;
    background: var(--background);
    padding: 0 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
}

.custom-topic-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.custom-topic-section input {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}

.custom-topic-section input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.custom-topic-section button {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.custom-topic-section button:hover:not(:disabled) {
    background: #059669;
}

.custom-topic-section button:disabled {
    background: var(--disabled-color);
    cursor: not-allowed;
}

.status-bar {
    background: var(--disabled-bg);
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
    margin-top: 1.5rem;
}

.status-bar p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Loading animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Responsive design */
@media (min-width: 768px) {
    body {
        padding: 2rem;
    }

    header h1 {
        font-size: 2.25rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .name-section,
    .voting-section {
        padding: 2.5rem 2rem;
    }

    .topics-list {
        gap: 1rem;
    }

    .topic-item {
        padding: 1.25rem;
    }

    .topic-name {
        font-size: 1rem;
    }

    .topic-status {
        font-size: 0.875rem;
    }
}
