/* 定向越野模拟器 - 现代风格样式表 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-dark: rgba(15, 23, 42, 0.95);
    --bg-card: rgba(30, 41, 59, 0.9);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body {
    margin: 0;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

/* 语言切换按钮 */
.lang-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.lang-toggle:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* Logo - 左上角 */
.home-logo {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.home-logo:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.home-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Beta 标签 */
.beta-badge {
    position: absolute;
    top: 25px;
    left: 90px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========== HUD 层 ========== */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hud {
    padding: 16px 20px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    display: none;
    background: var(--bg-card);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

#top-hud {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 12px;
}

#timer {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

#game-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-card);
    padding: 20px 40px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    display: none;
    transition: opacity 0.3s ease;
}

#bottom-hud {
    position: absolute;
    bottom: 20px;
    left: 20px;
}

/* ========== 小地图 ========== */
#minimap-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 280px;
    height: 280px;
    border: 3px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.95);
    overflow: hidden;
    display: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
}

#minimap-container.expanded {
    width: 560px;
    height: 560px;
    border-radius: 16px;
    bottom: 50%;
    right: 50%;
    transform: translate(50%, 50%);
    z-index: 100;
    opacity: 0.7;
}

#control-desc-container {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 70px;
    background: white;
    border: 2px solid #7c3aed;
    border-radius: 8px;
    padding: 4px;
    font-size: 11px;
    color: #1e293b;
    z-index: 101;
    pointer-events: none;
    display: none;
}

#control-desc-table {
    width: 100%;
    border-collapse: collapse;
}

#control-desc-table td,
#control-desc-table th {
    border: 1px solid #7c3aed;
    text-align: center;
    padding: 2px 4px;
}

#control-desc-table th {
    background: #f3f4f6;
    font-weight: 600;
}

canvas#mapCanvas {
    width: 100%;
    height: 100%;
}

/* ========== 屏幕遮罩 ========== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    pointer-events: auto;
    z-index: 200;
}

.screen.active {
    display: flex;
}

/* ========== 标题 ========== */
.screen h1 {
    font-size: 48px;
    font-weight: 700;
    margin: 0 0 8px 0;
    background: linear-gradient(135deg, #10b981, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.screen h1.paused {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.screen h1.finished {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== 文本 ========== */
.screen p {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 8px 0;
    line-height: 1.6;
}

.screen p.subtitle {
    font-size: 14px;
    color: var(--primary);
    font-weight: 500;
    margin-top: 0;
}

.screen .instructions {
    background: var(--bg-card);
    padding: 16px 24px;
    border-radius: 12px;
    margin: 20px 0;
    border: 1px solid var(--border-color);
}

.screen .instructions p {
    margin: 0;
    font-size: 14px;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 6px;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--secondary);
}

.btn-secondary:hover {
    background: #475569;
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.4);
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* ========== 难度选择 ========== */
.difficulty-select {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.difficulty-select .btn {
    min-width: 140px;
}

.difficulty-select .btn-easy {
    background: var(--success);
}

.difficulty-select .btn-easy:hover {
    background: #059669;
}

.difficulty-select .btn-medium {
    background: var(--warning);
}

.difficulty-select .btn-medium:hover {
    background: #d97706;
}

.difficulty-select .btn-hard {
    background: var(--danger);
}

.difficulty-select .btn-hard:hover {
    background: #dc2626;
}

/* ========== 技术标识 ========== */
.tech-badge {
    margin-top: 32px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* ========== 指南针 ========== */
#compass {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 100px;
    height: 100px;
    border: 4px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    background: var(--bg-card);
    display: none;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 24px;
    backdrop-filter: blur(10px);
}

#compass-needle {
    position: absolute;
    width: 8px;
    height: 90%;
    background: linear-gradient(to bottom, #ef4444 50%, #f8fafc 50%);
    border-radius: 4px;
    transform: rotate(0deg);
}

/* ========== 结果统计 ========== */
.result-stats {
    display: flex;
    gap: 40px;
    margin: 24px 0;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.time {
    color: #fbbf24;
}

.stat-value.distance {
    color: #3b82f6;
}

/* ========== 暂停菜单按钮组 ========== */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 24px;
}