/* Tab Navigation Styles - 确保真正无缝的抽出式效果 */

/* Hero Header Overlay Styles */
.hero-header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    padding: 6px 0;
    background-color: transparent;
    box-shadow: none;
}

.hero-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hero-brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.hero-brand-link:hover {
    transform: scale(1.05);
}

.hero-logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.hero-logo-text {
    font-family: 'Pacifico', cursive;
    font-size: 24px;
    color: #6f4e37;
    white-space: nowrap;
}

.hero-nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.hero-nav-link {
    color: #6f4e37;
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    padding: 8px 14px;
    border-radius: 999px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.hero-nav-link:hover {
    background-color: rgba(184, 134, 11, 0.15);
    color: #4a321f;
}

/* Language Selector Styles */
.language-selector {
    position: relative;
}

.language-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(184, 134, 11, 0.1);
    border: none;
    border-radius: 999px;
    color: #6f4e37;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.language-button:hover {
    background: rgba(184, 134, 11, 0.2);
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: rgba(255, 248, 220, 0.98);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 99999;
}

.language-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: block;
    padding: 12px 16px;
    color: #6f4e37;
    text-decoration: none;
    transition: background 0.2s ease;
}

.language-option:hover {
    background: rgba(111, 78, 55, 0.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .hero-header-inner {
        padding: 0 15px;
    }

    .hero-logo-text {
        font-size: 18px;
    }

    .hero-logo-img {
        width: 32px;
        height: 32px;
    }

    .hero-nav {
        gap: 10px;
    }

    .hero-nav-link,
    .language-button {
        padding: 6px 12px;
        font-size: 14px;
    }
}

.tool-tabs-container {
    display: flex;
    margin-bottom: 0;
    overflow-x: auto;
    white-space: nowrap;
    -ms-overflow-style: none;
    scrollbar-width: none;
    background: transparent;
    border: none;
    padding: 0;
    flex-wrap: wrap;
    margin-top: 0;
}

.warm-style .tool-tabs-container {
    background: transparent;
    border: none;
}

.tool-tabs-container::-webkit-scrollbar {
    display: none;
}

.tool-tab-link {
    padding: 10px 15px;
    cursor: pointer;
    border: none;
    font-weight: 600;
    position: relative;
    transition: all 0.3s ease;
    border-radius: 6px 6px 0 0;
    margin-right: 0;
    white-space: normal;
    word-wrap: break-word;
    text-align: center;
    min-width: 80px;
    flex: 1;
    color: #555;
}

/* 默认状态的背景色 */
.tool-tab-link[data-tab="presets"] {
    background: #e9e9e9;
}
.tool-tab-link[data-tab="core"] {
    background: #e0e6eb;
}
.tool-tab-link[data-tab="color"] {
    background: #f5ede6;
}
.tool-tab-link[data-tab="effects"] {
    background: #e0ebe0;
}

/* 激活状态的背景色 */
.tool-tab-link.active[data-tab="presets"] {
    background-color: #fafafa;
    color: #d66781;
}
.tool-tab-link.active[data-tab="core"] {
    background-color: #f0f4f8;
    color: #d66781;
}
.tool-tab-link.active[data-tab="color"] {
    background-color: #fef7f0;
    color: #d66781;
}
.tool-tab-link.active[data-tab="effects"] {
    background-color: #f0f8f0;
    color: #d66781;
}

.tool-tab-link:hover:not(.active) {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

.tool-tab-link.active {
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
    z-index: 10;
    position: relative;
}

/* 温暖风格的标签链接 */
.warm-style .tool-tab-link {
    color: #4a3b2a;
}
.warm-style .tool-tab-link[data-tab="presets"] {
    background: #dcd5c3;
}
.warm-style .tool-tab-link[data-tab="core"] {
    background: #d8dde3;
}
.warm-style .tool-tab-link[data-tab="color"] {
    background: #f0e8de;
}
.warm-style .tool-tab-link[data-tab="effects"] {
    background: #d8e3d8;
}

.warm-style .tool-tab-link.active[data-tab="presets"] {
    background-color: #faf8f5;
    color: #8b5a2b;
}
.warm-style .tool-tab-link.active[data-tab="core"] {
    background-color: #f0f2f6;
    color: #8b5a2b;
}
.warm-style .tool-tab-link.active[data-tab="color"] {
    background-color: #fdf6f0;
    color: #8b5a2b;
}
.warm-style .tool-tab-link.active[data-tab="effects"] {
    background-color: #f2f6f2;
    color: #8b5a2b;
}

/* Tab Content Styles (related to tool) */
.tool-tab-content {
    display: none;
    padding: 15px; /* General padding, specific override below */
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
    border: none;
    border-radius: 0 0 6px 6px;
    margin-top: 0;
}

.tool-tab-content.active {
    display: block;
}

/* 各标签内容区域背景色 */
#tab-content-presets { background-color: #fafafa; }
#tab-content-core { background-color: #f0f4f8; }
#tab-content-color { background-color: #fef7f0; }
#tab-content-effects { background-color: #f0f8f0; }

/* 温暖风格下各标签内容区域背景色 */
.warm-style #tab-content-presets { background-color: #faf8f5; }
.warm-style #tab-content-core { background-color: #f0f2f6; }
.warm-style #tab-content-color { background-color: #fdf6f0; }
.warm-style #tab-content-effects { background-color: #f2f6f2; }

/* Mini header at the top */
.mini-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.logo-container-mini {
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-logo-img-tiny {
    height: 40px;
    margin-right: 10px;
}

.micro-logo {
    font-family: 'Pacifico', cursive;
    color: #fff;
    margin: 0;
    font-size: 1rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* Centered title styles (Hero specific part) */
.centered-title-container {
    text-align: center;
    padding: 20px 0 10px;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title-centered {
    font-size: 2.5rem;
    color: #fff;
    margin: 0 0 15px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

.hero-features-centered {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}


/* Tool Section Styles */
.tool-section {
    background-color: transparent;
    padding: 15px;
    border-radius: 12px;
    box-shadow: none;
    margin-bottom: 20px;
    border: none;
}

.tool-section.warm-style {
    background-color: transparent;
    border: none;
    box-shadow: none;
}

/* App Layout Grid */
.app-layout-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.app-layout-grid.split-layout {
    display: grid;
    grid-template-columns: 4fr 6fr;
    /* MODIFIED: Reduced the height of the first row from 120px to 70px */
    grid-template-rows: 70px 1fr;
    gap: 15px; /* This is the existing gap between grid items */
    grid-template-areas:
        "controls upload"
        "controls preview";
    height: 700px;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    align-items: start;
}

#controls-panel-container {
    grid-area: controls;
    align-self: stretch;
    display: flex; /* Added for consistency if direct children need flex props */
    flex-direction: column; /* Added for consistency */
    padding: 0; /* Reset padding for the container itself */
    overflow: hidden; /* Reset overflow for the container itself */
}

#upload-area-container {
    grid-area: upload;
    align-self: start;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 70px;
    margin: 0;
    padding: 12px;
    /* border: 1px solid #8B4513; */ /* 深棕色边框 - 已由 golden-border 类提供 */
    border-radius: 8px;
    background-color: #f0ead9; /* 浅棕色背景 */
    box-sizing: border-box;
}

.warm-style #upload-area-container {
    /* border: 1px solid #8B4513; */ /* 深棕色边框 for warm style - 已由 golden-border 类提供 */
    background-color: #f0ead9; /* 浅棕色背景 for warm style */
}

#preview-container {
    grid-area: preview;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0;
    padding: 6px 0 0 0;
}

.split-section {
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.golden-border {
    border: 2px solid #b8860b;
    box-shadow: 0 4px 12px rgba(184, 134, 11, 0.2);
}

.split-section .tool-tabs-container {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
}

.split-section .tool-tab-content-area {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.split-section #upload-section { /* Style for #upload-section when it's part of .split-section */
    height: auto;
    display: flex;
    flex-direction: column;
    /* justify-content: flex-start; /* 修改为 flex-start，使其内容顶部对齐 */
}

.split-section .image-previews-area { /* Style for .image-previews-area when it's part of .split-section */
    height: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    margin-top: 0;
    padding-top: 0;
}


.tool-container-wrapper {
    margin-top: auto;
    padding-top: 0;
    margin-bottom: 15px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.centered-title-container { /* Specific to tool area context if needed, or already general */
    padding-bottom: 15px; /* Overrides general padding-bottom if this is more specific */
}

/* Controls panel */
.controls-panel {
    padding: 0;
    background-color: #fafafa;
    border-radius: 6px;
    box-shadow: none;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease;
    position: relative;
    padding-bottom: 60px; /* Space for fixed buttons */
    margin: 0;
    align-self: stretch;
}

.warm-style .controls-panel {
    background-color: #faf8f5;
    border: none;
    transition: background-color 0.3s ease;
}

/* 动态背景色类 */
.controls-panel.tab-presets-active {
    background-color: #fafafa;
}
.controls-panel.tab-core-active {
    background-color: #f0f4f8;
}
.controls-panel.tab-color-active {
    background-color: #fef7f0;
}
.controls-panel.tab-effects-active {
    background-color: #f0f8f0;
}

.warm-style .controls-panel.tab-presets-active {
    background-color: #faf8f5;
}
.warm-style .controls-panel.tab-core-active {
    background-color: #f0f2f6;
}
.warm-style .controls-panel.tab-color-active {
    background-color: #fdf6f0;
}
.warm-style .controls-panel.tab-effects-active {
    background-color: #f2f6f2;
}

.controls-panel h2 { /* H2 specifically inside .controls-panel */
    display: none;
}

.tool-tab-content { /* Padding specifically for tool tab contents */
    padding: 5px;
}

/* 统一两个操作按钮的样式 */
.action-button {
    padding: 8px 12px; /* Further reduced padding */
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75em; /* Further reduced font size */
    font-weight: 700;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content; /* Width based on text */
    min-width: 80px; /* Reduced min-width */
    text-align: center;
    box-sizing: border-box;
    white-space: nowrap;
}

.btn-secondary.action-button {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary.action-button:hover {
    background-color: #7f8c8d;
    transform: translateY(-2px);
}

.btn-secondary.action-button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.btn-primary.action-button {
    background-color: #e87a90;
    color: white;
}

.btn-primary.action-button:hover {
    background-color: #d9687f;
    transform: translateY(-2px);
}

.btn-primary.action-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* Upload Area */
.upload-section { /* Styles for the div with id="upload-section" */
    margin-bottom: 0; /* Adjusted margin */
    margin-top: 0;
}

.upload-area {
    border: 1px dashed #D2B48C; /* 改为鞣革色虚线边框 */
    padding: 15px; /* Changed from 10px to ensure equal padding */
    text-align: center;
    cursor: pointer;
    background-color: #FAF0E6; /* 改为亚麻色背景 */
    transition: background-color 0.3s ease;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    flex-grow: 1;
    border-radius: 8px;
    box-sizing: border-box; /* Added to ensure padding is included in size calculation */
}

.warm-style .upload-area {
    /* border: none; - Removed to inherit new border */
    /* background-color: transparent; - Removed to inherit new background */
}

.highlight-upload { /* This class is used on #upload-area-container now */
    border: 1px dashed #B8860B !important; /* 改为暗金黄色虚线边框 */
    background-color: #FFF8DC; /* 改为玉米丝色背景 */
}

.upload-text { /* Text inside upload-area */
    margin: 0;
    font-size: 0.85em; /* Reduced from 0.95em */
    color: #8B5A2B; /* 改为深棕色 */
}


/* Image Preview Area */
.image-previews-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    margin-top: 0;
    padding-top: 0;
}

.pixelated-image-container {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

#pixelated-image-canvas {
    max-width: 100%;
    height: auto;
    max-height: calc(100vh - 180px); /* Default max height */
    border-radius: 4px;
    margin: 0 auto;
    display: block;
    object-fit: contain;
}

.image-box { /* Container for the canvas and placeholder */
    padding: 10px;
    background-color: #F5F5DC; /* 改为米色背景 */
    border-radius: 8px;
    border: 1px solid #D2B48C; /* 改为鞣革色边框 */
    text-align: center;
    height: auto; /* Changed from 100% to auto to be more flexible */
    min-height: 160px;
    display: flex;
    flex-direction: column;
    position: relative; /* For fixed download button positioning */
    padding-bottom: 60px; /* Space for download button */
}

.warm-style .image-box {
    background-color: #F5F5DC; /* 保持米色背景 */
    border: 1px solid #D2B48C; /* 保持鞣革色边框 */
}

.image-box h3 { /* Title inside image-box, if any (currently not in HTML structure for preview) */
    margin-top: 0;
    margin-bottom: 8px;
    color: #6F4E37; /* 改为咖啡色 */
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 1em;
}

#pixelated-image-placeholder {
    color: #8B5A2B; /* 改为深棕色 */
    font-size: 0.85em;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #D2B48C; /* 改为鞣革色虚线边框 */
    border-radius: 8px;
    padding: 10px;
    height: 140px; /* Default height */
    flex-grow: 1; /* Allow it to take space if canvas is not there */
    background-color: #FAF0E6; /* 改为亚麻色背景 */
}

/* Buttons (general .btn styles, if primarily used in tool, keep here) */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 700;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary { /* This is also used for action-button, definitions are similar */
    background-color: #FFD700; /* 改为标准金色 */
    color: #6F4E37; /* 改为咖啡色文字 */
}

.btn-primary:hover {
    background-color: #DAA520; /* 改为金麒麟色 */
    transform: translateY(-2px);
}

.btn-primary:disabled {
    background-color: #D2B48C; /* 改为鞣革色 */
    cursor: not-allowed;
    transform: none;
}


/* General layout for control options */
.control-option {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    width: 100%;
    padding-right: 5px;
    box-sizing: border-box;
}

.control-option label {
    flex: 0 0 130px;
    margin-right: 10px;
    font-size: 0.9em;
    white-space: nowrap;
    color: #6F4E37; /* 改为咖啡色 */
}

.control-input {
    flex: 1;
    display: flex;
    align-items: center;
    max-width: calc(100% - 140px);
    box-sizing: border-box;
}

.control-option input[type="range"] {
    flex: 1;
    margin-right: 8px;
    cursor: pointer;
    accent-color: #e87a90;
    /* width: calc(100% - 3.5em); */ /* Overridden by specific control-input rules */
    box-sizing: border-box;
}

.control-option select {
    flex: 1;
    padding: 5px 6px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background-color: #fff;
    font-size: 0.9em;
    /* width: calc(100% - 3.5em); */ /* Overridden by specific control-input rules */
    box-sizing: border-box;
}

.control-option span { /* Value display for sliders */
    flex: 0 0 3.5em;
    text-align: right;
    color: #8B5A2B; /* 改为深棕色 */
    font-size: 0.9em;
    white-space: nowrap;
    min-width: 3.5em;
    box-sizing: border-box;
}

.control-input input[type="range"],
.control-input select {
    width: calc(100% - 3.5em); /* Ensures input/select and span fit */
}

.tool-tab-content-area {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    background: none; /* Or specific tab background if needed */
    border-radius: 0 0 6px 6px;
    padding-bottom: 60px; /* Space for fixed buttons if content scrolls */
    margin-bottom: -60px; /* To counteract padding for scroll with fixed buttons */
}

/* Hero Section Styles */
.hero-section {
    position: relative;
    padding: 80px 0 0;
    overflow: hidden;
    background-image: linear-gradient(to bottom, rgba(255,232,124,0) 70%, rgba(255,232,124,1) 100%), var(--hero-bg-image, url('/images/Background.png')); /* 改为黄色渐变 */
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: scroll;
    aspect-ratio: 3 / 2;
    display: flex;
    flex-direction: column;
}

.hero-section > *:not(.hero-header-overlay) { /* Keep hero content stacked while leaving the nav floating */
    position: relative;
    z-index: 2;
}

.feature-badge { /* Badges in the hero section */
    background-color: #FFD700; /* 改为标准金色 */
    color: #6F4E37; /* 改为咖啡色文字 */
    padding: 5px 15px;
    border-radius: 20px;
    margin: 0 10px 10px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(184, 134, 11, 0.3); /* 添加金色阴影 */
}

/* Preset Style Buttons */
.style-category {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    padding: 0; /* Reset padding if any from other general styles */
}

.style-button { /* General style button, might be too generic? This is for presets. */
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: #333;
}

.style-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.style-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Specific styling for preset buttons within the tab */
#tab-content-presets .style-button {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    padding: 6px 12px;
    border-radius: 15px;
    margin: 3px; /* Ensure some spacing */
    font-size: 0.85em;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

#tab-content-presets .style-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    filter: brightness(110%) saturate(110%); /* Combined hover effect */
}

#tab-content-presets .style-button.active {
    border-width: 2px;
    border-style: solid;
    border-color: rgba(0,0,0,0.3);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2), inset 0 2px 4px rgba(0,0,0,0.25); /* Combined active shadow */
    transform: translateY(1px);
    filter: saturate(120%) brightness(95%);
}
#tab-content-presets .style-button.active:hover {
    filter: brightness(95%) saturate(115%);
}


/* Specific button styling for unique colors (within presets tab) */
#tab-content-presets .style-button[data-preset-key="none"] { background-color: #E6E6FA; color: #6A5ACD; }
#tab-content-presets .style-button[data-preset-key="NES"] { background-color: #FFDEAD; color: #8B4513; }
#tab-content-presets .style-button[data-preset-key="GameBoy"] { background-color: #E0E0E0; color: #555555; }
#tab-content-presets .style-button[data-preset-key="Pico-8"] { background-color: #FFC0CB; color: #800000; }
#tab-content-presets .style-button[data-preset-key="CGA"] { background-color: #ADD8E6; color: #000080; }
#tab-content-presets .style-button[data-preset-key="VGA"] { background-color: #D3D3D3; color: #464646; }
#tab-content-presets .style-button[data-preset-key="Super Mario"] { background-color: #FFCCCB; color: #A52A2A; }
#tab-content-presets .style-button[data-preset-key="Stardew Valley"] { background-color: #DEB887; color: #5F4C30; }
#tab-content-presets .style-button[data-preset-key="Octopath Traveler"] { background-color: #D2B48C; color: #6C584C; }
#tab-content-presets .style-button[data-preset-key="Minecraft"] { background-color: #A0D2DB; color: #5E493C; }
#tab-content-presets .style-button[data-preset-key="Terraria"] { background-color: #C1E1C1; color: #556B2F; }
#tab-content-presets .style-button[data-preset-key="VA-11 Hall-A"] { background-color: #B0C4DE; color: #3B3B58; }
#tab-content-presets .style-button[data-preset-key="Dreamcore"] { background-color: #F0E6FF; color: #663399; }
#tab-content-presets .style-button[data-preset-key="Neon"] { background-color: #E0FFFF; color: #008080; }
#tab-content-presets .style-button[data-preset-key="Vaporwave"] { background-color: #FFDFD3; color: #B19CD9; }
#tab-content-presets .style-button[data-preset-key="Glitchcore"] { background-color: #DCDCDC; color: #696969; }
#tab-content-presets .style-button[data-preset-key="Anime"] { background-color: #FFF0F5; color: #C7838E; }
#tab-content-presets .style-button[data-preset-key="Phantom"] { background-color: #F5F5F5; color: #A9A9A9; }
#tab-content-presets .style-button[data-preset-key="Golden Age"] { background-color: #FAF0E6; color: #B8860B; }
#tab-content-presets .style-button[data-preset-key="Matrix"] { background-color: #C8E6C9; color: #2E7D32; }
#tab-content-presets .style-button[data-preset-key="Red Alert"] { background-color: #FFDAB9; color: #8B0000; }
#tab-content-presets .style-button[data-preset-key="Psychedelic"] { background-color: #E6E6FA; color: #9370DB; }
#tab-content-presets .style-button[data-preset-key="Thermal"] { background-color: #FFEFD5; color: #FF7F50; }
#tab-content-presets .style-button[data-preset-key="Vintage Film"] { background-color: #D2B48C; color: #5A4A34; }


#tab-content-presets h2 {
    display: block; /* Ensure these headings are visible */
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: #444;
    margin-top: 20px;
    margin-bottom: 12px;
    font-size: 1.05em;
    text-align: left;
    padding-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
    background: none;
}

#tab-content-presets h2:first-of-type {
    margin-top: 10px;
}

.warm-style #tab-content-presets h2 {
    color: #5d4a35;
    border-bottom: 1px solid #d6cdb5;
}

/* 固定按钮位置 - 修复冲突 (These are for buttons within tool panels) */
.button-group { /* For Reset All button in controls panel */
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    text-align: center;
    margin: 0 auto;
    padding: 0;
    z-index: 10;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.download-section.fixed-download-section { /* For Download button in preview panel */
    position: absolute;
    bottom: 15px;
    left: 0; /* Changed from 50% */
    right: 0; /* Added for centering */
    /* transform: translateX(-50%); */ /* Removed transform */
    text-align: center;
    margin: 0 auto; /* Added for centering block element */
    padding: 0;
    z-index: 10;
    width: fit-content; /* Changed from auto to fit-content for better centering */
    display: flex; /* Added for centering items if multiple buttons */
    justify-content: center; /* Added for centering items if multiple buttons */
}


/* Responsive Design specific to Hero/Tool Area */

/* 16:9 screen optimization */
@media (min-width: 1200px) and (min-height: 675px) {
    .app-layout-grid.split-layout {
        height: 750px;
        max-width: 1000px; /* Max width for the tool area */
        grid-template-columns: 4fr 6fr; /* Maintain aspect ratio */
    }
    #controls-panel-container { /* Ensure it doesn't overflow if content is too much */
        width: auto;
    }
}

/* Medium screen optimization */
@media (min-width: 1024px) and (max-width: 1199px) {
    .app-layout-grid.split-layout {
        height: 650px;
        grid-template-columns: 4fr 6fr; /* Maintain aspect ratio */
        max-width: 1000px; /* Max width for the tool area */
    }
}


@media (max-width: 992px) {
    .hero-section {
        min-height: auto; /* 或者 min-height: unset; 允许高度由内容决定 */
        height: auto;     /* 确保高度由内容决定 */
        overflow: visible;/* 允许内容溢出，从而使页面可以滚动 */
        padding-bottom: 20px; /* 为底部添加一些内边距，避免内容紧贴边缘 */
        padding-top: 70px;
    }

    .app-layout-grid.split-layout {
        grid-template-columns: 1fr; /* Single column */
        grid-template-rows: auto auto auto; /* Rows adjust to content */
        grid-template-areas:
            "upload"    /* Upload area at the top */
            "controls"  /* Controls panel below upload */
            "preview";   /* Preview area at the bottom */
        height: auto; /* Allow content to determine height, enabling scroll */
        max-width: 100%; /* Use full width available */
        padding-left: 15px; /* Add some padding for smaller screens */
        padding-right: 15px;
    }

    #controls-panel-container {
        max-height: 400px; /* Max height for controls panel */
        overflow-y: auto;  /* Enable scrolling for controls panel if content overflows */
        align-self: stretch; /* Ensure it stretches to grid area */
        min-height: 200px; /* Minimum height to ensure it's usable */
    }

    #upload-area-container {
        min-height: 70px; /* Keep its defined min-height */
        height: auto; /* Adjust height based on content */
        align-self: stretch;
    }

    #preview-container {
        min-height: 300px; /* Ensure preview area has some minimum space */
        height: auto; /* Adjust height based on content */
        align-self: stretch;
    }

    .split-section {
        overflow: visible; /* Allow content to overflow if necessary */
    }

    .tool-container-wrapper { /* This rule is specific to this media query as per the plan */
        padding-top: 15px; /* Add some top padding for the tool container */
    }

    .controls-panel {
        padding-bottom: 60px; /* Adjust padding to ensure space for buttons */
        position: relative; /* Ensure button-group stays within */
    }

    .button-group,
    .download-section.fixed-download-section {
        position: absolute; /* Keep buttons fixed at bottom */
        bottom: 15px;
        left: 0;
        right: 0;
        text-align: center;
        margin: 0 auto;
        width: fit-content;
        display: flex;
        justify-content: center;
    }
    .image-box { /* Adjust padding as fixed buttons are now static */
        padding-bottom: 60px; /* Ensure space for download button */
    }
    .image-previews-area {
        gap: 15px; /* Gap between preview elements if they stack */
    }
    #pixelated-image-canvas {
        max-height: 320px; /* Adjust canvas height */
    }
    .tool-tabs-container { /* Allow tabs to wrap and align left */
        flex-wrap: wrap;
        justify-content: flex-start;
        white-space: normal; /* Allow text wrapping in tabs if needed */
        padding: 0; /* Reset padding */
    }
    .tool-tab-link { /* Smaller tabs on smaller screens */
        flex: 0 0 auto; /* Don't grow, shrink based on content */
        font-size: 0.9em;
        padding: 6px 8px;
        margin: 0; /* Reset margin */
        min-width: 60px; /* Smaller min-width */
    }
    /* The duplicated/commented .app-layout-grid.split-layout rule from the original is removed for clarity. */
}

@media (max-width: 768px) {
    .app-layout-grid.split-layout {
        gap: 10px; /* Smaller gap */
        margin: 0 10px; /* Add some side margin */
    }
    /* Controls panel padding already adjusted */
    .controls-panel {
        padding: 10px; /* General padding for controls panel */
    }
    .image-box {
        padding: 10px; /* General padding for image box */
        min-height: 120px; /* Smaller min-height */
    }
    #pixelated-image-canvas {
        max-height: 280px; /* Further reduce canvas height */
    }
    .control-option label { /* Adjust control option labels */
         flex: 0 0 100px;
         font-size: 0.9em;
    }
    .control-input { /* Adjust control inputs */
        max-width: calc(100% - 110px);
    }
    .btn, .action-button { /* Smaller buttons */
        padding: 10px 20px;
        font-size: 0.9em;
    }
     /* Preset cards are now style-buttons, styling handled by .tool-tab-link changes */
    .tool-tabs-container {
        padding: 0;
        flex-wrap: wrap; /* Ensure wrapping */
    }
    .tool-tab-link {
        padding: 4px 6px;
        font-size: 0.85em;
        margin: 0;
        flex: 1; /* Allow flex to distribute space if fewer tabs */
        min-width: 70px; /* Min width for readability */
    }
    /* Specific tool layout changes from original 768px block */
    #controls-panel-container,
    #upload-area-container,
    #preview-container {
        padding: 8px; /* Padding for the containers themselves */
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding-top: 60px;
    }
    .tool-section, .controls-panel { /* Padding for tool sections and controls */
        padding: 10px 5px; /* Reduced padding */
    }
    .upload-area {
        padding: 15px 10px; /* Adjust upload area padding */
    }
    .upload-text {
        font-size: 0.9em; /* Slightly smaller upload text */
    }
     .control-option label {
         flex: 0 0 90px; /* Shorter labels */
         font-size: 0.85em;
         padding-right: 5px; /* reduce padding */
     }
     .control-input {
         max-width: calc(100% - 95px); /* Adjust for shorter label */
     }
     .control-option select {
         padding: 4px;
         font-size: 0.85em;
     }
    .app-layout-grid.split-layout {
        gap: 8px; /* Smallest gap */
        margin: 0 5px; /* Smallest margin */
    }
    #controls-panel-container,
    #upload-area-container,
    #preview-container {
        padding: 6px; /* Smallest padding for containers */
    }
    .tool-tab-link {
        padding: 3px 5px;
        font-size: 0.8em;
        margin: 0;
        flex: 1;
        min-width: 60px; /* Smallest min-width */
    }
}



#tab-content-presets .style-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.03);
}

.tool-tab-link.active {
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
    z-index: 10;
    position: relative;
}

.slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background-color: #ffffff; /* 改为白色 */
    z-index: 3;
    cursor: ew-resize;
}

.slider-handle::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background-color: #ffffff; /* 改为白色 */
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.language-option-item {
    padding: 10px 10px; /* 上下 10px, 左右 10px */
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    text-align: center;
    width: 100%;
    min-width: 108px; /* 与按钮和下拉菜单宽度一致 */
    box-sizing: border-box;
    transition: background-color 0.3s ease;
}

#language-switcher-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px; /* 上下 8px, 左右 10px */
    background: #333;
    color: white;
    border: 1px solid #555;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    min-width: 108px; /* 横向缩小约40% (180px * 0.6 = 108px) */
    box-sizing: border-box;
}

#current-language-name-display {
    text-align: center;
    flex: 1;
}

#language-options-dropdown {
    min-width: 108px; /* 与按钮同宽 */
    width: 100%;
    box-sizing: border-box;
}
