﻿@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@400;700&display=swap');

:root {
    --primary-pink: #ffb7c5;
    --secondary-yellow: #fff9c4;
    --accent-red: #ff5252;
    --text-color: #5d4037;
    --bg-color: #fff0f5;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Zen Maru Gothic', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
    overflow-x: hidden;
}

.container {
    background: white;
    border-radius: 30px;
    box-shadow: 0 10px 25px rgba(255, 183, 197, 0.5);
    width: 100%;
    max-width: 450px;
    padding: clamp(20px, 5vw, 40px);
    text-align: center;
    position: relative;
    overflow: hidden;
}

h1 {
    color: var(--accent-red);
    font-size: clamp(1.8rem, 8vw, 2.5rem); 
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0px var(--secondary-yellow);
}

.character-box {
    width: 100%;
    max-width: 200px;
    aspect-ratio: 1 / 1;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: transparent;
    overflow: hidden;
}

.character-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.img-error-msg {
    font-size: 0.8rem;
    color: #999;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
}

.intro-text {
    font-weight: bold;
    font-size: clamp(1rem, 4vw, 1.1rem);
    margin-bottom: 20px;
    line-height: 1.6;
}

#result-area {
    margin-top: 10px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.fortune-rank {
    font-size: clamp(2rem, 10vw, 3rem);
    font-weight: bold;
    color: var(--accent-red);
    margin-bottom: 15px;
    padding: 10px;
    border-bottom: 3px dashed var(--primary-pink);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.stat-item {
    background: var(--bg-color);
    padding: 12px 8px;
    border-radius: 15px;
    font-size: 0.85rem;
}

.stat-name {
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
}

.stat-stars {
    color: #ffca28;
    font-size: clamp(1rem, 4vw, 1.2rem);
    letter-spacing: 1px;
}

.comment-box {
    margin-top: 20px;
    padding: 15px;
    background: var(--secondary-yellow);
    border-radius: 15px;
    font-size: clamp(0.9rem, 3.5vw, 1rem);
    line-height: 1.6;
    font-weight: bold;
    white-space: pre-wrap;
    text-align: left;
}

.btn {
    background: var(--primary-pink);
    color: white;
    border: none;
    padding: 16px 20px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 0 #e5a1ae;
    margin-top: 20px;
    width: 100%;
    outline: none;
}

.btn:hover {
    background: #ff9eaf;
}

.btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #e5a1ae;
}

.reset-btn {
    background: #ccc;
    box-shadow: 0 4px 0 #999;
}

.hidden { display: none !important; }

@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}