/* RE0: 从0开始的异世界编程冒险 - 现代化全局样式表 */

:root {
    /* 颜色变量 */
    --primary-color: #4361ee;
    --primary-light: #6388ff;
    --primary-dark: #2a4fb0;
    --secondary-color: #ff5e7d;
    --secondary-light: #ff7fa2;
    --secondary-dark: #d2455f;
    --accent-color: #ffaa00;
    --success-color: #4caf50;
    --info-color: #2196f3;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    
    /* 中性色 */
    --text-color: #333333;
    --text-light: #666666;
    --text-lighter: #999999;
    --bg-color: #ffffff;
    --bg-light: #f8f9fa;
    --bg-dark: #e9ecef;
    --border-color: #dee2e6;
    
    /* 字体 */
    --font-main: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-heading: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    
    /* 尺寸 */
    --border-radius-sm: 4px;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    
    /* 过渡效果 */
    --transition: all 0.3s ease;
    
    /* 布局 */
    --container-width: 1200px;
    --header-height: 60px;
    --footer-height: 60px;
    --sidebar-width: 250px;
}

/* 全局重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-light);
    overflow-x: hidden;
}

/* 排版 */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
    color: var(--text-color);
}

h1 {
    font-size: 2.5rem;
    color: var(--primary-dark);
}

h2 {
    font-size: 2rem;
    color: var(--primary-color);
}

h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* 容器与布局 */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1rem;
}

.section {
    padding: 2rem 0;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: var(--border-radius);
    transition: var(--transition);
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.btn-secondary:hover {
    background-color: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

.btn-block {
    display: block;
    width: 100%;
}

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

/* 卡片样式 */
.card {
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1rem;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 1rem;
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.card-body {
    padding: 1rem;
}

.card-footer {
    padding: 1rem;
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-color);
}

/* 表单元素 */
input, select, textarea {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--bg-color);
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary-light);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* 进度条 */
.progress {
    height: 0.75rem;
    overflow: hidden;
    background-color: var(--bg-dark);
    border-radius: var(--border-radius);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
    text-align: center;
    line-height: 0.75rem;
    color: white;
}

.progress-bar.health {
    background-color: var(--success-color);
}

.progress-bar.exp {
    background-color: var(--info-color);
}

/* 警告状态 */
.progress-bar.low-health {
    background-color: var(--danger-color);
}

/* 实用类 */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.d-flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.justify-content-center {
    justify-content: center;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.m-0 {
    margin: 0;
}

.p-0 {
    padding: 0;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

/* 游戏特定样式 */
#game-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.screen {
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    padding: 1.5rem;
    background-color: var(--bg-light);
}

.screen.active {
    display: flex;
}

/* 开始屏幕 */
#start-screen {
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
}

#start-screen h1 {
    font-size: 2.8rem;
    margin-bottom: 2rem;
    color: white;
    text-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
    animation: fade-in 1.5s ease;
}

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

.save-selection {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.save-selection h2 {
    color: var(--text-color);
    margin-bottom: 1rem;
}

.save-input {
    display: flex;
    gap: 0.5rem;
}

.save-input input {
    flex: 1;
}

/* 主游戏屏幕 */
#main-screen {
    background-color: var(--bg-light);
    overflow-y: auto;
}

.header-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 1rem;
    gap: 1rem;
}

.help-btn, .settings-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
}

.help-btn {
    background-color: var(--info-color);
    color: white;
    text-decoration: none;
}

.settings-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    cursor: pointer;
}

.help-btn:hover, .settings-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    text-decoration: none;
}

/* 战斗屏幕 */
#battle-screen {
    background-color: var(--bg-color);
}

/* 地图和团队部分 */
.maps-grid, .team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.map-card, .team-member {
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.map-card:hover, .team-member:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.map-card img, .team-member img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
}

.map-info, .team-member-info {
    padding: 1rem;
}

.map-card h3, .team-member h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* 团队成员样式 */
.team-member {
    padding: 1rem;
    text-align: center;
}

.team-member img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 1rem auto;
    object-fit: cover;
    border: 3px solid var(--primary-light);
}

.member-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.member-btn {
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius);
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.member-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

/* 模态窗口 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow-y: auto;
    animation: modal-fade 0.3s;
}

.modal-content {
    position: relative;
    background-color: var(--bg-color);
    margin: 2rem auto;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 800px;
    width: 90%;
    animation: modal-slide 0.3s;
}

@keyframes modal-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.close-btn {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1010;
    transition: var(--transition);
}

.close-btn:hover {
    color: #e74c3c;
}

/* 战斗界面样式 */
.battle-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
}

.battle-status-bar {
    display: flex;
    gap: 1.5rem;
    background-color: var(--bg-light);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.player-status, .monster-status {
    flex: 1;
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.battle-main-area {
    display: flex;
    gap: 1.5rem;
    flex: 1;
}

.battle-question-area {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.battle-log-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-width: 30%;
}

.battle-log-content {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

.battle-log-content p {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.battle-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding: 10px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-light);
    align-items: center;
    gap: 1rem;
}

/* 问题容器 */
.question-container {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* 生命值和经验条 */
.health-bar, .exp-bar {
    height: 20px;
    border-radius: var(--border-radius);
    background-color: var(--bg-dark);
    margin: 0.5rem 0;
    position: relative;
    overflow: hidden;
}

.health-bar .progress-fill {
    height: 100%;
    background: linear-gradient(to right, #4caf50, #8bc34a);
    transition: width 0.3s ease;
}

.health-bar .progress-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 2;
    text-shadow: 0 0 2px white;
}

.health-bar.low-health .progress-fill {
    background: linear-gradient(to right, #f44336, #ff9800);
    animation: pulse 1.5s infinite;
}

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

.exp-bar .progress-fill {
    height: 100%;
    background: linear-gradient(to right, #2196f3, #03a9f4);
    transition: width 0.3s ease;
}

/* 添加伤害数字动画样式 */

/* 伤害数字 */
.damage-number {
    position: fixed;
    font-size: 24px;
    font-weight: bold;
    color: #ff3030;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    z-index: 1000;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
}

/* 伤害数字动画 */
.damage-number-animate {
    animation: damage-float 1s ease-out;
    opacity: 1;
}

@keyframes damage-float {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -80%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -100%) scale(0.5);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .battle-status-bar {
        flex-direction: column;
    }
    
    .battle-main-area {
        flex-direction: column;
    }
    
    .battle-log-area {
        max-width: 100%;
        height: 30vh;
    }
    
    .maps-grid, .team-grid {
        grid-template-columns: 1fr;
    }
}

/* 地图网格布局 - 每行3个 */
.maps-grid.three-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* 地图卡片样式调整 */
.map-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    min-height: 220px;
}

/* 商店物品样式调整 - 缩小尺寸 */
.shop-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 8px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s;
    width: 140px;
    height: 180px;
}

.shop-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.shop-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 8px;
}

.shop-item h4 {
    font-size: 14px;
    margin: 0 0 6px 0;
    text-align: center;
}

.shop-item .item-price {
    font-size: 13px;
    color: #e67e22;
    margin: 5px 0;
}

.shop-item p {
    font-size: 12px;
    margin: 5px 0;
    text-align: center;
    color: #777;
}

.shop-item button {
    font-size: 12px;
    padding: 5px 10px;
    margin-top: auto;
}

/* 商店网格布局调整 */
.shop-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    padding: 15px;
}

/* 商店模态窗口改进 */
.shop-modal-content {
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

/* 商店物品和装备卡片统一样式 - 缩小尺寸 */
.shop-item, .equipment-slot.potion-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 8px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s;
    width: 120px;
    height: 160px;
    position: relative;
    overflow: hidden;
}

.shop-item:hover, .equipment-slot.potion-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.shop-item img, .equipment-slot.potion-card img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-bottom: 5px;
}

.shop-item h4, .equipment-slot.potion-card p.item-name {
    font-size: 12px;
    margin: 0 0 5px 0;
    text-align: center;
    font-weight: bold;
}

.shop-item .item-price, .equipment-slot.potion-card .item-price {
    font-size: 11px;
    color: #e67e22;
    margin: 3px 0;
}

.shop-item p, .equipment-slot.potion-card p {
    font-size: 11px;
    margin: 3px 0;
    text-align: center;
    color: #777;
}

.shop-item button, .equipment-slot.potion-card button {
    font-size: 11px;
    padding: 4px 8px;
    margin-top: auto;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.shop-item button:hover, .equipment-slot.potion-card button:hover {
    background-color: var(--primary-dark);
}

/* 商店网格布局调整 */
.shop-items-grid, .potions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    padding: 12px;
}

/* 商店模态窗口改进 */
.shop-modal-content {
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

/* 药水与装备部分分隔 */
.shop-section-divider {
    margin: 15px 0;
    border-top: 1px solid #eee;
}

/* 商店部分标题 */
.shop-section-title {
    margin: 15px 0 10px 0;
    font-size: 1.2em;
    color: var(--primary-color);
}

/* 学生健康条样式 */
.student-health-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.student-info {
    display: flex;
    align-items: center;
    margin-right: 10px;
    min-width: 150px;
}

.student-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 8px;
}
