* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Noto Sans KR', sans-serif;
    background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    background-size: 200% 200%;
    animation: gradientShift 10s ease infinite;
    color: #333;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* 배경 별들 */
.star {
    position: absolute;
    background: rgba(255, 255, 255, 0.7);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    animation: twinkle 5s ease-in-out infinite;
}

.star:nth-child(1) { top: 10%; left: 10%; width: 15px; height: 15px; animation-delay: 0s; }
.star:nth-child(2) { top: 20%; right: 15%; width: 10px; height: 10px; animation-delay: 1.5s; }
.star:nth-child(3) { bottom: 30%; left: 20%; width: 20px; height: 20px; animation-delay: 3s; }
.star:nth-child(4) { bottom: 15%; right: 10%; width: 12px; height: 12px; animation-delay: 0.8s; }
.star:nth-child(5) { top: 40%; left: 5%; width: 8px; height: 8px; animation-delay: 2.2s; }
.star:nth-child(6) { top: 60%; right: 25%; width: 18px; height: 18px; animation-delay: 4s; }

.container {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    padding: 40px;
    width: 100%;
    max-width: 650px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-align: center;
    position: relative;
    animation: containerBounce 0.8s ease-out;
}

.header {
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #ff9a8b 0%, #ff6a88 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    font-weight: 800;
}

.guide {
    color: #555;
    font-size: 1.2rem;
    margin-bottom: 8px;
    font-weight: 500;
}

.tips {
    background: rgba(255, 229, 153, 0.4);
    border: 1px solid rgba(255, 229, 153, 0.8);
    border-radius: 20px;
    padding: 20px;
    margin-top: 30px;
    text-align: left;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
}

.tips-title {
    color: #f39c12;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tips-content {
    color: #594a26;
    font-size: 0.95rem;
    line-height: 1.6;
    font-weight: 500;
}

#result-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 25px;
    padding: 35px 25px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.text-container {
    padding: 25px;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    border: 2px solid transparent;
}

.text-container.active {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 12px 40px rgba(255, 154, 68, 0.3);
    border: 2px solid rgba(255, 154, 68, 0.5);
}

.text-container h2 {
    font-size: 1rem;
    color: #ff9a44;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.text-container p {
    font-size: 1.4rem;
    font-weight: 600;
    color: #34495e;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
    word-break: break-word;
    text-align: center;
}

.text-container p.placeholder {
    color: #b0bec5;
    font-style: italic;
    font-weight: 500;
}

.text-container p.loading {
    color: #ff9a44;
    animation: pulse 1.5s ease-in-out infinite;
}

.arrow-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.arrow-container:hover {
    background-color: rgba(255, 154, 68, 0.1);
    transform: scale(1.1);
}

.arrow {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ff9a44, #ff6347);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 25px rgba(255, 99, 71, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.arrow:hover {
    transform: rotate(360deg);
}

.arrow.reverse {
    transform: rotate(180deg);
}

.arrow.reverse:hover {
    transform: rotate(540deg);
}

.listen-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #fff0e6;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.listen-btn svg {
    width: 22px;
    height: 22px;
    color: #ff9a44;
}

.listen-btn:hover {
    transform: scale(1.15);
    background: #ffe0cc;
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

#record-btn {
    background: linear-gradient(135deg, #ff9a44, #ff6347);
    border: none;
    border-radius: 50%;
    width: 140px;
    height: 140px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 15px 50px rgba(255, 99, 71, 0.4);
    position: relative;
    overflow: hidden;
    border: 4px solid rgba(255, 255, 255, 0.3);
}

#record-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3), rgba(255,255,255,0.1));
    border-radius: 50%;
}

#record-btn:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 20px 60px rgba(255, 99, 71, 0.5);
}

#record-btn:active {
    transform: translateY(-4px) scale(1.02);
}

#record-btn svg {
    width: 55px;
    height: 55px;
    color: #ffffff;
    transition: all 0.3s ease;
    z-index: 1;
    position: relative;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

#record-btn.recording {
    background: linear-gradient(135deg, #48c774, #34a853);
    animation: recordingPulse 1.2s infinite;
}

#record-btn.recording svg {
    animation: micBounce 0.6s ease-in-out infinite alternate;
}

#status-text {
    font-size: 1.2rem;
    color: #555;
    font-weight: 600;
    min-height: 32px;
    transition: all 0.3s ease;
}

#status-text.recording {
    color: #48c774;
    font-weight: 700;
}

#status-text.translating {
    color: #ff9a44;
    font-weight: 700;
}

/* 애니메이션들 */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

@keyframes containerBounce {
    0% { transform: scale(0.9) translateY(40px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes recordingPulse {
    0% { box-shadow: 0 15px 50px rgba(72, 199, 116, 0.4); }
    50% { box-shadow: 0 15px 50px rgba(72, 199, 116, 0.7), 0 0 0 20px rgba(72, 199, 116, 0.2); }
    100% { box-shadow: 0 15px 50px rgba(72, 199, 116, 0.4); }
}

@keyframes micBounce {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 30px 20px;
        margin: 0;
        width: 100%;
    }

    h1 {
        font-size: 2rem;
    }

    #result-box {
        padding: 25px 20px;
    }

    .text-container {
        min-height: 100px;
        padding: 20px;
    }

    .text-container p {
        font-size: 1.3rem;
    }

    #record-btn {
        width: 120px;
        height: 120px;
    }

    #record-btn svg {
        width: 45px;
        height: 45px;
    }

    .tips {
        text-align: center;
        margin-top: 25px;
        padding: 18px;
    }

    .arrow {
        transform: rotate(90deg);
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
    }

    .arrow.reverse {
        transform: rotate(-90deg);
    }

    .arrow:hover {
        transform: rotate(450deg);
    }

    .arrow.reverse:hover {
        transform: rotate(-450deg);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 25px 15px;
    }

    h1 {
        font-size: 1.7rem;
    }

    .guide {
        font-size: 1.1rem;
    }
}

@media (min-width: 769px) {
    #result-box {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        gap: 25px;
        align-items: center;
    }

    .arrow-container {
        margin: 0;
    }

    .arrow {
        transform: none;
    }

    .arrow svg {
        transform: none;
    }

    .arrow.reverse {
        transform: rotate(180deg);
    }

    .arrow:hover {
        transform: rotate(360deg);
    }

    .arrow.reverse:hover {
        transform: rotate(540deg);
    }
}

#browser-notice {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    text-align: center;
    padding: 15px;
    font-size: 1rem;
    font-weight: 500;
    z-index: 100;
    transform: translateY(100%);
    transition: transform 0.5s ease-in-out;
}

#browser-notice.visible {
    transform: translateY(0);
}

#browser-notice.hidden {
    display: none;
}

.donation {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px dashed #ddd;
    text-align: center;
}

.donation-guide {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 25px;
}

.donation-methods {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    flex-wrap: wrap;
}

.donation-method {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.qr-code {
    width: 160px;
    height: 160px;
    border-radius: 12px;
    border: 1px solid #eee;
}

.donation-title-pc {
    font-size: 1.1rem;
    color: #333;
}

.donation-guide-pc {
    font-size: 0.9rem;
    color: #777;
}

.kakaopay-button {
    display: none; /* 평소에는 숨겨 둠 */
}

/* 모바일 화면에서는 QR과 PC용 텍스트를 숨기고, 카카오페이 버튼을 카드로 디자인 */
@media (max-width: 768px) {
    .qr-code,
    .donation-title-pc,
    .donation-guide-pc {
        display: none;
    }

    .kakaopay-button {
        display: flex;
        width: 100%;
        background: #FFDE00;
        border-radius: 12px;
        padding: 15px 20px;
        align-items: center;
        text-decoration: none;
        color: #3C1E1E;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        transition: all 0.2s ease-in-out;
    }
    
    .kakaopay-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    }

    .kakaopay-logo {
        width: 40px;
        height: 40px;
        background-color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 15px;
    }

    .kakaopay-logo svg {
        width: 24px;
        height: 24px;
    }
    
    .kakaopay-text {
        text-align: left;
        flex-grow: 1;
    }

    .kakaopay-text strong {
        font-size: 1.1rem;
        font-weight: bold;
    }

    .kakaopay-text span {
        font-size: 0.9rem;
        color: rgba(60, 30, 30, 0.7);
    }

    .kakaopay-arrow {
        font-size: 1.5rem;
        font-weight: bold;
        color: rgba(60, 30, 30, 0.5);
    }
}

/* 데스크탑 화면에서는 카카오페이 버튼을 숨김 */
@media (min-width: 769px) {
    .kakaopay-button {
        display: none;
    }
}