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

body {
    font-family: 'MS Gothic', 'ヒラギノ角ゴ Pro W3', monospace;
    background: #f0e6d2;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2c2c2c;
}

.container {
    background: #ffffff;
    border: 3px solid #2c2c2c;
    border-radius: 0;
    padding: 30px 40px;
    box-shadow: 8px 8px 0 #2c2c2c;
    text-align: center;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.container::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: #ffffff;
    z-index: -1;
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    font-weight: normal;
    text-decoration: underline;
    text-decoration-style: wavy;
    text-decoration-color: #ff6b6b;
    text-underline-offset: 5px;
}

.subtitle {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 25px;
    font-style: italic;
}

.input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    justify-content: center;
}

#nameInput {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #2c2c2c;
    border-radius: 0;
    font-size: 1rem;
    font-family: inherit;
    background: #fffef5;
    color: #2c2c2c;
    transition: all 0.2s ease;
}

#nameInput:focus {
    outline: none;
    background: #fff;
    border-color: #ff6b6b;
    box-shadow: 4px 4px 0 #ffd3d3;
}

#morphButton {
    padding: 12px 24px;
    border: 2px solid #2c2c2c;
    border-radius: 0;
    background: #ff6b6b;
    color: #ffffff;
    font-size: 1rem;
    font-family: inherit;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 4px 4px 0 #2c2c2c;
    position: relative;
    top: 0;
    left: 0;
}

#morphButton:hover {
    background: #ff5252;
    top: 1px;
    left: 1px;
    box-shadow: 3px 3px 0 #2c2c2c;
}

#morphButton:active {
    top: 4px;
    left: 4px;
    box-shadow: 0 0 0 #2c2c2c;
}

#morphButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #ccc;
}

.morph-container {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.morph-canvas {
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.morph-text {
    font-size: 2.5rem;
    font-weight: normal;
    margin: 20px 0;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.05em;
    position: relative;
    color: #2c2c2c;
}

.morph-char {
    display: inline-block;
    transition: all 0.5s ease;
    position: relative;
}

.morph-char.melting {
    animation: melt 2s ease-in-out forwards;
    filter: blur(0px);
}

@keyframes melt {
    0% {
        transform: translateY(0) scale(1) rotateZ(0deg);
        opacity: 1;
        filter: blur(0px);
    }
    20% {
        transform: translateY(2px) scale(1.1) rotateZ(-2deg);
        opacity: 0.9;
        filter: blur(0.5px);
    }
    40% {
        transform: translateY(5px) scale(1.05) rotateZ(3deg);
        opacity: 0.8;
        filter: blur(1px);
        text-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
    }
    60% {
        transform: translateY(10px) scale(0.95) rotateZ(-5deg);
        opacity: 0.6;
        filter: blur(2px);
        text-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    }
    80% {
        transform: translateY(15px) scale(0.9) rotateZ(2deg);
        opacity: 0.3;
        filter: blur(3px);
        text-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
    }
    100% {
        transform: translateY(30px) scale(0.7) rotateZ(0deg);
        opacity: 0;
        filter: blur(5px);
    }
}

.morph-char.forming {
    animation: form 2s ease-out forwards;
}

@keyframes form {
    0% {
        transform: translateY(-30px) scale(0.7) rotateZ(180deg);
        opacity: 0;
        filter: blur(5px);
    }
    20% {
        transform: translateY(-15px) scale(0.8) rotateZ(90deg);
        opacity: 0.3;
        filter: blur(3px);
    }
    40% {
        transform: translateY(-10px) scale(0.9) rotateZ(45deg);
        opacity: 0.6;
        filter: blur(2px);
    }
    60% {
        transform: translateY(-5px) scale(0.95) rotateZ(20deg);
        opacity: 0.8;
        filter: blur(1px);
    }
    80% {
        transform: translateY(-2px) scale(1.05) rotateZ(5deg);
        opacity: 0.9;
        filter: blur(0.5px);
    }
    100% {
        transform: translateY(0) scale(1) rotateZ(0deg);
        opacity: 1;
        filter: blur(0px);
    }
}

.liquid-drop {
    position: absolute;
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    opacity: 0.6;
    animation: drip 1.5s ease-in forwards;
    pointer-events: none;
}

@keyframes drip {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.6;
    }
    100% {
        transform: translateY(50px) scale(0.5);
        opacity: 0;
    }
}

.status {
    font-size: 0.9rem;
    color: #666;
    height: 30px;
    transition: opacity 0.3s ease;
    font-family: 'MS Mincho', serif;
}

.reset-button {
    margin-top: 20px;
    padding: 10px 20px;
    border: 2px solid #2c2c2c;
    border-radius: 0;
    background: #fff;
    color: #2c2c2c;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 3px 3px 0 #2c2c2c;
    position: relative;
    top: 0;
    left: 0;
}

.reset-button:hover {
    background: #f5f5f5;
    top: 1px;
    left: 1px;
    box-shadow: 2px 2px 0 #2c2c2c;
}

.reset-button:active {
    top: 3px;
    left: 3px;
    box-shadow: 0 0 0 #2c2c2c;
}

@media (max-width: 480px) {
    .container {
        padding: 30px 20px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .morph-text {
        font-size: 2rem;
    }
    
    .input-container {
        flex-direction: column;
    }
    
    #nameInput {
        width: 100%;
    }
}