/* 龙棋大师 - 样式表 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #0a0a0a;
    --card-bg: #141414;
    --border-color: #262626;
    --text-primary: #ffffff;
    --text-secondary: #a3a3a3;
    --text-muted: #525252;
    --accent-blue: #3b82f6;
    --accent-purple: #a855f7;
    --accent-yellow: #eab308;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

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

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

.pulse {
    animation: pulse 2s infinite;
}

/* 页面容器 */
.page {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

/* Logo */
.logo-container {
    width: 128px;
    height: 128px;
    position: relative;
    margin-bottom: 24px;
}

.logo-board {
    position: absolute;
    inset: 0;
    opacity: 0.4;
}

.logo-pieces {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-piece {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.logo-piece.black {
    background: #000;
    border: 1px solid #333;
    top: 25%;
    left: 25%;
}

.logo-piece.white {
    background: #fff;
    border: 1px solid #ddd;
    bottom: 25%;
    right: 25%;
}

/* 标题 */
.title {
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(to bottom, #fff, #737373);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -2px;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 48px;
}

/* 按钮 */
.btn {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s;
    outline: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #fff;
    color: #000;
}

.btn-primary:hover {
    background: #f0f0f0;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--text-muted);
}

.btn-tertiary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
}

.btn-back {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

/* 菜单项 */
.menu-list {
    width: 256px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 模式选择卡片 */
.mode-card {
    width: 100%;
    padding: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-card:hover {
    border-color: var(--accent-blue);
}

.mode-card.purple:hover {
    border-color: var(--accent-purple);
}

.mode-card.green:hover {
    border-color: var(--accent-green);
}

.mode-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-title {
    font-size: 18px;
    font-weight: 700;
}

.mode-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* 难度选择 */
.difficulty-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.difficulty-btn {
    padding: 16px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s;
}

.difficulty-btn:hover {
    border-color: var(--text-muted);
}

.difficulty-btn.selected {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
}

.difficulty-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.difficulty-name {
    font-weight: 700;
}

.difficulty-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.difficulty-stars {
    color: var(--accent-yellow);
}

/* 游戏页面 */
.game-page {
    padding: 16px;
    justify-content: flex-start;
    background: #050505;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
    margin-bottom: 8px;
    z-index: 20;
}

.game-info {
    text-align: center;
}

.game-mode-label {
    display: none;
}

.game-message {
    font-size: 11px;
    font-weight: 900;
    color: #050505;
    background: #fff;
    padding: 8px 24px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: 1px solid #e5e5e5;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.game-message.alert {
    background: #fef2f2;
    color: var(--accent-red);
    border-color: #fecaca;
}

/* 玩家面板容器 */
.player-panel-top,
.player-panel-bottom {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* 玩家卡片 - 严格还原demo */
.player-card-new {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    max-width: 360px;
    width: 100%;
}

.player-card-new.top {
    flex-direction: row;
}

.player-card-new.bottom {
    flex-direction: row-reverse;
}

/* 头像容器 */
.player-avatar-wrapper {
    position: relative;
}

/* 头像样式 */
.player-avatar {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid #262626;
    background: #171717;
    transition: all 0.3s ease;
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 激活状态头像 */
.player-card-new.active .player-avatar {
    border-color: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* 非激活状态 */
.player-card-new:not(.active) {
    opacity: 0.4;
}

.player-card-new:not(.active) .player-avatar {
    border-color: #262626;
}

/* 玩家信息 */
.player-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.player-card-new.top .player-card-info {
    align-items: flex-start;
}

.player-card-new.bottom .player-card-info {
    align-items: flex-end;
}

/* 玩家名称 */
.player-name {
    font-size: 14px;
    font-weight: 900;
    color: #fff;
    transition: all 0.3s ease;
}

.player-card-new:not(.active) .player-name {
    color: #525252;
}

/* 棋子数量容器 */
.player-piece-count {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: #171717;
    border-radius: 9999px;
    border: 1px solid #262626;
}

/* 棋子圆点 */
.player-piece-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.player-piece-dot.black {
    background: #262626;
    border: 1px solid #404040;
}

.player-piece-dot.white {
    background: #fff;
}

/* 棋子数量文字 */
.player-piece-num {
    font-size: 10px;
    font-weight: 900;
    color: #525252;
}

/* 飞出棋子动画容器 */
.flying-piece-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

/* 飞出棋子 */
.flying-piece {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -50%) scale(0.3);
}

/* 向下飞出动画 */
@keyframes flyDown {
    0% {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, calc(-50% + 60px)) scale(0.6);
        opacity: 0;
    }
}

/* 向上飞出动画 */
@keyframes flyUp {
    0% {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, calc(-50% - 60px)) scale(0.6);
        opacity: 0;
    }
}

.flying-piece.fly-down {
    animation: flyDown 1.2s ease-out infinite;
}

.flying-piece.fly-up {
    animation: flyUp 1.2s ease-out infinite;
}

/* 棋盘容器 */
.board-container {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    margin: 0 auto;
    padding: 24px;
    position: relative;
    filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.8));
}

.board-svg {
    width: 100%;
    height: 100%;
}

/* 棋子样式 */
.piece {
    cursor: pointer;
    transition: all 0.2s;
}

.piece.black-piece {
    fill: #111;
    stroke: #333;
    stroke-width: 2;
}

.piece.white-piece {
    fill: #fff;
    stroke: #ddd;
    stroke-width: 2;
}

.piece.selected {
    stroke: #fff;
    stroke-width: 8;
}

/* 棋子阴影 */
.piece-shadow {
    fill: #000;
    fill-opacity: 0.6;
}

/* 棋子高光 */
.piece-shine {
    fill: rgba(255, 255, 255, 0.1);
}

.piece-shine.white {
    fill: rgba(255, 255, 255, 0.9);
}

/* 棋盘点 */
.board-point {
    cursor: pointer;
}

/* 成龙脉冲动画 - 严格还原demo */
@keyframes millPulse {
    0% {
        transform-origin: center;
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        opacity: 0.4;
    }
    100% {
        transform-origin: center;
        transform: scale(1.15);
        opacity: 0;
    }
}

.mill-pulse-circle {
    animation: millPulse 2.5s ease-in-out infinite;
    transform-box: fill-box;
}

/* 隐藏旧的玩家面板 */
.players-panel {
    display: none;
}

.player-card {
    display: none;
}

/* 胜利弹窗 */
.victory-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    text-align: center;
    border-radius: 40px;
    z-index: 30;
}

.victory-icon {
    width: 80px;
    height: 80px;
    color: var(--accent-yellow);
    margin-bottom: 24px;
}

.victory-title {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: -2px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.victory-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 48px;
}

.victory-btn {
    padding: 16px 64px;
}

/* 联网对战页面 */
.online-container {
    width: 100%;
    max-width: 400px;
}

.room-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 16px;
}

.room-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
}

.room-code {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 8px;
    text-align: center;
    color: var(--accent-yellow);
    margin-bottom: 16px;
}

.room-input {
    width: 100%;
    padding: 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 4px;
    text-align: center;
    text-transform: uppercase;
    outline: none;
}

.room-input:focus {
    border-color: var(--accent-blue);
}

.room-input::placeholder {
    color: var(--text-muted);
    letter-spacing: 2px;
}

/* 等待状态 */
.waiting-container {
    text-align: center;
    padding: 48px 24px;
}

.waiting-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

.waiting-text {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.waiting-subtext {
    font-size: 14px;
    color: var(--text-muted);
}

/* 玩家列表 */
.players-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 24px 0;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-color);
    border-radius: 12px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.player-name {
    font-weight: 600;
}

.player-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 8px;
}

.player-status.ready {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

.player-status.waiting {
    background: rgba(234, 179, 8, 0.2);
    color: var(--accent-yellow);
}

.player-status.host {
    background: rgba(168, 85, 247, 0.2);
    color: var(--accent-purple);
}

/* 玩法说明 */
.instructions-page {
    overflow-y: auto;
}

.instructions-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.instructions-title {
    font-size: 24px;
    font-weight: 900;
}

.instructions-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

.instruction-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.section-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-icon.blue {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

.section-icon.purple {
    background: rgba(168, 85, 247, 0.2);
    color: var(--accent-purple);
}

.section-icon.yellow {
    background: rgba(234, 179, 8, 0.2);
    color: var(--accent-yellow);
}

.section-title {
    font-size: 18px;
    font-weight: 700;
}

.section-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* 龙示例 */
.mill-demo {
    padding: 20px;
    background: rgba(20, 20, 20, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 40px;
    margin: 24px 0;
}

.mill-demo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.mill-demo-title {
    font-size: 12px;
    font-weight: 900;
    color: var(--accent-yellow);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.mill-demo-badge {
    font-size: 9px;
    font-weight: 700;
    color: var(--accent-yellow);
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.2);
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
}

.mill-demo-board {
    width: 160px;
    height: 160px;
    margin: 0 auto 16px;
    position: relative;
}

.mill-demo-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
}

/* 提示框 */
.tip-box {
    padding: 16px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-top: 16px;
}

.tip-icon {
    width: 8px;
    height: 8px;
    background: var(--accent-blue);
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}

.tip-text {
    font-size: 12px;
    color: var(--accent-blue);
    line-height: 1.6;
    font-weight: 500;
}

/* 胜负条件 */
.win-conditions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.win-condition {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.win-condition-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.win-condition-badge {
    font-size: 10px;
    font-weight: 900;
    color: var(--accent-green);
    background: rgba(34, 197, 94, 0.1);
    padding: 2px 8px;
    border-radius: 8px;
}

/* 自定义滚动条 */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

/* 返回链接 */
.back-link {
    margin-top: 48px;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    background: none;
    border: none;
}

.back-link:hover {
    color: var(--text-secondary);
}

/* 响应式 */
@media (max-width: 480px) {
    .page {
        padding: 16px;
    }
    
    .title {
        font-size: 36px;
    }
    
    .board-container {
        border-radius: 24px;
        padding: 16px;
    }
    
    .player-card {
        padding: 12px;
        border-radius: 24px;
    }
}

/* 图标占位 */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon svg {
    width: 100%;
    height: 100%;
}

/* 退出确认弹窗 */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: #171717;
    padding: 32px;
    border-radius: 40px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    max-width: 360px;
    width: 100%;
    border: 1px solid #262626;
    text-align: center;
}

.modal-title {
    font-size: 20px;
    font-weight: 900;
    color: #fff;
    margin-bottom: 8px;
}

.modal-desc {
    font-size: 14px;
    color: #525252;
    margin-bottom: 32px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    padding: 16px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

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

.modal-btn-cancel {
    background: #262626;
    color: #fff;
}

.modal-btn-confirm {
    background: #dc2626;
    color: #fff;
}

/* 胜负结果弹窗 */
.result-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(16px);
}

.result-modal-content {
    background: #171717;
    padding: 40px;
    border-radius: 48px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    max-width: 340px;
    width: 100%;
    border: 1px solid #262626;
    text-align: center;
}

.result-icon {
    width: 96px;
    height: 96px;
    margin: 0 auto 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.result-icon.black-win {
    background: #262626;
    border: 1px solid #404040;
}

.result-icon.white-win {
    background: #fff;
    box-shadow: 0 25px 50px rgba(255, 255, 255, 0.1);
}

.result-title {
    font-size: 36px;
    font-weight: 900;
    font-style: italic;
    letter-spacing: -2px;
    color: #fff;
    margin-bottom: 8px;
}

.result-desc {
    font-size: 14px;
    color: #525252;
    font-weight: 500;
    line-height: 1.6;
    margin-bottom: 40px;
}

.result-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-btn {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

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

.result-btn-primary {
    background: #fff;
    color: #050505;
    font-size: 18px;
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.1);
}

.result-btn-secondary {
    background: #262626;
    color: #525252;
    font-size: 14px;
}

/* 确保游戏页面返回按钮可点击 */
.game-header .btn-back {
    position: relative;
    z-index: 100;
    background: #171717 !important;
    border: 1px solid #262626 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

.game-header .btn-back .icon {
    color: #a3a3a3 !important;
}

.game-header .btn-back:hover {
    background: #262626 !important;
}

.game-header .btn-back:hover .icon {
    color: #fff !important;
}
