.hmw-game {
    --hmw-pink: #ffb3a7;
    --hmw-pink2: #ffd8d2;
    --hmw-brown: #9b735d;
    --hmw-shadow: rgba(80, 40, 30, 0.14);
    max-width: 760px;
    margin: 24px auto;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
    color: #5f463a;
}

.hmw-game * {
    box-sizing: border-box;
}

.hmw-card {
    background: linear-gradient(180deg, #fffdfb 0%, #fff7f4 100%);
    border: 3px solid #ffe1da;
    border-radius: 28px;
    padding: 22px;
    box-shadow: 0 14px 35px var(--hmw-shadow);
    overflow: hidden;
}

.hmw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.hmw-title {
    font-size: clamp(24px, 4vw, 38px);
    font-weight: 900;
    line-height: 1.15;
    color: #e85b68;
    letter-spacing: 0.02em;
}

.hmw-subtitle {
    margin-top: 6px;
    font-size: clamp(13px, 2vw, 16px);
    font-weight: 700;
    color: #8d6c5f;
}

.hmw-mini-tooth {
    font-size: clamp(38px, 8vw, 68px);
    filter: drop-shadow(0 6px 6px rgba(0,0,0,.08));
}

.hmw-character-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border: 2px solid #ffe1da;
    border-radius: 22px;
    padding: 10px 12px;
    margin: 10px 0 14px;
    box-shadow: 0 5px 14px rgba(0,0,0,.05);
}

.hmw-character-bubble {
    flex: 0 0 clamp(74px, 16vw, 112px);
    width: clamp(74px, 16vw, 112px);
    height: clamp(74px, 16vw, 112px);
    border-radius: 50%;
    background: radial-gradient(circle, #fff9d8 0 50%, #ffe9a8 51% 100%);
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 2px solid #ffe1a8;
}

.hmw-character-img {
    max-width: 96%;
    max-height: 96%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 5px 6px rgba(0,0,0,.10));
}

.hmw-character-text {
    flex: 1;
    font-size: clamp(14px, 2.4vw, 18px);
    font-weight: 900;
    color: #8d6c5f;
    line-height: 1.45;
}

.hmw-state-playing .hmw-character-bubble {
    animation: hmw-character-bounce 1.05s ease-in-out infinite;
}

.hmw-state-clear .hmw-character-bubble {
    background: radial-gradient(circle, #fff7c9 0 40%, #ffdc74 41% 100%);
}

.hmw-state-gameover .hmw-character-bubble {
    background: radial-gradient(circle, #ffffff 0 46%, #dcefff 47% 100%);
}

.hmw-scoreboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 14px 0 18px;
}

.hmw-box {
    background: #ffffff;
    border: 2px solid #ffe1da;
    border-radius: 18px;
    padding: 10px 8px;
    text-align: center;
    box-shadow: 0 5px 14px rgba(0,0,0,.05);
}

.hmw-box span {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: #a0786b;
}

.hmw-box strong {
    display: block;
    margin-top: 2px;
    font-size: clamp(22px, 5vw, 34px);
    color: #e85b68;
    line-height: 1;
}

.hmw-stage-wrap {
    position: relative;
}

.hmw-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background:
        radial-gradient(circle at 50% 50%, rgba(255,255,255,.95) 0 28%, transparent 29%),
        linear-gradient(180deg, #fffefe, #fff8f5);
    border-radius: 30px;
    border: 2px solid #ffe5df;
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
}

.hmw-cry-popup {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(.82);
    width: clamp(120px, 26vw, 205px);
    height: clamp(120px, 26vw, 205px);
    border-radius: 28px;
    background: rgba(255, 255, 255, .92);
    border: 3px solid #bfe4ff;
    box-shadow: 0 12px 28px rgba(45, 80, 110, .20);
    display: grid;
    place-items: center;
    z-index: 18;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.hmw-cry-popup.hmw-show {
    visibility: visible;
    animation: hmw-cry-popup 1s ease-out forwards;
}

.hmw-cry-popup-img {
    max-width: 94%;
    max-height: 94%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 6px 8px rgba(0,0,0,.14));
}

.hmw-arch {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 78%;
    height: 35%;
    background: linear-gradient(180deg, var(--hmw-pink2), var(--hmw-pink));
    border: 3px solid rgba(231, 133, 116, .55);
    box-shadow: inset 0 8px 16px rgba(255,255,255,.35);
    z-index: 1;
}

.hmw-upper {
    top: 5%;
    border-radius: 50% 50% 35% 35% / 75% 75% 28% 28%;
}

.hmw-lower {
    bottom: 5%;
    border-radius: 35% 35% 50% 50% / 28% 28% 75% 75%;
}

.hmw-tooth {
    position: absolute;
    transform: translate(-50%, -50%);
    width: clamp(38px, 8vw, 64px);
    height: clamp(38px, 8vw, 64px);
    border: 3px solid var(--hmw-brown);
    border-radius: 42% 42% 48% 48%;
    background:
        radial-gradient(circle at 35% 25%, #ffffff 0 28%, transparent 30%),
        linear-gradient(180deg, #ffffff 0%, #fff9ef 100%);
    box-shadow: 0 5px 10px rgba(91, 57, 40, .16);
    cursor: pointer;
    z-index: 3;
    display: grid;
    place-items: center;
    font-size: clamp(24px, 5vw, 42px);
    padding: 0;
    transition: transform .08s ease, filter .08s ease;
    appearance: none;
    -webkit-appearance: none;
}

.hmw-tooth::after {
    content: "";
    width: 42%;
    height: 22%;
    border-bottom: 3px solid rgba(155, 115, 93, .75);
    border-radius: 50%;
    position: absolute;
    bottom: 22%;
    left: 29%;
}

.hmw-tooth.hmw-molar::after {
    width: 44%;
    height: 44%;
    border: none;
    background:
        linear-gradient(45deg, transparent 45%, rgba(155,115,93,.75) 47% 53%, transparent 55%),
        linear-gradient(-45deg, transparent 45%, rgba(155,115,93,.75) 47% 53%, transparent 55%);
    bottom: 27%;
    left: 28%;
}

.hmw-tooth:hover {
    filter: brightness(1.03);
}

.hmw-tooth:active {
    transform: translate(-50%, -50%) scale(.94);
}

.hmw-target {
    animation: hmw-pop .18s ease-out;
    filter: drop-shadow(0 4px 4px rgba(0,0,0,.12));
    z-index: 5;
}

.hmw-target::after {
    display: none;
}

.hmw-hit {
    animation: hmw-hit .22s ease-out;
}

.hmw-miss {
    animation: hmw-miss .22s ease-out;
}

.hmw-brush {
    position: absolute;
    left: 50%;
    top: 50%;
    font-size: clamp(46px, 9vw, 78px);
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-35deg) scale(.9);
    transition: opacity .08s ease;
    filter: drop-shadow(0 8px 8px rgba(0,0,0,.14));
}

.hmw-brush.hmw-swing {
    opacity: 1;
    animation: hmw-brush .22s ease-out;
}

.hmw-message {
    min-height: 32px;
    margin: 14px 0 10px;
    text-align: center;
    font-size: clamp(15px, 2.5vw, 20px);
    font-weight: 900;
    color: #e85b68;
}

.hmw-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 10px auto;
}

.hmw-start {
    min-width: min(260px, 100%);
    border: none;
    border-radius: 999px;
    padding: 16px 22px;
    font-size: 20px;
    font-weight: 900;
    color: #ffffff;
    background: linear-gradient(180deg, #ff7a83, #ef5867);
    box-shadow: 0 8px 0 #c94755, 0 14px 24px rgba(239, 88, 103, .24);
    cursor: pointer;
}

.hmw-start:active {
    transform: translateY(5px);
    box-shadow: 0 3px 0 #c94755, 0 9px 18px rgba(239, 88, 103, .18);
}

.hmw-start:disabled {
    cursor: default;
    opacity: .92;
}

.hmw-sound-toggle {
    border: 2px solid #ffd2ca;
    border-radius: 999px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 900;
    color: #8d6c5f;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(0,0,0,.05);
}

.hmw-sound-toggle[aria-pressed="true"] {
    color: #e85b68;
    background: #fff7f4;
}

.hmw-rule {
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    color: #8d6c5f;
    line-height: 1.6;
}

@keyframes hmw-pop {
    from { transform: translate(-50%, -50%) scale(.3); opacity: .2; }
    to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes hmw-hit {
    0%   { transform: translate(-50%, -50%) scale(1); }
    50%  { transform: translate(-50%, -50%) scale(1.18) rotate(5deg); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes hmw-miss {
    0%, 100% { transform: translate(-50%, -50%); }
    25% { transform: translate(calc(-50% - 5px), -50%); }
    75% { transform: translate(calc(-50% + 5px), -50%); }
}

@keyframes hmw-brush {
    0%   { transform: translate(-50%, -50%) rotate(-55deg) scale(.8); }
    55%  { transform: translate(-50%, -50%) rotate(12deg) scale(1.08); }
    100% { transform: translate(-50%, -50%) rotate(-35deg) scale(.9); }
}

@keyframes hmw-character-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}


@keyframes hmw-cry-popup {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(.65) rotate(-4deg);
    }
    12% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.06) rotate(3deg);
    }
    72% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(.86) rotate(0deg);
    }
}

@media (max-width: 520px) {
    .hmw-card {
        padding: 14px;
        border-radius: 22px;
    }

    .hmw-character-panel {
        gap: 8px;
        padding: 8px 10px;
        border-radius: 18px;
    }

    .hmw-scoreboard {
        gap: 6px;
    }

    .hmw-box {
        border-radius: 14px;
        padding: 8px 4px;
    }

    .hmw-box span {
        font-size: 10px;
    }

    .hmw-stage {
        border-radius: 22px;
    }
}
