﻿/* ============ 全局重置 ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f5f6fa;
    color: #2c3e50;
    line-height: 1.6;
}

button {
    border: none;
    cursor: pointer;
    font-family: inherit;
}

input, select {
    font-family: inherit;
    outline: none;
}

/* ============ 通用按钮 ============ */
.btn-primary {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: white;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #dfe6e9;
}

/* ============ 登录页 ============ */
.login-page {
    background: linear-gradient(135deg, #c0392b 0%, #8e2418 100%);
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    max-width: 420px;
    margin: 0 auto;
}

.login-header {
    text-align: center;
    color: white;
    padding: 30px 0;
}

.logo-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 22px;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 13px;
    opacity: 0.9;
}

.login-form-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-form-card h2 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #2c3e50;
}

.form-tip {
    font-size: 13px;
    color: #7f8c8d;
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #34495e;
}

.required {
    color: #e74c3c;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #c0392b;
}

.login-notes {
    margin-top: 20px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 12px;
    color: #7f8c8d;
    line-height: 1.8;
}

.login-footer {
    text-align: center;
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    margin-top: 20px;
}

/* ============ 游戏页 ============ */
.game-page {
    background: #f5f6fa;
    min-height: 100vh;
    padding-bottom: 70px;
}

.game-header {
    background: linear-gradient(135deg, #c0392b, #a93226);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.player-info {
    display: flex;
    flex-direction: column;
}

.player-name {
    font-size: 16px;
    font-weight: 600;
}

.player-role {
    font-size: 12px;
    opacity: 0.9;
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 2px;
    display: inline-block;
    width: fit-content;
}

.score-display {
    text-align: right;
}

.score-label {
    font-size: 12px;
    opacity: 0.9;
    display: block;
}

.score-value {
    font-size: 24px;
    font-weight: 700;
}

.stage-progress {
    background: white;
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
}

#stageText {
    font-size: 13px;
    color: #7f8c8d;
    display: block;
    margin-bottom: 6px;
}

.progress-bar {
    height: 6px;
    background: #ecf0f1;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #c0392b, #e74c3c);
    border-radius: 3px;
    transition: width 0.5s;
}

.game-main {
    padding: 16px;
}

/* 开场剧情 */
.story-opening {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    text-align: center;
}

.opening-badge {
    display: inline-block;
    background: #e74c3c;
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
}

.opening-narration {
    font-size: 15px;
    color: #2c3e50;
    line-height: 1.8;
    margin-bottom: 16px;
    text-align: left;
}

.opening-trigger {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 10px;
    padding: 14px;
    font-size: 14px;
    color: #856404;
    text-align: left;
}

/* 关卡内容 */
.stage-content {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.stage-title {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
}

.stage-role-badge {
    display: inline-block;
    background: #3498db;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    margin-bottom: 16px;
}

.stage-narration {
    font-size: 15px;
    color: #34495e;
    line-height: 1.8;
    margin-bottom: 20px;
}

/* 选项 */
.options-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    text-align: left;
    transition: all 0.3s;
    line-height: 1.5;
}

.option-btn:hover {
    border-color: #c0392b;
    background: #fff5f5;
}

.option-btn.selected {
    border-color: #c0392b;
    background: #ffeaea;
}

.option-key {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    background: #c0392b;
    color: white;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 600;
    margin-right: 10px;
}

/* 多选题选项 */
.multi .option-btn {
    display: flex;
    align-items: flex-start;
}

/* 排序题 */
.sort-area {
    margin-top: 10px;
}

.sort-tip {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 12px;
}

.sort-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.sort-btn {
    background: #3498db;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.3s;
}

.sort-btn:hover {
    background: #2980b9;
}

.sort-btn.used {
    background: #bdc3c7;
    opacity: 0.5;
    pointer-events: none;
}

.sort-selected {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    min-height: 50px;
    margin-bottom: 12px;
    font-size: 14px;
}

.sort-selected .selected-step {
    display: inline-block;
    background: #27ae60;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    margin: 3px;
    font-size: 12px;
}

/* 等待提示 */
.wait-tip {
    text-align: center;
    padding: 40px 20px;
}

.wait-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: pulse 2s infinite;
}

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

.wait-tip p {
    color: #7f8c8d;
    font-size: 15px;
    line-height: 1.6;
}

/* 推演结束 */
.game-finished {
    text-align: center;
    padding: 40px 20px;
}

.finished-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.game-finished h2 {
    font-size: 22px;
    margin-bottom: 12px;
    color: #27ae60;
}

.game-finished p {
    font-size: 16px;
    margin-bottom: 8px;
    color: #34495e;
}

/* 底部常驻 */
.game-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 100;
}

.footer-btn {
    flex: 1;
    background: white;
    padding: 10px;
    font-size: 12px;
    color: #7f8c8d;
    transition: all 0.3s;
}

.footer-btn:hover {
    background: #f8f9fa;
    color: #c0392b;
}

.footer-icon {
    display: block;
    font-size: 20px;
    margin-bottom: 2px;
}

/* ============ 弹窗 ============ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-box {
    background: white;
    border-radius: 16px;
    max-width: 400px;
    width: 100%;
    overflow: hidden;
    animation: modalSlideIn 0.3s;
}

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

.modal-header {
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.modal-header.correct {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.modal-header.wrong {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
}

.modal-header.info {
    background: linear-gradient(135deg, #2c3e50, #34495e);
}

.modal-body {
    padding: 20px;
    font-size: 14px;
    line-height: 1.8;
    color: #34495e;
}

.modal-footer {
    padding: 0 20px 20px;
}

/* ============ 主持人后台 ============ */
.host-page {
    background: #f0f2f5;
    min-height: 100vh;
}

.host-container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 20px;
}

.host-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.host-header h1 {
    font-size: 24px;
    color: #2c3e50;
}

.status-badge {
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    background: #95a5a6;
    color: white;
}

.status-badge.running { background: #27ae60; }
.status-badge.paused { background: #f39c12; }
.status-badge.finished { background: #3498db; }

.host-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
}

.host-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.host-card h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.access-info {
    display: flex;
    flex-wrap: wrap;          /* 地址太长（https 域名）时换到下一行，避免把域名从中间截断 */
    gap: 14px 20px;
    align-items: center;
}

/* 窄栏放不下完整 https 域名，地址块独占一行铺满卡片宽度 */
.url-info {
    flex: 1 1 100%;
    min-width: 0;
}

.qrcode-area {
    text-align: center;
}

#qrcodeCanvas {
    border: 1px solid #eee;
    border-radius: 8px;
}

.qr-tip {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 8px;
}

.url-info .url-text {
    font-size: 15px;
    color: #c0392b;
    font-weight: 600;
    word-break: break-all;    /* 极长链接仍可折行，但常规域名能整行显示 */
    line-height: 1.45;
}

.url-note {
    font-size: 12px;
    color: #95a5a6;
    margin-top: 8px;
}

.control-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-control {
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-start { background: #27ae60; color: white; }
.btn-start:hover { background: #229954; }

.btn-pause { background: #f39c12; color: white; }
.btn-pause:hover { background: #d68910; }

.btn-next { background: #3498db; color: white; }
.btn-next:hover { background: #2980b9; }

.btn-reset { background: #e74c3c; color: white; }
.btn-reset:hover { background: #c0392b; }

.stage-info {
    text-align: center;
}

.stage-badge {
    display: inline-block;
    background: #e74c3c;
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.btn-report {
    width: 100%;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
}

.report-success {
    color: #27ae60;
    font-size: 14px;
    margin: 10px 0;
}

#reportPath {
    font-size: 12px;
    color: #7f8c8d;
    word-break: break-all;
    margin-bottom: 10px;
}

/* 人员表格 */
.players-table-wrap {
    overflow-x: auto;
}

.players-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.players-table th,
.players-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.players-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #7f8c8d;
}

.players-table tr:hover {
    background: #f8f9fa;
}

.empty-tip {
    text-align: center;
    color: #bdc3c7;
    padding: 20px;
    font-size: 14px;
}

/* 统计 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 16px 8px;
    background: #f8f9fa;
    border-radius: 10px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #c0392b;
}

.stat-label {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 4px;
}

.host-footer {
    text-align: center;
    color: #95a5a6;
    font-size: 12px;
    margin-top: 20px;
}

/* ============ 报告页 ============ */
.report-page {
    background: #f5f6fa;
    min-height: 100vh;
    padding: 20px;
}

.report-container {
    max-width: 500px;
    margin: 0 auto;
}

.report-header {
    text-align: center;
    margin-bottom: 24px;
}

.report-header h1 {
    font-size: 24px;
    color: #2c3e50;
}

.report-subtitle {
    color: #7f8c8d;
    font-size: 14px;
    margin-top: 4px;
}

.report-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.report-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: #2c3e50;
}

.score-circle {
    text-align: center;
    padding: 20px;
}

.score-num {
    font-size: 48px;
    font-weight: 700;
    color: #c0392b;
}

.score-label {
    font-size: 16px;
    color: #7f8c8d;
}

.grade-badge {
    text-align: center;
    margin-top: 10px;
    font-size: 16px;
    font-weight: 600;
}

.badge-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.badge-item {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
}

.cards-list .card-item {
    background: #fff3cd;
    border-left: 4px solid #f39c12;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 13px;
}

.wrong-list .wrong-item {
    background: #fdecea;
    border-left: 4px solid #e74c3c;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 13px;
}

.report-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
    .host-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 干扰卡按钮 */
.btn-interf {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    margin: 3px;
}
.btn-interf:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}