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

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;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1000px;
    width: 100%;
}

.main-content {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.wheel-section {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.items-section {
    flex: 1;
    min-width: 0;
}

.settings-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.config-btn {
    width: 100%;
    padding: 12px 20px;
    background: #f8f9fa;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.config-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.config-btn.active {
    background: #667eea;
    color: white;
}

.settings-section {
    display: flex;
    gap: 10px;
}

.settings-content {
    margin-top: 20px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
    animation: slideDown 0.3s ease;
}

.settings-content.hidden {
    display: none;
}

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

.settings-content h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.setting-item {
    margin-bottom: 15px;
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #555;
    font-size: 1em;
}

.setting-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.limit-input {
    width: 80px;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    text-align: center;
}

.limit-input:focus {
    outline: none;
    border-color: #667eea;
}

.usage-info {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.usage-info p {
    color: #555;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.usage-info p:last-child {
    margin-bottom: 0;
}

.usage-info span {
    color: #667eea;
    font-weight: 700;
    font-size: 1.2em;
}

.title {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2em;
    font-weight: 600;
}

.wheel-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
}

#wheelCanvas {
    display: block;
    max-width: 400px;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 30px solid #ff6b6b;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    z-index: 10;
}

.start-btn {
    display: block;
    padding: 15px 50px;
    font-size: 1.2em;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.start-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.start-btn:active:not(:disabled) {
    transform: translateY(0);
}

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

.items-section h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
}

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

#itemInput {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

#itemInput:focus {
    outline: none;
    border-color: #667eea;
}

.add-btn {
    padding: 12px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.items-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
}

.item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.item:last-child {
    margin-bottom: 0;
}

.item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.item-name {
    flex: 1;
    color: #333;
    font-weight: 500;
}

.delete-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: #ee5a5a;
    transform: scale(1.05);
}

.clear-btn {
    width: 100%;
    padding: 12px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: #ee5a5a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 30px;
    font-size: 0.95em;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.modal-content h2 {
    color: #333;
    margin-bottom: 20px;
}

.modal-content p {
    font-size: 1.3em;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 25px;
}

.modal-btn {
    padding: 12px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.config-modal {
    text-align: left;
    max-width: 450px;
}

.config-modal h2 {
    margin-bottom: 25px;
}

.config-modal .modal-btn {
    margin-top: 20px;
}

/* 历史记录弹窗样式 */
.history-modal {
    max-width: 500px;
}

.history-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.clear-history-btn {
    padding: 8px 16px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.clear-history-btn:hover {
    background: #ee5a5a;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history-item-content {
    flex: 1;
}

.history-item-name {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.history-item-time {
    font-size: 0.85em;
    color: #999;
}

.history-item-date {
    font-size: 0.85em;
    color: #666;
}

.empty-history {
    text-align: center;
    color: #999;
    padding: 30px;
    font-size: 0.95em;
}

/* 转盘悬停提示 */
.wheel-tooltip {
    display: none;
    position: fixed;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    animation: tooltipFadeIn 0.2s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Responsive design */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }

    .wheel-section {
        width: 100%;
    }

    .items-section {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 25px;
        border-radius: 15px;
    }

    .title {
        font-size: 1.6em;
        margin-bottom: 25px;
    }

    .wheel-container {
        padding: 10px 0;
    }
}

    .start-btn {
        padding: 12px 40px;
        font-size: 1.1em;
    }

    .items-section h2 {
        font-size: 1.2em;
    }

    .input-group {
        flex-direction: column;
    }

    .add-btn {
        width: 100%;
    }
}

@media (max-width: 400px) {
    #wheelCanvas {
        max-width: 250px;
    }

    .title {
        font-size: 1.4em;
    }
}
