/* --- Neubrutalism Style --- */
:root {
    --color-background: #f0f0f0; /* 浅灰背景 */
    --color-foreground: #1a1a1a; /* 近黑前景 */
    --color-primary: #ffff00;    /* 亮黄强调色 */
    --color-secondary: #00ffff; /* 青色次强调色 */
    --color-white: #ffffff;
    --color-border: #1a1a1a;     /* 黑色边框 */

    --border-width: 3px;
    --shadow-offset: 5px;
    --font-family: 'Courier New', Courier, monospace; /* 或选择其他清晰的无衬线/等宽字体 */
}

body {
    margin: 0;
    padding: 20px;
    font-family: var(--font-family);
    background-color: var(--color-background);
    color: var(--color-foreground);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--color-white);
    border: var(--border-width) solid var(--color-border);
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--color-border);
}

.header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: var(--border-width) solid var(--color-border);
    padding-bottom: 20px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 0.2em;
    text-transform: uppercase; /* 大写强调 */
}

.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px; /* 元素间距 */
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    font-family: var(--font-family);
    font-size: 1em;
    font-weight: bold;
    padding: 12px 25px;
    border: var(--border-width) solid var(--color-border);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--color-border);
    user-select: none;
}

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

.btn-primary:hover {
    background-color: #e6e600; /* 稍暗的黄色 */
}

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

.btn-secondary:hover {
     background-color: #00e6e6; /* 稍暗的青色 */
}

.btn-download {
     background-color: #90ee90; /* 浅绿色 */
     color: var(--color-border);
}
.btn-download:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn:active:not(:disabled) {
    transform: translate(var(--shadow-offset), var(--shadow-offset));
    box-shadow: none;
}

/* Style for the new Reset button */
.btn-reset {
    background-color: #ff8c00; /* 暗橙色 */
    color: var(--color-border);
}

.btn-reset:hover {
    background-color: #cc7000;
}

/* --- Upload Section --- */
.upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%; /* Ensure section takes full width */
}

.file-name-display {
    font-style: italic;
    color: #555;
    margin-top: 5px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center; /* Center the text */
    padding: 0 10px; /* Add horizontal padding */
    box-sizing: border-box; /* Include padding in width calculation */
}

/* --- Split Options --- */
.split-options {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.split-options label {
    font-weight: bold;
}

.select-style {
    font-family: var(--font-family);
    font-size: 1em;
    padding: 8px 12px;
    border: var(--border-width) solid var(--color-border);
    background-color: var(--color-white);
    color: var(--color-foreground);
    cursor: pointer;
    /* Basic arrow styling */
    appearance: none; /* Remove default arrow */
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: .65em auto;
    padding-right: 30px; /* Space for arrow */
    box-shadow: 3px 3px 0 var(--color-border); /* Simpler shadow for select */
}

.select-style:focus {
    outline: var(--border-width) solid var(--color-secondary);
    outline-offset: 2px;
}

/* --- Output Format Options --- */
.output-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

.output-options label {
    font-weight: bold;
}

.format-hint {
    font-size: 0.85em;
    color: #555;
    font-style: italic;
}

/* Style for the moved drag hint */
.drag-hint {
    text-align: center;
    font-size: 0.9em;
    color: #333;
    margin-top: 15px;
    margin-bottom: 15px;
    display: none; /* ADDED: Hide by default */
}

/* --- Canvas Area --- */
.canvas-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    border: var(--border-width) solid var(--color-border);
    overflow: auto;
    position: relative;
    background-color: #e0e0e0;
    max-height: 75vh;
}

#imageCanvas {
    display: block; /* 移除 canvas 下方的空隙 */
    max-width: 100%; /* 宽度自适应容器 */
    height: auto;   /* 高度自动 */
    cursor: crosshair; /* 默认光标 */
}

/* --- Controls --- */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 25px;
    margin-top: 20px;
}

/* --- Footer --- */
.footer {
    margin-top: 40px;
    text-align: center;
    font-size: 0.9em;
    color: #555;
    border-top: var(--border-width) dashed var(--color-border); /* 虚线分割 */
    padding-top: 15px;
}

/* --- Loading Indicator --- */
.loading {
    font-weight: bold;
    color: var(--color-secondary);
    background-color: var(--color-border);
    padding: 10px 20px;
    display: inline-block; /* 使其像个标签 */
    margin-top: 15px; /* Add some margin */
}

/* --- Results Section --- */
.results-section {
    width: 100%;
    margin-top: 30px;
    border-top: var(--border-width) solid var(--color-border);
    padding-top: 20px;
    text-align: center;
}

.results-section h2 {
    margin-bottom: 10px;
    text-transform: uppercase;
}

.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* 响应式网格布局 */
    gap: 20px;
    justify-items: center; /* 网格项居中 */
    border: 1px solid #ccc;
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px;
    border: var(--border-width) dashed var(--color-border); /* 虚线边框 */
    background-color: #fafafa;
}

.result-item img {
    max-width: 100%;
    height: auto;
    display: block;
    border: 1px solid #ccc; /* 给图片加个细边框 */
}

.result-item .btn-download-single {
    /* Use existing btn styles but maybe smaller */
    padding: 8px 15px;
    font-size: 0.9em;
    background-color: var(--color-primary); /* Use primary color for single download */
    color: var(--color-border);
}

.result-item .btn-download-single:hover {
    background-color: #e6e600;
}

/* ADD styles for the individual item hint */
.result-item-hint {
    font-size: 0.8em; /* Smaller font size */
    color: #666;      /* Lighter color */
    margin-top: 5px;   /* Space above the button */
    margin-bottom: 0;  /* No extra space below */
}

/* 响应式考虑 (简单示例) */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    .header h1 {
        font-size: 1.8em;
    }
    .btn {
        padding: 10px 20px;
        font-size: 0.9em;
    }
     .controls {
        flex-direction: column; /* 在小屏幕上垂直排列按钮 */
        align-items: center;
    }
} 