:root {
    --primary: #6366f1;
    /* Indigo */
    --primary-dark: #4f46e5;
    --bg-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Pretendard', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 900px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

.logo-icon {
    font-size: 3.5rem;
}

h1 {
    font-size: 3rem;
    font-weight: 900;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-dim);
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
}

.step-box {
    margin-bottom: 30px;
}

.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.upload-item label {
    display: block;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--primary);
    font-size: 1.1rem;
}

.upload-item input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 10px;
    border-radius: 8px;
}

.file-status {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-top: 5px;
}

/* Editor Area */
.editor-area.hidden {
    display: none;
}

.viewer-container {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #1e293b;
}

.canvas-wrapper {
    position: relative;
    max-width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    background: white;
}

#pdfCanvas {
    display: block;
    max-width: 100%;
}

.draggable {
    position: absolute;
    top: 50px;
    left: 50px;
    border: 2px dashed #6366f1;
    cursor: move;
    user-select: none;
    line-height: 0;
}

.draggable.hidden {
    display: none;
}

.draggable img {
    width: 150px;
    /* Default width */
    height: auto;
    pointer-events: none;
}

.resizer {
    width: 12px;
    height: 12px;
    background: #6366f1;
    position: absolute;
    right: -6px;
    bottom: -6px;
    cursor: nwse-resize;
    border-radius: 50%;
}

.page-controls {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    font-weight: 700;
}

.mini-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
}

.actions {
    text-align: center;
}

.guide {
    margin-bottom: 20px;
    font-weight: 700;
    color: var(--text-dim);
}

.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 20px;
    border-radius: 12px;
    font-size: 1.4rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
    transition: transform 0.2s;
}

.primary-btn:hover {
    transform: translateY(-2px);
}

/* Modal & Pad */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal.active {
    display: flex;
}

.pad-content {
    width: 95%;
    max-width: 500px;
    text-align: center;
}

.pad-wrapper {
    background: white;
    border-radius: 12px;
    margin: 20px 0;
    line-height: 0;
    touch-action: none;
}

#sigPad {
    width: 100%;
    height: 300px;
    cursor: crosshair;
}

.pad-actions {
    display: flex;
    gap: 10px;
}

.sign-options {
    display: flex;
    gap: 10px;
}

.sign-opt-btn {
    flex: 1;
    padding: 15px !important;
    font-weight: 700;
}

.ad-slot {
    margin-top: 40px;
    text-align: center;
    border: 2px dashed var(--glass-border);
    padding: 20px;
}

footer {
    text-align: center;
    margin-top: 60px;
    padding-bottom: 40px;
    color: var(--text-dim);
}

@media (max-width: 600px) {
    .upload-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2.22rem;
    }

    .sign-options {
        flex-direction: column;
    }

    .pad-actions {
        flex-direction: column;
    }
}