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

:root {
    --red:    #c0392b;
    --red-dk: #96281b;
    --pink:   #f8a5c2;
    --text:   #1a0a10;
    --text-s: #5c2d44;
    --card:   rgba(255, 252, 255, 0.82);
}

body {
    min-height: 100vh;
    background: linear-gradient(145deg, #fff0f5 0%, #fce4ec 45%, #ede0f5 100%);
    font-family: 'Noto Serif JP', Georgia, serif;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* ── Фоновые блобы (bokeh) ── */
.bg-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
    animation: drift 18s ease-in-out infinite alternate;
}
.blob-1 { width: 420px; height: 420px; background: #f9a8c9; top: -120px; left: -100px; animation-delay: 0s; }
.blob-2 { width: 360px; height: 360px; background: #d4a8f5; bottom: -100px; right: -80px; animation-delay: -6s; }
.blob-3 { width: 300px; height: 300px; background: #ffd6e0; top: 40%; left: 60%; animation-delay: -12s; }

@keyframes drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(30px, 20px) scale(1.08); }
}

/* ── Лепестки сакуры ── */
.petals-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.petal {
    position: absolute;
    top: -24px;
    opacity: 0;
    border-radius: 150% 0 150% 0;
    animation: petal-fall linear infinite;
}

@keyframes petal-fall {
    0%   { opacity: 0;   transform: translateY(0)     rotate(0deg)   translateX(0); }
    8%   { opacity: 0.9; }
    92%  { opacity: 0.6; }
    100% { opacity: 0;   transform: translateY(105vh) rotate(600deg) translateX(60px); }
}

/* ── Экраны ── */
.screen {
    display: none;
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 480px;
    padding: 20px;
    animation: screen-in 0.5s ease both;
}

.screen.active { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

@keyframes screen-in {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Карточка ── */
.card {
    background: var(--card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 28px;
    padding: 52px 44px;
    text-align: center;
    box-shadow:
        0 8px 32px rgba(180, 80, 120, 0.18),
        0 2px 8px  rgba(180, 80, 120, 0.1),
        inset 0 1px 0 rgba(255,255,255,0.9);
    border: 1px solid rgba(255, 190, 215, 0.45);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: -1px; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--pink), var(--red), var(--pink));
    border-radius: 28px 28px 0 0;
}

/* ── Иероглиф-декор ── */
.deco-kanji {
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #e84393, var(--red));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.9;
}

.deco-flag {
    font-size: 3.2rem;
    margin-bottom: 12px;
    line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(200, 60, 60, 0.3));
}

/* ── Заголовки ── */
h1 {
    font-size: 1.85rem;
    color: var(--text);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 20px;
}

/* ── Текст ── */
.message {
    color: var(--text-s);
    font-size: 1rem;
    line-height: 1.9;
    margin-bottom: 8px;
    font-family: 'Noto Sans JP', sans-serif;
}

.jp-hint {
    font-family: 'Noto Serif JP', serif;
    color: var(--red);
    font-size: 0.95rem;
    opacity: 0.7;
    margin-top: 24px;
    line-height: 1.6;
}

.jp-hint small {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.8rem;
    opacity: 0.85;
}

/* ── Загрузка ── */
.loader-icon {
    font-size: 3.4rem;
    margin-bottom: 18px;
    animation: spin 2.4s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader-text {
    color: var(--text-s);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.95rem;
}

/* ── Форма ввода ── */
.input-group {
    display: flex;
    gap: 10px;
    margin-top: 26px;
}

input[type="text"] {
    flex: 1;
    padding: 15px 18px;
    border: 2px solid rgba(240, 150, 190, 0.6);
    border-radius: 14px;
    font-size: 1rem;
    font-family: 'Noto Sans JP', sans-serif;
    outline: none;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 0;
}

input[type="text"]:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

input[type="text"].shake {
    animation: shake 0.45s ease;
    border-color: var(--red) !important;
}

@keyframes shake {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-9px); }
    40%      { transform: translateX(9px); }
    60%      { transform: translateX(-5px); }
    80%      { transform: translateX(5px); }
}

button {
    padding: 15px 22px;
    background: linear-gradient(135deg, #c0392b, #96281b);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-family: 'Noto Serif JP', serif;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 14px rgba(150, 40, 27, 0.35);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(150, 40, 27, 0.45);
}

button:active {
    transform: translateY(0);
}

.error-msg {
    min-height: 1.4em;
    margin-top: 12px;
    color: var(--red);
    font-size: 0.9rem;
    font-family: 'Noto Sans JP', sans-serif;
}

/* ── Экран успеха ── */
.success-card { animation: success-glow 3s ease-in-out infinite alternate; }

@keyframes success-glow {
    from { box-shadow: 0 8px 32px rgba(180, 80, 120, 0.18), inset 0 1px 0 rgba(255,255,255,0.9); }
    to   { box-shadow: 0 12px 48px rgba(192, 57, 43, 0.28), inset 0 1px 0 rgba(255,255,255,0.9); }
}

.yen-badge {
    display: inline-block;
    font-size: 3.2rem;
    font-weight: 700;
    font-family: 'Noto Serif JP', serif;
    background: linear-gradient(135deg, #c0392b, #e8507a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -1px;
    filter: drop-shadow(0 2px 4px rgba(192, 57, 43, 0.25));
}

.success-hint {
    margin-top: 28px;
    opacity: 0.75;
    font-style: italic;
}


/* ── Мобильные ── */
@media (max-width: 500px) {
    .card { padding: 40px 24px; }
    h1    { font-size: 1.55rem; }
    .deco-kanji { font-size: 4rem; }
    .yen-badge  { font-size: 2.7rem; }

    .input-group {
        flex-direction: column;
    }

    .input-group button {
        width: 100%;
    }
}
