/* 核心样式表 - 极简主义设计 */
:root {
    --bg-color: #f5f5f7;
    --text-main: #1d1d1f;
    --text-secondary: #86868b;
    --accent-color: #000;
    --font-family: Arial, sans-serif; /* 恢复为原始要求的字体样式 */
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.47059;
    font-weight: 400;
    letter-spacing: -0.022em;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* 模拟图片的背景阴影效果 */
    background-image: 
        radial-gradient(circle at 70% 20%, rgba(0, 0, 0, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 30% 80%, rgba(0, 0, 0, 0.02) 0%, transparent 50%);
}

header {
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    background: rgba(245, 245, 247, 0.8);
    backdrop-filter: blur(20px);
}

nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 0;
}

nav a {
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.3s;
}

header > nav > ul > li:nth-child(1) > a {
    font-family: Georgia, serif;
}

header > nav > ul > li:nth-child(2) > a {
    font-family: Georgia, serif;
}

header > nav > ul > li:nth-child(3) > a {
    font-family: Georgia, serif;
}

nav a:hover {
    opacity: 1;
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 980px;
    margin: 0 auto;
    padding: 6rem 2rem;
}

.hero-section {
    text-align: left;
    width: 100%;
    max-width: 680px;
}

.title-large {
    font-family: "Book Antiqua", Palatino, "Palatino Linotype", "Palatino LT STD", Georgia, serif;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.015em;
}

.title-medium {
    font-family: "Book Antiqua", Palatino, "Palatino Linotype", "Palatino LT STD", Georgia, serif;
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--text-main);
    margin: 0.2rem 0;
}

/* 打字机效果容器 */
.typing-container {
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
}

.line-1 { height: 4rem; }
.line-2 { height: 2.5rem; }
.line-3 { height: 2.5rem; }

.typing-text {
    display: inline-block;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid transparent;
}

/* 第一行动画 */
.line-1 .typing-text {
    animation: typing-1 1s steps(20, end) forwards, blink 0.75s step-end 2; /* 限制闪烁次数 */
}

/* 第二行动画 */
.line-2 .typing-text {
    animation: typing-2 1.5s steps(30, end) forwards, blink 0.75s step-end 3; /* 限制闪烁次数 */
    animation-delay: 1.2s;
}

/* 第三行动画 */
.line-3 .typing-text {
    animation: typing-3 2s steps(40, end) forwards, blink 0.75s step-end 4; /* 限制闪烁次数 */
    animation-delay: 2.9s;
}

@keyframes typing-1 {
    from { width: 0; border-color: var(--accent-color); }
    to { width: 100%; border-color: transparent; } /* 结束后隐藏边框 */
}

@keyframes typing-2 {
    from { width: 0; border-color: var(--accent-color); }
    to { width: 100%; border-color: transparent; } /* 结束后隐藏边框 */
}

@keyframes typing-3 {
    from { width: 0; border-color: var(--accent-color); }
    to { width: 100%; border-color: transparent; } /* 结束后隐藏边框 */
}

@keyframes blink {
    from, to { border-color: transparent }
    50% { border-color: var(--accent-color) }
}

.bio-content {
    margin-top: 2.5rem;
    max-width: 600px;
    opacity: 1;
}

.home-page .bio-content {
    opacity: 0;
    animation: fadeInBio 1s forwards;
    animation-delay: 5s;
}

.bio-content p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
}

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

.btn-chat {
    background-color: var(--accent-color);
    color: #fff;
    border: none;
    padding: 0.7rem 1.8rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 980px;
    cursor: pointer;
    margin-top: 2rem;
    opacity: 0;
    animation: fadeIn 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 5.5s; /* 在所有文字打完后显示 */
    transition: transform 0.2s, background-color 0.2s;
}

.btn-chat:hover {
    background-color: #333;
    transform: scale(1.02);
}

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

footer {
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.side-card {
    margin-top: 2rem;
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.6);
}

.side-image {
    width: 100%;
    height: auto;
    border-radius: 14px;
    display: block;
}

.side-text {
    margin: 0.75rem 0 0;
    color: var(--text-secondary);
}

.game-page .container {
    align-items: stretch;
    justify-content: flex-start;
}

.game-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    align-items: start;
    margin-top: 1.25rem;
}

.board-section {
    display: flex;
    justify-content: center;
}

.game-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: start;
}

.game-panels-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.game-layout .panel {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.65);
    border-radius: 18px;
    padding: 1rem;
}

.panel-title {
    margin: 0 0 0.6rem;
    font-weight: 700;
}

.label {
    color: var(--text-secondary);
    margin-right: 0.4rem;
}

.join-form {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.65);
    border-radius: 18px;
    padding: 1rem;
    margin: 0;
}

.form-label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.form-row {
    display: flex;
    gap: 0.6rem;
}

.text-input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.16);
    background: #fff;
    font-size: 1rem;
}

.btn-primary {
    border: none;
    border-radius: 12px;
    padding: 0.6rem 1rem;
    background: var(--accent-color);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    white-space: nowrap;
}

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

.hand-slot {
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    border: 1px dashed rgba(0, 0, 0, 0.18);
    background: rgba(255, 255, 255, 0.7);
}

.hint-text {
    margin: 0.7rem 0 0;
    color: var(--text-secondary);
}

.message {
    margin: 0;
    color: var(--text-main);
    min-height: 1.3rem;
}

.asset-preview {
    width: 100%;
    height: auto;
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    display: block;
}

.game-board {
    width: min(440px, 100%);
    aspect-ratio: 1 / 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    --grid-line: #686868;
    --grid-thickness: 10px;
    gap: var(--grid-thickness);
    padding: var(--grid-thickness);
    border-radius: 0;
    background: var(--grid-line);
}

.board-cell {
    border: none;
    border-radius: 0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.board-cell svg {
    width: 52px;
    height: 52px;
    max-width: 72%;
    max-height: 72%;
}

.board-cell:focus-visible {
    outline: 4px solid rgba(0, 0, 0, 0.35);
    outline-offset: 2px;
}

.board-cell:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.my-turn .game-board {
    outline: 3px solid rgba(0, 0, 0, 0.25);
    outline-offset: 4px;
}

.score-section {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.65);
    border-radius: 18px;
    padding: 1rem;
}

.scoreboard {
    margin: 0.75rem 0 0;
    padding-left: 1.2rem;
}

.score-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0.2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.score-row:last-child {
    border-bottom: none;
}

.score-row.is-current .score-name {
    font-weight: 800;
}

.score-row.is-me .score-name::after {
    content: ' (you)';
    color: var(--text-secondary);
    font-weight: 500;
}

/* 响应式 */
@media (max-width: 734px) {
    .title-large { font-size: 2.2rem; }
    .title-medium { font-size: 1.4rem; }
    .container { padding-top: 5rem; }
    .typing-container { height: auto; white-space: normal; }
    .typing-text { white-space: normal; width: auto; animation: none; border: none; }

    .game-panels {
        grid-template-columns: 1fr;
    }

    .game-board {
        width: 100%;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.game-page {
    background: #faf8ef;
    color: #776e65;
}

.game-page .container {
    max-width: 1100px;
    padding: 5.5rem 1.5rem 3.5rem;
}

.game-frame {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 1.2rem;
    align-items: start;
    width: 100%;
}

.game-left {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.game-topbar {
    display: grid;
    grid-template-columns: repeat(4, 88px);
    gap: 0.65rem;
    align-items: start;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    grid-column: 1 / -1;
}

.topbar-row2 {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 88px);
    gap: 0.65rem;
    align-items: stretch;
}

.brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    background: rgba(187, 173, 160, 0.35);
    padding: 0.5rem;
    object-fit: contain;
}

.brand-word {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.brand-main {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.brand-sub {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.35em;
    margin-left: 0.05em;
}

.join-form.join-tile {
    width: 88px;
    height: 88px;
    border-radius: 3px;
    background: #bbada0;
    padding: 0.45rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}

.join-form.join-tile .form-row {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.join-form.join-tile .text-input {
    width: 100%;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.92);
    padding: 0.28rem 0.35rem;
    font-size: 0.72rem;
}

.join-form.join-tile .btn-primary {
    width: 100%;
    border-radius: 3px;
    background: #8f7a66;
    padding: 0.28rem 0.35rem;
    font-size: 0.8rem;
}

.stat-card {
    width: 88px;
    height: 88px;
    padding: 0.55rem 0.5rem;
    border-radius: 3px;
    background: #bbada0;
    color: #fff;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-label {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    opacity: 0.95;
}

.stat-card .title-medium {
    margin: 0.1rem 0 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    font-size: 2.05rem;
    font-weight: 900;
    color: #fff;
}

.hand-tile {
    width: 88px;
    height: 88px;
    border-radius: 3px;
    background: #bbada0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hand-tile svg {
    width: 66px;
    height: 66px;
}

.timer-tile {
    width: 88px;
    height: 88px;
    border-radius: 3px;
    background: #bbada0;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-digits {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    font-size: 2.05rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.04em;
}

.board-section {
    justify-content: flex-start;
}

.game-board {
    width: min(500px, 100%);
    border-radius: 6px;
    background: #bbada0;
    --grid-thickness: 14px;
    gap: var(--grid-thickness);
    padding: var(--grid-thickness);
}

.board-cell {
    border-radius: 6px;
    background: #b7aa9d;
}

.board-cell.has-block {
    background: #f3ede6;
}

.leaderboard-panel {
    border-radius: 6px;
    background: #bbada0;
    padding: 1rem;
    color: #fff;
}

.leaderboard-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.9rem;
    gap: 0.2rem;
}

.leaderboard-title {
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1;
}

.leaderboard-subtitle {
    font-size: 1rem;
    font-weight: 800;
    opacity: 0.9;
}

.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 90px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 4px;
    background: rgba(238, 228, 218, 0.95);
    color: #776e65;
}

.rank-badge {
    width: 44px;
    height: 44px;
    border-radius: 3px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    font-weight: 900;
    background: #111;
    color: #fff;
}

.leaderboard-row:nth-child(1) .rank-badge {
    background: #f4c430;
    color: #3b2f00;
}

.leaderboard-row:nth-child(2) .rank-badge {
    background: #cfc9c2;
    color: #3b2f00;
}

.leaderboard-row:nth-child(3) .rank-badge {
    background: #c8892f;
    color: #3b2f00;
}

.player-name {
    font-weight: 800;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-score {
    text-align: right;
    font-weight: 900;
    letter-spacing: 0.02em;
}

.leaderboard-row.is-current {
    outline: 3px solid #f4a261;
    outline-offset: 0;
}

.leaderboard-row.is-me .player-name::after {
    content: ' (you)';
    font-weight: 700;
    opacity: 0.75;
}

@media (max-width: 980px) {
    .game-frame {
        grid-template-columns: 1fr;
    }

    .game-topbar {
        grid-template-columns: repeat(2, 88px);
    }

    .topbar-row2 {
        grid-template-columns: repeat(2, 88px);
    }
}
