/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #7c3aed;
    --secondary-color: #ec4899;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --danger-color: #f43f5e;
    --warning-color: #fbbf24;
    --bg-color: #0a0a1a;
    --card-bg: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
    --text-color: #ffffff;
    --text-secondary: #94a3b8;
    --border-radius: 20px;
    --shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.6);
    --glow: 0 0 20px rgba(124, 58, 237, 0.5);
    --glow-pink: 0 0 20px rgba(236, 72, 153, 0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: radial-gradient(ellipse at top, #1a1a2e 0%, #0a0a1a 50%, #000000 100%);
    background-attachment: fixed;
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    user-select: none;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
    pointer-events: none;
    animation: bgPulse 15s ease-in-out infinite;
    z-index: 0;
}

@keyframes bgPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

#app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* 页面切换 */
.page {
    display: none;
    animation: fadeIn 0.3s ease;
    min-height: 100vh;
    padding-bottom: 100px;
}

.page.active {
    display: block;
}

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

/* 首页样式 */
.app-header {
    text-align: center;
    padding: 50px 20px 40px;
    background: linear-gradient(135deg, #7c3aed 0%, #ec4899 50%, #06b6d4 100%);
    border-radius: 0 0 40px 40px;
    box-shadow: 0 10px 40px rgba(124, 58, 237, 0.5);
    position: relative;
    overflow: hidden;
}

.language-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 10;
}

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

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

.app-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(255, 255, 255, 0.1) 50%, 
        transparent 70%);
    animation: headerShine 3s ease-in-out infinite;
}

@keyframes headerShine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.app-header h1 {
    font-size: 38px;
    margin-bottom: 12px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5), 
                 2px 2px 8px rgba(0, 0, 0, 0.5);
    font-weight: 900;
    letter-spacing: 2px;
    animation: titlePulse 2s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

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

.subtitle {
    font-size: 17px;
    opacity: 0.95;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 1;
    font-weight: 500;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 20px;
}

.tool-card {
    background: linear-gradient(145deg, #1e1e3e 0%, #16213e 100%);
    border-radius: var(--border-radius);
    padding: 35px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(124, 58, 237, 0.2) 0%, 
        rgba(236, 72, 153, 0.2) 50%,
        rgba(6, 182, 212, 0.2) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-card:active {
    transform: scale(0.95);
}

.tool-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 60px rgba(124, 58, 237, 0.4),
                0 0 40px rgba(236, 72, 153, 0.3);
    border-color: rgba(124, 58, 237, 0.5);
}

.tool-icon {
    font-size: 56px;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    animation: iconFloat 3s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.tool-card:hover .tool-icon {
    animation: iconBounce 0.6s ease;
    filter: drop-shadow(0 8px 16px rgba(124, 58, 237, 0.6));
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    25% { transform: translateY(-12px) scale(1.1); }
    75% { transform: translateY(-4px) scale(1.05); }
}

.tool-card h3 {
    font-size: 19px;
    margin-bottom: 10px;
    font-weight: 700;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tool-card p {
    font-size: 14px;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
    font-weight: 500;
}

.tool-intro {
    margin: 20px 20px 15px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(124, 58, 237, 0.12);
    border: 1px solid rgba(124, 58, 237, 0.3);
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 14px;
}

.player-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
}

.player-actions .btn {
    flex: 1;
}

#bottle-page .tool-intro {
    margin-bottom: 30px;
}

#bottle-page .bottle-container {
    margin-top: 60px;
}

.info-preview {
    margin: 30px 0 110px;
    padding: 24px;
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.15), rgba(6, 182, 212, 0.15));
    border: 1px solid rgba(124, 58, 237, 0.35);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.info-preview h2 {
    font-size: 22px;
    margin-bottom: 10px;
}

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

.info-links {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.info-link {
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(124, 58, 237, 0.4);
    background: rgba(30, 41, 89, 0.7);
    color: var(--text-color);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.info-link:hover {
    transform: translateY(-2px);
    border-color: rgba(236, 72, 153, 0.7);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4);
}

.page.info-page {
    padding-bottom: 120px;
}

.info-content {
    padding: 24px 20px 140px;
    line-height: 1.7;
}

.info-section {
    margin-bottom: 24px;
    padding: 18px 20px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(124, 58, 237, 0.25);
    box-shadow: inset 0 0 20px rgba(124, 58, 237, 0.08);
}

.info-section h3 {
    margin-bottom: 10px;
    font-size: 18px;
}

.info-list {
    padding-left: 20px;
    margin: 0;
    color: var(--text-secondary);
}

.info-list li {
    margin-bottom: 6px;
}

.contact-card {
    background: rgba(20, 29, 74, 0.9);
}

.contact-link {
    display: inline-block;
    margin-top: 8px;
    color: #38bdf8;
    font-weight: 600;
}

.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    gap: 12px;
    padding: 18px 20px;
    background: linear-gradient(180deg, rgba(30, 30, 62, 0.9) 0%, rgba(22, 33, 62, 0.95) 100%);
    backdrop-filter: blur(20px);
    border-top: 2px solid rgba(124, 58, 237, 0.3);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.footer-btn {
    flex: 1;
    padding: 14px;
    background: linear-gradient(145deg, #1e1e3e, #16213e);
    border: 2px solid rgba(124, 58, 237, 0.3);
    border-radius: 14px;
    color: var(--text-color);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.footer-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.4), transparent);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
    border-radius: 50%;
}

.footer-btn:hover::before {
    width: 300px;
    height: 300px;
}

.footer-btn:hover {
    border-color: rgba(124, 58, 237, 0.8);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
    transform: translateY(-2px);
}

.footer-btn:active {
    transform: scale(0.95);
}

/* 页面头部 */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 20px;
    background: linear-gradient(145deg, #1e1e3e, #16213e);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    border-bottom: 2px solid rgba(124, 58, 237, 0.3);
}

.page-header h2 {
    font-size: 22px;
    flex: 1;
    text-align: center;
    font-weight: 800;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.back-btn, .config-btn {
    padding: 10px 18px;
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.2), rgba(236, 72, 153, 0.2));
    border: 2px solid rgba(124, 58, 237, 0.4);
    border-radius: 10px;
    color: var(--text-color);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.back-btn:hover, .config-btn:hover {
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.4), rgba(236, 72, 153, 0.4));
    border-color: rgba(124, 58, 237, 0.8);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
    transform: translateY(-2px);
}

.back-btn:active, .config-btn:active {
    transform: scale(0.95);
}

/* 按钮样式 */
.btn {
    padding: 16px 32px;
    border: none;
    border-radius: 15px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.6),
                0 0 30px rgba(236, 72, 153, 0.4);
    transform: translateY(-3px);
}

.btn-secondary {
    background: linear-gradient(145deg, #1e1e3e, #16213e);
    color: var(--text-color);
    border: 2px solid rgba(124, 58, 237, 0.3);
}

.btn-secondary:hover {
    border-color: rgba(124, 58, 237, 0.8);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
}

/* 转盘页面 */
.wheel-container {
    padding: 20px;
}

.wheel-mode-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: var(--card-bg);
    padding: 5px;
    border-radius: 12px;
}

.mode-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

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

.canvas-wrapper {
    position: relative;
    width: 100%;
    max-width: 350px;
    margin: 30px auto;
}

#wheelCanvas {
    width: 100%;
    height: auto;
    display: block;
    /* 优化Canvas渲染质量 - 使用高质量插值 */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: auto;
    /* 启用硬件加速 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
    /* 抗锯齿 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* 确保Canvas缩放时使用高质量算法 */
    -ms-interpolation-mode: bicubic;
}

.wheel-pointer {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-top: 30px solid #f43f5e;
    filter: drop-shadow(0 4px 12px rgba(244, 63, 94, 0.8))
            drop-shadow(0 0 20px rgba(244, 63, 94, 0.6));
    z-index: 10;
    animation: pointerPulse 1.5s ease-in-out infinite;
}

@keyframes pointerPulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.1); }
}

.wheel-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.wheel-controls button {
    flex: 1;
}

.options-list {
    background: linear-gradient(145deg, #1e1e3e, #16213e);
    border-radius: var(--border-radius);
    padding: 18px;
    max-height: 320px;
    overflow-y: auto;
    border: 2px solid rgba(124, 58, 237, 0.2);
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.3);
}

.option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(124, 58, 237, 0.1);
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid rgba(124, 58, 237, 0.2);
    transition: all 0.3s ease;
}

.option-item:hover {
    background: rgba(124, 58, 237, 0.15);
    border-color: rgba(124, 58, 237, 0.4);
    transform: translateX(4px);
}

.option-item input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    background: linear-gradient(145deg, rgba(30, 30, 62, 0.6), rgba(22, 33, 62, 0.6));
    border: 2px solid rgba(124, 58, 237, 0.3);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.option-item input[type="text"]:focus {
    outline: none;
    border-color: rgba(124, 58, 237, 0.8);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

.option-item input[type="number"] {
    width: 70px;
    padding: 10px 12px;
    background: linear-gradient(145deg, rgba(30, 30, 62, 0.6), rgba(22, 33, 62, 0.6));
    border: 2px solid rgba(124, 58, 237, 0.3);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
}

.option-item input[type="number"]:focus {
    outline: none;
    border-color: rgba(124, 58, 237, 0.8);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

.option-item button {
    padding: 8px 12px;
    background: var(--danger-color);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
}

/* 骰子页面 */
.dice-count {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dice-count button {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    color: var(--text-color);
    font-size: 18px;
    cursor: pointer;
}

.dice-container {
    width: 100%;
    height: 400px;
    position: relative;
    background: linear-gradient(135deg, #0a0a1a 0%, #1e1e3e 100%);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 
        inset 0 4px 20px rgba(0, 0, 0, 0.3),
        0 8px 32px rgba(124, 58, 237, 0.3);
}

.dice-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.dice {
    width: 90px;
    height: 90px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 52px;
    font-weight: bold;
    color: #f43f5e;
    box-shadow: 0 12px 30px rgba(244, 63, 94, 0.4),
                0 0 20px rgba(124, 58, 237, 0.2);
    position: relative;
    transition: all 0.3s ease;
    border: 3px solid rgba(124, 58, 237, 0.2);
}

.dice::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    border-radius: 16px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dice:hover::before {
    opacity: 1;
}

.dice.rolling {
    animation: diceRoll 0.6s ease-in-out infinite;
}

@keyframes diceRoll {
    0%, 100% { 
        transform: rotate(0deg) scale(1); 
        box-shadow: 0 12px 30px rgba(244, 63, 94, 0.4);
    }
    25% { 
        transform: rotate(90deg) scale(1.1); 
        box-shadow: 0 16px 40px rgba(124, 58, 237, 0.6);
    }
    50% { 
        transform: rotate(180deg) scale(1); 
        box-shadow: 0 12px 30px rgba(236, 72, 153, 0.4);
    }
    75% { 
        transform: rotate(270deg) scale(1.1); 
        box-shadow: 0 16px 40px rgba(6, 182, 212, 0.6);
    }
}

.dice-controls {
    text-align: center;
    padding: 20px;
}

.hint {
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* 硬币页面 */
.coin-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
    perspective: 1000px;
}

.coin {
    width: 150px;
    height: 150px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s ease-out;
}

.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    font-weight: bold;
    backface-visibility: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    border: 4px solid rgba(255, 255, 255, 0.3);
}

.coin-heads {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    color: white;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4),
                 0 0 20px rgba(251, 191, 36, 0.6);
}

.coin-tails {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 50%, #475569 100%);
    color: white;
    transform: rotateY(180deg);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4),
                 0 0 20px rgba(148, 163, 184, 0.6);
}

.coin.flip-heads {
    animation: flipHeads 1s ease-out forwards;
}

.coin.flip-tails {
    animation: flipTails 1s ease-out forwards;
}

@keyframes flipHeads {
    0% { transform: rotateY(0); }
    100% { transform: rotateY(1800deg); }
}

@keyframes flipTails {
    0% { transform: rotateY(0); }
    100% { transform: rotateY(1980deg); }
}

.coin-controls {
    text-align: center;
    padding: 20px;
}

.coin-result {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: var(--warning-color);
    min-height: 40px;
}

#coin-skin {
    padding: 10px 14px;
    background: linear-gradient(145deg, #1e1e3e, #16213e);
    border: 2px solid rgba(124, 58, 237, 0.4);
    border-radius: 10px;
    color: var(--text-color);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
}

#coin-skin:focus {
    outline: none;
    border-color: rgba(124, 58, 237, 0.8);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
}

#coin-skin option {
    background: #1e1e3e;
    color: var(--text-color);
    padding: 10px;
    font-weight: 600;
}

/* 随机数页面 */
.random-config {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.config-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-group label {
    min-width: 80px;
    font-size: 16px;
}

.config-group input[type="number"] {
    flex: 1;
    padding: 14px;
    background: linear-gradient(145deg, #1e1e3e, #16213e);
    border: 2px solid rgba(124, 58, 237, 0.3);
    border-radius: 10px;
    color: var(--text-color);
    font-size: 17px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.config-group input[type="number"]:focus {
    outline: none;
    border-color: rgba(124, 58, 237, 0.8);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
}

.config-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.random-controls {
    text-align: center;
    padding: 20px;
}

.random-result {
    padding: 20px;
    margin: 20px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    min-height: 100px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.random-number {
    padding: 18px 30px;
    background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
    border-radius: 16px;
    font-size: 28px;
    font-weight: 900;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.5),
                0 0 30px rgba(236, 72, 153, 0.3);
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.random-number::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(255, 255, 255, 0.2) 50%, 
        transparent 70%);
    animation: numberShine 2s ease-in-out infinite;
}

@keyframes numberShine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-10deg);
    }
    50% {
        transform: scale(1.1) rotate(5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* 翻牌游戏 */
.card-count {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-count input {
    width: 60px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-color);
    text-align: center;
}

.card-count button {
    padding: 6px 12px;
    background: var(--primary-color);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    row-gap: 30px;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.card-wrapper {
    width: 100%;
    height: 0;
    padding-bottom: 150%;
    position: relative;
    z-index: 1;
}

.card-wrapper:hover,
.card-wrapper.flipped-wrapper {
    z-index: 10;
}

.card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.2s ease;
    top: 0;
    left: 0;
    transform-origin: center center;
}

.card-front {
    background: linear-gradient(135deg, #7c3aed 0%, #ec4899 50%, #06b6d4 100%);
    font-size: 56px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    position: absolute;
    overflow: hidden;
    opacity: 1;
    transform: scaleX(1);
}

.card.flipped .card-front {
    opacity: 0;
    transform: scaleX(0);
    pointer-events: none;
    transition-delay: 0s, 0s;
}

.card-front::before {
    content: '?';
    position: absolute;
    font-size: 120px;
    opacity: 0.1;
    animation: questionFloat 3s ease-in-out infinite;
}

@keyframes questionFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

.card-back {
    background: linear-gradient(145deg, #1e1e3e, #16213e);
    font-size: 36px;
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transform: scaleX(0);
    transition-delay: 0s, 0s;
}

.card.flipped .card-back {
    opacity: 1;
    transform: scaleX(1);
    pointer-events: auto;
    transition-delay: 0.15s, 0.15s;
}

/* 炸弹游戏 */
.bomb-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 20px;
    max-width: 400px;
    margin: 0 auto;
}

.bomb-cell {
    aspect-ratio: 1;
    background: linear-gradient(145deg, #1e1e3e, #16213e);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 52px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(124, 58, 237, 0.3);
    position: relative;
    overflow: hidden;
}

.bomb-cell::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.3), transparent);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
    border-radius: 50%;
}

.bomb-cell:hover::before {
    width: 200%;
    height: 200%;
}

.bomb-cell:active {
    transform: scale(0.9);
}

.bomb-cell.revealed {
    background: linear-gradient(135deg, #10b981, #059669);
    cursor: default;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.5),
                0 0 30px rgba(16, 185, 129, 0.3);
    animation: successPop 0.4s ease;
}

@keyframes successPop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.bomb-cell.bomb {
    background: linear-gradient(135deg, #f43f5e, #be123c);
    animation: explosion 0.6s ease;
    box-shadow: 0 0 60px rgba(244, 63, 94, 0.8),
                0 0 100px rgba(244, 63, 94, 0.4);
}

@keyframes explosion {
    0% { 
        transform: scale(1) rotate(0deg); 
        filter: brightness(1);
    }
    25% { 
        transform: scale(1.3) rotate(10deg); 
        filter: brightness(2);
    }
    50% { 
        transform: scale(0.9) rotate(-10deg); 
        filter: brightness(1.5);
    }
    75% { 
        transform: scale(1.2) rotate(5deg); 
        filter: brightness(1.8);
    }
    100% { 
        transform: scale(1) rotate(0deg); 
        filter: brightness(1);
    }
}

/* 瓶子页面 */
.bottle-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 40px auto;
    border: 3px dashed rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 100% 100%;
    background-position: center center;
}

.bottle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 3s cubic-bezier(0.25, 0.1, 0.25, 1);
    width: 70px;
    height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bottle-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
}

.player-positions {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.player-marker {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(145deg, #7c3aed, #ec4899);
    border: 3px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    box-shadow: 
        0 4px 12px rgba(124, 58, 237, 0.5),
        0 0 20px rgba(236, 72, 153, 0.3);
    transition: all 0.3s ease;
    animation: playerPulse 2s ease-in-out infinite;
    z-index: 5;
}

.player-marker.selected {
    background: linear-gradient(145deg, #fbbf24, #f59e0b);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 
        0 6px 20px rgba(251, 191, 36, 0.7),
        0 0 40px rgba(245, 158, 11, 0.5);
    transform: translate(-50%, -50%);
    animation: selectedPlayer 1s ease-in-out infinite;
    z-index: 10;
}

@keyframes playerPulse {
    0%, 100% {
        box-shadow: 
            0 4px 12px rgba(124, 58, 237, 0.5),
            0 0 20px rgba(236, 72, 153, 0.3);
    }
    50% {
        box-shadow: 
            0 6px 16px rgba(124, 58, 237, 0.7),
            0 0 30px rgba(236, 72, 153, 0.5);
    }
}

@keyframes selectedPlayer {
    0%, 100% {
        box-shadow: 
            0 6px 20px rgba(251, 191, 36, 0.7),
            0 0 40px rgba(245, 158, 11, 0.5);
    }
    50% {
        box-shadow: 
            0 8px 24px rgba(251, 191, 36, 0.9),
            0 0 50px rgba(245, 158, 11, 0.7);
    }
}

.bottle-controls {
    text-align: center;
    padding: 20px;
    margin-top: 80px;
}

.bottle-players {
    padding: 20px;
}

.player-inputs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.player-name {
    padding: 14px;
    background: linear-gradient(145deg, #1e1e3e, #16213e);
    border: 2px solid rgba(124, 58, 237, 0.3);
    border-radius: 10px;
    color: var(--text-color);
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.player-name:focus {
    outline: none;
    border-color: rgba(124, 58, 237, 0.8);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
}

/* Magic 8 Ball */
.magic8ball-container {
    padding: 30px 20px;
    text-align: center;
}

.magic8ball-instruction {
    margin-bottom: 30px;
}

.magic8ball-instruction p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

.magic8ball-wrapper {
    width: 300px;
    height: 300px;
    margin: 40px auto;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s ease;
}

.magic8ball-wrapper:hover {
    transform: scale(1.05);
}

.ball-surface {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 30%, #2d2d2d, #000000);
    border-radius: 50%;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.8),
        inset -10px -10px 30px rgba(0, 0, 0, 0.8),
        inset 10px 10px 30px rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.ball-surface::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 20%;
    width: 40%;
    height: 40%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2), transparent);
    border-radius: 50%;
}

.ball-window {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        inset 0 4px 10px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(59, 130, 246, 0.5);
    animation: windowGlow 2s ease-in-out infinite;
}

@keyframes windowGlow {
    0%, 100% { 
        box-shadow: 
            inset 0 4px 10px rgba(0, 0, 0, 0.5),
            0 0 20px rgba(59, 130, 246, 0.5);
    }
    50% { 
        box-shadow: 
            inset 0 4px 10px rgba(0, 0, 0, 0.5),
            0 0 30px rgba(59, 130, 246, 0.8);
    }
}

.ball-answer {
    font-size: 16px;
    font-weight: 900;
    color: white;
    text-align: center;
    padding: 15px;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

.magic8ball-wrapper.shaking {
    animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-10px, -10px) rotate(-5deg); }
    20% { transform: translate(10px, 10px) rotate(5deg); }
    30% { transform: translate(-10px, 10px) rotate(-5deg); }
    40% { transform: translate(10px, -10px) rotate(5deg); }
    50% { transform: translate(-10px, -10px) rotate(-5deg); }
    60% { transform: translate(10px, 10px) rotate(5deg); }
    70% { transform: translate(-10px, 10px) rotate(-5deg); }
    80% { transform: translate(10px, -10px) rotate(5deg); }
    90% { transform: translate(-10px, -10px) rotate(-5deg); }
}

#shake-ball-btn {
    margin-top: 30px;
    font-size: 18px;
    padding: 16px 40px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    animation: modalFadeIn 0.3s ease;
}

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

.modal-content {
    background: linear-gradient(145deg, #1e1e3e, #16213e);
    border-radius: var(--border-radius);
    max-width: 420px;
    width: 90%;
    max-height: 80vh;
    overflow: auto;
    animation: modalSlideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 30px 80px rgba(124, 58, 237, 0.4),
                0 0 100px rgba(236, 72, 153, 0.3);
    border: 2px solid rgba(124, 58, 237, 0.5);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-100px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 30px 20px;
}

.result-display {
    text-align: center;
    font-size: 56px;
    font-weight: 900;
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #fbbf24);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: resultGlow 3s ease-in-out infinite,
               gradientShift 3s linear infinite;
    text-shadow: 0 0 40px rgba(251, 191, 36, 0.5);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

@keyframes resultGlow {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes gradientShift {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-footer button {
    flex: 1;
}

/* 模板选择器 */
.template-selector {
    padding: 22px;
    background: linear-gradient(145deg, #1e1e3e, #16213e);
    margin: 20px;
    border-radius: var(--border-radius);
    border: 2px solid rgba(124, 58, 237, 0.3);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.template-item {
    padding: 18px;
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.1), rgba(236, 72, 153, 0.1));
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(124, 58, 237, 0.2);
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.template-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.3), transparent);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
    border-radius: 50%;
}

.template-item:hover::before {
    width: 300px;
    height: 300px;
}

.template-item:active {
    transform: scale(0.95);
}

.template-item:hover {
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.3), rgba(236, 72, 153, 0.3));
    border-color: rgba(124, 58, 237, 0.6);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
    transform: translateY(-4px);
}

/* 响应式 */
@media (max-width: 768px) {
    .cards-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
        row-gap: 25px;
    }
}

@media (max-width: 480px) {
    .page {
        padding-bottom: 110px;
    }

    .tools-grid {
        gap: 10px;
        padding: 15px;
    }

    .tool-card {
        padding: 20px 15px;
    }

    .tool-icon {
        font-size: 36px;
    }

    .app-header h1 {
        font-size: 28px;
    }

    .cards-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        row-gap: 20px;
    }

    .card-front {
        font-size: 40px;
    }

    .card-back {
        font-size: 28px;
    }

    .magic8ball-wrapper {
        width: 250px;
        height: 250px;
    }

    .ball-window {
        width: 100px;
        height: 100px;
    }

    .ball-answer {
        font-size: 14px;
        padding: 12px;
    }

    .dice-container {
        height: 300px;
    }

    #shake-ball-btn {
        font-size: 16px;
        padding: 14px 30px;
    }

    .bottle-container {
        width: 250px;
        height: 250px;
    }

    .bottle {
        width: 60px;
        height: 120px;
    }

    .player-marker {
        width: 50px;
        height: 50px;
        font-size: 12px;
    }

    /* 优化移动端输入框显示 */
    .option-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .option-item input[type="text"] {
        min-width: 0;
        font-size: 14px;
        padding: 8px 10px;
    }

    .option-item input[type="number"] {
        width: 60px;
        font-size: 14px;
        padding: 8px 10px;
    }

    .option-item button {
        padding: 8px 10px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* 转瓶子玩家输入框 */
    .player-inputs {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .player-name {
        padding: 12px;
        font-size: 14px;
        width: 100%;
        box-sizing: border-box;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

