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

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: #f6f7f9;
    color: #222;
}


/* =====================
   Header
===================== */

.header {
    width: 100%;
    height: 64px;

    background: #fff;

    border-bottom: 1px solid #e5e5e5;
}

.header-inner {
    max-width: 1100px;
    height: 100%;

    margin: auto;
    padding: 0 24px;

    display: flex;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 700;
}


/* =====================
   Main
===================== */

.main {
    min-height: calc(100vh - 120px);

    display: flex;
    justify-content: center;

    padding: 70px 20px;
}

.upload-container {
    width: 100%;
    max-width: 680px;
}


/* =====================
   Title
===================== */

.title-area {
    text-align: center;

    margin-bottom: 32px;
}

.title-area h2 {
    font-size: 30px;

    margin-bottom: 10px;
}

.title-area p {
    color: #777;

    font-size: 14px;
}


/* =====================
   User Name
===================== */

.user-name-area {
    width: 100%;

    margin-bottom: 20px;
}

.user-name-area label,
.template-select-label {
    display: flex;
    align-items: center;

    gap: 8px;

    margin-bottom: 8px;

    font-size: 13px;
    font-weight: 600;
}

.required {
    display: inline-block;

    padding: 2px 6px;

    border-radius: 4px;

    background: #111;
    color: #fff;

    font-size: 9px;
    font-weight: 700;
}

.user-name-area input {
    width: 100%;

    padding: 13px 14px;

    border: 1px solid #d9d9d9;
    border-radius: 9px;

    background: #fff;
    color: #222;

    font-size: 14px;

    outline: none;
}

.user-name-area input:focus {
    border-color: #222;
}

.user-name-area input::placeholder {
    color: #aaa;
}


/* =====================
   Template Select
===================== */

.template-select-area {
    width: 100%;

    margin-bottom: 20px;
}

.template-select-button {
    width: 100%;

    padding: 14px 16px;

    border: 1px solid #d9d9d9;
    border-radius: 9px;

    background: #fff;
    color: #222;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
}

.template-select-button:hover {
    border-color: #222;

    background: #fafafa;
}


/* =====================
   Selected Template
===================== */

.selected-template {
    width: 100%;

    display: flex;
    align-items: center;

    gap: 14px;

    margin-top: 10px;

    padding: 12px;

    background: #fff;

    border: 1px solid #e1e1e1;
    border-radius: 10px;
}

.selected-template-image {
    width: 64px;
    height: 64px;

    flex-shrink: 0;

    overflow: hidden;

    background: #f1f1f1;

    border-radius: 7px;
}

.selected-template-image img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    display: block;
}

.selected-template-info {
    flex: 1;

    min-width: 0;
}

.selected-template-label {
    display: block;

    margin-bottom: 4px;

    color: #999;

    font-size: 10px;
}

.selected-template-info p {
    overflow: hidden;

    font-size: 13px;
    font-weight: 600;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-change-button {
    flex-shrink: 0;

    padding: 8px 12px;

    border: 1px solid #ddd;
    border-radius: 7px;

    background: #fff;

    font-size: 12px;

    cursor: pointer;
}

.template-change-button:hover {
    border-color: #999;
}


/* =====================
   Drop Area
===================== */

.drop-area {
    width: 100%;
    min-height: 300px;

    background: #fff;

    border: 2px dashed #cfd4da;
    border-radius: 16px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    transition: 0.2s;
}

.drop-area:hover {
    border-color: #222;
}

.drop-area.drag-over {
    border-color: #222;

    background: #f0f1f3;
}

.upload-icon {
    width: 58px;
    height: 58px;

    border-radius: 50%;

    background: #111;
    color: #fff;

    display: flex;
    justify-content: center;
    align-items: center;

    font-size: 26px;

    margin-bottom: 20px;
}

.drop-title {
    font-size: 18px;
    font-weight: 600;
}

.drop-sub {
    margin: 12px 0;

    color: #999;

    font-size: 13px;
}

.file-select-button {
    padding: 12px 24px;

    border-radius: 8px;

    background: #111;
    color: #fff;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
}


/* =====================
   File Info
===================== */

.file-info {
    margin-top: 20px;

    padding: 16px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    background: #fff;

    border: 1px solid #e5e5e5;
    border-radius: 12px;
}

.file-details {
    display: flex;
    align-items: center;

    gap: 14px;

    min-width: 0;
}

.file-icon {
    width: 42px;
    height: 42px;

    flex-shrink: 0;

    display: flex;
    justify-content: center;
    align-items: center;

    background: #eee;

    border-radius: 8px;
}

.file-text {
    min-width: 0;
}

.file-text p {
    overflow: hidden;

    font-size: 14px;
    font-weight: 600;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-text span {
    color: #888;

    font-size: 12px;
}

.remove-button {
    padding: 5px 10px;

    border: none;

    background: transparent;

    font-size: 24px;

    cursor: pointer;
}


/* =====================
   Upload Button
===================== */

.upload-button {
    width: 100%;

    margin-top: 20px;

    padding: 15px;

    border: none;
    border-radius: 10px;

    background: #111;
    color: #fff;

    font-size: 15px;
    font-weight: 600;

    cursor: pointer;
}

.upload-button:hover {
    opacity: 0.85;
}


/* =====================
   Progress
===================== */

.progress-area {
    margin-top: 25px;
}

.progress-header {
    display: flex;
    justify-content: space-between;

    margin-bottom: 10px;

    font-size: 13px;
}

.progress-bar {
    width: 100%;
    height: 8px;

    overflow: hidden;

    background: #ddd;

    border-radius: 10px;
}

.progress {
    width: 0%;
    height: 100%;

    background: #111;

    transition: width 0.15s;
}


/* =====================
   Complete
===================== */

.complete-area {
    margin-top: 30px;

    padding: 40px;

    background: #fff;

    border: 1px solid #e5e5e5;
    border-radius: 16px;

    text-align: center;
}

.complete-icon {
    width: 54px;
    height: 54px;

    margin: 0 auto 16px;

    display: flex;
    justify-content: center;
    align-items: center;

    border-radius: 50%;

    background: #111;
    color: #fff;

    font-size: 25px;
}

.complete-area h3 {
    margin-bottom: 8px;

    font-size: 22px;
}

.complete-area > p {
    color: #777;

    font-size: 13px;
}


/* =====================
   Complete Template
===================== */

.complete-template-info {
    margin-top: 24px;

    padding: 13px 16px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 20px;

    border: 1px solid #e5e5e5;
    border-radius: 9px;

    background: #fafafa;

    text-align: left;
}

.complete-template-info span {
    color: #999;

    font-size: 9px;
    font-weight: 700;

    letter-spacing: 1px;
}

.complete-template-info strong {
    min-width: 0;

    overflow: hidden;

    font-size: 13px;

    text-overflow: ellipsis;
    white-space: nowrap;
}


/* =====================
   Card Preview
===================== */

.card-preview-area {
    margin-top: 28px;
}

.card-preview-label {
    margin-bottom: 10px;

    color: #888;

    font-size: 11px;
}

.card-preview {
    position: relative;

    width: min(100%, 430px);

    aspect-ratio: 1 / 1;

    margin: auto;

    overflow: hidden;

    background: #eee;

    border: 1px solid #ddd;
    border-radius: 12px;
}

.card-preview > img {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;

    display: block;
}


/* =====================
   QR Position
===================== */

.card-qr-position {
    position: absolute;

    left: 50%;
    top: 79%;

    transform:
        translate(
            -50%,
            -50%
        );

    padding: 3px;

    background: #fff;
}


/* =====================
   Real QR
===================== */

.card-dummy-qr {
    width: 140px;
    height: 140px;

    padding: 4px;

    display: flex;
    justify-content: center;
    align-items: center;

    background: #fff;

    color: #111;

    font-size: 14px;
    font-weight: 700;
}


/*
 * QRCode.js は内部に
 * canvas と img を生成する。
 *
 * 外箱118px
 * 内側余白4px × 左右
 * QR本体110px
 */

.card-dummy-qr canvas,
.card-dummy-qr img {
    width: 132px !important;
    height: 132px !important;

    display: block;

    margin: 0 !important;
}


/* =====================
   Complete Buttons
===================== */

.video-preview-button {
    width: 100%;

    margin-top: 26px;

    padding: 14px 20px;

    border: none;
    border-radius: 9px;

    background: #111;
    color: #fff;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
}

.video-preview-button:hover {
    opacity: 0.85;
}

.new-upload-button {
    width: 100%;

    margin-top: 10px;

    padding: 13px 20px;

    border: 1px solid #ddd;
    border-radius: 9px;

    background: #fff;

    font-size: 13px;

    cursor: pointer;
}


/* =====================
   Template Modal
===================== */

.template-modal {
    position: fixed;

    inset: 0;

    z-index: 2000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;
}

.template-modal-overlay {
    position: absolute;

    inset: 0;

    background: rgba(0, 0, 0, 0.6);
}

.template-modal-content {
    position: relative;

    z-index: 2;

    width: 100%;
    max-width: 920px;

    max-height: calc(100vh - 40px);

    overflow-y: auto;

    padding: 36px;

    background: #fff;

    border-radius: 18px;

    box-shadow:
        0 20px 60px
        rgba(0, 0, 0, 0.25);
}

.template-modal-close {
    position: absolute;

    top: 14px;
    right: 18px;

    border: none;

    background: transparent;

    font-size: 28px;

    cursor: pointer;
}

.template-modal-header {
    margin-bottom: 28px;

    text-align: center;
}

.template-modal-label {
    display: inline-block;

    margin-bottom: 10px;

    padding: 5px 8px;

    border-radius: 4px;

    background: #111;
    color: #fff;

    font-size: 9px;
    font-weight: 700;

    letter-spacing: 1px;
}

.template-modal-header h3 {
    margin-bottom: 7px;

    font-size: 24px;
}

.template-modal-header p {
    color: #888;

    font-size: 13px;
}


/* =====================
   Template Slider
===================== */

.template-slider {
    width: 100%;

    overflow-x: auto;

    overscroll-behavior-x: contain;

    scrollbar-width: thin;
}

.template-list {
    display: flex;

    gap: 16px;

    padding: 4px 2px 15px;
}

.template-card {
    flex:
        0 0
        calc((100% - 32px) / 3);

    min-width: 0;

    padding: 10px;

    border: 2px solid transparent;
    border-radius: 12px;

    background: #f7f7f7;

    cursor: pointer;
}

.template-card:hover {
    background: #f0f0f0;
}

.template-card.selected {
    border-color: #111;

    background: #fff;
}

.template-card-image {
    width: 100%;

    aspect-ratio: 1 / 1;

    overflow: hidden;

    background: #eee;

    border-radius: 8px;
}

.template-card-image img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    display: block;
}

.template-card-name {
    padding: 10px 4px 3px;

    overflow: hidden;

    font-size: 13px;
    font-weight: 600;

    text-align: center;

    text-overflow: ellipsis;
    white-space: nowrap;
}


/* =====================
   Template Empty
===================== */

.template-empty {
    padding: 45px 20px;

    border: 1px dashed #ddd;
    border-radius: 12px;

    color: #888;

    font-size: 13px;

    text-align: center;
}


/* =====================
   Template Modal Footer
===================== */

.template-modal-footer {
    margin-top: 20px;

    text-align: center;
}

.template-confirm-button {
    min-width: 240px;

    padding: 14px 24px;

    border: none;
    border-radius: 9px;

    background: #111;
    color: #fff;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
}

.template-confirm-button:disabled {
    background: #ccc;

    cursor: not-allowed;
}


/* =====================
   Footer
===================== */

.footer {
    padding: 20px;

    color: #aaa;

    font-size: 12px;

    text-align: center;
}


/* =====================
   Utility
===================== */

.hidden {
    display: none !important;
}


/* =====================
   Smartphone
===================== */

@media (max-width: 600px) {

    .header {
        height: 56px;
    }

    .header-inner {
        padding: 0 18px;
    }

    .logo {
        font-size: 18px;
    }

    .main {
        padding: 40px 16px;
    }

    .title-area {
        margin-bottom: 24px;
    }

    .title-area h2 {
        font-size: 24px;
    }

    .title-area p {
        font-size: 13px;

        line-height: 1.6;
    }

    .user-name-area {
        margin-bottom: 18px;
    }

    .user-name-area input {
        min-height: 46px;
    }

    .template-select-area {
        margin-bottom: 18px;
    }

    .template-select-button {
        min-height: 46px;
    }

    .selected-template-image {
        width: 56px;
        height: 56px;
    }

    .drop-area {
        min-height: 260px;

        padding: 25px;
    }

    .complete-area {
        padding: 30px 20px;
    }

    .complete-template-info {
        flex-direction: column;
        align-items: flex-start;

        gap: 5px;
    }

    .card-preview {
        width: 100%;
    }


    /* =====================
       Real QR Smartphone
    ===================== */

    .card-dummy-qr {
        width: 135px;
        height: 135px;

        padding: 4px;
    }

    .card-dummy-qr canvas,
    .card-dummy-qr img {
        width: 117px !important;
        height: 117px !important;
    }


    /* =====================
       Template Modal
    ===================== */

    .template-modal {
        padding: 12px;
    }

    .template-modal-content {
        padding:
            32px
            18px
            24px;

        border-radius: 15px;
    }

    .template-modal-header {
        margin-bottom: 22px;
    }

    .template-modal-header h3 {
        font-size: 21px;
    }

    .template-slider {
        scroll-snap-type: x mandatory;

        -webkit-overflow-scrolling: touch;
    }

    .template-list {
        gap: 12px;

        padding-bottom: 12px;
    }

    .template-card {
        flex: 0 0 100%;

        padding: 10px;

        scroll-snap-align: center;
    }

    .template-card-name {
        font-size: 14px;
    }

    .template-confirm-button {
        width: 100%;

        min-width: 0;
        min-height: 46px;
    }

}