:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --bg-light: #e5e7eb;
    --bg-dark: #111827;
    --card-light: rgba(255, 255, 255, 0.8);
    --card-dark: rgba(31, 41, 55, 0.8);
    --text-light: #1f2937;
    --text-dark: #f9fafb;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
}

/* 基础重置 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    /* 移除 body 的默认背景，交给 #app 接管，或者设为透明 */
    background: #000; 
    color: var(--text-light);
    transition: color 0.3s;
    height: 100vh;
    /* 尝试使用 dvh 解决 Safari 底部遮挡问题 */
    height: 100dvh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+/Edge */
    /* 禁用双击缩放 */
    touch-action: manipulation;
}
body.dark {
    color: var(--text-dark);
}

/* 布局容器 */
#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    /* 默认背景色在这里定义 */
    background: var(--bg-light);
    transition: background 0.3s;
    background-size: cover;
    background-position: center;
}
body.dark #app {
    background: var(--bg-dark);
}

/* 顶部栏 */
.header {
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(10px);
    z-index: 10;
    /* 适配刘海屏 */
    padding-top: max(12px, env(safe-area-inset-top));
}
body.dark .header { background: rgba(0,0,0,0.3); }

.round-badge {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
    cursor: pointer;
}

.header-actions { display: flex; gap: 12px; }
.icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: inherit;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative; /* For tooltip */
}
.icon-btn:hover { background: rgba(0,0,0,0.05); }
.icon-btn.disabled { opacity: 0.3; cursor: not-allowed; }
body.dark .icon-btn:hover { background: rgba(255,255,255,0.1); }

/* Tooltip Styles */
@media (hover: hover) {
    .icon-btn[data-tooltip]:hover::after {
        content: attr(data-tooltip);
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-top: 8px;
        padding: 4px 8px;
        background: rgba(0, 0, 0, 0.8);
        color: white;
        font-size: 12px;
        border-radius: 4px;
        white-space: nowrap;
        pointer-events: none;
        opacity: 0;
        animation: tooltip-fade 0.2s forwards;
        z-index: 100;
    }
    
    body.dark .icon-btn[data-tooltip]:hover::after {
        background: rgba(255, 255, 255, 0.9);
        color: black;
    }
}

@keyframes tooltip-fade {
    from { opacity: 0; transform: translate(-50%, -5px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* 游戏区域 */
.game-area {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* 中间转盘 */
.center-dial {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--card-light);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 5;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 4px solid rgba(255,255,255,0.5);
}
body.dark .center-dial {
    background: var(--card-dark);
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.dial-round { 
    font-size: 36px; /* 缩小字号 */
    font-weight: 800; 
    color: var(--primary); 
    line-height: 1;
}

/* 方向指示 */
.direction {
    position: absolute;
    font-size: 20px; /* 稍微缩小方向字号 */
    font-weight: bold;
    color: #9ca3af;
    transition: color 0.3s;
    z-index: 1; /* 确保在骰子下方 */
}
/* 只有东(0)是红色，其他默认 */
.direction.is-east { 
    color: var(--danger); 
}

/* 增加边距，往外移 */
.dir-0 { bottom: 10px; } 
.dir-1 { right: 10px; transform: rotate(-90deg); } 
.dir-2 { top: 10px; transform: rotate(180deg); } 
.dir-3 { left: 10px; transform: rotate(90deg); }

/* 玩家卡片 */
.player-card {
    position: absolute;
    width: 200px; /* 从180px进一步增加到200px以容纳更长的数字 */
    padding: 16px;
    background: var(--card-light);
    backdrop-filter: blur(20px); /* 增强模糊 */
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15); /* 更柔和但更有深度的阴影 */
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: grab;
    border: 1px solid rgba(255, 255, 255, 0.4); /* 玻璃边缘高光 */
    touch-action: none; /* 防止移动端默认行为 */
    overflow: visible; /* 允许内容溢出可见 */
}
body.dark .player-card { 
    background: var(--card-dark); 
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

/* 庄家卡片金色样式 */
.player-card.dealer {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(245, 158, 11, 0.15));
    border: 2px solid #f59e0b;
    box-shadow: 0 8px 32px 0 rgba(245, 158, 11, 0.3), 0 0 20px rgba(251, 191, 36, 0.2);
}
body.dark .player-card.dealer {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.1));
    border: 2px solid #fbbf24;
    box-shadow: 0 8px 32px 0 rgba(251, 191, 36, 0.4), 0 0 25px rgba(251, 191, 36, 0.3);
}

/* 庄家分数金色 */
.player-card.dealer .player-score {
    color: #d97706;
}
body.dark .player-card.dealer .player-score {
    color: #fbbf24;
}

/* 拖拽状态 */
.player-card.dragging {
    opacity: 0.3;
    cursor: grabbing;
}
.player-card.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.2);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}
.player-card.empty-seat {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.3); /* 降低透明度 */
    border: 2px dashed #9ca3af; /* 虚线边框 */
    box-shadow: none; /* 移除阴影 */
}
body.dark .player-card.empty-seat {
    background: rgba(31, 41, 55, 0.3);
    border-color: #4b5563;
}
.player-card.empty-seat:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: var(--primary);
}
body.dark .player-card.empty-seat:hover {
    background: rgba(31, 41, 55, 0.5);
    border-color: var(--primary);
}

/* 拖拽分身 */
.drag-clone {
    position: fixed;
    width: 200px; /* 保持与玩家卡片一致 */
    padding: 16px;
    background: var(--card-light);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.2s, transform 0.08s ease-out;
    border: 2px solid var(--primary);
    will-change: transform, left, top;
}
body.dark .drag-clone {
    background: var(--card-dark);
}
.drag-clone.show {
    opacity: 0.5;
}
.drag-clone .player-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.8;
}
.drag-clone .player-score {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
}

/* 下一局拖拽分身 */
.drag-clone.next-round-clone {
    background: var(--secondary);
    border-color: var(--secondary);
    color: white;
}
body.dark .drag-clone.next-round-clone {
    background: var(--secondary);
    border-color: var(--secondary);
}
.drag-clone.next-round-clone .clone-text {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
}

/* 针对不同座位的旋转和缩放 */
/* 基础缩放值 */
.pos-0 { transform: scale(var(--scale-factor, 1)); }
.pos-1 { transform: translateY(-50%) rotate(-90deg) scale(var(--scale-factor, 1)); }
.pos-2 { transform: rotate(180deg) scale(var(--scale-factor, 1)); }
.pos-3 { transform: translateY(-50%) rotate(90deg) scale(var(--scale-factor, 1)); }

/* 拖拽状态需要叠加旋转和缩放 */
.player-card.dragging.pos-0 { transform: scale(calc(var(--scale-factor, 1) * 1.1)); }
.player-card.dragging.pos-1 { transform: translateY(-50%) rotate(-90deg) scale(calc(var(--scale-factor, 1) * 1.1)); }
.player-card.dragging.pos-2 { transform: rotate(180deg) scale(calc(var(--scale-factor, 1) * 1.1)); }
.player-card.dragging.pos-3 { transform: translateY(-50%) rotate(90deg) scale(calc(var(--scale-factor, 1) * 1.1)); }

.player-card.drag-over.pos-0 { transform: scale(calc(var(--scale-factor, 1) * 1.08)); }
.player-card.drag-over.pos-1 { transform: translateY(-50%) rotate(-90deg) scale(calc(var(--scale-factor, 1) * 1.08)); }
.player-card.drag-over.pos-2 { transform: rotate(180deg) scale(calc(var(--scale-factor, 1) * 1.08)); }
.player-card.drag-over.pos-3 { transform: translateY(-50%) rotate(90deg) scale(calc(var(--scale-factor, 1) * 1.08)); }

/* 激活状态需要叠加旋转 */
.player-card.active.pos-0 { transform: scale(calc(var(--scale-factor, 1) * 1.05)); }
.player-card.active.pos-1 { transform: translateY(-50%) rotate(-90deg) scale(calc(var(--scale-factor, 1) * 1.05)); }
.player-card.active.pos-2 { transform: rotate(180deg) scale(calc(var(--scale-factor, 1) * 1.05)); }
.player-card.active.pos-3 { transform: translateY(-50%) rotate(90deg) scale(calc(var(--scale-factor, 1) * 1.05)); }

/* 庄家标记 */
.dealer-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.5); /* 增加红色发光 */
    z-index: 2;
    font-weight: 700;
    animation: badge-pulse 2s infinite; /* 缓慢呼吸效果 */
}

@keyframes badge-pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* 响应式定位修正 - 使用CSS变量实现缩放时的位置补偿 */
.pos-0 { 
    bottom: calc(20px + var(--offset-y, 0px)); 
}
.pos-1 { 
    right: calc(-12px + var(--offset-x, 0px)); /* 从-5px改为-12px，往外推7px */
    top: 50%; 
}
.pos-2 { 
    top: calc(20px + var(--offset-y, 0px)); 
}
.pos-3 { 
    left: calc(-12px + var(--offset-x, 0px)); /* 从-5px改为-12px，往外推7px */
    top: 50%; 
}


.player-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; opacity: 0.8; }
.player-score { 
    font-size: 40px; 
    font-weight: 800; 
    color: var(--primary); 
    transition: color 0.3s;
    white-space: nowrap; /* 强制单行显示，不换行 */
    overflow: visible; /* 允许内容溢出可见 */
}
/* 分数变化反馈 */
.score-changed-pos { color: var(--success) !important; }
.score-changed-neg { color: var(--danger) !important; }

.score-diff { font-size: 12px; height: 16px; font-weight: bold; }
.diff-pos { color: var(--success); }
.diff-neg { color: var(--danger); }

/* 底部操作栏 */
.action-bar {
    padding: 20px;
    /* 适配底部安全区域 */
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    display: flex;
    gap: 12px;
    justify-content: center;
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(10px);
    z-index: 10;
}
body.dark .action-bar { background: rgba(0,0,0,0.3); }

.btn {
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    /* 防止文字换行 */
    white-space: nowrap;
}
.btn:active { transform: scale(0.96); }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: white; color: var(--text-light); }
body.dark .btn-secondary { background: var(--card-dark); color: var(--text-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }

/* 下一局按钮拖拽状态 */
.next-round-btn {
    cursor: grab;
}
.next-round-btn.dragging {
    opacity: 0.3;
    cursor: grabbing;
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }

.modal-card {
    background: white;
    width: 90%;
    max-width: 400px;
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh; /* 从85vh增加到90vh，利用更多屏幕空间 */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
body.dark .modal-card { background: #1f2937; border: 1px solid rgba(255,255,255,0.1); }
.modal-overlay.show .modal-card { transform: translateY(0); }

.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 16px; text-align: center; } /* 减小标题尺寸和间距 */

/* 输入框 */
.input-field {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
    font-size: 16px;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}
body.dark .input-field { background: #374151; border-color: #4b5563; color: white; }
.input-field:focus { outline: none; border-color: var(--primary); }

/* 列表项 */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    background: #f3f4f6;
    margin-bottom: 8px;
    cursor: pointer;
}
body.dark .list-item { background: #374151; }
.list-item.active { background: var(--primary); color: white; }

/* 设置原点样式 */
.origin-item {
    padding: 16px;
    border-radius: 12px;
    background: #f9fafb;
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
}
body.dark .origin-item {
    background: #374151;
    border-color: #4b5563;
}


/* 骰子相关样式 */
.center-dial.dice-mode {
    transform: scale(2.5);
    z-index: 101;
    border-color: rgba(255,255,255,0.2);
    background: rgba(40, 40, 60, 0.95);
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s, border-color 0.3s;
}

.center-dial.dice-mode.is-rolling {
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.6) !important;
    border-color: rgba(239, 68, 68, 0.8);
}

.center-dial.dice-mode.roll-finished {
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.6) !important;
    border-color: rgba(16, 185, 129, 0.8);
}

body.dark .center-dial.dice-mode {
    background: rgba(20, 20, 30, 0.95);
}

.center-dial.dice-mode .direction,
.center-dial.dice-mode .dial-round {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.dice-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.dice-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.dice-container {
    display: flex;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.5s 0.2s; /* 延迟显示，等圆盘变大 */
    z-index: 10; /* 确保在方向指示上方 */
}
.center-dial.dice-mode .dice-container {
    opacity: 1;
    pointer-events: auto;
}

.dice-box {
    width: 30px;
    height: 30px;
    position: relative;
    transform-style: preserve-3d;
    /* 过渡时间由JS动态控制 */
}

.dice-face {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    border-radius: 4px; /* Keep rounded corners for realistic look */
    /* border: 1px solid #d1d5db; Removed to avoid dark edges */
    box-shadow: inset 0 0 2px rgba(0,0,0,0.1); /* Lighter inner shadow */
    backface-visibility: hidden;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

/* SVG Data URIs for Dice Faces */
.face-1 { 
    transform: rotateY(0deg) translateZ(15px); 
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='30' fill='%23ef4444'/%3E%3C/svg%3E");
}
.face-2 { 
    transform: rotateX(-90deg) translateZ(15px); 
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='70' cy='30' r='12' fill='%23333'/%3E%3Ccircle cx='30' cy='70' r='12' fill='%23333'/%3E%3C/svg%3E");
}
.face-3 { 
    transform: rotateY(90deg) translateZ(15px); 
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='80' cy='20' r='12' fill='%23333'/%3E%3Ccircle cx='50' cy='50' r='12' fill='%23333'/%3E%3Ccircle cx='20' cy='80' r='12' fill='%23333'/%3E%3C/svg%3E");
}
.face-4 { 
    transform: rotateY(-90deg) translateZ(15px); 
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='25' cy='25' r='12' fill='%23ef4444'/%3E%3Ccircle cx='75' cy='25' r='12' fill='%23ef4444'/%3E%3Ccircle cx='25' cy='75' r='12' fill='%23ef4444'/%3E%3Ccircle cx='75' cy='75' r='12' fill='%23ef4444'/%3E%3C/svg%3E");
}
.face-5 { 
    transform: rotateX(90deg) translateZ(15px); 
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='20' cy='20' r='12' fill='%23333'/%3E%3Ccircle cx='80' cy='20' r='12' fill='%23333'/%3E%3Ccircle cx='50' cy='50' r='12' fill='%23333'/%3E%3Ccircle cx='20' cy='80' r='12' fill='%23333'/%3E%3Ccircle cx='80' cy='80' r='12' fill='%23333'/%3E%3C/svg%3E");
}
.face-6 { 
    transform: rotateY(180deg) translateZ(15px); 
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='25' cy='20' r='12' fill='%23333'/%3E%3Ccircle cx='75' cy='20' r='12' fill='%23333'/%3E%3Ccircle cx='25' cy='50' r='12' fill='%23333'/%3E%3Ccircle cx='75' cy='50' r='12' fill='%23333'/%3E%3Ccircle cx='25' cy='80' r='12' fill='%23333'/%3E%3Ccircle cx='75' cy='80' r='12' fill='%23333'/%3E%3C/svg%3E");
}

/* 动画 */
.fade-enter-active, .fade-leave-active { transition: opacity 0.3s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

.slide-up-enter-active, .slide-up-leave-active { transition: all 0.3s; }
.slide-up-enter-from, .slide-up-leave-to { transform: translateY(100%); opacity: 0; }

/* 结算选择器 */
.settle-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px; /* 从20px减少到12px */
}
.player-select-box {
    padding: 8px; /* 从10px减少到8px */
    border-radius: 10px;
    background: #f3f4f6;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
    font-size: 14px; /* 添加明确的字体大小 */
}
body.dark .player-select-box { background: #374151; }
.player-select-box.selected { border-color: var(--primary); background: rgba(99, 102, 241, 0.1); }
.player-select-box.highlighting { 
    background: rgba(99, 102, 241, 0.2); 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    animation: pulse 1.5s ease-in-out infinite;
}
body.dark .player-select-box.highlighting { 
    background: rgba(99, 102, 241, 0.3); 
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}
.player-select-box.error {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    animation: error-shake 0.5s ease-in-out, error-pulse 2s ease-in-out infinite;
}
body.dark .player-select-box.error {
    background: rgba(239, 68, 68, 0.2);
}

/* 文字颜色 */
.player-select-box .placeholder-text {
    color: #9ca3af;
    opacity: 0.7;
}
body.dark .player-select-box .placeholder-text {
    color: #6b7280;
    opacity: 0.8;
}
.player-select-box .player-name-text {
    color: var(--text-light);
    font-weight: 600;
}
body.dark .player-select-box .player-name-text {
    color: var(--text-dark);
}

@keyframes pulse {
    0%, 100% { 
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    }
    50% { 
        box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.1);
    }
}
body.dark .player-select-box.highlighting {
    animation: pulse-dark 1.5s ease-in-out infinite;
}
@keyframes pulse-dark {
    0%, 100% { 
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
    }
    50% { 
        box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.15);
    }
}

/* 错误提示动画 */
@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes error-pulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
        border-color: var(--danger);
    }
    50% { 
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
        border-color: rgba(239, 68, 68, 0.8);
    }
}
.arrow-icon { color: var(--text-light); opacity: 0.5; }
body.dark .arrow-icon { color: var(--text-dark); }

/* 历史记录 */
.history-item {
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    margin-bottom: 16px;
}
.history-meta { font-size: 12px; opacity: 0.6; margin-bottom: 4px; display: flex; justify-content: space-between; }
.history-trans { font-size: 14px; margin-bottom: 2px; }
.trans-amount { font-weight: bold; color: var(--primary); }

/* 统计图表容器 */
.chart-container { position: relative; height: 300px; width: 100%; }

/* 帮助说明区域 */
.help-section {
    background: #f9fafb;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid #e5e7eb;
}
body.dark .help-section {
    background: #374151;
    border-color: #4b5563;
}

/* Numeric Keypad & Settle Modal Styles */
.calc-display {
    background: var(--bg-light);
    padding: 12px; /* 从16px减少到12px */
    border-radius: 10px;
    margin-bottom: 12px; /* 从20px减少到12px */
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 28px; /* 从32px减少到28px */
    font-weight: 700;
    color: var(--text-light);
    border: 2px solid transparent;
    transition: all 0.3s;
    position: relative;
    min-height: 56px; /* 从72px减少到56px */
}
body.dark .calc-display { background: rgba(0,0,0,0.2); color: var(--text-dark); }
.calc-display.has-value { border-color: var(--primary); background: rgba(99, 102, 241, 0.1); }

.currency-symbol {
    font-size: 20px;
    margin-right: 8px;
    opacity: 0.6;
    font-weight: normal;
}
.amount-value { letter-spacing: 1px; }

.clear-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    opacity: 0.3;
    font-size: 20px;
    padding: 10px;
}
body.dark .clear-btn { color: var(--text-dark); }

.numeric-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px; /* 从12px减少到8px */
    flex-shrink: 0; /* 防止键盘被压缩 */
}

.key-btn {
    background: var(--bg-light);
    border: none;
    border-radius: 10px;
    padding: 12px 0; /* 从15px减少到12px */
    font-size: 20px; /* 从24px减少到20px */
    font-weight: 600;
    color: var(--text-light);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}
body.dark .key-btn { background: rgba(255,255,255,0.1); color: var(--text-dark); box-shadow: none; }

.key-btn:active { transform: scale(0.95); background: rgba(0,0,0,0.1); }
body.dark .key-btn:active { background: rgba(255,255,255,0.2); }

.key-cancel { font-size: 16px; color: var(--text-light); opacity: 0.7; }
.key-delete { color: var(--danger); }

.key-confirm {
    grid-column: 1 / -1;
    background: var(--primary);
    color: white;
    font-size: 18px; /* 从20px减少到18px */
    margin-top: 4px; /* 从8px减少到4px */
    padding: 14px 0; /* 从18px减少到14px */
}
body.dark .key-confirm { background: var(--primary); color: white; }
.key-confirm:active { background: var(--primary-dark); }

/* Mobile Responsive Styles for Settle Modal */
@media screen and (max-width: 768px) {
    .settle-modal-overlay {
        align-items: flex-end; /* Bottom align */
        padding: 0;
    }
    
    .settle-modal-overlay .modal-card {
        width: 100%;
        max-width: none;
        max-height: 95vh; /* 增加到95vh以利用更多屏幕空间 */
        border-radius: 20px 20px 0 0;
        padding: 16px 16px 20px 16px; /* 减小内边距 */
        margin: 0;
        animation: slideUp 0.3s ease-out;
    }
    
    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    /* Adjust keypad button size for touch */
    .key-btn { padding: 14px 0; font-size: 20px; } /* 进一步减小以适配高度 */
    
    /* Compact the top part to save space */
    .settle-modal-overlay .modal-title { margin-bottom: 10px; font-size: 16px; } /* 减小标题 */
    .settle-modal-overlay .settle-grid { margin-bottom: 10px; gap: 6px; }
    .settle-modal-overlay .player-select-box { padding: 6px; font-size: 13px; }
    .settle-modal-overlay .calc-display { padding: 10px; min-height: 50px; font-size: 24px; margin-bottom: 10px; }
    .settle-modal-overlay .numeric-keypad { gap: 6px; }
    .settle-modal-overlay .key-confirm { padding: 12px 0; margin-top: 2px; }
}
