*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

h1 {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: #888;
    margin-bottom: 1.5rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.setting label {
    display: block;
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 0.3rem;
}

.setting input[type="number"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #333;
    border-radius: 6px;
    background: #16213e;
    color: #e0e0e0;
    font-size: 1rem;
}

.zoom-anchor-setting {
    grid-column: 1 / -1;
}

.single-wide-zoom-setting {
    grid-column: 1 / -1;
}

.single-wide-zoom-ui {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
}

.single-wide-zoom-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #7d8aa8;
}

.single-wide-zoom-setting input[type="range"] {
    width: 100%;
    accent-color: #7ec850;
}

.single-wide-zoom-label {
    margin-top: 0.45rem;
    font-size: 0.78rem;
    color: #9fc89a;
}

.zoom-anchor-ui {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
}

.zoom-anchor-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #7d8aa8;
}

.zoom-anchor-setting input[type="range"] {
    width: 100%;
    accent-color: #537ec5;
}

.zoom-anchor-preview {
    margin-top: 0.55rem;
    height: 130px;
    width: 100%;
    border-radius: 8px;
    border: 1px solid #2a3a5e;
    background: linear-gradient(to bottom, #3a588f 0%, #486aa7 35%, #29446f 100%);
    position: relative;
    overflow: hidden;
}

.zoom-anchor-image {
    position: absolute;
    left: 50%;
    top: 0;
    width: auto;
    height: 100%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.zoom-anchor-image.has-image {
    opacity: 1;
}

.zoom-anchor-preview::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.05) 0,
        rgba(255, 255, 255, 0.05) 1px,
        rgba(0, 0, 0, 0) 1px,
        rgba(0, 0, 0, 0) 16px
    );
}

.zoom-anchor-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 32px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 2px solid #f0f7ff;
    border-bottom: 2px solid #f0f7ff;
    background: rgba(240, 247, 255, 0.14);
    box-shadow: 0 0 0 1px rgba(12, 23, 44, 0.8) inset;
}

.zoom-anchor-label {
    margin-top: 0.45rem;
    font-size: 0.78rem;
    color: #9faecc;
}

.checkbox-setting label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    height: 100%;
    padding-top: 0.3rem;
}

.checkbox-setting input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #0f3460;
}

.help-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #555;
    background: transparent;
    color: #888;
    font-size: 0.7rem;
    font-weight: bold;
    cursor: pointer;
    margin-left: 0.3rem;
    vertical-align: middle;
    line-height: 1;
}

.help-toggle:hover {
    border-color: #537ec5;
    color: #537ec5;
}

.help-panel {
    background: #0d1b33;
    border: 1px solid #2a3a5e;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #bbb;
}

.help-panel ul {
    margin: 0.5rem 0 0.75rem 1.25rem;
}

.help-panel li {
    margin-bottom: 0.25rem;
}

.help-diagram {
    width: 100%;
    max-width: 680px;
    margin-top: 0.75rem;
    border-radius: 6px;
}

.dropzone {
    border: 2px solid #333;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 1rem;
    background: #16213e;
}

.dropzone:hover {
    border-color: #537ec5;
    background: rgba(83, 126, 197, 0.08);
}

.dropzone p {
    color: #888;
}

.dropzone .hint {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    color: #555;
}

.file-info {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 1rem;
}

.generate-btn {
    display: block;
    width: 100%;
    padding: 0.85rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 8px;
    background: #0f3460;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.generate-btn:hover:not(:disabled) {
    background: #1a4d8f;
}

.generate-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.progress {
    margin-top: 1rem;
    text-align: center;
}

.progress-bar {
    height: 6px;
    background: #222;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: #537ec5;
    transition: width 0.15s;
}

#progressText {
    font-size: 0.85rem;
    color: #888;
}

.output {
    margin-top: 2rem;
}

.output h2 {
    margin-bottom: 1rem;
    color: #fff;
}

.output-section {
    margin-bottom: 2rem;
    background: #16213e;
    border-radius: 10px;
    padding: 1rem;
}

.output-section h3 {
    font-size: 1rem;
    color: #aaa;
    margin-bottom: 0.5rem;
}

.output-section .meta {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.output-section canvas {
    width: 100%;
    border-radius: 6px;
    background: #000;
}

.download-btn {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 6px;
    background: #0f3460;
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
}

.download-btn:hover {
    background: #1a4d8f;
}

.warning {
    background: #3d2e00;
    color: #ffcc00;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}
