@font-face {
    font-family: 'Nunito';
    src: url('fonts/nunito-latin.woff2') format('woff2');
    font-weight: 500 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --pink-50: #fff5f9;
    --pink-100: #ffe1ec;
    --pink-200: #ffc6db;
    --pink-300: #ff9fc2;
    --pink-500: #ff4f8b;
    --pink-600: #e63673;
    --pink-700: #c42460;
    --ink: #4a1835;
    --ink-soft: #8a4268;
    --shadow: 0 10px 30px rgba(196, 36, 96, .16);
    --heart-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 22'%3E%3Cpath d='M12 21.5C5 16 1 12.2 1 7.2 1 3.8 3.6 1 7 1c2.1 0 3.9 1.1 5 2.8C13.1 2.1 14.9 1 17 1c3.4 0 6 2.8 6 6.2 0 5-4 8.8-11 14.3z'/%3E%3C/svg%3E");
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
    font-weight: 700;
    color: var(--ink);
    background: var(--pink-100);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ------------------------------------------------------------ Himmel */

.sky {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 8%, #fffafc 0%, rgba(255, 250, 252, 0) 55%),
        linear-gradient(180deg, var(--pink-50) 0%, var(--pink-100) 45%, var(--pink-200) 100%);
}

.float-heart {
    position: absolute;
    bottom: -40px;
    left: var(--x);
    width: var(--s);
    aspect-ratio: 24 / 22;
    background: var(--c);
    opacity: var(--o);
    -webkit-mask: var(--heart-mask) center / contain no-repeat;
    mask: var(--heart-mask) center / contain no-repeat;
    animation: rise var(--d) linear infinite;
    animation-delay: var(--delay);
}

@keyframes rise {
    0% {
        transform: translate(0, 0) rotate(-8deg);
    }

    50% {
        transform: translate(var(--sway), -55vh) rotate(8deg);
    }

    100% {
        transform: translate(0, -115vh) rotate(-8deg);
    }
}

/* ------------------------------------------------------------ Layout */

.app {
    width: min(100%, 560px);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    padding:
        max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.topbar {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
}

.title {
    margin: 0;
    text-align: center;
    font-size: clamp(2.1rem, 10vw, 2.9rem);
    font-weight: 900;
    letter-spacing: .02em;
    color: var(--pink-600);
    text-shadow: 0 3px 0 #fff, 0 6px 14px rgba(196, 36, 96, .18);
}

.icon-btn {
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .75);
    box-shadow: 0 4px 12px rgba(196, 36, 96, .14);
    font-size: 1.35rem;
    line-height: 1;
    display: grid;
    place-items: center;
    transition: transform .15s;
}

.icon-btn[hidden] {
    display: grid;
    visibility: hidden;
}

.icon-btn:active {
    transform: scale(.9);
}

.stage {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ------------------------------------------------------------ Sprechblase */

.bubble-area {
    flex: 1 0 auto;
    width: 100%;
    min-height: 8.5rem;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-top: 14px;
}

.bubble {
    position: relative;
    width: 100%;
    min-height: 5.6rem;
    padding: 18px 22px;
    border-radius: 28px;
    background: #fff;
    box-shadow: var(--shadow);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.bubble::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -11px;
    width: 26px;
    height: 26px;
    background: #fff;
    border-radius: 4px;
    transform: translateX(-50%) rotate(45deg);
    box-shadow: 8px 8px 14px rgba(196, 36, 96, .08);
}

.bubble-text {
    position: relative;
    z-index: 1;
    font-size: clamp(1.15rem, 4.9vw, 1.5rem);
    font-weight: 800;
    line-height: 1.35;
}

.bubble-text p {
    margin: 0;
}

.bubble-text p+p {
    margin-top: .35em;
}

.ghost {
    visibility: hidden;
}

.name-form {
    position: relative;
    z-index: 1;
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.name-form[hidden] {
    display: none;
}

.name-form input {
    flex: 1 1 160px;
    min-width: 0;
    padding: 12px 16px;
    border: 3px solid var(--pink-200);
    border-radius: 999px;
    font: inherit;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--ink);
    background: var(--pink-50);
    outline: none;
    text-align: center;
}

.name-form input:focus {
    border-color: var(--pink-500);
}

.btn-small {
    flex: 0 0 auto;
    padding: 12px 20px;
    border: 0;
    border-radius: 999px;
    background: var(--pink-500);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 900;
    box-shadow: 0 4px 0 var(--pink-700);
}

.btn-small:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--pink-700);
}

.link-btn {
    flex-basis: 100%;
    border: 0;
    background: none;
    color: var(--ink-soft);
    font-size: .95rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 4px;
}

/* ------------------------------------------------------------ Herzi */

.herzi-wrap {
    position: relative;
    margin-top: 22px;
}

.herzi {
    position: relative;
    display: block;
    width: min(62vw, 34vh, 330px);
    width: min(62vw, 34dvh, 330px);
    aspect-ratio: 232 / 210;
    padding: 0;
    border: 0;
    background: none;
    border-radius: 40%;
}

.herzi:focus-visible {
    outline: 4px dashed var(--pink-500);
    outline-offset: 6px;
}

.herzi-move,
.herzi-float {
    display: block;
}

.herzi-float {
    animation: float 4s ease-in-out infinite;
}

.herzi-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    transform-origin: 50% 60%;
    animation: beat 1.5s ease-in-out infinite;
    filter: drop-shadow(0 8px 12px rgba(196, 36, 96, .25));
}

.herzi-shadow {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 46%;
    height: 7%;
    border-radius: 50%;
    background: rgba(196, 36, 96, .18);
    transform: translateX(-50%);
    animation: shadow 4s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-9px);
    }
}

@keyframes shadow {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }

    50% {
        transform: translateX(-50%) scale(.82);
        opacity: .7;
    }
}

/* Badumm, badumm */
@keyframes beat {
    0% {
        transform: scale(1);
    }

    10% {
        transform: scale(1.045);
    }

    20% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.065);
    }

    45%,
    100% {
        transform: scale(1);
    }
}

/* Gesicht */
.face {
    transform: translate(var(--fx, 0px), var(--fy, 0px));
    transition: transform .3s ease-out;
}

.eye {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform .08s;
}

.blink .eye {
    transform: scaleY(.1);
}

.eyes-happy,
.mouth-open {
    display: none;
}

.happy .eyes-happy {
    display: inline;
}

.happy .eyes-normal {
    display: none;
}

.brows {
    opacity: 0;
    transition: opacity .3s;
}

.caring .brows {
    opacity: 1;
}

.cheek {
    fill: #ff2a6d;
    opacity: .28;
    transition: opacity .3s;
}

.happy .cheek {
    opacity: .45;
}

.talking .mouth-open,
.happy .mouth-open {
    display: inline;
}

.talking .mouth-smile,
.happy .mouth-smile {
    display: none;
}

.mouth-open {
    transform-box: fill-box;
    transform-origin: 50% 0%;
}

.talking .mouth-open {
    animation: talk .19s ease-in-out infinite alternate;
}

@keyframes talk {
    from {
        transform: scale(.9, .35);
    }

    to {
        transform: scale(1, 1);
    }
}

/* Ärmchen */
.arm {
    transform-box: fill-box;
}

.arm-left {
    transform-origin: 100% 100%;
    animation: sway-left 3.2s ease-in-out infinite;
}

.arm-right {
    transform-origin: 0% 100%;
    animation: sway-right 3.2s ease-in-out infinite;
}

@keyframes sway-left {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(8deg);
    }
}

@keyframes sway-right {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(-8deg);
    }
}

.wave .arm-right {
    animation: wave .3s ease-in-out 6 alternate;
}

@keyframes wave {
    from {
        transform: rotate(-10deg);
    }

    to {
        transform: rotate(-55deg);
    }
}

.giggle .arm-left {
    animation: wave-left .18s ease-in-out 6 alternate;
}

.giggle .arm-right {
    animation: wave .18s ease-in-out 6 alternate;
}

@keyframes wave-left {
    from {
        transform: rotate(10deg);
    }

    to {
        transform: rotate(55deg);
    }
}

/* Ganze Figur */
.herzi.bounce {
    animation: squish .5s ease-out;
}

@keyframes squish {
    0% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.12, .88);
    }

    50% {
        transform: scale(.93, 1.08);
    }

    75% {
        transform: scale(1.03, .98);
    }

    100% {
        transform: scale(1);
    }
}

.giggle .herzi-move {
    animation: giggle .14s ease-in-out 7 alternate;
}

@keyframes giggle {
    from {
        transform: rotate(-5deg);
    }

    to {
        transform: rotate(5deg);
    }
}

.spin .herzi-move {
    animation: spin 1s cubic-bezier(.5, -0.3, .5, 1.3);
}

@keyframes spin {
    0% {
        transform: translateY(0) rotate(0);
    }

    40% {
        transform: translateY(-40px) rotate(180deg);
    }

    100% {
        transform: translateY(0) rotate(360deg);
    }
}

/* Herzchen-Konfetti */
.burst {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.mini-heart {
    position: absolute;
    left: 50%;
    top: 45%;
    width: var(--s);
    aspect-ratio: 24 / 22;
    background: var(--c);
    -webkit-mask: var(--heart-mask) center / contain no-repeat;
    mask: var(--heart-mask) center / contain no-repeat;
    animation: fly 1s ease-out forwards;
}

@keyframes fly {
    0% {
        transform: translate(-50%, -50%) scale(.3);
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--r));
        opacity: 0;
    }
}

.hint {
    margin: 10px 0 0;
    min-height: 1.4em;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--pink-600);
    animation: pulse 1.6s ease-in-out infinite;
}

.hint.gone {
    visibility: hidden;
    animation: none;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

/* ------------------------------------------------------------ Knöpfe */

.controls {
    margin-top: 14px;
}

.big-btn {
    display: block;
    width: 100%;
    padding: 16px 20px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, #ff7cad 0%, var(--pink-500) 100%);
    color: #fff;
    font-size: clamp(1.2rem, 5.2vw, 1.5rem);
    font-weight: 900;
    letter-spacing: .01em;
    text-shadow: 0 2px 0 rgba(196, 36, 96, .35);
    box-shadow: 0 6px 0 var(--pink-700), 0 14px 24px rgba(196, 36, 96, .25);
    transition: transform .08s, box-shadow .08s;
}

.big-btn:active {
    transform: translateY(5px);
    box-shadow: 0 1px 0 var(--pink-700), 0 6px 12px rgba(196, 36, 96, .2);
}

.controls-label {
    margin: 18px 0 8px;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--ink-soft);
}

.moods,
.extras {
    display: grid;
    gap: 8px;
}

.moods {
    grid-template-columns: repeat(4, 1fr);
}

.extras {
    grid-template-columns: 1fr 1fr;
    margin-top: 10px;
}

.chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    padding: 10px 2px 9px;
    border: 0;
    border-radius: 20px;
    background: rgba(255, 255, 255, .92);
    font-size: clamp(.8rem, 3.5vw, 1rem);
    font-weight: 800;
    box-shadow: 0 4px 0 var(--pink-200), 0 8px 16px rgba(196, 36, 96, .1);
    transition: transform .08s, box-shadow .08s;
}

.chip:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--pink-200), 0 4px 8px rgba(196, 36, 96, .1);
}

.chip .emoji {
    font-size: 1.85rem;
    line-height: 1.15;
}

.chip-row {
    flex-direction: row;
    gap: 8px;
    padding: 10px 8px;
    font-size: clamp(.95rem, 4vw, 1.1rem);
}

.chip-row .emoji {
    font-size: 1.5rem;
}

.big-btn:focus-visible,
.chip:focus-visible,
.icon-btn:focus-visible,
.btn-small:focus-visible {
    outline: 3px solid var(--pink-600);
    outline-offset: 3px;
}

.noscript {
    position: fixed;
    inset: auto 16px 16px;
    padding: 16px;
    border-radius: 20px;
    background: #fff;
    text-align: center;
}

/* ------------------------------------------------------------ Tablets hochkant: alles größer */

@media (min-width: 700px) and (min-height: 900px) {
    .app {
        width: min(100%, 640px);
    }

    .title {
        font-size: 3.4rem;
    }

    .bubble-text {
        font-size: 1.8rem;
    }

    .herzi {
        width: min(70vw, 40dvh, 470px);
    }

    .hint {
        font-size: 1.3rem;
    }

    .big-btn {
        font-size: 1.75rem;
        padding: 20px;
    }

    .controls-label {
        font-size: 1.3rem;
    }

    .chip {
        font-size: 1.2rem;
        padding: 14px 4px 12px;
    }

    .chip .emoji {
        font-size: 2.4rem;
    }

    .chip-row {
        font-size: 1.3rem;
    }

    .chip-row .emoji {
        font-size: 1.9rem;
    }
}

/* ------------------------------------------------------------ Kleine Handys */

@media (max-height: 700px) and (orientation: portrait) {
    .bubble-area {
        min-height: 7rem;
        padding-top: 8px;
    }

    .herzi-wrap {
        margin-top: 16px;
    }

    .hint {
        margin-top: 4px;
    }

    .controls-label {
        margin: 12px 0 6px;
    }
}

/* ------------------------------------------------------------ Breite Bildschirme im Querformat */

@media (orientation: landscape) and (max-height: 560px) {
    .app {
        width: min(100%, 980px);
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto 1fr;
        column-gap: 28px;
    }

    .topbar {
        grid-column: 1 / -1;
    }

    .bubble-area {
        min-height: 6rem;
    }

    .herzi {
        width: min(34vw, 40vh, 260px);
        width: min(34vw, 40dvh, 260px);
    }

    .herzi-wrap {
        margin-top: 16px;
    }

    .hint {
        display: none;
    }

    .controls {
        align-self: center;
    }
}

/* ------------------------------------------------------------ Weniger Bewegung */

@media (prefers-reduced-motion: reduce) {

    .float-heart,
    .herzi-float,
    .herzi-svg,
    .herzi-shadow,
    .arm,
    .hint {
        animation: none !important;
    }

    .herzi.bounce,
    .giggle .herzi-move,
    .spin .herzi-move {
        animation: none;
    }
}
