* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 允许输入框和文本区域选择文本 */
input,
textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 所有按钮默认不可选中，无点击高亮 */
button {
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --accent-color: #FFE66D;
    --bg-color: #F7F7F7;
    --text-color: #2C3E50;
    --card-bg: #FFFFFF;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 6px 30px rgba(0, 0, 0, 0.15);
    --border-radius: 20px;
    --border-radius-small: 12px;
}

body {
    font-family: 'Comic Sans MS', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    color: var(--text-color);
}

.main-wrapper {
    display: flex;
    flex: 1;
    position: relative;
    min-height: calc(100vh - 60px);
    padding: 20px;
    gap: 20px;
    align-items: flex-start;
    justify-content: center;
}

.container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 1200px;
    position: relative;
}

.wheel-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    aspect-ratio: 1;
    background: var(--card-bg);
    border-radius: 50%;
    box-shadow: var(--shadow);
    overflow: hidden;
}

#wheelCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.spin-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: 4px solid var(--card-bg);
    color: white;
    font-size: 24px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    z-index: 10;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.spin-button:hover:not(:disabled) {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: var(--shadow-hover);
}

.spin-button:active:not(:disabled) {
    transform: translate(-50%, -50%) scale(0.95);
}

.spin-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.pointer {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 30px solid var(--text-color);
    z-index: 5;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

header {
    position: relative;
    z-index: 100;
}

.design-mode-button {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 30px;
    border: none;
    border-radius: var(--border-radius-small);
    background: var(--accent-color);
    color: var(--text-color);
    font-size: 16px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    z-index: 100;
    white-space: nowrap;
    min-width: 160px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.design-mode-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.language-selector {
    position: fixed;
    top: 20px;
    right: 240px;
    display: flex;
    gap: 5px;
    z-index: 100;
}

.lang-btn {
    padding: 8px 15px;
    border: 2px solid var(--card-bg);
    border-radius: var(--border-radius-small);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-color);
    font-size: 14px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.lang-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    background: var(--card-bg);
}

.lang-btn.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.history-sidebar {
    width: 250px;
    min-width: 200px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    position: fixed;
    left: 20px;
    top: 80px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    z-index: 10;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--bg-color);
}

.history-sidebar h2 {
    margin: 0;
    color: var(--text-color);
    text-align: center;
    font-size: 18px;
    flex: 1;
}

.clear-history-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 20px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.clear-history-btn:hover {
    background: #ff5252;
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 10px 20px;
    border-radius: var(--border-radius-small);
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.design-panel {
    width: 400px;
    max-width: 90vw;
    background: var(--card-bg);
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    padding: 60px 25px 25px 25px;
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.design-panel:not(.hidden) {
    transform: translateX(0);
    pointer-events: auto;
}

.design-panel.hidden {
    transform: translateX(100%);
    pointer-events: none;
}

.design-panel-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--bg-color);
}

.exit-button {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 28px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 1001;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.exit-button:hover {
    background: #ff5252;
    transform: scale(1.1);
    box-shadow: var(--shadow-hover);
}

.design-panel-header h2 {
    color: var(--text-color);
}

.design-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.add-button {
    padding: 12px 25px;
    border: none;
    border-radius: var(--border-radius-small);
    background: var(--secondary-color);
    color: white;
    font-size: 16px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.add-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.segments-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.segment-item {
    background: var(--bg-color);
    border-radius: var(--border-radius-small);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.segment-item:hover {
    border-color: var(--secondary-color);
}

.segment-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.segment-control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.segment-control-group label {
    font-weight: bold;
    color: var(--text-color);
    font-size: 14px;
}

.segment-control-group input {
    padding: 10px;
    border: 2px solid var(--bg-color);
    border-radius: var(--border-radius-small);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.segment-control-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.segment-control-group input[type="color"] {
    height: 45px;
    cursor: pointer;
    border: none;
    border-radius: var(--border-radius-small);
}

.segment-control-group input[type="number"] {
    width: 100%;
}

.remove-button {
    padding: 8px 15px;
    border: none;
    border-radius: var(--border-radius-small);
    background: var(--primary-color);
    color: white;
    font-size: 14px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-start;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.remove-button:hover {
    background: #ff5252;
    transform: translateY(-2px);
}

.remove-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
    pointer-events: auto;
}

.result-modal.hidden {
    display: none;
    pointer-events: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.result-modal-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow-hover);
    text-align: center;
    max-width: 500px;
    width: 90%;
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

@keyframes scaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.result-modal-content h2 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 28px;
}

.result-text {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary-color);
    margin: 30px 0;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: pulse 1s ease infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.confirm-button {
    padding: 15px 40px;
    border: none;
    border-radius: var(--border-radius-small);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-size: 18px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    margin-top: 20px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.confirm-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.footer {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    text-align: center;
    color: white;
    backdrop-filter: blur(10px);
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-content p {
    margin: 0;
    font-size: 14px;
}

.privacy-link {
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
}

.privacy-link:hover {
    border-bottom-color: white;
    opacity: 0.8;
}

@media (max-width: 1024px) {
    .main-wrapper {
        flex-direction: column;
        align-items: center;
    }
    
    .history-sidebar {
        position: relative;
        left: auto;
        top: auto;
        width: 100%;
        max-width: 600px;
        max-height: 300px;
        order: -1;
    }
    
    .container {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .wheel-container {
        max-width: 90vw;
    }
    
    .spin-button {
        width: 80px;
        height: 80px;
        font-size: 20px;
    }
    
    .design-mode-button {
        top: 10px;
        right: 10px;
        padding: 10px 15px;
        font-size: 12px;
        min-width: 140px;
    }
    
    .language-selector {
        top: 10px;
        right: 160px;
        gap: 3px;
    }
    
    .lang-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .history-sidebar {
        padding: 15px;
        max-height: 200px;
    }
    
    @media (max-width: 480px) {
        .language-selector {
            top: 50px;
            right: 10px;
        }
        
        .design-mode-button {
            top: 50px;
            right: 85px;
            min-width: 120px;
        }
    }
    
    .segment-controls {
        grid-template-columns: 1fr;
    }
    
    .design-panel {
        width: 90vw;
        padding: 55px 15px 15px 15px;
    }
    
    .exit-button {
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
        font-size: 24px;
    }
    
    .result-modal-content {
        padding: 30px 20px;
    }
    
    .result-text {
        font-size: 24px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 10px;
    }
}

