/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #fff;
}

/* 登录页面 */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container h1 {
    margin-bottom: 30px;
    font-size: 2.5rem;
    color: #00d4ff;
}

.login-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 10px;
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 16px;
}

.form-group input:focus {
    outline: 2px solid #00d4ff;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.btn-primary {
    background: #00d4ff;
    color: #1a1a2e;
    width: 100%;
}

.btn-primary:hover {
    background: #00b8e6;
}

.btn-attack {
    background: #ff4757;
    color: #fff;
}

.btn-attack:hover {
    background: #ff3344;
}

.error-msg {
    color: #ff4757;
    text-align: center;
    margin-top: 15px;
}

/* 竞赛页面布局 */
.competition-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 20px;
}

.header h1 {
    color: #00d4ff;
    font-size: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* 主内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 20px;
}

.panel {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
}

.panel h3 {
    color: #00d4ff;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* 对手列表 */
.opponent-item {
    padding: 12px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.opponent-item:hover, .opponent-item.selected {
    background: rgba(0, 212, 255, 0.2);
    border-left: 3px solid #00d4ff;
}

.opponent-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.opponent-score {
    font-size: 0.9rem;
    color: #aaa;
}

/* 攻击面板 */
.attack-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.target-info {
    padding: 15px;
    background: rgba(255, 77, 87, 0.1);
    border-radius: 5px;
    border-left: 3px solid #ff4757;
}

.attack-input {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: none;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
    resize: vertical;
}

.attack-input:focus {
    outline: 2px solid #ff4757;
}

/* 快速模板 */
.templates {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.template-btn {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
}

.template-btn:hover {
    background: rgba(0, 212, 255, 0.2);
}

/* 排名列表 */
.ranking-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

.ranking-item.me {
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid #00d4ff;
}

.rank-num {
    font-weight: bold;
    color: #00d4ff;
    width: 30px;
}

.rank-name {
    flex: 1;
}

.rank-score {
    color: #ffd700;
}

/* 历史记录 */
.history-panel {
    margin-top: 20px;
}

.history-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tab-btn {
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tab-btn.active {
    background: #00d4ff;
    color: #1a1a2e;
    font-weight: bold;
}

.search-box {
    margin-bottom: 15px;
}

.search-box input {
    width: 100%;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
}

.search-box input:focus {
    outline: 2px solid #00d4ff;
}

.search-box input::placeholder {
    color: #aaa;
}

.history-table-container {
    max-height: 400px;
    overflow-y: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table thead {
    position: sticky;
    top: 0;
    background: rgba(26, 26, 46, 0.95);
    z-index: 10;
}

.history-table th {
    padding: 12px;
    text-align: left;
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    font-weight: bold;
    border-bottom: 2px solid rgba(0, 212, 255, 0.3);
    font-size: 13px;
}

.history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
}

.history-table tbody tr {
    transition: background 0.2s;
}

.history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.history-table tbody tr.success {
    border-left: 3px solid #2ed573;
}

.history-table tbody tr.fail {
    border-left: 3px solid #ff4757;
}

.history-table .positive {
    color: #2ed573;
    font-weight: bold;
}

.history-table .negative {
    color: #ff4757;
    font-weight: bold;
}

/* 滚动条样式 */
.history-table-container::-webkit-scrollbar {
    width: 8px;
}

.history-table-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.history-table-container::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 4px;
}

.history-table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.5);
}

/* 结果显示 */
.result-box {
    padding: 15px;
    border-radius: 5px;
    margin-top: 15px;
}

.result-box.success {
    background: rgba(46, 213, 115, 0.2);
    border: 1px solid #2ed573;
}

.result-box.fail {
    background: rgba(255, 71, 87, 0.2);
    border: 1px solid #ff4757;
}

/* 话题灯样式 */
.topic-lights {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.topic-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff4757;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.topic-light.breached {
    background: #2ed573;
    box-shadow: 0 0 6px #2ed573;
}

.topic-light:hover {
    transform: scale(1.3);
}

/* 话题提示框 */
.topic-light[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 5px;
}

.topic-progress {
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 4px;
}

/* 话题选择器 */
.topic-selector {
    margin-bottom: 15px;
}

.topic-selector label {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
}

.topic-selector select {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.topic-selector select:focus {
    outline: 2px solid #00d4ff;
}

.topic-selector select option {
    background: #1a1a2e;
    color: #fff;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s;
}

.modal-content {
    background: linear-gradient(135deg, #1e2a47 0%, #16213e 100%);
    margin: 5% auto;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    border: 1px solid rgba(0, 212, 255, 0.3);
}

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

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

.modal-header h3 {
    color: #00d4ff;
    margin: 0;
    font-size: 1.3rem;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.close-btn:hover {
    color: #ff4757;
}

.modal-body {
    padding: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-label {
    color: #00d4ff;
    font-weight: bold;
    width: 120px;
}

.detail-value {
    color: #fff;
    text-align: right;
    flex: 1;
}

.detail-value.success {
    color: #2ed573;
}

.detail-value.fail {
    color: #ff4757;
}

.detail-section {
    margin-top: 20px;
}

.detail-section h4 {
    color: #00d4ff;
    margin-bottom: 10px;
    font-size: 1rem;
}

.detail-content {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 5px;
    color: #ddd;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    border-left: 3px solid #00d4ff;
}

.detail-content::-webkit-scrollbar {
    width: 8px;
}

.detail-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.detail-content::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 4px;
}

.detail-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.5);
}

/* 表格行悬停效果 */
.history-table tbody tr:hover {
    background: rgba(0, 212, 255, 0.1) !important;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}
