/* ==========================================
   魔镜 MirrorCore - 启动器样式
   暗色主题 · 中式复古风格
   ========================================== */

/* ----- 基础重置与变量 ----- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0608;
    --bg-secondary: #120c0a;
    --bg-topbar: #1a1210;
    --bg-surface: #1a1210;
    --bg-hover: #2a1e18;
    --bg-card: #140e0c;
    --border-light: #2a1e18;
    --border-gold: #c8a878;
    --border-gold-dim: #8a7a5a;
    --text-primary: #e8ddd0;
    --text-secondary: #a89880;
    --text-muted: #6a5a4a;
    --gold: #c8a878;
    --gold-light: #e0c898;
    --gold-dark: #8a7a5a;
    --font-cn: 'SimSun', 'STSong', 'SimSun-ExtB', serif;
    --font-en: 'Segoe UI', 'Roboto', sans-serif;
    --transition-speed: 0.25s;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: var(--font-cn);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    user-select: none;
    overflow: hidden;
}

ul, ol {
    list-style: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    outline: none;
    border: none;
    background: none;
}

input, textarea, select {
    font-family: inherit;
    outline: none;
}

/* ----- 滚动条 ----- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-gold-dim);
}

/* ----- 顶栏 ----- */
.launcher-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 24px;
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-gold);
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-logo {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-gold-dim);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--gold);
    background: var(--bg-primary);
    flex-shrink: 0;
}

.topbar-brand {
    font-size: 22px;
    font-weight: bold;
    color: var(--gold);
    letter-spacing: 4px;
    font-family: var(--font-cn);
}

.topbar-version {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-en);
    letter-spacing: 1px;
    padding: 2px 8px;
    border: 1px solid var(--border-light);
    border-radius: 3px;
    background: var(--bg-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ----- 按钮通用样式 ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    font-size: 13px;
    font-family: var(--font-cn);
    background: transparent;
    border: 1px solid var(--border-gold-dim);
    color: var(--text-secondary);
    border-radius: 3px;
    transition: all var(--transition-speed) ease;
    white-space: nowrap;
    gap: 6px;
}

.btn:hover {
    background: var(--border-gold);
    color: var(--bg-primary);
    border-color: var(--border-gold);
}

.btn:active {
    background: var(--gold-dark);
    border-color: var(--gold-dark);
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid transparent;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--gold);
    border-color: var(--border-light);
}

.btn-primary {
    background: var(--border-gold);
    color: var(--bg-primary);
    border-color: var(--border-gold);
}

.btn-primary:hover {
    background: var(--gold-light);
    border-color: var(--gold-light);
}

.btn-primary:active {
    background: var(--gold-dark);
    border-color: var(--gold-dark);
}

.btn-danger {
    border-color: #5a2a2a;
    color: #c87a6a;
}

.btn-danger:hover {
    background: #5a2a2a;
    color: #e8a090;
    border-color: #8a3a3a;
}

/* ----- 主内容区 ----- */
.launcher-main {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    overflow: hidden;
}

/* ----- 最近项目区域 ----- */
.recent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px 16px;
    flex-shrink: 0;
}

.recent-header h2 {
    font-size: 16px;
    color: var(--gold);
    font-weight: normal;
    letter-spacing: 3px;
}

.recent-header h2::before {
    content: '◆ ';
    font-size: 12px;
    color: var(--border-gold-dim);
}

.recent-count {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-en);
}

/* ----- 项目卡片网格 ----- */
.project-grid {
    flex: 1;
    overflow-y: auto;
    padding: 0 32px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    align-content: start;
}

.project-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 20px 16px 16px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 160px;
}

.project-card:hover {
    border-color: var(--border-gold);
    box-shadow: 0 0 20px rgba(200, 168, 120, 0.15), inset 0 0 20px rgba(200, 168, 120, 0.05);
    transform: translateY(-2px);
}

.project-card:active {
    transform: translateY(0);
}

.project-card-thumb {
    width: 100%;
    height: 90px;
    border-radius: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--text-muted);
    overflow: hidden;
    flex-shrink: 0;
    transition: border-color var(--transition-speed) ease;
}

.project-card:hover .project-card-thumb {
    border-color: var(--border-gold-dim);
}

.project-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-card-thumb .thumb-placeholder {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.project-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.project-card-name {
    font-size: 14px;
    color: var(--text-primary);
    letter-spacing: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color var(--transition-speed) ease;
}

.project-card:hover .project-card-name {
    color: var(--gold);
}

.project-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-en);
}

.project-card-meta .meta-separator {
    color: var(--border-light);
}

.project-card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
}

.project-card:hover .project-card-actions {
    opacity: 1;
}

.project-card-actions .btn-card-action {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(10, 6, 8, 0.7);
    border: 1px solid var(--border-light);
    border-radius: 3px;
    transition: all var(--transition-speed) ease;
}

.project-card-actions .btn-card-action:hover {
    color: var(--text-primary);
    border-color: var(--border-gold-dim);
    background: rgba(10, 6, 8, 0.9);
}

.project-card-actions .btn-card-delete:hover {
    color: #e87a6a;
    border-color: #8a3a3a;
}

/* 空状态 */
.project-grid-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    gap: 16px;
}

.project-grid-empty .empty-icon {
    font-size: 48px;
    opacity: 0.5;
}

.project-grid-empty .empty-text {
    font-size: 15px;
    letter-spacing: 2px;
}

.project-grid-empty .empty-hint {
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.7;
}

/* ----- 底部操作栏 ----- */
.launcher-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 32px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.launcher-footer .btn {
    padding: 8px 20px;
    font-size: 14px;
}

/* ----- 模态框 ----- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 6, 8, 0.75);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: 480px;
    max-width: 90vw;
    max-height: 85vh;
    background: var(--bg-surface);
    border: 1px solid var(--border-gold);
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform var(--transition-speed) ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    font-size: 16px;
    color: var(--gold);
    font-weight: normal;
    letter-spacing: 2px;
}

.modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: 3px;
    transition: all var(--transition-speed) ease;
    cursor: pointer;
    background: none;
}

.modal-close:hover {
    color: var(--text-primary);
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border-light);
}

/* 表单样式 */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.form-group label .required {
    color: #c87a6a;
    margin-left: 2px;
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 13px;
    border-radius: 3px;
    transition: border-color var(--transition-speed) ease;
}

.form-input:focus {
    border-color: var(--border-gold);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 13px;
    border-radius: 3px;
    transition: border-color var(--transition-speed) ease;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a7a5a'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.form-select:focus {
    border-color: var(--border-gold);
}

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.form-textarea {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 13px;
    border-radius: 3px;
    transition: border-color var(--transition-speed) ease;
    resize: vertical;
    min-height: 60px;
}

.form-textarea:focus {
    border-color: var(--border-gold);
}

.form-textarea::placeholder {
    color: var(--text-muted);
}

/* 分辨率选择特殊样式 */
.resolution-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 6px;
}

.resolution-preset {
    padding: 8px 6px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 3px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    font-family: var(--font-en);
}

.resolution-preset:hover {
    border-color: var(--border-gold-dim);
    color: var(--text-primary);
}

.resolution-preset.active {
    border-color: var(--border-gold);
    color: var(--gold);
    background: rgba(200, 168, 120, 0.1);
}

.resolution-preset .preset-label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ----- Toast 消息 ----- */
.toast-container {
    position: fixed;
    top: 68px;
    right: 20px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast-item {
    padding: 10px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    animation: toast-in 0.3s ease forwards;
    pointer-events: auto;
    max-width: 320px;
}

.toast-item.toast-out {
    animation: toast-out 0.3s ease forwards;
}

.toast-item.toast-error {
    border-color: #8a3a3a;
}

.toast-item.toast-success {
    border-color: #3a7a5a;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(30px);
    }
}

/* ----- 隐藏文件输入 ----- */
.file-input-hidden {
    display: none;
}

/* ----- 确认弹窗 ----- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 6, 8, 0.75);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) ease;
}

.confirm-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.confirm-dialog {
    width: 360px;
    max-width: 85vw;
    background: var(--bg-surface);
    border: 1px solid var(--border-gold);
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    padding: 24px 24px 20px;
    transform: translateY(20px);
    transition: transform var(--transition-speed) ease;
}

.confirm-overlay.active .confirm-dialog {
    transform: translateY(0);
}

.confirm-dialog p {
    font-size: 14px;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: 1px;
    line-height: 1.6;
}

.confirm-dialog .confirm-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* ----- 响应式 ----- */
@media (max-width: 1024px) {
    .project-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
        padding: 0 24px 20px;
    }

    .recent-header {
        padding: 20px 24px 12px;
    }
}

@media (max-width: 768px) {
    .launcher-topbar {
        padding: 0 16px;
        height: 50px;
    }

    .topbar-brand {
        font-size: 18px;
        letter-spacing: 2px;
    }

    .topbar-version {
        font-size: 11px;
    }

    .recent-header {
        padding: 16px 16px 10px;
    }

    .recent-header h2 {
        font-size: 14px;
    }

    .project-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
        padding: 0 16px 16px;
    }

    .project-card {
        padding: 14px 12px 12px;
        min-height: 140px;
    }

    .project-card-thumb {
        height: 70px;
    }

    .project-card-name {
        font-size: 13px;
    }

    .launcher-footer {
        padding: 12px 16px;
        gap: 10px;
    }

    .launcher-footer .btn {
        padding: 6px 14px;
        font-size: 12px;
    }

    .modal {
        width: 95vw;
    }

    .resolution-presets {
        grid-template-columns: repeat(2, 1fr);
    }

    .topbar-right .btn span {
        display: none;
    }
}

@media (max-width: 480px) {
    .project-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 0 12px 12px;
    }

    .project-card {
        min-height: 120px;
        padding: 10px 10px 10px;
    }

    .project-card-thumb {
        height: 60px;
    }

    .launcher-footer {
        flex-direction: column;
        gap: 8px;
    }

    .launcher-footer .btn {
        width: 100%;
        justify-content: center;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* ----- 工具类 ----- */
.hidden {
    display: none !important;
}

/* ----- 新建项目步骤样式 ----- */
.step-section {
    margin-bottom: 16px;
}

.step-section:last-child {
    margin-bottom: 0;
}

.step-label {
    font-size: 12px;
    color: var(--gold);
    letter-spacing: 1px;
    margin-bottom: 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.step-label::before {
    content: '◆';
    font-size: 8px;
    color: var(--border-gold-dim);
}

/* 游戏类型卡片网格 */
.game-type-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.game-type-card {
    padding: 12px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    text-align: center;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.game-type-card:hover {
    border-color: var(--border-gold-dim);
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.game-type-card.active {
    border-color: var(--border-gold);
    background: rgba(200, 168, 120, 0.1);
    box-shadow: 0 0 12px rgba(200, 168, 120, 0.15);
}

.game-type-card .game-type-icon {
    font-size: 22px;
    line-height: 1;
}

.game-type-card .game-type-name {
    font-size: 11px;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.game-type-card .game-type-perspective {
    font-size: 9px;
    color: var(--text-muted);
}

.game-type-card.active .game-type-name {
    color: var(--gold);
}

/* 游戏类型描述 */
.game-type-desc {
    font-size: 11px;
    color: var(--text-muted);
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 3px;
    min-height: 32px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.game-type-desc .desc-icon {
    font-size: 14px;
    flex-shrink: 0;
}

/* 模板类型下拉菜单 */
.template-type-dropdown-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-type-dropdown-wrapper .form-select {
    font-size: 12px;
    padding: 9px 12px;
    padding-right: 32px;
}

.template-type-hint {
    font-size: 10px;
    color: var(--text-muted);
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 3px;
    line-height: 1.4;
}

/* 项目信息区域 */
.project-info-section {
    margin-top: 4px;
}

/* 模态框加宽 */
.modal-wide {
    width: 580px;
}

@media (max-width: 768px) {
    .game-type-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .modal-wide {
        width: 95vw;
    }
}

@media (max-width: 480px) {
    .game-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .game-type-card {
        min-height: 60px;
        padding: 10px 6px;
    }
    .game-type-card .game-type-icon {
        font-size: 18px;
    }
    .game-type-card .game-type-name {
        font-size: 10px;
    }
}