/* 图灵测试游戏 — 轻量样式（系统字体、无外链依赖） */
:root {
    --primary: #243559;
    --primary-light: #344f85;
    --accent: #c49355;
    --accent-soft: rgba(196, 147, 85, 0.14);
    --bg: #f4f0ea;
    --bg-accent: #ebe4da;
    --card-bg: #ffffff;
    --text: #2a2218;
    --text-muted: #7a6e62;
    --border: rgba(42, 34, 24, 0.09);
    --shadow-sm: 0 2px 10px rgba(36, 28, 18, 0.06);
    --shadow-md: 0 10px 30px rgba(36, 28, 18, 0.09);
    --shadow-lg: 0 18px 44px rgba(36, 28, 18, 0.11);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.22s var(--ease);
    --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* ─── 基础重置 ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse 120% 80% at 50% -20%, rgba(52, 79, 133, 0.07), transparent 55%),
        radial-gradient(ellipse 70% 50% at 100% 0%, rgba(196, 147, 85, 0.06), transparent 45%);
    color: var(--text);
    line-height: 1.65;
    overflow-x: hidden;
    min-height: 100vh;
}

.sym {
    display: inline-block;
    font-weight: 600;
    opacity: 0.92;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─── 导航栏 ─── */
.game-nav {
    position: fixed;
    top: 0;
    width: 100%;
    height: 56px;
    background: rgba(244, 240, 234, 0.94);
    border-bottom: 1px solid var(--border);
    z-index: 200;
}

.nav-container {
    max-width: 860px;
    margin: 0 auto;
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
}

.back-home {
    justify-self: start;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: color var(--transition);
}

.back-home:hover {
    color: var(--primary);
}

.game-logo {
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.nav-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.btn-nav-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
}

.btn-nav-icon:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
}

.logo-text {
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: var(--transition);
}

.nav-links a:hover::after {
    width: 100%;
}

.player-stats {
    position: absolute;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.score-badge {
    background: var(--accent-soft);
    color: var(--primary);
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
}

.player-nickname {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ─── 主容器 ─── */
.game-container {
    max-width: 860px;
    margin: 0 auto;
    padding: 76px 1.25rem 2.5rem;
}

/* ─── 首页 Hero + 主卡片壳 ─── */
.hero-banner {
    text-align: center;
    padding: 0.25rem 0 1.25rem;
}

.hero-banner h1 {
    font-size: clamp(1.65rem, 4vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
}

.hero-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.main-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.card-empty-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
    margin-top: 0.65rem;
}

.btn-compact {
    padding: 0.55rem 1.25rem !important;
    font-size: 0.88rem !important;
}

.empty-ico {
    font-size: 2.25rem;
    line-height: 1;
    margin-bottom: 0.75rem;
    opacity: 0.85;
}

#card-empty p {
    color: var(--text-muted);
    font-size: 0.98rem;
    max-width: 22rem;
}

/* ─── 步骤系统 ─── */
.step {
    display: none;
    animation: fadeIn 0.4s ease;
}

.step.active {
    display: block;
}

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

.fade-in {
    animation: fadeIn 0.4s ease;
}

.scale-in {
    animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* ─── 话题卡片区域 ─── */
.topic-area {
    padding: 1.35rem 1.5rem 1rem;
    background: linear-gradient(180deg, var(--accent-soft) 0%, transparent 72%);
    border-bottom: 1px solid var(--border);
}

.topic-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary);
    background: rgba(36, 53, 89, 0.08);
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    margin-bottom: 0.85rem;
}

.topic-content {
    font-size: 1.12rem;
    font-weight: 500;
    line-height: 1.55;
    color: var(--text);
    margin: 0;
    padding: 0 0 0 1rem;
    border-left: 3px solid var(--accent);
}

.topic-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* 换题限速提示：文案芯片，避免与圆形答题倒计时混淆 */
.change-topic-cooldown-chip {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 100%;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(36, 53, 89, 0.28);
    background: rgba(36, 53, 89, 0.05);
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--text-muted);
    font-weight: 500;
}

.change-topic-cooldown-msg {
    flex: 1;
    min-width: 0;
}

.cooldown-chip-icon {
    flex-shrink: 0;
    opacity: 0.75;
    font-size: 0.95rem;
}

.topic-header {
    padding: 1.75rem 2rem 1rem;
    border-bottom: 1px solid var(--border);
}

.topic-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* ─── 卡片加载/空状态 ─── */
#card-loading, #card-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.mini-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.empty-title {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.empty-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* ─── 回答选项网格 ─── */
#challenge-area {
    padding: 1.5rem 2rem 2rem;
}

.section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 1rem;
}

.answer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.answer-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.answer-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.answer-card.selected {
    border-color: var(--primary);
    background: rgba(36, 53, 89, 0.05);
}

.answer-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text);
}

/* ─── 选择后输入区域 ─── */
.post-selection {
    display: none;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    animation: fadeIn 0.4s ease;
}

.input-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.input-container textarea {
    width: 100%;
    min-height: 96px;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    line-height: 1.55;
    resize: vertical;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
    background: var(--card-bg);
}

.input-container textarea:focus {
    outline: none;
    border-color: rgba(36, 53, 89, 0.35);
    box-shadow: 0 0 0 3px rgba(36, 53, 89, 0.08);
}

.text-counter {
    text-align: right;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.user-input {
    width: 100%;
    min-height: 100px;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    transition: var(--transition);
    font-family: inherit;
}

.user-input:focus {
    outline: none;
    border-color: var(--primary);
}

.input-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
}

.char-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-submit {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.cooldown-tip {
    font-size: 0.8rem;
    color: var(--accent);
    display: none;
}

/* ─── 底部操作栏 ─── */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
}

.btn-change-topic {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
}

.btn-change-topic:hover:not(:disabled) {
    border-color: var(--accent);
    background: var(--accent-soft);
}

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

.change-topic-timer {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
}

.timer-svg {
    width: 32px;
    height: 32px;
    transform: rotate(-90deg);
}

.timer-arc {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.2s linear;
}

.timer-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    min-width: 20px;
    text-align: center;
}

.btn-create {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
}

.btn-create:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* ─── 结果页 ─── */
.result-card {
    max-width: 680px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.result-body {
    padding: 1rem 1.5rem 0.5rem;
}

.result-detail-area {
    padding: 0 1.5rem 1.75rem;
}

.result-layout {
    max-width: 680px;
    margin: 0 auto;
}

.result-header {
    text-align: center;
    padding: 2rem 1.5rem;
    border-radius: 0;
    margin-bottom: 0;
}

.result-header.correct {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #28a745;
}

.result-header.wrong {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border: 1px solid #dc3545;
}

.status-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.result-header.correct .status-badge {
    background: #28a745;
    color: white;
}

.result-header.wrong .status-badge {
    background: #dc3545;
    color: white;
}

.status-title {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.result-message {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.05rem;
}

.result-answers {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.detail-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    position: relative;
}

.detail-card.is-ai {
    border-color: var(--primary);
    background: rgba(36, 53, 89, 0.05);
}

.detail-card.is-human {
    border-color: var(--border);
}

.detail-card.is-me {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.identity-reveal {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

.detail-card.is-ai .identity-reveal {
    color: var(--primary);
}

.detail-card.is-human .identity-reveal {
    color: var(--text-muted);
}

.detail-me-tag {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--accent);
    color: white;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.result-footer {
    text-align: center;
    padding: 0 1rem 2rem;
}

/* ─── 创建话题页 ─── */
.create-layout {
    max-width: 640px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header span {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

.btn-back {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--card-bg);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-back:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.create-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.input-container {
    position: relative;
}

.create-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    resize: vertical;
}

.create-input:focus {
    outline: none;
    border-color: var(--primary);
}

.input-hint {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-create-submit {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-create-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.create-tips {
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text-muted);
    background: var(--accent-soft);
    border: 1px solid rgba(196, 147, 85, 0.22);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
}

.create-tips strong {
    color: var(--primary);
}

.tip-mark {
    font-weight: 700;
    margin-right: 0.35rem;
    opacity: 0.85;
}

.center-action {
    justify-content: center;
}

.center-action .btn-primary {
    min-width: 12rem;
}

/* ─── 创建成功页 ─── */
.finished-layout {
    max-width: 520px;
    margin: 0 auto;
    padding: 2rem 0;
}

.finished-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    text-align: center;
}

.success-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.success-icon-bg {
    position: absolute;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-radius: 50%;
    animation: successPulse 2s ease infinite;
}

@keyframes successPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 0.4; }
}

.success-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.65rem;
    font-weight: 800;
    color: #28a745;
    z-index: 1;
}

.finished-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.finished-desc {
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 2rem;
}

.finished-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 2rem;
    background: transparent;
    color: var(--text-muted);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--primary);
    background: var(--accent-soft);
}

/* ─── 辅助按钮（底部操作栏） ─── */
.aux-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.btn-aux {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: var(--card-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-aux:hover {
    border-color: var(--accent);
    color: var(--primary);
    background: var(--accent-soft);
    transform: translateY(-1px);
}

/* ─── 历史记录页 ─── */
.history-layout {
    max-width: 680px;
    margin: 0 auto;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.history-item.role-creator {
    border-left: 4px solid var(--accent);
}

.history-item.role-respondent {
    border-left: 4px solid var(--primary);
}

.history-meta {
    flex: 1;
}

.history-topic-text {
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-info {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.role-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.role-tag.creator {
    background: var(--accent-soft);
    color: var(--accent);
}

.role-tag.respondent {
    background: rgba(44, 62, 107, 0.08);
    color: var(--primary);
}

.status-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.status-tag.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-tag.status-approved {
    background: #d4edda;
    color: #155724;
}

.status-tag.status-rejected {
    background: #f8d7da;
    color: #721c24;
}

.date-txt {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.loading-placeholder, .empty-tip {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

/* ─── 话题详情页 ─── */
.detail-layout {
    max-width: 680px;
    margin: 0 auto;
}

.answer-detail-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ─── 全页加载遮罩 ─── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(244, 240, 234, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ─── Toast 提示 ─── */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-warn {
    background: #f0ad4e;
}

.toast-error {
    background: #dc3545;
}

.toast-success {
    background: #28a745;
}

/* ─── 排行榜 Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(32, 26, 18, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 400;
}

.modal-box {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    max-height: min(80vh, 560px);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-box .modal-header {
    flex-shrink: 0;
}

#leaderboard-my-rank:not(:empty) {
    padding: 0.65rem 1rem 0;
}

.lb-table-wrap {
    overflow-y: auto;
    padding: 0 0.5rem 1rem;
}

.lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.lb-table th,
.lb-table td {
    padding: 0.65rem 0.75rem;
    text-align: left;
}

.lb-table thead th {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.lb-table tbody tr {
    border-top: 1px solid var(--border);
}

.lb-table tbody tr:hover {
    background: rgba(36, 53, 89, 0.03);
}

.btn-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
}

.btn-modal-close:hover {
    background: var(--accent-soft);
    color: var(--text);
}

.detail-me-ico {
    margin-right: 0.25rem;
}

.history-chevron {
    font-size: 1.25rem;
    font-weight: 600;
    opacity: 0.45;
}

/* （以下为兼容旧类名， leaderboard modal 使用 modal-box） */
.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header span {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary);
}

.modal-header h3 {
    font-size: 1.25rem;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 1rem;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

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

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.75rem;
    text-align: left;
}

.leaderboard-table th {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.leaderboard-table td {
    border-top: 1px solid var(--border);
}

.lb-top1 { background: linear-gradient(90deg, rgba(255,215,0,0.15) 0%, transparent 100%); }
.lb-top2 { background: linear-gradient(90deg, rgba(192,192,192,0.15) 0%, transparent 100%); }
.lb-top3 { background: linear-gradient(90deg, rgba(205,127,50,0.15) 0%, transparent 100%); }

.lb-score {
    font-weight: 700;
    color: var(--primary);
}

.lb-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.lb-me-row {
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lb-me-nick {
    font-weight: 600;
}

.lb-me-score {
    color: var(--primary);
    font-weight: 700;
}

.lb-me-rank {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ─── 工具类 ─── */
.mb-4 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* ─── 响应式 ─── */
@media (max-width: 640px) {
    .hero-banner h1 { font-size: 1.55rem; }
    .answer-grid { grid-template-columns: 1fr; }
    .player-nickname { display: none; }
    .topic-area { padding: 1.25rem 1.15rem 0.85rem; }
    #challenge-area { padding: 1.25rem 1.15rem 1.5rem; }
    .result-body,
    .result-footer,
    .result-detail-area { padding-left: 1.15rem; padding-right: 1.15rem; }
    .btn-primary { width: 100%; justify-content: center; }
    .logo-text { font-size: 0.88rem; }
    .score-badge { display: none; }
}
