:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --border-color: #ddd;
    --panel-bg: #f5f5f5;
    --button-bg: #4CAF50;
    --button-hover: #45a049;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    font-family: Arial, sans-serif;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    flex-wrap: wrap;
}

@media screen and (max-width: 480px) {
    .controls-row {
        gap: 10px;
        padding: 10px;
    }
    .button {
        min-width: 80px;
    }
    .control-item {
        flex: 1 1 100%;
        justify-content: space-between;
    }
}

.control-item {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.button {
    padding: 8px 16px;
    height: 36px;
    background-color: var(--button-bg);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-sizing: border-box;
}

.button:hover {
    background-color: var(--button-hover);
}

.button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

input[type="range"] {
    width: 100px;
}

.number-input {
    width: 50px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
}

.preview {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.original, .result {
    flex: 1;
    min-width: 300px;
    max-width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    height: 400px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media screen and (max-width: 768px) {
    .original {
        display: none;
    }
    .result {
        max-width: 100%;
        height: auto;
        max-height: 65vh;
        flex: 1 1 100%;
    }
    
    .image-container,
    canvas#resultCanvas {
        min-height: 150px;
        height: 100%;
        max-height: 100%;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    img#originalImage {
        max-height: 100%;
        width: auto;
        max-width: 100%;
        object-fit: contain;
    }
}

.image-container, 
canvas#resultCanvas {
    width: 100%;
    height: 340px;
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

img#originalImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

canvas#resultCanvas {
    max-width: 100%;
    height: auto;
    min-height: 200px;
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    object-fit: contain;
}

h3 {
    margin: 0 0 10px 0;
}

.upload-button, .save-button {
    display: none;
}

.copyright {
    text-align: center;
    padding: 20px 0;
    margin-top: 20px;
    color: #666;
    font-size: 0.9em;
    border-top: 1px solid #eee;
}

.copyright a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
}

.copyright a:hover {
    color: #333;
    text-decoration: underline;
}

.description {
    max-width: 800px;
    margin: 0 auto 20px;
    color: #666;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.description p {
    margin: 8px 0;
}

.help-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #666;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: help;
    transition: background-color 0.3s;
}

.help-icon:hover {
    background: #333;
}

/* Tooltip styling */
.help-icon[title] {
    position: relative;
}

.help-icon[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 4px;
    font-size: 0.85em;
    line-height: 1.4;
    white-space: pre-line;
    text-align: left;
    width: max-content;
    max-width: 300px;
    margin-bottom: 5px;
    z-index: 1000;
}

.help-icon[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
    margin-bottom: -5px;
}

.version {
    font-size: 0.5em;
    color: #666;
    font-weight: normal;
    vertical-align: middle;
}

.logo {
    margin: 20px auto;
    width: 100%;
    max-width: 1200px;
    padding: 0 20px;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    height: auto;
}

.logo img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    object-position: center;
    max-height: 55vh;
    min-height: 400px;
}

.steam-banner {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 10px auto 20px;
    flex-wrap: wrap;
    align-items: center;
}

.steam-banner a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background-color: #1b2838;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.steam-banner a img {
    display: block;
    height: auto;
}

.steam-banner a[href*="apps.apple.com"] {
    background: none;
    padding: 0;
}

.steam-banner a[href*="apps.apple.com"]:hover {
    transform: translateY(-2px);
    background: none;
}

.steam-banner a.help-link {
    background-color: #4CAF50;
}

.steam-banner a.help-link:hover {
    background-color: #45a049;
}

.help-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    color: #4CAF50;
    font-weight: bold;
    font-size: 12px;
}

.legal-links {
    margin-top: 10px;
    font-size: 0.85em;
}

.legal-links a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
    margin: 0 5px;
}

.legal-links a:hover {
    color: #4CAF50;
    text-decoration: underline;
}

.language-options {
    margin-top: 5px;
    font-size: 0.85em;
    color: #888;
}

.language-options a {
    color: #888;
    text-decoration: none;
    margin: 0 5px;
}

.language-options a:hover {
    color: #4CAF50;
}

/* WeChat tooltip styles */
.wechat-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.wechat-tooltip {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
    min-width: 200px;
}

/* PC端保持hover效果 */
@media (hover: hover) and (pointer: fine) {
    .wechat-container:hover .wechat-tooltip {
        opacity: 1;
        visibility: visible;
    }
}

/* 手机端和触摸设备使用点击切换 */
@media (hover: none) or (pointer: coarse) {
    .wechat-tooltip.show {
        opacity: 1;
        visibility: visible;
    }
}

.wechat-container img {
    display: block;
    height: auto;
}

.wechat-tooltip img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

/* =================================
   Gallery Styles
==================================== */
.gallery-container {
    width: 100%;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #eee;
    text-align: center;
}

.gallery-container h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 10px;
}

.gallery-placeholder {
    color: #666;
    margin-bottom: 20px;
    font-style: italic;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    justify-content: center;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease-in-out;
    background-color: #fff;
}

.gallery-item:hover {
    transform: scale(1.05);
    z-index: 10;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.gallery-item .item-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.gallery-item:hover .item-actions {
    transform: translateY(0);
}

.item-actions button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
}

.item-actions button:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* 样本图片样式 */
.sample-item {
    border: 2px solid #4CAF50;
    position: relative;
}

.sample-item::before {
    content: "Sample";
    position: absolute;
    top: 5px;
    left: 5px;
    background: #4CAF50;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    z-index: 20;
}

/* 用户图片样式 */
.user-item {
    border: 2px solid #ddd;
}