body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 95%;
    max-width: 1290px;
    margin: 20px auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

header {
    padding: 20px 0;
    border-bottom: 1px solid #333;
  	display:flex;
	justify-content: center;
}

header a{
	width:150px;
}

header .logo img {
    max-height: 50px;
}

main {
    padding: 0px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

#upload-area {
    border: 2px dashed #555;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    background-color: #1e1e1e;
    transition: background-color 0.3s;
  	margin-top:32px;
}

#upload-area.drag-over {
    background-color: #333;
    border-color: #777;
}

#upload-area p {
    margin: 0;
    font-size: 1.2em;
}

.upload-btn-container {
    text-align: center;
    margin-top: 20px;
}

#convert-btn {
    padding: 12px 25px;
    font-size: 1.1em;
    cursor: pointer;
    background-color: #FFFFFF60;
    color: white;
    border: none;
    border-radius: 12px;
    margin-top: 24px;
    width: 180px;
    transition: all 0.3s ease;
}

#convert-btn:hover {
    transform: translateY(-6px);
}


#download-list {
    margin-top: 30px;
}

.download-item {
    display: flex;
    align-items: center;
    background-color: #1e1e1e;
    padding: 10px;
    border-bottom: 1px solid #333;
}

.download-item img {
    width: 60px;
    height: 60px;
    margin-right: 15px;
    object-fit: cover;
}

.download-item .file-info {
    flex-grow: 1;
    word-break: break-all;
}

.download-item .download-link {
    padding: 8px 15px;
    background-color: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 5px;
}

.batch-download-container {
    text-align: center;
    margin-top: 30px;
}

#batch-download-btn {
    padding: 12px 25px;
    font-size: 1.1em;
    cursor: pointer;
    background-color: #17a2b8;
    color: white;
    border: none;
    border-radius: 5px;
}

footer {
  padding:0px 16px;
  margin-top: auto;
    text-align: center;
    border-top: 1px solid #333;
    font-size: 14px;
  	line-height:24px;
}

footer a {
    color: #EFEFEF;
}

#turnstile-widget {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    min-height: 65px; /* Cloudflare Turnstile widget height */
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

.banner-container {
    margin: 20px 0;
    text-align: center;
}

.banner-container img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
}

.desktop-banner {
  display: block;
  width: 100%;
  height: auto;
}

.mobile-banner {
  display: none;
  width: 100%;
  height: auto;
}

@media (max-width: 768px) {
  .desktop-banner {
    display: none;
  }
  .mobile-banner {
    display: block;
  }
}

/* ===== 工具列（總說明 + 使用說明按鈕） ===== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.toolbar-intro {
    margin: 0;
    font-size: 1.05em;
    color: #ccc;
}

.toolbar-intro strong {
    color: #37BFF0;
}

.toolbar-note {
    display: block;
    font-size: 0.82em;
    color: #888;
    margin-top: 4px;
}

.help-btn {
    background: none;
    border: 1px solid #37BFF0;
    color: #37BFF0;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.95em;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.help-btn:hover {
    background-color: #37BFF0;
    color: #fff;
}

/* ===== 左右兩欄 ===== */
.tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

.tool-col {
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 24px;
}

.tool-title {
    margin: 0 0 8px;
    font-size: 1.4em;
    color: #fff;
    text-align: center;
}

.tool-desc {
    margin: 0 0 20px;
    font-size: 0.9em;
    line-height: 1.7;
    color: #999;
    text-align: center;
}

.upload-hint {
    font-size: 0.8em;
    color: #888;
}

/* 欄內上傳區縮小 padding、不要外距 */
.tool-col #upload-area,
.tool-col #crop-upload-area {
    margin-top: 0;
    padding: 32px 20px;
}

#crop-upload-area {
    border: 2px dashed #555;
    text-align: center;
    cursor: pointer;
    background-color: #1e1e1e;
    transition: background-color 0.3s;
}

#crop-upload-area.drag-over {
    background-color: #333;
    border-color: #777;
}

#crop-upload-area p {
    margin: 0;
    font-size: 1.2em;
}

.options-container {
    text-align: center;
    margin-top: 24px;
}

.options-title {
    margin: 0 0 8px;
    font-weight: 700;
    font-size: 1.05em;
    text-align: center;
}

#resize-options {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin: 12px auto 0;
    width: fit-content;
}

/* ===== 進度條 ===== */
#progress-wrap {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: #0d0d0d;
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background-color: #37BFF0;
    transition: width 0.25s ease;
}

.progress-text {
    text-align: center;
    margin-top: 8px;
    font-size: 0.95em;
    color: #aaa;
}

/* ===== 指定比例裁切 ===== */
.crop-ratios {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.ratio-btn {
    padding: 8px 16px;
    font-size: 0.95em;
    cursor: pointer;
    background-color: #0d0d0d;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.ratio-btn:hover {
    border-color: #37BFF0;
}

.ratio-btn.active {
    background-color: #37BFF0;
    color: #fff;
    border-color: #37BFF0;
}

.crop-tip {
    text-align: center;
    font-size: 0.82em;
    color: #888;
    margin: 10px 0 16px;
}

.crop-canvas-wrap {
    max-width: 1000px;
    margin: 0 auto;
    background-color: #0d0d0d;
}

.crop-canvas-wrap > img {
    display: block;
    max-width: 100%;
}

.cropper-container {
    margin: 0 auto;
}

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

#crop-reset-btn,
#crop-download-btn {
    padding: 12px 22px;
    font-size: 1em;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    transition: all 0.3s ease;
}

#crop-reset-btn {
    background-color: #444;
    color: #e0e0e0;
}

#crop-download-btn {
    background-color: #28a745;
    color: white;
}

#crop-download-btn:hover:not(:disabled) {
    transform: translateY(-4px);
}

#crop-download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 使用說明 Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-box {
    position: relative;
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 16px;
    max-width: 680px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.8em;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover {
    color: #fff;
}

.modal-title {
    margin: 0 0 8px;
    text-align: center;
    color: #fff;
}

.modal-subtitle {
    text-align: center;
    color: #37BFF0;
    font-size: 0.9em;
    margin: 0 0 24px;
}

.help-section {
    margin-bottom: 28px;
}

.help-section h3 {
    color: #37BFF0;
    font-size: 1.15em;
    margin: 0 0 12px;
}

.help-steps {
    margin: 12px 0 0;
    padding-left: 20px;
    line-height: 1.9;
    color: #ccc;
    font-size: 0.92em;
}

/* 示意圖 */
.help-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    background-color: #141414;
    border-radius: 10px;
    padding: 18px;
}

.dgm-box {
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #aaa;
    font-size: 0.75em;
}

.dgm-lg { width: 120px; height: 90px; }
.dgm-sm { width: 72px; height: 54px; }
.dgm-crop {
    width: 108px;
    height: 61px;
    background-color: #1f3a4d;
    border-color: #37BFF0;
    color: #cfe9f7;
}

.dgm-arrow {
    color: #37BFF0;
    font-size: 1.5em;
}

.dgm-cropframe {
    width: 70%;
    height: 60%;
    border: 2px dashed #37BFF0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #37BFF0;
    font-size: 0.9em;
    background-color: rgba(55, 191, 240, 0.12);
}

.dgm-note {
    width: 100%;
    text-align: center;
    margin: 6px 0 0;
    font-size: 0.8em;
    color: #888;
}

/* ===== 單一流程：單卡片版面 ===== */
.tool-single {
    max-width: none;
    margin: 20px 0 0;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 28px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tool-single #upload-area {
    margin-top: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 模式提示橫幅 */
.mode-tip {
    text-align: center;
    font-weight: 700;
    padding: 10px;
    border-radius: 8px;
    margin: 24px 0 8px;
}

.mode-tip-batch {
    background-color: rgba(55, 191, 240, 0.12);
    color: #37BFF0;
}

.mode-tip-single {
    background-color: rgba(40, 167, 69, 0.15);
    color: #4cd17a;
}

.step-label {
    font-weight: 700;
    font-size: 1.05em;
    margin: 22px 0 10px;
    text-align: center;
}

/* 尺寸選項：批次用直排 radio、單張用按鈕 */
.size-options:not(.size-options-btn) {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin: 12px auto 0;
    width: fit-content;
}

.size-options-btn {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.size-btn {
    padding: 8px 16px;
    font-size: 0.95em;
    cursor: pointer;
    background-color: #0d0d0d;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.size-btn:hover {
    border-color: #37BFF0;
}

.size-btn.active {
    background-color: #37BFF0;
    color: #fff;
    border-color: #37BFF0;
}

.action-btn-container {
    text-align: center;
    margin-top: 20px;
}

/* 下載項目文字 + 評分徽章 */
.file-name {
    font-weight: 700;
    word-break: break-all;
}

.file-meta {
    font-size: 0.82em;
    color: #aaa;
    margin-top: 2px;
}

.grade-badge {
    display: inline-block;
    font-size: 0.8em;
    margin-top: 6px;
    padding: 3px 10px;
    border-radius: 12px;
}

.grade-great { background-color: rgba(40, 167, 69, 0.2); color: #5fd98a; }
.grade-good  { background-color: rgba(55, 191, 240, 0.18); color: #5cc8f0; }
.grade-warn  { background-color: rgba(240, 173, 78, 0.2); color: #f0ad4e; }
.grade-big   { background-color: rgba(217, 83, 79, 0.2); color: #e57373; }

/* 單張裁切結果 */
.single-result-box {
    text-align: center;
    margin-top: 20px;
    padding: 16px;
    background-color: #0d0d0d;
    border-radius: 10px;
}

.single-result-box .file-meta {
    font-size: 0.9em;
    color: #ccc;
}

.single-result-box .grade-badge {
    font-size: 0.9em;
    margin-top: 10px;
}

/* ===== 上傳區內的模式引導（不用點使用說明就懂） ===== */
.upload-main {
    margin: 0;
    font-size: 1.2em;
}

.upload-modes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    margin: 20px 0 14px;
    flex-wrap: wrap;
}

.umode {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    max-width: 170px;
}

.umode strong {
    color: #fff;
    font-size: 1.02em;
}

.umode-desc {
    font-size: 0.8em;
    color: #999;
    line-height: 1.5;
}

.umode-or {
    color: #666;
    font-size: 0.9em;
    font-weight: 700;
}

.umode-icon {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 4px;
}

/* 多張：三個小方塊 */
.umi-sq {
    width: 15px;
    height: 15px;
    border: 2px solid #37BFF0;
    border-radius: 3px;
    background-color: rgba(55, 191, 240, 0.15);
}

/* 裁切：方塊內虛線裁切框 */
.umi-crop {
    width: 42px;
    height: 32px;
    border: 2px solid #666;
    border-radius: 4px;
    position: relative;
    background-color: rgba(255, 255, 255, 0.04);
}

.umi-crop::after {
    content: '';
    position: absolute;
    inset: 6px;
    border: 2px dashed #37BFF0;
    border-radius: 2px;
}

/* ===== 模式列 + 重新上傳 ===== */
.mode-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 24px 0 8px;
    flex-wrap: wrap;
}

.mode-bar .mode-tip {
    margin: 0;
    flex: 1;
}

.reupload-btn {
    background: none;
    border: 1px solid #555;
    color: #aaa;
    padding: 6px 14px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.85em;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.reupload-btn:hover {
    border-color: #37BFF0;
    color: #37BFF0;
}

/* ===== 自訂寬度輸入 ===== */
.size-custom-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.custom-w {
    width: 82px;
    padding: 5px 8px;
    background-color: #0d0d0d;
    border: 1px solid #555;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.9em;
}

.custom-w:disabled {
    opacity: 0.4;
}

.size-options-btn .custom-w {
    margin-left: 4px;
}

/* ===== 預估中 ===== */
.estimating {
    text-align: center;
    color: #888;
    font-size: 0.9em;
    margin-top: 16px;
    padding: 12px;
}

/* ===== 響應式 ===== */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        text-align: center;
    }
    .tool-single {
        padding: 20px 16px;
    }
    .upload-modes {
        gap: 14px;
    }
    .umode {
        max-width: 140px;
    }
}
