@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
    /* 核心极客配色 */
    --bg-color: #f3e8c8;
    --card-bg: rgba(255, 255, 255, 0.92);
    --primary: #2b5c5d; 
    --primary-hover: #1e4243;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: rgba(43, 92, 93, 0.2);
    --glow-color: rgba(43, 92, 93, 0.4);
    --led-on: #00ffcc;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(#d1c7a8 2px, transparent 2px);
    background-size: 24px 24px;
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace, sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    /* 【核心修复】改为 flex-start 顶部对齐，去掉原来的 center 绝对居中 */
    align-items: flex-start; 
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 760px;
    padding: 20px;
    position: relative;
    /* 电脑端给予 6vh 的顶部边距，使其不会完全贴着屏幕顶端 */
    margin: 6vh auto; 
}

.pixel-title {
    color: var(--primary); 
    font-size: 3rem; /* 像素字体较宽，适当减小字号 */
    text-align: center; 
    letter-spacing: 2px;
    /* 欢迎页标题单独往下推一点，避免太靠上 */
    margin-top: 10vh; 
    margin-bottom: 20px;
    /* 应用引入的像素字体 */
    font-family: 'Press Start 2P', monospace;
    text-shadow: 3px 3px 0px #ffffff;
}

.screen {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ================= 标题与文字 ================= */
.pixel-title {
    color: var(--primary); 
    font-size: 4rem; 
    text-align: center; 
    letter-spacing: 4px;
    margin-bottom: 10px;
    font-family: monospace;
    text-shadow: 3px 3px 0px #ffffff;
}

.welcome-subtitle { text-align: center; font-size: 1.5rem; color: var(--text-main); margin-bottom: 10px; }
.welcome-desc { text-align: center; color: var(--text-muted); font-style: italic; }

/* ================= 卡片拟物与悬浮感 ================= */
.card, .result-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), inset 0 2px 0 rgba(255,255,255,1);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
}

/* ================= 进度条呼吸光效 ================= */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

@keyframes breath-led {
    0% { box-shadow: 0 0 8px var(--primary); }
    50% { box-shadow: 0 0 18px var(--led-on), 0 0 5px var(--primary); }
    100% { box-shadow: 0 0 8px var(--primary); }
}

#progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
    animation: breath-led 2s infinite;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.progress-text { font-family: monospace; font-weight: bold; color: var(--primary); font-size: 1.1rem; }
.icon-btn { background: none; border: none; color: var(--text-muted); font-weight: bold; cursor: pointer; font-size: 1rem; }

/* ================= 选项按钮 (机械手感) ================= */
.options-grid { display: flex; flex-direction: column; gap: 15px; margin-top: 25px; }

.option-btn {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    color: var(--text-main);
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 1.05rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.option-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px var(--glow-color);
}

.option-btn.selected {
    border-color: var(--primary);
    background: rgba(43, 92, 93, 0.08);
    transform: scale(0.98);
}

.opt-label {
    font-weight: 900;
    color: #fff;
    background: var(--primary);
    min-width: 30px;
    height: 30px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border-radius: 6px;
    margin-right: 15px;
    font-family: monospace;
}

/* ================= 结果页：长方形图片适配与悬浮动画 ================= */
.result-header { text-align: center; color: var(--primary); font-size: 2rem; margin-bottom: 20px; }

@keyframes float-chip {
    0% { transform: translateY(0px) rotateX(0deg); }
    50% { transform: translateY(-8px) rotateX(2deg); box-shadow: 0 25px 40px rgba(43, 92, 93, 0.3); }
    100% { transform: translateY(0px) rotateX(0deg); }
}

.image-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 10px 0 30px;
    perspective: 1000px;
}

.image-wrapper img {
    /* 核心修复：自适应长方形图片，去除强行正方形的限制 */
    width: 100%;
    max-width: 420px; /* 控制电脑端最大宽度 */
    height: auto; 
    object-fit: contain;
    border-radius: 12px;
    border: 4px solid var(--primary);
    padding: 6px;
    background: #ffffff;
    box-shadow: 0 15px 30px rgba(43, 92, 93, 0.15);
    animation: float-chip 4s ease-in-out infinite;
}

.result-label { text-align: center; color: var(--text-muted); margin: 0 0 5px 0; font-size: 0.95rem; font-weight: bold; }
.result-main-title { text-align: center; font-size: 2.2rem; font-weight: 900; color: var(--primary); margin: 0 0 5px 0; }
.result-sub-title { text-align: center; color: var(--text-muted); font-size: 1.1rem; margin: 0 0 25px 0; font-family: monospace;}

/* ================= 标签与详情面板 ================= */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
}

.tag {
    background: rgba(43, 92, 93, 0.1);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    border: 1px solid rgba(43, 92, 93, 0.2);
}

.classic-quote {
    margin: 0 0 30px 0;
    padding: 20px 25px;
    background: linear-gradient(135deg, var(--primary), #1a3d3e);
    color: #ffffff;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    font-style: italic;
    box-shadow: 0 10px 20px rgba(43, 92, 93, 0.2);
    border-left: 6px solid var(--led-on);
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.detail-item {
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 18px;
    border-radius: 12px;
    transition: transform 0.3s;
}

.detail-item:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.05); }

.detail-item.full-width {
    grid-column: 1 / -1; 
    background: linear-gradient(to right, #ffffff, #fdfbf7);
}

.detail-item h4 { margin: 0 0 10px 0; color: var(--primary); font-size: 1.05rem; }
.detail-item p { margin: 0; font-size: 0.95rem; color: #444; line-height: 1.6; text-align: justify; }

/* ================= 底部按钮 ================= */
.action-buttons { display: flex; flex-direction: column; gap: 15px; margin-top: 30px; align-items: center; }
.mode-buttons { display: flex; flex-direction: column; gap: 15px; margin-top: 40px; align-items: center; }

.btn {
    padding: 16px 20px;
    width: 100%;
    max-width: 350px;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.indicator-led {
    width: 10px; height: 10px;
    background: var(--led-on);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--led-on);
}

.primary-btn {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(43, 92, 93, 0.3);
}

.primary-btn:hover { background: var(--primary-hover); transform: translateY(-2px); }

.secondary-btn {
    background: #ffffff;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.secondary-btn:hover { background: rgba(43, 92, 93, 0.05); }

/* ================= 移动端精细化适配 ================= */
/* ================= 移动端精细化适配 ================= */
@media (max-width: 600px) {
    .container { 
        padding: 15px; 
        /* 手机端取消 margin-top，让答题界面直接贴顶，消除上方大片空白 */
        margin: 0 auto; 
    }
    
    .pixel-title { 
        font-size: 2.2rem; 
        /* 手机端欢迎页的标题高度补偿 */
        margin-top: 12vh; 
    }
    
    .card, .result-card { padding: 20px; }
    
    /* 手机端答题卡片与顶部状态栏的距离稍微拉近 */
    .options-grid { margin-top: 15px; }
    
    .details-grid { grid-template-columns: 1fr; } /* 手机端单列排版 */
    .image-wrapper img { max-width: 100%; } /* 手机端图片撑满卡片宽度 */
    .result-main-title { font-size: 1.8rem; }
}

/* 导航栏容器 */
.quiz-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* 按钮基础样式：像 DogTI 那样轻盈 */
.nav-btn {
    background: #fff;
    border: 1.5px solid #eee;
    padding: 10px 24px;
    border-radius: 25px;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.nav-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.nav-btn:active {
    transform: translateY(1px);
    background: #f9f9f9;
}

/* 强调“提交”或“继续”的状态 */
.nav-btn.highlight {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* 占位符，保持布局不乱 */
.nav-placeholder {
    width: 80px;
}