/* CSS Variables - Premium Cathedral Palette */
:root {
    --bg-dark: #0a0c10;
    --bg-card: rgba(22, 27, 34, 0.65);
    --border-color: rgba(212, 175, 55, 0.2);
    --border-hover: rgba(212, 175, 55, 0.4);
    
    /* Colors */
    --gold: #d4af37;
    --gold-light: #f3e5ab;
    --gold-glow: rgba(212, 175, 55, 0.35);
    --text-primary: #f0f3f6;
    --text-muted: #8b949e;
    --text-dark: #0d1117;
    --accent-red: #ea6060;
    
    /* Fonts */
    --font-serif: 'Noto Serif KR', Georgia, serif;
    --font-sans: 'Outfit', 'Noto Sans KR', sans-serif;
}

/* Screen-reader only utility (SEO + accessibility) */
.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;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-x: hidden;
    position: relative;
}

/* Cathedral Background Overlay */
.cathedral-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 30%, rgba(13, 17, 23, 0.6) 0%, rgba(10, 12, 16, 0.95) 100%);
    z-index: -1;
}

/* Decorative grid overlay for sacred/architectural geometry */
.cathedral-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(var(--gold-glow) 1px, transparent 1px),
        linear-gradient(rgba(212, 175, 55, 0.02) 1px, transparent 1px);
    background-size: 40px 40px, 100% 80px;
    opacity: 0.5;
}

.app-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    z-index: 1;
    transition: max-width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 고해소 단계(Step 3) 활성화 시 브라우저 화면 전체를 100% 활용 (ChatGPT 스타일) */
body:has(#step-3.active) {
    overflow: hidden; /* 페이지 스크롤 방지 */
}

body:has(#step-3.active) .app-header,
body:has(#step-3.active) .app-footer {
    display: none !important; /* 주변 방해 요소 숨김 */
}

body:has(#step-3.active) .app-container {
    max-width: 100% !important;
    width: 100vw !important;
    height: 100vh !important;
    padding: 0 !important;
    margin: 0 !important;
}

body:has(#step-3.active) .step-section.active {
    height: 100% !important;
    width: 100% !important;
}

body:has(#step-3.active) .chat-card {
    height: 100vh !important;
    max-height: 100vh !important;
    width: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 2rem 3rem !important;
}

@media (max-width: 768px) {
    body:has(#step-3.active) .chat-card {
        padding: 1rem !important;
    }
}

/* Step Layout & Transition */
.step-section {
    display: none;
    width: 100%;
    animation: fadeIn 0.8s ease forwards;
}

.step-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Premium Card Design (Glassmorphism) */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.card:hover {
    border-color: rgba(212, 175, 55, 0.3);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 15px rgba(212, 175, 55, 0.05);
}

.card.dark-card {
    background: rgba(8, 10, 14, 0.85);
    border-color: rgba(212, 175, 55, 0.15);
}

/* Typography */
h1, h2, h3, .brand-title, .liturgy-text, .prayer-body {
    font-family: var(--font-serif);
}

.brand-title {
    font-size: 3.5rem;
    font-weight: 300;
    color: var(--gold);
    letter-spacing: 4px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    margin-bottom: 0.5rem;
    text-align: center;
}

.brand-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-title {
    font-size: 1.6rem;
    color: var(--gold);
    font-weight: 400;
    margin-bottom: 1.8rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title i {
    font-size: 1.2rem;
    opacity: 0.8;
}

.text-center {
    text-align: center;
}

/* Landing Page Elements */
.landing-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.cross-icon {
    font-size: 3rem;
    color: var(--gold);
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 12px var(--gold-glow));
    animation: pulse 3s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

.intro-card {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    width: 100%;
}

.intro-text {
    font-size: 1.25rem;
    color: var(--gold-light);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-style: italic;
}

.notice-box {
    background: rgba(234, 96, 96, 0.05);
    border-left: 3px solid var(--accent-red);
    border-radius: 0 8px 8px 0;
    padding: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.notice-box.notice-gold {
    background: rgba(212, 175, 55, 0.05);
    border-left: 3px solid var(--gold);
}

.notice-tag {
    display: block;
    font-weight: 600;
    color: var(--accent-red);
    margin-bottom: 0.35rem;
}

.notice-box.notice-gold .notice-tag {
    color: var(--gold);
}

.notice-text {
    color: var(--text-primary);
}

.notice-text strong {
    color: var(--gold-light);
}

/* Interactive Buttons */
.btn {
    font-family: var(--font-sans);
    font-size: 1rem;
    padding: 0.85rem 2rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    letter-spacing: 1px;
}

.btn-primary {
    background-color: var(--gold);
    color: var(--text-dark);
    border: 1px solid var(--gold);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--gold-light);
    border-color: var(--gold-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.btn-primary:disabled {
    background-color: #3b3523;
    border-color: #3b3523;
    color: #7c7562;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-outline {
    background-color: transparent;
    color: var(--gold);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background-color: rgba(212, 175, 55, 0.08);
    border-color: var(--gold);
    color: var(--gold-light);
}

.btn-outline-white {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-outline-white:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--text-primary);
}

.btn-glow {
    box-shadow: 0 0 15px var(--gold-glow);
}

.btn-group {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: flex-end;
}

/* Step 2 Form / Checks */
.question-box {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.question-text {
    font-size: 1.15rem;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-family: var(--font-serif);
    color: var(--gold-light);
}

.answer-check {
    display: flex;
    justify-content: center;
}

.checkbox-container {
    display: block;
    position: relative;
    padding-left: 35px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 1rem;
    user-select: none;
    color: var(--text-primary);
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 2px;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.3s;
}

.checkbox-container:hover input ~ .checkmark {
    background-color: rgba(212, 175, 55, 0.1);
    border-color: var(--gold);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--gold);
    border-color: var(--gold);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid var(--text-dark);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Prayer Tabs */
.prayer-tabs {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.tab-headers {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 1rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-family: var(--font-serif);
}

.tab-btn:hover {
    color: var(--gold-light);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--gold);
    background: rgba(212, 175, 55, 0.05);
    border-bottom: 2px solid var(--gold);
}

.tab-contents {
    padding: 1.5rem;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.prayer-body {
    font-size: 1.05rem;
    line-height: 1.8;
    text-align: center;
    color: #e4e6eb;
    white-space: pre-line;
}

.prayer-body em {
    color: var(--gold);
    font-style: normal;
    font-weight: 600;
}

/* Candle Graphic (Step 3) */
.candle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.candle {
    width: 34px;
    height: 100px;
    background: linear-gradient(to bottom, #d4af37, #b8860b, #553b08);
    border-radius: 5px 5px 0 0;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.wick {
    width: 3px;
    height: 15px;
    background-color: #222;
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
}

.flame {
    width: 20px;
    height: 35px;
    background: radial-gradient(ellipse at center, #ffffff 0%, #ffdf6d 25%, #ff9d00 60%, rgba(255,60,0,0) 100%);
    border-radius: 50% 50% 20% 20%;
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 30px #ff9d00, 0 0 50px rgba(255, 120, 0, 0.5);
    animation: flicker 1.8s infinite alternate ease-in-out;
}

@keyframes flicker {
    0% {
        transform: translateX(-50%) scale(1) rotate(-1deg);
        opacity: 0.9;
    }
    100% {
        transform: translateX(-50%) scale(1.05) rotate(1deg);
        opacity: 1;
        filter: blur(0.5px);
    }
}

.candle-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 1rem;
    letter-spacing: 1px;
}

.booth-intro {
    text-align: center;
}

.guide-narrative {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

/* Cross Button & Liturgy Dialogue */
.btn-cross {
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
    font-size: 1.1rem;
    border-radius: 8px;
    border-color: var(--gold);
    color: var(--gold);
    padding: 0.75rem;
}

.liturgy-flow {
    margin-top: 2.5rem;
    text-align: left;
}

.dialogue-block {
    background: rgba(0, 0, 0, 0.3);
    border-left: 2px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
}

.dialogue-block.priest {
    border-left-color: var(--gold);
    background: rgba(212, 175, 55, 0.03);
}

.dialogue-block.believer {
    border-left-color: #f0f3f6;
    background: rgba(255, 255, 255, 0.02);
}

.speaker {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.dialogue-block.priest .speaker {
    color: var(--gold);
}

.dialogue-block.believer .speaker {
    color: var(--text-primary);
}

.dialogue-text {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    line-height: 1.6;
}

.btn-next-step {
    width: 100%;
    margin-top: 1rem;
}

/* Form Styles (Step 4) */
.form-group {
    margin-bottom: 1.8rem;
}

.form-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gold-light);
    margin-bottom: 0.6rem;
}

.field-guide {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.form-control {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 0.8rem 1rem;
    font-size: 1rem;
    font-family: var(--font-sans);
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.15);
}

.text-area {
    line-height: 1.6;
    resize: none;
    overflow-y: auto;
}

/* Select custom wrapper */
.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold);
    pointer-events: none;
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 40px;
}

select option {
    background-color: var(--bg-dark);
    color: var(--text-primary);
}

.ending-confess-box {
    background: rgba(212, 175, 55, 0.03);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    margin: 2rem 0;
    text-align: center;
}

.ending-confess-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.liturgy-text {
    font-size: 1.25rem;
    color: var(--gold-light);
}

.italic {
    font-style: italic;
}

/* Priest Response (Step 5) */
.loading-state {
    text-align: center;
    padding: 3rem 1rem;
}

.spinner-cross {
    font-size: 3rem;
    color: var(--gold);
    margin-bottom: 1.5rem;
    animation: glow-pulse 2s infinite alternate;
}

@keyframes glow-pulse {
    from {
        text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
    }
    to {
        text-shadow: 0 0 25px rgba(212, 175, 55, 0.8);
    }
}

.loading-text {
    font-size: 1.15rem;
    font-family: var(--font-serif);
    color: var(--gold-light);
    margin-bottom: 0.5rem;
}

.loading-sub {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.markdown-body {
    font-family: var(--font-sans);
    line-height: 1.7;
    font-size: 1.05rem;
}

.markdown-body p {
    margin-bottom: 1rem;
}

.markdown-body blockquote {
    border-left: 3px solid var(--gold);
    background: rgba(212, 175, 55, 0.05);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--gold-light);
    margin: 1.5rem 0;
}

.contrition-confirmation {
    background: rgba(255, 255, 255, 0.015);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 2rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.contrition-guide {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Step 6 Absolution */
.absolution-text-box {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    line-height: 1.8;
    color: var(--gold-light);
    text-align: center;
    background: rgba(212, 175, 55, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}

.cross-mark {
    color: var(--gold);
    font-weight: bold;
    text-shadow: 0 0 10px var(--gold-glow);
}

.absolution-action-box {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.liturgy-action-btn-box {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.liturgy-action-btn-box .btn {
    width: 100%;
    max-width: 320px;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.hide {
    display: none;
}

.animate-fadein {
    animation: fadeIn 0.6s ease forwards;
}

/* Step 7 Completion */
.completion-cross {
    font-size: 4rem;
    color: var(--gold);
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 15px var(--gold-glow));
}

.completion-title {
    font-size: 2rem;
    color: var(--gold);
    margin-bottom: 1rem;
    font-weight: 400;
}

.completion-text {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #e4e6eb;
    margin-bottom: 2rem;
}

/* Footer styling */
.app-footer {
    padding: 2rem 0;
    text-align: center;
    font-size: 0.8rem;
    color: #4b525d;
    border-top: 1px solid rgba(255, 255, 255, 0.02);
}

.app-footer p {
    letter-spacing: 1px;
}

/* Helper spacing classes */
.mb-2 { margin-bottom: 0.5rem; }
.mt-2 { margin-top: 0.5rem; }

/* Responsive adjustments */
@media (max-width: 576px) {
    .card {
        padding: 1.75rem 1.25rem;
    }
    
    .brand-title {
        font-size: 2.8rem;
    }
    
    .btn {
        width: 100%;
        padding: 0.8rem 1.5rem;
    }
    
    .btn-group {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
}

/* Reflection guide message */
.reflection-guide-msg {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: var(--gold-light);
    text-align: center;
    font-family: var(--font-serif);
    animation: fadeIn 0.5s ease forwards;
    letter-spacing: 0.5px;
}

.reflection-guide-msg i {
    color: var(--gold);
    margin-right: 5px;
}

/* Chat Booth Container */
.chat-card {
    display: flex;
    flex-direction: column;
    height: 620px;
    max-height: 85vh;
    padding: 1.5rem !important;
}

.small-candle {
    margin-top: 1rem !important;
    margin-bottom: 0.8rem !important;
}

.small-candle .candle {
    height: 30px;
    width: 14px;
}

.small-candle .wick {
    width: 1.5px;
    height: 8px;
    top: -8px;
}

.small-candle .flame {
    width: 9px;
    height: 16px;
    top: -20px;
}

.small-candle .candle-label {
    display: none;
}

/* Chat Message Area */
.chat-messages-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    
    /* Custom Scrollbar for premium vibe */
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.2) transparent;
}

.chat-messages-container::-webkit-scrollbar {
    width: 5px;
}

.chat-messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background-color: rgba(212, 175, 55, 0.2);
    border-radius: 10px;
}

/* Chat Bubbles */
.chat-bubble {
    max-width: 85%;
    padding: 0.9rem 1.1rem;
    border-radius: 14px;
    font-size: 1rem;
    line-height: 1.6;
    animation: fadeIn 0.4s ease forwards;
    position: relative;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.chat-bubble.priest {
    align-self: flex-start;
    background: rgba(212, 175, 55, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.15);
    color: var(--text-primary);
    border-top-left-radius: 2px;
    font-family: var(--font-sans);
}

.chat-bubble.priest .speaker {
    color: var(--gold) !important;
    font-family: var(--font-serif);
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
    display: block;
}

.chat-bubble.priest blockquote {
    border-left: 2px solid var(--gold);
    background: rgba(212, 175, 55, 0.04);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-family: var(--font-serif);
    color: var(--gold-light);
    font-style: italic;
    border-radius: 0 6px 6px 0;
}

.chat-bubble.believer {
    align-self: flex-end;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-top-right-radius: 2px;
}

.chat-bubble.believer .speaker {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
    display: block;
    text-align: right;
}

/* Chat Input Panel Controls */
.chat-input-panel {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.input-panel-content {
    animation: fadeIn 0.4s ease forwards;
}

.panel-guide {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-align: center;
}

.chat-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: flex-end;
}

.chat-input-wrapper .form-control {
    width: 100% !important;
    padding-right: 48px !important;
}

.chat-input-wrapper textarea.form-control {
    padding-right: 48px !important;
    resize: none;
    min-height: 44px;
    max-height: 200px;
    overflow-y: auto;
    transition: height 0.1s ease;
    
    /* Custom Scrollbar for active input textarea */
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.3) transparent;
}

.chat-input-wrapper textarea.form-control::-webkit-scrollbar {
    width: 6px;
}

.chat-input-wrapper textarea.form-control::-webkit-scrollbar-track {
    background: transparent;
}

.chat-input-wrapper textarea.form-control::-webkit-scrollbar-thumb {
    background-color: rgba(212, 175, 55, 0.3);
    border-radius: 3px;
}

.chat-input-wrapper textarea.form-control[readonly] {
    overflow: hidden !important;
}

.chat-input-wrapper .btn-send {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--gold);
    color: var(--text-dark);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 10;
}

.chat-input-wrapper .btn-send i {
    font-size: 0.95rem;
}

.chat-input-wrapper .btn-send:hover:not(:disabled) {
    background-color: var(--gold-light);
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

.chat-input-wrapper:has(textarea) .btn-send {
    top: auto;
    bottom: 8px;
    transform: none;
}

.chat-input-wrapper:has(textarea) .btn-send:hover:not(:disabled) {
    transform: scale(1.05);
}

.chat-input-wrapper .btn-send:disabled {
    background-color: #3b3523;
    color: #7c7562;
    cursor: not-allowed;
}

.panel-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.liturgy-hint {
    font-family: var(--font-serif);
    font-size: 0.85rem;
    color: var(--gold-light);
    font-style: italic;
}

.flex-grow {
    flex-grow: 1;
}

.small-spinner {
    font-size: 1.5rem !important;
    margin-bottom: 0.5rem !important;
}

.panel-guide-text {
    font-family: var(--font-serif);
    color: var(--gold-light);
    font-size: 0.95rem;
}

.w-full {
    width: 100%;
}

/* Modal Popup Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hide {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--card-bg) !important;
    border: 1px solid var(--gold-border) !important;
    max-width: 500px;
    width: 90%;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5) !important;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.modal-action-buttons .btn {
    flex: 1;
    padding: 0.75rem 1.25rem;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ChatGPT 스타일: 가로 전체 화면에서 콘텐츠가 900px을 초과하지 않고 정중앙 정렬되도록 제한 */
body:has(#step-3.active) .chat-messages-container {
    display: flex;
    flex-direction: column;
}

body:has(#step-3.active) .chat-bubble {
    max-width: 75% !important; /* 화면이 넓어지므로 말풍선 폭 조절 */
    width: fit-content;
}

body:has(#step-3.active) .chat-bubble.priest {
    margin-right: auto;
}

body:has(#step-3.active) .chat-bubble.believer {
    margin-left: auto;
}

/* 대화 리스트 내부 알맹이와 입력창의 가로 최대 너비를 900px로 세련되게 제한 */
body:has(#step-3.active) .chat-messages-container,
body:has(#step-3.active) .chat-input-panel,
body:has(#step-3.active) .liturgy-candle-section {
    max-width: 900px !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Language Selector Styles */
.lang-selector-container {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(18, 22, 28, 0.6);
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 6px 12px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.lang-selector-container:hover {
    border-color: var(--gold);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
}

.lang-globe-icon {
    color: var(--gold);
    font-size: 0.9rem;
}

#lang-select {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    padding-right: 4px;
}

#lang-select option {
    background: #12161c;
    color: var(--text-color);
}

/* Global Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(8, 10, 14, 0.4);
}

::-webkit-scrollbar-thumb {
    background-color: rgba(212, 175, 55, 0.25);
    border: 2px solid rgba(8, 10, 14, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(212, 175, 55, 0.5);
}

/* Global Firefox Scrollbar */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.25) rgba(8, 10, 14, 0.4);
}
