* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    touch-action: manipulation;
    position: relative;
}

.home-hero-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(650px 120px at 20% -10%, rgba(99,102,241,0.35), transparent 60%),
                radial-gradient(600px 140px at 80% -10%, rgba(124,58,237,0.35), transparent 60%);
    pointer-events: none;
    z-index: -1;
    filter: blur(0.5px);
    opacity: 0.9;
}

.home-hero-container::after {
    content: '';
    position: absolute;
    top: -10%;
    left: 10%;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle at center, rgba(255,255,255,0.2), rgba(255,255,255,0));
    border-radius: 50%;
    filter: blur(10px);
    animation: floatBubble 12s ease-in-out infinite;
    pointer-events: none;
}

@keyframes floatBubble {
    0% { transform: translateY(0) translateX(0); opacity: 0.7; }
    50% { transform: translateY(12px) translateX(8px); opacity: 1; }
    100% { transform: translateY(0) translateX(0); opacity: 0.7; }
}

.brand-title {
    letter-spacing: 0.02em;
    line-height: 1.1;
    background-image: linear-gradient(120deg, #0f172a 0%, #1e293b 50%, #4f46e5 50%, #7c3aed 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleShimmer 6s ease-in-out infinite;
}
.brand-title::after {
    content: '';
    display: block;
    width: 120px;
    height: 4px;
    margin: 10px auto 0;
    border-radius: 9999px;
    background: linear-gradient(90deg, rgba(79,70,229,0.3), rgba(124,58,237,0.5));
}
.brand-title span {
    filter: drop-shadow(0 10px 22px rgba(124,58,237,0.25));
}

.brand-title .text-indigo-600 {
    color: #4f46e5;
    -webkit-text-fill-color: #4f46e5;
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
}

.brand-subtitle {
    color: #64748b;
    font-weight: 600;
    letter-spacing: 0.08em;
}
.brand-subtitle {
    background: linear-gradient(90deg, #475569, #64748b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.home-hero-container .text-xs.text-slate-400,
.home-hero-container .text-xs.text-emerald-100,
.home-hero-container .text-xs.text-indigo-100 {
    letter-spacing: 0.06em;
}

@keyframes titleShimmer {
    0%, 100% { filter: drop-shadow(0 1px 0 rgba(79,70,229,0.05)); }
    50% { filter: drop-shadow(0 6px 18px rgba(79,70,229,0.25)); }
}

.home-card {
    position: relative;
    isolation: isolate;
}
.home-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    transform: translate3d(0,0,0);
    background: linear-gradient(180deg, rgba(255,255,255,0.4), rgba(255,255,255,0));
    opacity: 0;
    transition: opacity 300ms ease;
}
.home-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease, opacity 0.3s ease;
    opacity: 0;
}
.home-card:active::before {
    width: 280px;
    height: 280px;
    opacity: 1;
}
.home-card:hover::after { opacity: 1; }
.home-card:hover { transform: translateY(-2px); }
.home-card .home-card-icon { transition: transform 300ms ease; }
.home-card:hover .home-card-icon { transform: scale(1.08); }
.home-card .home-card-arrow { transition: transform 300ms ease, opacity 300ms ease; }
.home-card:hover .home-card-arrow { transform: translateX(4px); opacity: 0.8; }
.home-card:active { transform: translateY(0) scale(0.98); }

.home-card--primary { box-shadow: 0 12px 24px rgba(79, 70, 229, 0.28); }
.home-card--success { box-shadow: 0 12px 24px rgba(16, 185, 129, 0.28); }
.home-card--neutral { box-shadow: 0 8px 18px rgba(15, 23, 42, 0.1); }

.home-card--primary:hover { box-shadow: 0 16px 32px rgba(79, 70, 229, 0.35); }
.home-card--success:hover { box-shadow: 0 16px 32px rgba(16, 185, 129, 0.35); }
.home-card--neutral:hover { box-shadow: 0 12px 26px rgba(15, 23, 42, 0.14); }

.home-card-icon { position: relative; }
.home-card-icon::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 9999px;
    border: 2px solid rgba(255,255,255,0.35);
    opacity: 0;
    transition: opacity 300ms ease;
}
.home-card:hover .home-card-icon::after { opacity: 1; }

.home-card { animation: cardEnter 500ms ease both; }
.home-card:nth-child(1) { animation-delay: 120ms; }
.home-card:nth-child(2) { animation-delay: 220ms; }
.home-card:nth-child(3) { animation-delay: 320ms; }
@keyframes cardEnter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (hover: hover) {
  .home-card:hover { transform: translateY(-2px) rotateX(0.5deg) rotateY(0.5deg); }
}

#matchingText { animation: matchingPulse 1.8s ease-in-out infinite; }
#matchingSubText { opacity: 0.85; }
@keyframes matchingPulse {
    0% { letter-spacing: 0; transform: translateY(0); }
    100% { letter-spacing: 0.03em; transform: translateY(-1px); }
}

/* 添加背景动效 */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: backgroundMove 20s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes backgroundMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* Logo浮动动画 */
@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0) rotate(3deg);
    }
    50% {
        transform: translateY(-10px) rotate(3deg);
    }
}

/* 上滑动画 */
@keyframes animate-slide-up {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: animate-slide-up 0.3s ease-out;
}

/* 聊天区域滚动条隐藏 */
#chatMessages::-webkit-scrollbar {
    display: none;
}

#chatMessages {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* 玩家网格区域 */
.player-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.player-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-avatar {
    position: relative;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 2px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    background-color: white;
}

.player-avatar.owner {
    background-color: #dbeafe;
    border-color: #6366f1;
}

.crown-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    background-color: #fbbf24;
    color: white;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    border: 2px solid white;
}

.player-name {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.player-name.owner {
    font-weight: 700;
    color: #4f46e5;
    text-shadow: 0 1px 2px rgba(79, 70, 229, 0.1);
}

.player-name.normal {
    font-weight: 500;
    color: #475569;
}

.empty-slot {
    opacity: 0.3;
}

.empty-slot .player-avatar {
    border: 2px dashed #cbd5e1;
    color: #94a3b8;
    background-color: transparent;
}

/* 聊天区域 */
.chat-section {
    border-top: 1px solid #f1f5f9;
    padding-top: 1rem;
    margin-top: 1rem;
}

.chat-section-header {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 700;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-message {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.chat-message.own {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.chat-avatar.own {
    background-color: #dbeafe;
}

.chat-avatar.other {
    background-color: white;
}

.chat-bubble {
    font-size: 0.75rem;
    color: #475569;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 80%;
    word-wrap: break-word;
}

.chat-bubble.own {
    background-color: #4f46e5;
    color: white;
    border-bottom-right-radius: 0.125rem;
}

.chat-bubble.other {
    background-color: white;
    border-bottom-left-radius: 0.125rem;
}

.system-message {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.5rem 0;
}

.system-message-content {
    background-color: #e2e8f0;
    color: #64748b;
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}

/* 页面切换 */
.page {
    display: none;
    min-height: 100vh;
    padding: 15px;
    position: relative;
    z-index: 1;
}

.page.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

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

@media (min-width: 768px) {
    .page {
        padding: 20px;
    }
}

/* 容器 */
.container {
    max-width: 500px;
    width: 100%;
    margin: 20px auto;
    background: rgba(255, 255, 255, 0.98);
    padding: 30px 25px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    animation: slideUp 0.5s ease-out;
    box-sizing: border-box;
    overflow-x: hidden;
}

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

@media (min-width: 768px) {
    .container {
        margin: 50px auto;
        padding: 45px 50px;
        border-radius: 28px;
    }
}

/* 标题 */
.title {
    font-size: 28px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    line-height: 1.3;
    font-weight: 800;
    animation: titlePulse 2s ease-in-out infinite;
    letter-spacing: 1px;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 35px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 1.5px;
}

@media (min-width: 768px) {
    .title {
        font-size: 36px;
        margin-bottom: 10px;
    }
    
    .subtitle {
        margin-bottom: 40px;
        font-size: 16px;
    }
}

/* 页面标题 */
.page-title {
    font-size: 24px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 30px;
    font-weight: 800;
    letter-spacing: 1px;
    animation: pageTitleSlide 0.5s ease-out;
}

@keyframes pageTitleSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 768px) {
    .page-title {
        font-size: 32px;
        margin-bottom: 40px;
    }
}

/* 表单 */
.form-group {
    margin-bottom: 24px;
    animation: formSlideIn 0.4s ease-out backwards;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }

@keyframes formSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.form-group label {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    color: #333;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.3px;
}

.form-group label::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    margin-right: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 15px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 52px;
    background: #fafafa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.form-group input::placeholder {
    color: #aaa;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 4px 12px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.form-group input:valid:not(:placeholder-shown) {
    border-color: #4caf50;
}

.form-group input:invalid:not(:placeholder-shown):not(:focus) {
    border-color: #ff5252;
}

/* 按钮 */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 30px;
    animation: buttonSlideIn 0.5s ease-out backwards;
    animation-delay: 0.5s;
}

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

.btn {
    flex: 1;
    padding: 16px 24px;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 56px;
    touch-action: manipulation;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.btn i { margin-right: 6px; }

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

@media (min-width: 768px) {
    .button-group {
        flex-direction: row;
        gap: 15px;
        margin-top: 35px;
    }
    
    .btn {
        padding: 16px 32px;
        font-size: 18px;
    }
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}

.btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.15);
}

.btn-secondary:hover {
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.15);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn:disabled:hover {
    transform: none !important;
}

.btn-danger {
    background: #ff5252;
    color: white;
}

.btn-danger:hover {
    background: #ff1744;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 5px;
    min-height: 32px;
    font-weight: normal;
}

.btn-lg {
    padding: 16px 30px;
    font-size: 18px;
    min-height: 52px;
}

@media (min-width: 768px) {
    .btn-lg {
        padding: 18px 36px;
        font-size: 20px;
    }
}

/* 房间页面 */
#roomPage {
    background: #f8fafc;
    padding: 0;
}

.room-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 10px 12px;
    border-radius: 12px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(102, 126, 234, 0.1);
    gap: 10px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    position: relative;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 聊天栏（顶部固定） */
.chat-bar {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(102, 126, 234, 0.08);
}

.chat-display {
    flex: 1;
    height: 72px;
    overflow-y: auto;
    overflow-x: hidden;
    cursor: pointer;
    border-radius: 6px;
    padding: 6px 8px;
    background: #fafafa;
    transition: all 0.3s ease;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;  /* Firefox 隐藏滚动条 */
    -ms-overflow-style: none;  /* IE/Edge 隐藏滚动条 */
}

/* 隐藏滚动条 */
.chat-display::-webkit-scrollbar {
    display: none;  /* Chrome/Safari/Opera 隐藏滚动条 */
}

.chat-display:hover {
    background: #f0f0f0;
}

.chat-display #chatMessages {
    display: flex;
    flex-direction: column;
}

.chat-toggle-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.chat-toggle-btn:active {
    transform: scale(0.95);
}

/* 聊天输入框弹窗 */
.chat-input-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10002;
    display: flex;
    align-items: flex-end;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(5px);
}

.chat-input-content {
    background: white;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-height: 70vh;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUpChat 0.3s ease-out;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@keyframes slideUpChat {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.chat-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.chat-input-header h3 {
    color: white;
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.chat-input-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    max-height: 40vh;
    -webkit-overflow-scrolling: touch;
}

.chat-messages-modal {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-input-footer {
    padding: 12px 15px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    gap: 10px;
    background: #fafafa;
}

.chat-input-footer input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.chat-input-footer input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input-footer .btn {
    padding: 10px 20px;
    white-space: nowrap;
}

#matchingRetryBtn,
#matchingOverlay .btn,
#matchingOverlay button {
    position: relative;
    overflow: hidden;
}
#matchingRetryBtn::before,
#matchingOverlay .btn::before,
#matchingOverlay button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: linear-gradient(120deg, rgba(255,255,255,0.35), rgba(255,255,255,0));
    transform: skewX(-25deg);
    transition: left 0.6s ease;
}
#matchingRetryBtn:hover::before,
#matchingOverlay .btn:hover::before,
#matchingOverlay button:hover::before {
    left: 120%;
}

/* 在线玩家气泡（抖音直播间样式） */
.online-players-bubble {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    padding: 0 12px;
    height: 32px;
    min-width: 40px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.online-players-bubble:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: scale(1.05);
}

.online-players-bubble .player-icon {
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.online-players-bubble #playerCount {
    color: white;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    text-align: center;
}

/* 退出按钮（×号圆形） */
.exit-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    line-height: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.exit-btn:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: scale(1.1) rotate(90deg);
}

.exit-btn:active {
    transform: scale(0.95) rotate(90deg);
}

/* 房间设置弹窗 */
.room-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(5px);
}

.room-settings-content {
    background: white;
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    animation: slideUp 0.4s ease-out;
    overflow: hidden;
}

.room-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.room-settings-header h3 {
    color: white;
    font-size: 18px;
    font-weight: 800;
    margin: 0;
    letter-spacing: 0.5px;
}

.room-settings-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.setting-item {
    margin-bottom: 24px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.room-settings-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
}

/* 退出按钮缩小 */

.player-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(5px);
}

.player-modal-content {
    background: white;
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 70vh;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    animation: slideUp 0.4s ease-out;
    overflow: hidden;
}

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

.player-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.player-modal-header h3 {
    color: white;
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    letter-spacing: 0.5px;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.player-modal-body {
    padding: 24px;
    max-height: calc(70vh - 70px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.player-modal-body .player-item {
    padding: 0px;
    margin-bottom: 12px;
    background: linear-gradient(145deg, #f8f9fa, #f0f0f0);
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    animation: playerSlideIn 0.4s ease-out backwards;
    transition: all 0.3s ease;
}

@keyframes playerSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.player-modal-body .player-item:nth-child(1) { animation-delay: 0.05s; }
.player-modal-body .player-item:nth-child(2) { animation-delay: 0.1s; }
.player-modal-body .player-item:nth-child(3) { animation-delay: 0.15s; }
.player-modal-body .player-item:nth-child(4) { animation-delay: 0.2s; }
.player-modal-body .player-item:nth-child(5) { animation-delay: 0.25s; }

.player-modal-body .player-item.owner {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border-left: 4px solid #ff9800;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.2);
}

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

.owner-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.room-info {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 4px;
    border-radius: 8px;
}

.room-info:hover {
    background: rgba(102, 126, 234, 0.05);
    transform: translateX(2px);
}

.room-info h2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 3px;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 800;
}

.room-info p {
    color: #999;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 768px) {
    #roomPage {
        padding: 20px;
    }
    
    .room-header {
        padding: 20px;
        margin-bottom: 20px;
        border-radius: 16px;
    }
    
    .room-info h2 {
        font-size: 24px;
    }
    
    .room-info p {
        font-size: 14px;
    }
}

.room-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (min-width: 1024px) {
    .room-content {
        display: grid;
        grid-template-columns: 1fr 250px;
        gap: 20px;
    }
}



/* 游戏区域 */
.game-area {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    padding: 20px 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(102, 126, 234, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 380px;
    order: 1;
    border: 1px solid rgba(102, 126, 234, 0.08);
}

@media (min-width: 768px) {
    .game-area {
        padding: 30px 20px;
        min-height: 450px;
        border-radius: 20px;
    }
}

@media (min-width: 1024px) {
    .game-area {
        padding: 40px;
        min-height: auto;
        order: 0;
    }
}

.waiting-area {
    width: 100%;
    overflow-y: auto;
    padding-bottom: 1rem;
}

.waiting-area h3 {
    font-size: 22px;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
    width: 100%;
}

.waiting-area p {
    color: #666;
    margin-bottom: 25px;
    font-size: 15px;
    text-align: center;
    width: 100%;
}

.waiting-area #startBtn {
    margin: 0 auto;
}

@media (min-width: 768px) {
    .waiting-area h3 {
        font-size: 28px;
        margin-bottom: 20px;
    }
    
    .waiting-area p {
        margin-bottom: 30px;
        font-size: 16px;
    }
}

.countdown-area {
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.countdown-area h1 {
    font-size: 80px;
    color: #667eea;
    animation: pulse 1s infinite;
    margin: 0 auto;
}

.countdown-area p {
    color: #666;
    font-size: 16px;
    margin-top: 20px;
}

@media (min-width: 768px) {
    .countdown-area h1 {
        font-size: 120px;
    }
    
    .countdown-area p {
        font-size: 18px;
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* 答题区域 */
.question-area {
    width: 100%;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: bold;
}

.time-remaining {
    color: #ff5252;
    font-size: 20px;
    font-weight: 900;
    animation: timePulse 1s ease-in-out infinite;
    text-shadow: 0 2px 10px rgba(255, 82, 82, 0.3);
}

@keyframes timePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

@media (min-width: 768px) {
    .question-header {
        margin-bottom: 30px;
        font-size: 18px;
    }
    
    .time-remaining {
        font-size: 24px;
    }
}

.word-display {
    text-align: center;
    margin-bottom: 25px;
}

.word-display h1 {
    font-size: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
    word-break: break-word;
    text-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    animation: wordBounce 0.6s ease-out;
    letter-spacing: 2px;
}

@keyframes wordBounce {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(-30px);
    }
    60% {
        transform: scale(1.1) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@media (min-width: 768px) {
    .word-display {
        margin-bottom: 40px;
    }
    
    .word-display h1 {
        font-size: 56px;
    }
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.option-btn {
    padding: 16px 12px;
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    border: 3px solid #e8e8e8;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    min-height: 56px;
    word-break: break-word;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    will-change: transform, background, color;
}

.option-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

@media (hover: hover) and (pointer: fine) {
    .option-btn:hover::after {
        width: 300px;
        height: 300px;
    }
}

@media (min-width: 768px) {
    .options-grid {
        gap: 15px;
    }
    
    .option-btn {
        padding: 20px;
        font-size: 18px;
        min-height: 64px;
        border-radius: 14px;
    }
}

@media (orientation: landscape) and (max-width: 1023px) {
    .options-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (hover: hover) and (pointer: fine) {
    .option-btn:hover {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border-color: #667eea;
        transform: translateY(-4px) scale(1.02);
        box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    }
}

.option-btn:focus {
    outline: none;
}

.option-btn:disabled:hover {
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    color: inherit;
    border-color: #e8e8e8;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.option-btn:active {
    transform: none;
}

.option-btn.correct {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border-color: #4caf50;
    animation: correctPulse 0.6s ease-out;
}

@keyframes correctPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.option-btn.wrong {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.option-btn.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.35);
}

.option-btn.selected:disabled {
    opacity: 1;
}

/* 右侧面板 */
.right-panel {
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    order: 2;
}

.right-panel h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
    font-weight: bold;
    border-bottom: 2px solid #667eea;
    padding-bottom: 6px;
}

#scoreBoard {
    max-height: none;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
    .right-panel h3 {
        margin-bottom: 15px;
        font-size: 16px;
    }
}

@media (min-width: 1024px) {
    .right-panel {
        padding: 20px;
        order: 0;
        max-height: none;
    }
    
    #scoreBoard {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: #f5f5f5;
    border-radius: 6px;
}

@media (min-width: 768px) {
    .score-item {
        padding: 10px 15px;
        margin-bottom: 8px;
    }
}

.score-item.rank1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    border: 2px solid #ffd700;
}

.score-item.rank2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
    box-shadow: 0 4px 15px rgba(192, 192, 192, 0.3);
    border: 2px solid #c0c0c0;
}

.score-item.rank3 {
    background: linear-gradient(135deg, #cd7f32 0%, #e8a87c 100%);
    box-shadow: 0 4px 15px rgba(205, 127, 50, 0.3);
    border: 2px solid #cd7f32;
}

.score-name {
    font-weight: bold;
    color: #333;
    font-size: 14px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-points {
    color: #667eea;
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
    margin-left: 10px;
}

@media (min-width: 768px) {
    .score-name {
        font-size: 15px;
    }
    
    .score-points {
        font-size: 18px;
    }
}

/* 结果区域 */
.result-area {
    width: 100%;
    max-width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    overflow-x: hidden;
}

.result-area h2 {
    font-size: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    font-weight: 900;
    animation: resultBounce 0.8s ease-out;
}

.result-area #restartBtn {
    margin: 20px auto 0;
}

@keyframes resultBounce {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-5deg);
    }
    60% {
        transform: scale(1.1) rotate(2deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@media (min-width: 768px) {
    .result-area h2 {
        font-size: 36px;
        margin-bottom: 30px;
    }
}

#rankingList {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 15px;
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    #rankingList {
        max-width: 600px;
        margin: 0 auto 30px;
        max-height: none;
    }
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    animation: rankSlide 0.5s ease-out backwards;
    transition: transform 0.3s ease;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.ranking-item:hover {
    transform: translateX(5px);
}

@keyframes rankSlide {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ranking-item:nth-child(1) { animation-delay: 0.1s; }
.ranking-item:nth-child(2) { animation-delay: 0.2s; }
.ranking-item:nth-child(3) { animation-delay: 0.3s; }

@media (min-width: 768px) {
    .ranking-item {
        padding: 15px 20px;
        margin-bottom: 10px;
        border-radius: 14px;
    }
}

.ranking-item.rank1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
    transform: scale(1.02);
}

.ranking-item.rank2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
    box-shadow: 0 4px 15px rgba(192, 192, 192, 0.4);
}

.ranking-item.rank3 {
    background: linear-gradient(135deg, #cd7f32 0%, #e8a87c 100%);
    box-shadow: 0 4px 15px rgba(205, 127, 50, 0.4);
}

.ranking-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.ranking-medal {
    font-size: 24px;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .ranking-left {
        gap: 15px;
    }
    
    .ranking-medal {
        font-size: 32px;
    }
}

.ranking-info {
    text-align: left;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.ranking-name {
    font-size: 15px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-stats {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-score {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
    flex-shrink: 0;
    margin-left: 8px;
}

.home-version {
    opacity: 0.8;
}

@media (min-width: 768px) {
    .ranking-name {
        font-size: 20px;
    }
    
    .ranking-stats {
        font-size: 14px;
    }
    
    .ranking-score {
        font-size: 28px;
    }
}

/* 聊天消息 */
.chat-message {
    background: transparent;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 3px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.chat-messages-modal .chat-message {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    font-size: 14px;
    padding: 8px 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.chat-message .name {
    font-weight: bold;
    color: #667eea;
    margin-right: 6px;
    flex-shrink: 0;
}

.chat-message .time {
    font-size: 10px;
    color: #999;
    margin-left: 6px;
}

.chat-messages-modal .chat-message .time {
    font-size: 11px;
}

/* 系统消息 */
.system-message {
    background: transparent;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 3px;
    text-align: center;
    font-size: 12px;
    line-height: 1.5;
    flex-shrink: 0;
}

.chat-messages-modal .system-message {
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 13px;
    white-space: normal;
}

/* 答案提交反馈 */
.submit-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    z-index: 20000;
    display: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease;
}

.submit-feedback.error {
    background: rgba(220, 53, 69, 0.9);
}

.submit-feedback.success {
    background: rgba(40, 167, 69, 0.9);
}

/* 答对弹窗 */
.answer-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 15px;
    padding: 30px 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    text-align: center;
    min-width: 280px;
    max-width: 90vw;
    animation: popupIn 0.3s ease-out;
}

@media (min-width: 768px) {
    .answer-popup {
        padding: 40px 60px;
        min-width: 400px;
        border-radius: 20px;
    }
}

@keyframes popupIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.answer-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.answer-popup .success-icon {
    font-size: 60px;
    margin-bottom: 15px;
    animation: bounce 0.6s ease-out;
}

@media (min-width: 768px) {
    .answer-popup .success-icon {
        font-size: 80px;
        margin-bottom: 20px;
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.answer-popup .player-info {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.answer-popup .player-info .score-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.answer-popup .word-info {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.answer-popup .word-info .word {
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.answer-popup .word-info .meaning {
    font-size: 16px;
    color: #555;
    font-weight: 500;
    line-height: 1.5;
}



.answer-popup .countdown-text {
    font-size: 16px;
    color: #666;
}

.answer-popup .countdown-number {
    display: inline-block;
    font-size: 36px;
    font-weight: bold;
    color: #667eea;
    min-width: 50px;
    animation: countPulse 1s infinite;
}

@media (min-width: 768px) {
    .answer-popup .player-info {
        font-size: 24px;
        margin-bottom: 15px;
    }
    
    .answer-popup .player-info .score-badge {
        font-size: 20px;
        padding: 6px 16px;
    }
    
    .answer-popup .word-info {
        padding: 20px 25px;
        margin-bottom: 20px;
    }
    
    .answer-popup .word-info .word {
        font-size: 36px;
        margin-bottom: 10px;
    }
    
    .answer-popup .word-info .meaning {
        font-size: 18px;
    }
    
    .answer-popup .countdown-text {
        font-size: 18px;
    }
    
    .answer-popup .countdown-number {
        font-size: 48px;
        min-width: 60px;
    }
}

@keyframes countPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* 移动端优化 */
@media (max-width: 767px) {
    /* 优化滚动 */
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    /* 首页优化 */
    #homePage .container {
        margin: 30px auto;
        padding: 30px 20px;
    }
    
    #homePage .title {
        font-size: 26px;
    }
    
    #homePage .subtitle {
        font-size: 14px;
        margin-bottom: 30px;
    }
    
    /* 创建和加入房间页面优化 */
    #createRoomPage .container,
    #joinRoomPage .container {
        margin: 10px auto;
        padding: 25px 20px;
    }
    
    .page-title {
        font-size: 22px;
        margin-bottom: 25px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group input,
    .form-group select {
        padding: 14px;
        font-size: 16px;
    }
    
    .button-group {
        gap: 12px;
        margin-top: 25px;
    }
    
    .btn {
        padding: 15px 20px;
        font-size: 16px;
        min-height: 52px;
    }
    
    /* 聊天消息 */
    .chat-message {
        font-size: 14px;
        padding: 6px;
    }
    
    .chat-message .name {
        font-size: 14px;
    }
    
    .chat-message .time {
        font-size: 11px;
    }
    
    /* 系统消息 */
    .system-message {
        font-size: 13px;
        padding: 8px;
    }
    
    /* 玩家列表项 */
    .player-item {
        padding: 8px;
        margin-bottom: 6px;
        font-size: 14px;
    }
    
    .owner-badge {
        font-size: 11px;
        padding: 2px 6px;
    }
}

/* 安全区域适配 */
@supports (padding-top: env(safe-area-inset-top)) {
    /* 为所有页面添加顶部安全区域 */
    .page {
        padding-top: max(30px, env(safe-area-inset-top));
    }
    
    /* 为子页面的返回按钮添加额外的顶部间距 */
    #createRoomPage .container,
    #joinRoomPage .container,
    #authPage .container,
    #userCenterPage .container {
        padding-top: calc(max(30px, env(safe-area-inset-top)) + 30px);
    }
    
    /* 房间页面的安全区域适配 */
    #roomPage {
        padding-top: max(20px, env(safe-area-inset-top));
    }
    
    .room-header {
        padding-top: calc(max(20px, env(safe-area-inset-top)) + 10px);
    }
}

/* APP环境下的特殊处理 */
html[data-env="app"] .page {
    padding-top: 40px;
}

html[data-env="app"] #createRoomPage .container,
html[data-env="app"] #joinRoomPage .container,
html[data-env="app"] #authPage .container,
html[data-env="app"] #userCenterPage .container {
    padding-top: 60px;
}

/* 平板优化 */
@media (min-width: 768px) and (max-width: 1023px) {
    .room-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 15px;
    }
    
    .game-area {
        grid-column: 1 / -1;
        order: 0;
    }
    
    .left-panel {
        order: 1;
        flex-direction: column;
    }
    
    .right-panel {
        order: 2;
    }
}

/* 大屏优化 */
@media (min-width: 1200px) {
    .room-content {
        grid-template-columns: 280px 1fr 280px;
    }
}

/* 分享功能样式 */
.share-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 700;
    z-index: 10003;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 90%;
    word-wrap: break-word;
}

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

.share-toast .toast-icon {
    font-size: 24px;
    font-weight: bold;
}

.share-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10003;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(5px);
}

.share-modal {
    background: white;
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    animation: slideUp 0.4s ease-out;
    overflow: hidden;
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.share-modal-header h3 {
    color: white;
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    letter-spacing: 0.5px;
}

.share-modal-body {
    padding: 24px;
}

.share-modal-body p {
    color: #64748b;
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 500;
}

.share-link-container {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.share-link-container input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    font-size: 16px;
    background: #f8fafc;
    color: #334155;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
    font-weight: 500;
}

.share-link-container input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.share-link-container .btn {
    padding: 14px 24px;
    white-space: nowrap;
    min-height: auto;
    border-radius: 16px;
    font-weight: 700;
    transition: all 0.3s ease;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.share-tip {
    color: #94a3b8 !important;
    font-size: 14px !important;
    margin: 0 !important;
    text-align: center;
    padding: 16px;
    background: #f1f5f9;
    border-radius: 16px;
    font-weight: 500;
}

@media (min-width: 768px) {
    .share-toast {
        max-width: 400px;
        font-size: 16px;
        padding: 16px 32px;
    }
    
    .share-modal-body p {
        font-size: 15px;
    }
    
    .share-link-container input {
        font-size: 15px;
    }
}
.btn-animated {
    position: relative;
    overflow: hidden;
}
.btn-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: linear-gradient(120deg, rgba(255,255,255,0.35), rgba(255,255,255,0));
    transform: skewX(-25deg);
    transition: left 0.6s ease;
}
.btn-animated:hover::before {
    left: 120%;
}

.user-icon-btn {
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}
.user-icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
}
.page a.home-card:focus-visible,
.page button:focus-visible {
    outline: 3px solid rgba(79,70,229,0.35);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(79,70,229,0.12);
}

:root {
    --motion-enabled: 1;
}
[data-reduce-motion="true"] * {
    animation: none !important;
    transition: none !important;
}

.home-card {
    will-change: transform;
}
.home-card .font-bold { letter-spacing: 0.02em; }
.home-card .text-xs { letter-spacing: 0.06em; }
