/* ═══════════════════════════════════════════════════════════════════════════
   飞花令 · 诗词对决 — Immersive Game UI
   ═══════════════════════════════════════════════════════════════════════════ */

.fh-game {
    min-height: calc(100vh - 64px); background: linear-gradient(170deg, #1a0a2e 0%, #2d1b4e 30%, #16213e 70%, #0f3460 100%);
    color: #fff; position: relative; overflow: hidden;
}
.fh-game::before {
    content: ''; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='1' fill='rgba(255,255,255,0.06)'/%3E%3C/svg%3E");
    pointer-events: none; z-index: 0;
}

/* ── Top bar ─────────────────────────────────────────────────────────── */
.fh-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 24px; position: relative; z-index: 1;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.fh-back { color: rgba(255,255,255,0.7); font-weight: 700; font-size: 14px; }
.fh-back:hover { color: #fff; }
.fh-mode-switch { display: flex; gap: 0; border-radius: 12px; overflow: hidden; border: 1px solid rgba(255,255,255,0.15); }
.fh-mode-btn {
    padding: 8px 22px; border: none; background: transparent; color: rgba(255,255,255,0.6);
    font-family: var(--pk-font); font-size: 14px; font-weight: 700; cursor: pointer; transition: all 0.2s;
}
.fh-mode-btn--active { background: rgba(255,255,255,0.15); color: #fff; }
.fh-mode-btn:hover:not(.fh-mode-btn--active) { color: #fff; background: rgba(255,255,255,0.05); }
.fh-btn-icon {
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.15);
    background: transparent; color: #fff; font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.fh-btn-icon:hover { background: rgba(255,255,255,0.1); }

/* ── Arena ───────────────────────────────────────────────────────────── */
.fh-arena {
    max-width: 640px; margin: 0 auto; padding: 32px 24px 60px;
    position: relative; z-index: 1; display: flex; flex-direction: column; gap: 28px;
}

/* ── VS display ──────────────────────────────────────────────────────── */
.fh-vs { display: flex; align-items: center; justify-content: center; gap: 32px; }
.fh-player-card { text-align: center; }
.fh-player-avatar { font-size: 36px; margin-bottom: 4px; }
.fh-player-name { font-size: 13px; color: rgba(255,255,255,0.6); font-weight: 700; }
.fh-player-score { font-size: 28px; font-weight: 900; margin-top: 2px; }
.fh-vs-badge {
    font-size: 18px; font-weight: 900; color: rgba(255,255,255,0.3);
    padding: 8px 14px; border: 2px solid rgba(255,255,255,0.15); border-radius: 50%;
}

/* ── Keyword zone ────────────────────────────────────────────────────── */
.fh-keyword-zone { text-align: center; }
.fh-keyword-label { font-size: 13px; color: rgba(255,255,255,0.5); margin-bottom: 8px; }
.fh-keyword-char {
    font-size: 96px; font-weight: 900; line-height: 1; color: #ffd93d;
    text-shadow: 0 0 60px rgba(255,217,61,0.4), 0 0 120px rgba(255,217,61,0.2);
    animation: fh-keyword-glow 3s ease-in-out infinite;
}
@keyframes fh-keyword-glow {
    0%, 100% { text-shadow: 0 0 40px rgba(255,217,61,0.3), 0 0 80px rgba(255,217,61,0.1); }
    50%      { text-shadow: 0 0 80px rgba(255,217,61,0.6), 0 0 160px rgba(255,217,61,0.3); }
}

/* ── Timer ───────────────────────────────────────────────────────────── */
.fh-timer-wrap { text-align: center; }
.fh-timer-bar {
    height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px;
    overflow: hidden; margin-bottom: 8px;
}
.fh-timer-bar::after {
    content: ''; display: block; height: 100%; width: 100%;
    background: linear-gradient(90deg, #6BCB77, #4D96FF, #FF6B6B);
    border-radius: 2px; transition: width 0.3s linear;
}
.fh-timer-bar--warning::after { background: #FF6B6B; animation: fh-timer-pulse 0.5s ease-in-out infinite; }
@keyframes fh-timer-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}
.fh-timer-text { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; color: rgba(255,255,255,0.7); }
.fh-timer-text--warning { color: #FF6B6B; }

/* ── Input zone ──────────────────────────────────────────────────────── */
.fh-input-zone { display: flex; gap: 12px; }
.fh-game-input {
    flex: 1; padding: 16px 22px; border: 2px solid rgba(255,255,255,0.12);
    border-radius: 16px; background: rgba(255,255,255,0.06); color: #fff;
    font-family: var(--pk-font); font-size: 20px; transition: border-color 0.2s;
}
.fh-game-input:focus { outline: none; border-color: #ffd93d; background: rgba(255,255,255,0.1); }
.fh-game-input::placeholder { color: rgba(255,255,255,0.25); }
.fh-submit-btn {
    padding: 16px 32px; border: none; border-radius: 16px;
    background: linear-gradient(135deg, #ffd93d, #ff8c00); color: #1a0a2e;
    font-family: var(--pk-font); font-size: 18px; font-weight: 900; cursor: pointer;
    transition: all 0.2s; flex-shrink: 0;
}
.fh-submit-btn:hover { transform: scale(1.03); box-shadow: 0 4px 20px rgba(255,217,61,0.4); }
.fh-submit-btn:disabled { opacity: 0.4; cursor: default; transform: none; }

/* ── Feedback ────────────────────────────────────────────────────────── */
.fh-feedback { text-align: center; min-height: 48px; }
.fh-fb-ok { color: #6BCB77; font-weight: 800; font-size: 16px; }
.fh-fb-err { color: #FF6B6B; font-weight: 700; font-size: 14px; }
.fh-fb-source { color: rgba(255,255,255,0.5); font-size: 13px; margin-top: 4px; }

/* ── History ─────────────────────────────────────────────────────────── */
.fh-history { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.fh-history-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    background: rgba(255,255,255,0.04); border-radius: 10px;
    font-size: 14px; animation: fh-item-in 0.3s ease-out;
}
@keyframes fh-item-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
.fh-history-player { font-weight: 800; min-width: 40px; }
.fh-history-line { flex: 1; }
.fh-history-source { font-size: 11px; color: rgba(255,255,255,0.4); }
.fh-history-ok { border-left: 3px solid #6BCB77; }

/* ── Overlay ─────────────────────────────────────────────────────────── */
.fh-overlay {
    position: fixed; inset: 0; background: rgba(10,5,20,0.9); z-index: 100;
    display: flex; align-items: center; justify-content: center;
}
.fh-overlay-card {
    background: linear-gradient(160deg, #2d1b4e, #16213e);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 28px;
    padding: 48px 40px; text-align: center; max-width: 420px; width: 90%;
}
.fh-overlay-card h2 { font-size: 28px; font-weight: 900; margin-bottom: 24px; }
.fh-final-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 28px; }
.fh-final-scores div {
    padding: 14px; background: rgba(255,255,255,0.05); border-radius: 12px;
    text-align: center;
}
.fh-final-scores span { display: block; font-size: 12px; color: rgba(255,255,255,0.5); margin-bottom: 4px; }
.fh-final-scores strong { font-size: 24px; font-weight: 900; }
.fh-overlay-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Leaderboard panel ───────────────────────────────────────────────── */
.fh-leaderboard-panel {
    position: fixed; top: 0; right: 0; bottom: 0; width: 360px; max-width: 90vw;
    background: #1a1a2e; border-left: 1px solid rgba(255,255,255,0.08);
    z-index: 200; overflow-y: auto; padding: 24px;
}
.fh-lb-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.fh-lb-header h3 { font-size: 20px; font-weight: 800; }
.fh-lb-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.fh-lb-tab {
    padding: 6px 16px; border-radius: 100px; border: 1px solid rgba(255,255,255,0.12);
    background: transparent; color: rgba(255,255,255,0.6); font-family: var(--pk-font);
    font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.2s;
}
.fh-lb-tab--active { background: rgba(255,255,255,0.15); color: #fff; border-color: rgba(255,255,255,0.3); }
.fh-lb-list { display: flex; flex-direction: column; gap: 6px; }
.fh-lb-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    background: rgba(255,255,255,0.03); border-radius: 10px;
}
.fh-lb-rank { font-size: 18px; font-weight: 900; width: 32px; text-align: center; }
.fh-lb-rank--gold { color: #ffd93d; }
.fh-lb-rank--silver { color: #c0c0c0; }
.fh-lb-rank--bronze { color: #cd7f32; }
.fh-lb-info { flex: 1; }
.fh-lb-name { font-size: 14px; font-weight: 700; }
.fh-lb-meta { font-size: 11px; color: rgba(255,255,255,0.4); }
.fh-lb-score { font-size: 18px; font-weight: 900; color: #ffd93d; }

/* ── Multiplayer ──────────────────────────────────────────────────────── */
.fh-multi-lobby { max-width: 640px; margin: 0 auto; padding: 40px 24px; }
.fh-lobby-split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.fh-lobby-card {
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px; padding: 28px 24px;
}
.fh-lobby-card h3 { font-size: 20px; font-weight: 800; margin-bottom: 16px; }
.fh-waiting-players { max-height: 200px; overflow-y: auto; }
.fh-multi-players { margin-bottom: 20px; }
.fh-room-item:hover { background: rgba(255,255,255,0.08) !important; }

@media (max-width: 768px) {
    .fh-lobby-split { grid-template-columns: 1fr; }
    .fh-keyword-char { font-size: 64px; }
    .fh-input-zone { flex-direction: column; }
    .fh-leaderboard-panel { width: 100%; max-width: 100%; }
    .fh-vs { gap: 16px; }
    .fh-player-score { font-size: 22px; }
}
