:root {
    --bg-1: #ffecd2;
    --bg-2: #fcb69f;
    --muted: #6b7280;
    --card-bg: rgba(255, 255, 255, 0.76);
    --accent-1: #ff9a9e;
    --accent-2: #fad0c4;
    --text: #1f2937;
    --soft: rgba(31, 41, 55, 0.06);
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%;
    overflow-x: hidden
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
    background: linear-gradient(160deg, var(--bg-1), var(--bg-2));
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

#lang-toggle {
    position: fixed;
    right: 18px;
    top: calc(16px + env(safe-area-inset-top, 8px));
    z-index: 999;
    background: rgba(255, 255, 255, 0.95);
    border: 0;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 13px;
    line-height: 1;
    color: var(--text);
    box-shadow: 0 6px 18px rgba(16, 24, 40, 0.12);
    cursor: pointer;
    backdrop-filter: blur(4px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    height: 36px;
}

.page {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto
}

.scene {
    position: relative;
    padding: 0
}

.bg-ornament {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    filter: blur(24px);
    transform-origin: center;
}

.card {
    font-family: "Noto Serif SC", serif;
    position: relative;
    margin: 0 auto;
    width: min(820px, 96%);
    max-width: 820px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.18);
    backdrop-filter: blur(8px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.55);
}

.card-head {
    display: flex;
    gap: 18px;
    align-items: center;
    padding: 8px 6px
}

.avatar {
    width: 88px;
    aspect-ratio: 1/1;
    flex: 0 0 88px;
    height: auto;
    border-radius: 24px;
    background: linear-gradient(180deg, var(--accent-1), var(--accent-2));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 8px rgba(255, 255, 255, 0.25), 0 6px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden
}

.avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
}

.meta .title {
    font-size: 20px;
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.4px
}

.meta .subtitle {
    margin: 2px 0 0 0;
    color: var(--muted);
    font-size: 13px
}

.letter {
    font-family: "Noto Serif SC", serif;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.15));
    padding: 20px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.45)
}

.letter p {
    line-height: 1.72;
    color: var(--text);
    margin: 0 0 14px
}

.letter p.wish {
    font-size: 18px;
    font-weight: 600;
    margin-top: 6px;
    color: #eaacb8
}

.signature {
    display: flex;
    justify-content: flex-end;
    padding-top: 6px
}

.signature span {
    font-weight: 600;
    color: var(--muted);
}

.card::after {
    content: "";
    position: absolute;
    right: -40px;
    top: -44px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.02));
    transform: rotate(18deg);
    opacity: 0.9
}

:root.js-ready .card {
    animation: cardIn .72s cubic-bezier(.2, .85, .3, 1) both
}

@keyframes cardIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

@media (max-width:860px) {
    .card-body {
        grid-template-columns: 1fr;
    }

    .avatar {
        width: 72px;
        flex: 0 0 72px;
    }
}

@media (max-width:640px) {
    body {
        padding: 18px;
        align-items: flex-start;
        padding-top: calc(18px + env(safe-area-inset-top, 8px));
    }
    
    .card {
        padding: 16px;
        border-radius: 16px
    }

    .card-body {
        grid-template-columns: 1fr;
        gap: 12px
    }

    .meta .title {
        font-size: 18px
    }

    .card::after {
        display: none
    }

    .scene {
        padding: 0
    }

    .bg-ornament {
        display: none
    }

}

@media print {
    body {
        background: white;
        color: #000
    }

    .bg-ornament,
    .card::after {
        display: none
    }

    .card {
        box-shadow: none;
        border: 0;
        background: white
    }
}

@media (max-width:420px) {
    #lang-toggle {
        right: 12px;
        top: 12px;
        height: 32px;
        min-width: 64px;
        padding: 6px 8px;
        font-size: 12px
    }
}

@media (max-height:740px){
    body{align-items:flex-start;justify-content:flex-start;padding-top:calc(18px + env(safe-area-inset-top, 8px));}
}

@media (max-width:900px){
    body{align-items:flex-start;justify-content:flex-start;padding-top:calc(18px + env(safe-area-inset-top, 8px));}
}