@import url('https://fonts.googleapis.com/css2?family=Kiwi+Maru:wght@500&family=Yuji+Syuku&display=swap');


* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #07163d 0%, #0d2f74 100%);
    color: #fff;
}

.wrapper {
    max-width: 560px;
    margin: 0 auto;
    padding: 20px 16px 50px;
}

h1 {
    margin: 0 0 10px;
    font-size: 28px;
    text-align: center;
}

.desc {
    text-align: center;
    font-size: 14px;
    line-height: 1.7;
    color: rgba(255,255,255,0.85);
    margin-bottom: 20px;
}

.preview-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

#captureArea {
    position: relative;
    width: 100%;
    max-width: 420px;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    background: #000;
}

#baseImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tanzaku-text {
    position: absolute;
    top: 7%;
    left: 50%;
    transform: translateX(-50%);
    width: 46%;
    height: 76%;
    writing-mode: vertical-rl;
    text-orientation: upright;
    line-height: 1.7;
    color: #222;
    font-weight: bold;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    letter-spacing: 0.08em;
    text-align: start;
    padding-top: 20px;
}

.name-text {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 46%;
    text-align: center;
    font-size: clamp(14px, 2vw, 20px);
    color: #333;
    font-weight: bold;
}

.control-box {
    background: rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 16px;
    backdrop-filter: blur(8px);
}

.control-group {
    margin-bottom: 16px;
}

label {
    display: block;
    font-size: 14px;
    margin-bottom: 8px;
}

textarea,
input,
select {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
    outline: none;
    font-family: inherit;
}

textarea {
    height: 120px;
    resize: none;
}

.color-size-wrap {
    display: flex;
    gap: 12px;
}

.color-size-wrap > div {
    flex: 1;
}

.color-input {
    height: 52px;
    padding: 4px;
}

.template-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.template-thumb {
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid transparent;
    cursor: pointer;
}

.template-thumb.active {
    border-color: #ffd84d;
}

.template-thumb img {
    width: 100%;
    display: block;
}

.note {
    font-size: 12px;
    line-height: 1.6;
    color: rgba(255,255,255,0.8);
}

.btns {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}

button,
.download-link {
    flex: 1;
    border: none;
    border-radius: 999px;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
    text-align: center;
}

#createBtn {
    background: #ffd84d;
    color: #222;
}

#xBtn {
    background: #111;
    color: #fff;
}

#downloadArea {
    margin-top: 18px;
    display: none;
}

.download-link {
    display: block;
    background: #4fd46b;
    color: #fff;
}

.preview-image {
    width: 100%;
    margin-top: 14px;
    border-radius: 14px;
    display: block;
}

@media (max-width: 480px) {
    .wrapper {
        padding: 14px 12px 32px;
    }
    h1 {
        font-size: 22px;
    }
    .btns {
        flex-direction: column;
    }
    .color-size-wrap {
        flex-direction: column;
    }
}

/* 背景キラキラ */
.sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    animation: sparkle 2s infinite ease-in-out;
}

.sparkle::after {
    content: '';
    position: absolute;
    top: -4px;
    left: 2px;
    width: 2px;
    height: 14px;
    background: rgba(255,255,255,0.8);
}

.sparkle::before {
    content: '';
    position: absolute;
    top: 2px;
    left: -4px;
    width: 14px;
    height: 2px;
    background: rgba(255,255,255,0.8);
}

@keyframes sparkle {
    0% {
        opacity: 0.2;
        transform: scale(0.7);
    }

    50% {
        opacity: 1;
        transform: scale(1.4);
    }

    100% {
        opacity: 0.2;
        transform: scale(0.7);
    }
}

.loading {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
    gap: 18px;
}

.loader {
    width: 54px;
    height: 54px;
    border: 6px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
/* =========================
   Splash
========================= */

#splash {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top,
        #183a8f 0%,
        #07163d 70%);

    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 1s ease;
}

#splash.hide {
    opacity: 0;
    pointer-events: none;
}

.splash-inner {
    text-align: center;
    animation:
        splashFloat 2s ease-in-out infinite;
}

.splash-inner img {
    width: min(90vw, 600px);
    max-width: 100%;
    display: block;
    margin: 0 auto 10px;
}

.splash-text {
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    letter-spacing: 0.08em;
    text-shadow:
        0 0 12px rgba(255,255,255,0.4);
}

/* 背景キラキラ */

#splash::before,
#splash::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
       radial-gradient(white 1px, transparent 1px);

    background-size: 40px 40px;
    opacity: 0.25;
    animation:
        sparkleMove 8s linear infinite;
}

#splash::after {

    background-size: 70px 70px;
    opacity: 0.15;
    animation-duration: 14s;
}

@keyframes splashFloat {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0px);
    }
}

@keyframes sparkleMove {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(40px);
    }
}

