/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'SimHei', Arial, sans-serif;
    background-color: #f8f9fa;
}

/* 大屏页面样式 */
.screen-page {
    overflow: hidden;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

/* 计时器动画 */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.timer-pulse {
    animation: pulse 1s ease-in-out infinite;
}

/* 按钮悬停效果 */
.btn-hover {
    transition: all 0.3s ease;
}

.btn-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 卡片样式增强 */
.card {
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* 计分板样式 */
.scoreboard-item {
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border-left: 4px solid #007bff;
    transition: all 0.3s ease;
}

.scoreboard-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.scoreboard-item.current-team {
    background: #fff3cd;
    border-left-color: #ffc107;
}

/* 抢答器按钮样式 */
.buzzer-btn {
    width: 100%;
    height: 200px;
    font-size: 2.5rem;
    font-weight: bold;
    border-radius: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.buzzer-btn:not(:disabled):hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(220, 38, 38, 0.4);
}

.buzzer-btn:not(:disabled):active {
    transform: scale(0.98);
}

.buzzer-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* 状态徽章 */
.status-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.1rem;
}

.status-enabled {
    background: #d4edda;
    color: #155724;
}

.status-disabled {
    background: #f8d7da;
    color: #721c24;
}

.status-waiting {
    background: #fff3cd;
    color: #856404;
}

/* 响应式断点 - 平板 */
@media (max-width: 991px) {
    .display-4 {
        font-size: 2.5rem;
    }
    
    .display-5 {
        font-size: 2rem;
    }
    
    .display-6 {
        font-size: 1.5rem;
    }
    
    .h1, .h2, .h3 {
        font-size: 1.75rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .buzzer-btn {
        height: 180px;
        font-size: 2rem;
    }
    
    .btn-group {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .btn-group .btn {
        flex: 1 1 auto;
        margin-bottom: 0.5rem;
    }
}

/* 响应式断点 - 手机 */
@media (max-width: 767px) {
    body {
        font-size: 14px;
    }
    
    .display-1 {
        font-size: 3rem;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .display-5 {
        font-size: 1.5rem;
    }
    
    .display-6 {
        font-size: 1.25rem;
    }
    
    .h1 {
        font-size: 1.5rem;
    }
    
    .h2 {
        font-size: 1.25rem;
    }
    
    .h3 {
        font-size: 1.1rem;
    }
    
    .card {
        margin-bottom: 0.75rem;
        border-radius: 8px;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
        margin-right: 0;
    }
    
    .buzzer-btn {
        height: 150px;
        font-size: 1.75rem;
        border-radius: 15px;
    }
    
    .status-badge {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .scoreboard-item {
        padding: 10px;
        margin-bottom: 6px;
        font-size: 0.875rem;
    }
    
    .form-select,
    .form-control {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* 大屏页面移动端调整 */
    .screen-page .display-1 {
        font-size: 4rem;
    }
    
    .screen-page .display-5 {
        font-size: 1.25rem;
    }
    
    /* 隐藏一些次要元素 */
    .screen-page .alert {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }
}

/* 响应式断点 - 小屏手机 */
@media (max-width: 480px) {
    body {
        font-size: 13px;
    }
    
    .display-1 {
        font-size: 2.5rem;
    }
    
    .display-4 {
        font-size: 1.75rem;
    }
    
    .display-5 {
        font-size: 1.25rem;
    }
    
    .h1 {
        font-size: 1.25rem;
    }
    
    .h2 {
        font-size: 1.1rem;
    }
    
    .card-body {
        padding: 0.5rem;
    }
    
    .btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.8125rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .buzzer-btn {
        height: 120px;
        font-size: 1.5rem;
        border-radius: 12px;
    }
    
    .badge {
        font-size: 0.7em;
        padding: 0.35em 0.65em;
    }
    
    .scoreboard-item {
        padding: 8px;
        margin-bottom: 4px;
        font-size: 0.8125rem;
    }
    
    .scoreboard-item strong {
        font-size: 0.875rem;
    }
    
    /* 表单控件 */
    .form-select,
    .form-control {
        font-size: 0.8125rem;
    }
    
    /* 大屏页面特殊处理 */
    .screen-page .display-1 {
        font-size: 3rem;
    }
    
    .screen-page .display-5 {
        font-size: 1.1rem;
    }
    
    /* 紧凑间距 */
    .py-3 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    .py-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
    
    .mb-4 {
        margin-bottom: 1rem !important;
    }
    
    .mb-3 {
        margin-bottom: 0.75rem !important;
    }
}

/* 响应式断点 - 大屏优化 */
@media (min-width: 1400px) {
    .container-fluid {
        max-width: 100%;
    }
    
    .screen-page .display-1 {
        font-size: 6rem;
    }
    
    .screen-page .display-5 {
        font-size: 2.5rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .buzzer-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .buzzer-btn {
        height: 200px;
    }
    
    /* 移除悬停效果 */
    .btn-hover:hover {
        transform: none;
        box-shadow: none;
    }
    
    .card:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .scoreboard-item:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
}

/* 横屏模式优化 */
@media (max-width: 767px) and (orientation: landscape) {
    .buzzer-btn {
        height: 100px;
        font-size: 1.25rem;
    }
    
    .card-body {
        padding: 0.5rem;
    }
    
    .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .screen-page .display-1 {
        font-size: 2.5rem;
    }
}

/* 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 1s ease-in-out infinite;
}

/* 渐变背景 */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-bg-blue {
    background: linear-gradient(135deg, #1a2a6c 0%, #b21f1f 50%, #fdbb2d 100%);
}

/* 文字阴影 */
.text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 移动端滚动条优化 */
@media (max-width: 767px) {
    ::-webkit-scrollbar {
        width: 4px;
    }

    ::-webkit-scrollbar-thumb {
        background: #ccc;
    }
}

/* 响应式辅助类 */
@media (max-width: 575px) {
    .small-sm {
        font-size: 0.75rem;
    }
}

@media (min-width: 576px) and (max-width: 767px) {
    .small-sm {
        font-size: 0.8125rem;
    }
}

@media (max-width: 767px) {
    .display-sm-2 {
        font-size: 3.5rem;
    }
    .display-sm-3 {
        font-size: 3rem;
    }
    .display-sm-4 {
        font-size: 2.5rem;
    }
    .display-sm-5 {
        font-size: 2rem;
    }

    .btn-md-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    .small-md {
        font-size: 0.875rem;
    }
}

@media (min-width: 768px) {
    .display-sm-2,
    .display-sm-3,
    .display-sm-4,
    .display-sm-5 {
        font-size: inherit;
    }

    .btn-md-lg {
        padding: 0.5rem 1rem;
        font-size: 1.25rem;
    }

    .small-md {
        font-size: 1rem;
    }
}

/* 优化触摸设备的按钮大小 */
@media (hover: none) and (pointer: coarse) {
    .btn-sm {
        min-height: 36px;
        padding: 0.5rem 0.75rem;
    }
}

/* 安全区域优化（刘海屏等） */
@supports (padding: max(0px)) {
    .safe-area-inset {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* 文字截断 */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
