* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Malgun Gothic", sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #ddd;
}

header {
    background: #2c3e50;
    color: #fff;
    padding: 25px 30px;
    border-bottom: 3px solid #1a252f;
}

h1 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.info-box {
    background: #34495e;
    padding: 12px 18px;
    display: inline-block;
    border-left: 3px solid #16a085;
}

.info-box p {
    margin: 3px 0;
    font-size: 0.95rem;
    color: #ecf0f1;
}

.info-box strong {
    color: #fff;
    font-weight: 600;
}

main {
    padding: 30px;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Home Link */
.home-link {
    display: inline-block;
    color: #ecf0f1;
    text-decoration: none;
    font-size: 0.95rem;
    margin-bottom: 15px;
    opacity: 0.8;
    transition: opacity 0.2s;
    font-weight: 500;
}

.home-link:hover {
    opacity: 1;
    color: #fff;
}

/* Upload Section */
.upload-section {
    text-align: center;
}

.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px 20px;
    background: #fafafa;
    transition: all 0.3s;
    cursor: pointer;
}

.drop-zone:hover {
    border-color: #16a085;
    background: #f0faf8;
}

.drop-zone.dragover {
    border-color: #16a085;
    background: #e8f8f5;
    border-style: solid;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.drop-zone-content svg {
    color: #999;
}

.drop-text {
    color: #666;
    font-size: 1rem;
}

.file-label {
    display: inline-block;
    padding: 10px 24px;
    background: #16a085;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 4px;
}

.file-label:hover {
    background: #138d75;
}

.file-hint {
    color: #999;
    font-size: 0.85rem;
}

/* Image Section */
.image-section {
    padding: 0 30px 20px;
}

.image-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.clear-btn {
    padding: 6px 14px;
    background: none;
    color: #e74c3c;
    border: 1px solid #e74c3c;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: #e74c3c;
    color: #fff;
}

.drag-hint {
    color: #999;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

/* Thumbnail Grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

/* Image Card */
.image-card {
    position: relative;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    cursor: grab;
    transition: all 0.2s;
}

.image-card:hover {
    border-color: #16a085;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.image-card.dragging {
    opacity: 0.4;
    border-color: #16a085;
}

.image-card.drag-over {
    border-color: #16a085;
    border-style: dashed;
    border-width: 2px;
    background: #e8f8f5;
}

.card-drag-handle {
    position: absolute;
    top: 4px;
    left: 4px;
    color: #fff;
    font-size: 0.8rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    z-index: 2;
    cursor: grab;
}

.card-number {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.card-thumb {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #eee;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-info {
    padding: 6px 8px;
}

.card-name {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    display: block;
    font-size: 0.65rem;
    color: #999;
    margin-top: 2px;
}

.card-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(231, 76, 60, 0.8);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.image-card:hover .card-remove {
    display: flex;
}

.image-card:hover .card-number {
    display: none;
}

/* PDF Options */
.pdf-options {
    display: flex;
    gap: 16px;
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    flex-wrap: wrap;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

.option-group select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    background: #fff;
    color: #333;
}

/* Convert Actions */
.convert-actions {
    margin-top: 20px;
    text-align: center;
}

.convert-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    background: #16a085;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.convert-btn:hover:not(:disabled) {
    background: #138d75;
}

.convert-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* Notice Section */
.notice-section {
    background: #fffbe6;
    border: 1px solid #e6d8a8;
    border-left: 4px solid #d4a017;
    padding: 20px;
    margin: 0 30px 25px 30px;
}

.notice-section h2 {
    color: #5d4e00;
    margin-bottom: 12px;
    font-size: 1.1rem;
    border-bottom: none;
    padding-bottom: 0;
}

.notice-content p {
    color: #665500;
    margin: 8px 0;
    line-height: 1.6;
    font-size: 0.9rem;
}

.notice-content strong {
    color: #4a4000;
}

/* Footer */
footer {
    background: #f8f9fa;
    text-align: center;
    padding: 15px 20px;
    color: #777;
    font-size: 0.85rem;
    border-top: 1px solid #ddd;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #2c3e50;
    color: #fff;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 0.9rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 1.3rem;
    }

    header {
        padding: 20px;
    }

    main {
        padding: 20px;
    }

    .image-section {
        padding: 0 20px 20px;
    }

    .notice-section {
        margin: 0 20px 20px 20px;
    }

    .drop-zone {
        padding: 30px 15px;
    }
}

@media (max-width: 480px) {
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }

    .pdf-options {
        flex-direction: column;
        gap: 10px;
    }

    .convert-btn {
        width: 100%;
    }
}
