@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=Mountains+of+Christmas:wght@400;700&display=swap');

:root {
    /* New Year Palette (Navy & Gold) */
    --primary-color: #1e3a8a;
    /* Deep Navy */
    --primary-hover: #172554;
    --accent-color: #f59e0b;
    /* Gold */
    --accent-hover: #d97706;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;

    /* Dawn/Sunrise Gradient */
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 40%, #312e81 80%, #4338ca 100%);

    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(251, 191, 36, 0.3);
    /* Gold tint border */
    --text-main: #ffffff;
    --text-muted: #cbd5e1;
    --card-bg: rgba(15, 23, 42, 0.7);

    --lucky-red: #dc2626;
    /* For envelopes/accents */
    --fortune-gold: #fbbf24;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Confetti/Sparkle Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image:
        radial-gradient(2px 2px at 20px 30px, var(--fortune-gold), rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 40px 70px, #ffffff, rgba(0, 0, 0, 0)),
        radial-gradient(3px 3px at 50px 160px, var(--fortune-gold), rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 90px 40px, #ffffff, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 130px 80px, var(--fortune-gold), rgba(0, 0, 0, 0)),
        radial-gradient(4px 4px at 160px 120px, rgba(255, 215, 0, 0.5), rgba(0, 0, 0, 0));
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: sparkle 5s linear infinite;
    opacity: 0.6;
    z-index: 0;
}

@keyframes sparkle {
    0% {
        transform: translateY(0);
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translateY(-200px);
        /* Rising effect like lanterns/sparkles */
        opacity: 0.5;
    }
}

.container {
    width: 100%;
    max-width: 1000px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 30px rgba(251, 191, 36, 0.15);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    position: relative;
    z-index: 1;
}

/* Decorative border top - Traditional Korean colors or Gold/Navy */
.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--lucky-red), var(--primary-color));
    border-radius: 24px 24px 0 0;
}

/* Mobile Responsiveness Fix */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .container {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        gap: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .total-amount {
        font-size: 2rem;
    }
}

/* Header */
.header {
    grid-column: 1 / -1;
    text-align: center;
    margin-bottom: 1rem;
}

.header h1 {
    font-family: 'Pretendard', sans-serif;
    /* Keep readable font for main title, maybe use decorative for accents */
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Form Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 0.25rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.form-control {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: white;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23fbbf24' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.hidden {
    display: none !important;
}

/* Result Section */
.result-section {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.total-display {
    text-align: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.total-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.total-amount {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-color);
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.breakdown-item span:last-child {
    font-weight: 600;
}

.advice-box {
    background: rgba(212, 36, 38, 0.1);
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.advice-box.warning {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: var(--warning-color);
}

.advice-box.danger {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: var(--danger-color);
}

.surcharge-box {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.surcharge-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.surcharge-comparison {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.surcharge-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--danger-color);
}

/* Button */
.btn-calc {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color), #b91c1c);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: auto;
    box-shadow: 0 4px 12px rgba(212, 36, 38, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-calc::after {
    content: '🧧';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    opacity: 0.9;
}

.btn-calc:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 36, 38, 0.6);
}

/* Small Button (Daily Wage) */
.btn-small {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--accent-color);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    margin-left: 0.5rem;
    transition: all 0.2s;
}

.btn-small:hover {
    background: var(--accent-color);
    color: #000;
}

/* Save Button */
.btn-save {
    width: 100%;
    padding: 0.8rem;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-save:hover {
    background: var(--accent-color);
    color: #000;
}

/* Tip Box */
.btn-tip {
    background: var(--accent-color);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    margin-left: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.btn-tip:hover {
    transform: scale(1.1);
}

.tip-box {
    background: rgba(251, 191, 36, 0.05);
    border: 1px solid var(--accent-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.tip-box h3 {
    font-size: 1.1rem;
    color: var(--accent-color);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tip-content h4 {
    font-size: 0.95rem;
    color: white;
    margin-bottom: 0.5rem;
}

.tip-content ul {
    list-style-type: none;
    margin-bottom: 1rem;
}

.tip-content li {
    position: relative;
    padding-left: 1.2rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.tip-content li::before {
    content: "🍀";
    font-size: 0.8rem;
    position: absolute;
    left: 0;
}

.tip-note {
    font-size: 0.85rem;
    color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
    padding: 0.5rem;
    border-radius: 6px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Footer */
.footer {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--glass-border);
    padding-top: 1.5rem;
}

.footer p {
    margin-bottom: 0.3rem;
}

.footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.developer-logo {
    height: 32px;
    width: auto;
    vertical-align: middle;
    margin-right: 8px;
    border-radius: 4px;
    transform: translateY(-1px);
    mix-blend-mode: screen;

}

.guidance-text {
    font-size: 0.85rem;
    color: var(--accent-color);
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(251, 191, 36, 0.2);
    animation: fadeIn 0.3s ease;
}

.developer-info {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.developer-info:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    background-color: transparent;
    padding: 0;
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--accent-color);
}

.modal-image {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.disclaimer {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    border: 1px solid var(--glass-border);
}

.disclaimer strong {
    color: var(--warning-color);
}


/* Responsive text for mobile/desktop */
.desktop-text {
    display: inline;
}

.mobile-text {
    display: none;
}

@media (max-width: 768px) {
    .desktop-text {
        display: none;
    }

    .mobile-text {
        display: inline;
    }
}