: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"],
.steam-banner a[href*="play.google.com"] {
    background: none;
    padding: 0;
}

.steam-banner a[href*="apps.apple.com"]:hover,
.steam-banner a[href*="play.google.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;
}

/* Palette modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    z-index: 2000;
}

.modal-content {
    background: #fff;
    width: 95%;
    max-width: 900px;
    max-height: 80vh;
    overflow: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    padding: 12px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.modal-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.palette-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.palette-card {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    background: #fafafa;
    transition: all 0.2s ease;
    cursor: pointer;
}

.palette-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #4CAF50;
}

.palette-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 12px 8px 12px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
}

.palette-card-header a {
    transition: color 0.2s ease;
}

.palette-card-header a:hover {
    color: #45a049 !important;
    text-decoration: underline !important;
}

.swatches {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0;
}

.swatch {
    height: 18px;
}

.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;
}

/* Ad Modal Styles */
.ad-modal {
    background: rgba(0, 0, 0, 0.9);
}

.ad-modal-content {
    max-width: 800px;
    width: 90%;
    background: #fff;
    padding: 30px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ad-timer-container {
    margin-bottom: 20px;
    text-align: center;
}

.ad-timer {
    font-size: 48px;
    font-weight: bold;
    color: var(--button-bg);
    margin-bottom: 5px;
}

.ad-timer-text {
    font-size: 14px;
    color: #666;
}

.ad-container {
    width: 100%;
    min-height: 250px;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    border: 1px dashed #ccc;
}

.ad-footer-notice {
    font-size: 14px;
    color: #d32f2f;
    background: #ffebee;
    padding: 10px 15px;
    border-radius: 4px;
    text-align: center;
    line-height: 1.5;
    margin-bottom: 15px;
}

.ad-close-button {
    margin-top: 10px;
}