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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 500px;
    margin: 0 auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

h1 {
    color: white;
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    color: rgba(255,255,255,0.9);
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

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

input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

#join-key {
    text-transform: uppercase;
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 8px;
    font-weight: bold;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

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

.btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn.secondary {
    background: #f0f0f0;
    color: #333;
    width: 100%;
    margin-top: 10px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.divider {
    color: rgba(255,255,255,0.7);
    text-align: center;
    margin: 20px 0;
    font-size: 0.9rem;
}

.error {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 10px;
}

.options-list {
    list-style: none;
    margin-bottom: 20px;
}

.options-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
}

.options-list li span {
    color: #333;
}

.options-list li button {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 8px;
}

.key-display {
    font-size: 3rem;
    font-weight: bold;
    text-align: center;
    color: #667eea;
    letter-spacing: 12px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 15px;
}

.share-url-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.share-url {
    color: #667eea;
    font-size: 0.85rem;
    text-align: center;
    word-break: break-all;
    font-family: monospace;
}

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

.btn-group .btn {
    flex: 1;
}

.btn.secondary-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn.secondary-outline:hover {
    background: rgba(102, 126, 234, 0.1);
}

.copy-feedback {
    text-align: center;
    color: #27ae60;
    font-size: 0.9rem;
    min-height: 20px;
}

.vote-list {
    list-style: none;
    margin-bottom: 20px;
}

.vote-list li {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
}

.vote-list li:active {
    cursor: grabbing;
}

.vote-list li.dragging {
    opacity: 0.5;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.vote-list li .rank {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 16px;
    flex-shrink: 0;
}

.vote-list li .drag-handle {
    color: #aaa;
    margin-right: 12px;
    font-size: 1.2rem;
}

.vote-list li .option-text {
    flex: 1;
    color: #333;
}

.vote-count {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.vote-count span {
    font-weight: bold;
    color: #667eea;
}

.results-list {
    list-style: none;
}

.results-list li {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.results-list li:first-child {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
}

.results-list li:first-child .rank,
.results-list li:first-child .option-text,
.results-list li:first-child .score {
    color: white;
}

.results-list li:first-child .rank {
    background: rgba(255,255,255,0.3);
}

.results-list li .rank {
    width: 30px;
    height: 30px;
    background: #e0e0e0;
    color: #666;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 16px;
    flex-shrink: 0;
}

.results-list li .option-text {
    flex: 1;
    color: #333;
    font-weight: 500;
}

.results-list li .score {
    color: #666;
    font-size: 0.9rem;
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }

    .card {
        padding: 20px;
    }

    .key-display {
        font-size: 2rem;
        letter-spacing: 8px;
    }
}
