/* ============================================================
   谁是卧底 - 游戏阶段样式
   查看词语 / 讨论 / 投票 / 结果 / 结算
   ============================================================ */

/* ---------- 顶部状态条 ---------- */
.game-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0 16px;
}

.game-bar .phase-tag {
    font-size: 13px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    letter-spacing: 1px;
    animation: fadeIn 0.4s ease;
}

.game-bar .phase-tag.changed {
    animation: pulseTag 0.6s ease;
}

@keyframes pulseTag {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.14); }
    100% { transform: scale(1); }
}

.game-bar .round-tag {
    font-size: 13px;
    color: var(--text-1);
    font-weight: 600;
}

/* 讨论倒计时 */
.discussion-timer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
}

.discussion-timer .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
}

.discussion-timer.urgent {
    color: var(--danger);
}

.discussion-timer.urgent .dot {
    background: var(--danger);
}

/* ---------- 查看词语（翻牌） ---------- */
.word-stage {
    text-align: center;
    padding-top: 26px;
}

.word-stage .word-prompt {
    color: var(--text-1);
    font-size: 14px;
    letter-spacing: 2px;
    margin-bottom: 26px;
}

.word-card {
    width: min(300px, 78vw);
    height: 220px;
    margin: 0 auto;
    perspective: 1200px;
    cursor: pointer;
}

.word-card .card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.word-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.word-card .face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
}

.word-card .face.back {
    background: linear-gradient(160deg, var(--bg-3), var(--bg-1));
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-md);
}

.word-card .face.back .tap-hint {
    font-size: 13px;
    color: var(--text-2);
    letter-spacing: 3px;
}

.word-card .face.front {
    background: var(--grad-accent);
    transform: rotateY(180deg);
    color: #2a1a00;
    box-shadow: 0 18px 44px rgba(255, 158, 59, 0.4);
}

.word-card .face.front .word-text {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: 4px;
    line-height: 1.2;
    word-break: break-all;
}

.word-card .face.front .word-caption {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0.75;
}

.word-stage .word-confirm {
    margin-top: 30px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
}

.word-stage .word-confirm.show {
    opacity: 1;
    transform: translateY(0);
}

.word-stage .waiting-hint {
    margin-top: 26px;
    color: var(--text-2);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-2);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ---------- 讨论区（聊天） ---------- */
.discussion-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 210px);
    min-height: 420px;
    max-height: 760px;
}

.chat-panel {
    flex: 1;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overscroll-behavior: contain;
}

.msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: msgIn 0.25s ease;
}

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

.msg .msg-avatar {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #10162a;
}

.msg .msg-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 82%;
}

.msg .msg-name {
    font-size: 11px;
    color: var(--text-2);
}

.msg .msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
}

.msg.mine {
    flex-direction: row-reverse;
}

.msg.mine .msg-main {
    align-items: flex-end;
}

.msg.mine .msg-bubble {
    background: var(--accent-soft);
    border-color: rgba(255, 184, 77, 0.35);
    color: var(--text-0);
}

.msg.system {
    justify-content: center;
}

.msg.system .msg-bubble {
    background: transparent;
    border: none;
    color: var(--text-2);
    font-size: 12px;
    letter-spacing: 1px;
    padding: 2px 6px;
}

.chat-input-bar {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.chat-input-bar .input {
    flex: 1;
    min-height: 48px;
    padding: 0 16px;
    border-radius: var(--radius-md);
}

.chat-input-bar .btn {
    width: auto;
    min-height: 48px;
    padding: 0 20px;
    flex: none;
}

/* ---------- 投票 ---------- */
.vote-stage {
    padding-top: 10px;
}

.vote-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    color: var(--text-1);
    font-size: 14px;
}

.vote-progress .bar {
    flex: 1;
    height: 8px;
    border-radius: 999px;
    background: var(--bg-2);
    overflow: hidden;
}

.vote-progress .bar > i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--grad-accent);
    transition: width 0.4s ease;
}

.vote-stage .vote-tip {
    color: var(--text-2);
    font-size: 13px;
    margin-bottom: 14px;
}

.vote-stage .player-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
}

.vote-stage .vote-confirm {
    margin-top: 22px;
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.25s;
}

.vote-stage .vote-confirm.ready {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- 结果 ---------- */
.result-stage {
    text-align: center;
    padding-top: 16px;
}

.result-banner {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 3px;
    margin-bottom: 18px;
    animation: popIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.result-banner.tie { color: var(--text-1); }
.result-banner.eliminate { color: var(--danger); }

@keyframes popIn {
    0%   { opacity: 0; transform: scale(0.8); }
    60%  { transform: scale(1.06); }
    100% { opacity: 1; transform: scale(1); }
}

.result-elim-card {
    width: min(320px, 84vw);
    margin: 0 auto;
    padding: 26px 20px;
    border-radius: var(--radius-lg);
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
}

.result-elim-card .elim-name {
    font-size: 26px;
    font-weight: 800;
    margin: 12px 0 6px;
}

.result-elim-card .elim-role {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
}

.result-elim-card .elim-role.undercover {
    background: rgba(255, 107, 107, 0.16);
    color: var(--danger);
}

.result-elim-card .elim-role.civilian {
    background: rgba(63, 214, 165, 0.14);
    color: var(--success);
}

.result-elim-card .elim-word {
    margin-top: 14px;
    font-size: 30px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 3px;
}

.result-elim-card .elim-word-label {
    font-size: 12px;
    color: var(--text-2);
    margin-top: 4px;
}

.result-stage .result-note {
    margin-top: 20px;
    color: var(--text-2);
    font-size: 13px;
}

/* ---------- 游戏结束 ---------- */
.over-stage {
    text-align: center;
    padding-top: 14px;
}

.over-trophy {
    width: 90px;
    height: 90px;
    margin: 0 auto 18px;
    filter: drop-shadow(0 10px 26px rgba(255, 184, 77, 0.4));
    animation: floaty 3s ease-in-out infinite;
}

.over-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 3px;
}

.over-title.win-civilians { color: var(--success); }
.over-title.win-undercover { color: var(--danger); }

.over-sub {
    margin-top: 10px;
    color: var(--text-1);
    font-size: 15px;
}

.over-stage .final-reveal {
    margin-top: 26px;
    text-align: left;
}

.final-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--card);
    border: 1px solid var(--line);
    margin-bottom: 10px;
}

.final-card .fc-word {
    font-weight: 700;
    font-size: 15px;
    flex: 1;
}

.final-card .fc-word.undercover { color: var(--danger); }
.final-card .fc-word.civilian { color: var(--success); }

/* 状态标签（讨论区上方玩家） */
.players-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 14px;
    scrollbar-width: none;
}

.players-row::-webkit-scrollbar { display: none; }

.players-row .mini-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 52px;
    flex: none;
}

.players-row .mini-player .avatar {
    width: 38px;
    height: 38px;
    font-size: 14px;
}

.players-row .mini-player .mini-name {
    font-size: 11px;
    color: var(--text-2);
    max-width: 52px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.players-row .mini-player.dead .avatar {
    opacity: 0.4;
    filter: grayscale(1);
}

.players-row .mini-player.voted-flag {
    position: relative;
}

/* 被打败标记 */
.voted-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--success);
    color: #063;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-1);
}

/* ---------- 阶段横幅 ---------- */
.phase-banner {
    text-align: center;
    padding: 20px 0 6px;
}

.phase-banner .pb-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 3px;
}

.phase-banner .pb-sub {
    color: var(--text-2);
    font-size: 13px;
    margin-top: 6px;
    letter-spacing: 1px;
}

/* 确认/等待通用 */
.confirm-panel {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.center-state {
    text-align: center;
    padding: 40px 0;
    color: var(--text-2);
}

.center-state .cs-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    opacity: 0.8;
}

/* 头像网格配色（投票对象） */
.vote-grid-tip {
    font-size: 13px;
    color: var(--text-1);
    margin-bottom: 6px;
}

/* 移动端底部安全区按钮 */
.safe-actions {
    padding-bottom: var(--safe-bottom);
}