.fortune-input-page {
    --toss-blue: #3182f6;
    --toss-blue-light: #e8f3ff;
    --toss-blue-dark: #1b64da;
    --toss-gray-900: #191f28;
    --toss-gray-800: #2a313c;
    --toss-gray-700: #4e5968;
    --toss-gray-600: #6b7684;
    --toss-gray-500: #8b95a1;
    --toss-gray-300: #d1d6db;
    --toss-gray-200: #e5e8eb;
    --toss-gray-100: #f2f4f6;
}

.fortune-input-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 16px 80px;
    font-family: var(--font-serif);
    min-height: 100vh;
    background-color: #f9fafb;
}

.fortune-input-page h1, .fortune-input-page h2, .fortune-input-page h3,
.fortune-input-page h4, .fortune-input-page h5, .fortune-input-page h6 {
    font-family: var(--font-serif);
}

.saved-charts-board {
    background: white;
    border-radius: 24px;
    padding: 40px 32px;
    margin-bottom: 32px;
    border: 1px solid rgba(15, 52, 96, 0.08);
    box-shadow: 0 12px 36px rgba(15, 52, 96, 0.08);
}

.saved-charts-header {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 26px;
    font-family: var(--font-serif);
}

@media (min-width: 768px) {
    .saved-charts-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.saved-charts-eyebrow {
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--toss-gray-500);
    margin-bottom: 4px;
}

.saved-charts-title {
    font-size: 1.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--toss-gray-900);
    font-family: var(--font-serif);
}

.saved-charts-subtitle {
    color: var(--toss-gray-600);
    margin: 0;
    max-width: 540px;
}

.saved-charts-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.saved-charts-actions button {
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    border: 2px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    min-width: 160px;
    height: 48px;
    box-sizing: border-box;
}

/* 버튼 내 꾹꾹이 아이콘 */
.btn-paw-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    filter: brightness(0) saturate(100%) invert(18%) sepia(15%) saturate(1800%) hue-rotate(260deg) brightness(95%) contrast(90%);
}

/* 버튼 내 Bootstrap 아이콘 크기 맞춤 */
.saved-charts-actions button i.bi {
    font-size: 18px;
    line-height: 1;
}

.saved-charts-actions button.primary {
    background: var(--brand-plum, #4c2c50);
    color: white;
    box-shadow: 0 10px 20px rgba(76, 44, 80, 0.25);
}

.saved-charts-actions button.secondary {
    background: white;
    color: var(--brand-plum, #4c2c50);
    border-color: var(--brand-plum, #4c2c50);
    box-shadow: 0 4px 12px rgba(76, 44, 80, 0.1);
}

.saved-charts-actions button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(76, 44, 80, 0.3);
    background: #5d3860;
}

.saved-charts-actions button.secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(76, 44, 80, 0.15);
    background: var(--brand-blush, #f7e3dd);
}

.saved-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.saved-chart-card {
    border: 1px solid rgba(15, 52, 96, 0.08);
    border-radius: 18px;
    padding: 20px;
    background: #f9fafb;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    cursor: pointer;
}

.saved-chart-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(15, 52, 96, 0.18);
}

.saved-chart-card:focus-visible {
    outline: 3px solid rgba(76, 44, 80, 0.4);
    outline-offset: 2px;
}

.chart-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.chart-name {
    font-size: 1.08rem;
    font-weight: 600;
    color: var(--toss-gray-900);
    margin-bottom: 4px;
}

.chart-meta {
    font-size: 0.92rem;
    color: var(--toss-gray-600);
}

.chart-description {
    font-size: 0.92rem;
    color: var(--toss-gray-700);
    margin: 12px 0 10px;
    min-height: 36px;
}

.chart-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.chart-action-btn {
    border: 1px solid var(--toss-gray-200);
    border-radius: 10px;
    padding: 6px 8px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    background: white;
    color: var(--toss-gray-700);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.chart-action-btn.primary-flag {
    color: #b45309;
    border-color: rgba(251, 146, 60, 0.4);
    background: rgba(251, 146, 60, 0.12);
}

.chart-action-btn.primary-flag.active {
    color: #f97316;
    border-color: rgba(251, 146, 60, 0.6);
    background: rgba(251, 146, 60, 0.2);
}

.chart-action-btn.edit {
    border-color: rgba(251, 146, 60, 0.35);
    color: #b45309;
    background: rgba(251, 146, 60, 0.12);
}

.chart-action-btn.delete {
    border-color: rgba(248, 113, 113, 0.4);
    color: #b91c1c;
    background: rgba(248, 113, 113, 0.08);
}

.chart-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chart-tag {
    font-size: 0.75rem;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(76, 44, 80, 0.12);
    color: var(--brand-plum, #4c2c50);
    font-weight: 600;
}

.no-charts-hint {
    text-align: center;
    padding: 70px 20px;
    background: rgba(76, 44, 80, 0.04);
    border-radius: 24px;
    border: 1px dashed rgba(76, 44, 80, 0.25);
}

.hint-actions {
    margin-top: 28px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.hint-actions button {
    border-radius: 12px;
    padding: 14px 22px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 15px;
}

.hint-actions .primary {
    background: var(--brand-plum, #4c2c50);
    color: white;
    box-shadow: 0 10px 22px rgba(76, 44, 80, 0.2);
}

.hint-actions .secondary {
    background: white;
    border-color: var(--toss-gray-200);
    color: var(--toss-gray-800);
}

.chart-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    font-family: var(--font-serif);
}

.chart-modal.is-visible {
    display: flex;
}

.chart-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(76, 44, 80, 0.4);
    backdrop-filter: blur(4px);
}

.chart-modal-dialog {
    position: relative;
    width: min(560px, 92vw);
    background: #fffcfa;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 25px 70px rgba(76, 44, 80, 0.2);
    z-index: 1;
    max-height: 90vh;
    overflow-y: auto;
}

.chart-modal-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--brand-blush, #f7e3dd);
}

.chart-modal-header h3 {
    font-family: var(--font-serif);
    color: var(--brand-plum, #4c2c50);
    font-size: 1.35rem;
    font-weight: 700;
}

.chart-modal-header p.text-muted {
    color: #8b7355;
    font-size: 14px;
}

.modal-eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--brand-rose, #e9a3a1);
    margin-bottom: 4px;
    font-weight: 600;
}

.chart-modal-close {
    border: none;
    background: var(--brand-blush, #f7e3dd);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    color: var(--brand-plum, #4c2c50);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chart-modal-close:hover {
    background: var(--brand-rose, #e9a3a1);
    color: white;
    transform: rotate(90deg);
}

/* =============================================
   모달 폼 - 홈과 동일한 토글/입력 스타일
   ============================================= */

/* 토글 행 (달력/성별) */
.chart-toggle-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    justify-content: stretch;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    width: 100%;
}

.chart-toggle-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    flex: 1;
}

.chart-toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-plum, #4c2c50);
    text-align: center;
}

.chart-toggle {
    display: flex;
    border: 1.5px solid #e8ddd5;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    width: 100%;
    padding: 0;
}

.chart-toggle-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--brand-plum, #4c2c50);
    padding: 0.55rem 0.5rem;
    font-weight: 600;
    font-size: 14px;
    font-family: var(--font-serif);
    transition: all 0.2s ease;
    text-align: center;
    margin: 0;
    border-radius: 0;
}

.chart-toggle .btn-check:checked + .chart-toggle-btn {
    background: linear-gradient(135deg, #eeb7b3, #4c2c50);
    color: #fff;
}

/* 첫 번째와 마지막 버튼에 라운드 적용 */
.chart-toggle .btn-check:first-of-type + .chart-toggle-btn {
    border-radius: 10px 0 0 10px;
}

.chart-toggle .chart-toggle-btn:last-of-type {
    border-radius: 0 10px 10px 0;
}

/* 입력 행 (생년월일/시각) */
.chart-input-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    justify-content: stretch;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    width: 100%;
}

.chart-input-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.chart-input-field > label {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-plum, #4c2c50);
}

.chart-input-field input {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1.5px solid #e8ddd5;
    font-size: 15px;
    color: var(--brand-plum, #4c2c50);
    font-weight: 600;
    transition: all 0.2s ease;
    background: #fff;
    font-family: var(--font-sans, "Pretendard", sans-serif);
    width: 100%;
    box-sizing: border-box;
    height: 50px;
}

.chart-input-field input::placeholder {
    color: #b8a89a;
    font-weight: 500;
}

.chart-input-field input:focus {
    outline: none;
    border-color: var(--brand-rose, #e9a3a1);
    box-shadow: 0 0 0 3px rgba(233, 163, 161, 0.2);
}

/* 라벨 + 모름 토글 한 줄 배치 */
.chart-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 20px;
}

/* =============================================
   기존 폼 스타일 (하위 호환)
   ============================================= */

.chart-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-label-row label:first-child {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-plum, #4c2c50);
}

.chart-unknown-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 12px !important;
    color: #8b7355 !important;
    font-weight: 500 !important;
}

.chart-unknown-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--brand-plum, #4c2c50);
    margin: 0;
}

.chart-unknown-toggle span {
    line-height: 1;
}

.chart-form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-plum, #4c2c50);
    font-family: var(--font-sans, "Pretendard", sans-serif);
}

.chart-form-group input,
.chart-form-group select,
.chart-form-group textarea {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1.5px solid #e8ddd5;
    font-size: 15px;
    color: var(--brand-plum, #4c2c50);
    transition: all 0.2s ease;
    background: #fff;
    font-family: var(--font-sans, "Pretendard", sans-serif);
    width: 100%;
    box-sizing: border-box;
    height: 50px;
}

.chart-form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%234c2c50' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.chart-form-group input::placeholder,
.chart-form-group textarea::placeholder {
    color: #b8a89a;
}

.chart-form-group textarea {
    resize: vertical;
    min-height: 72px;
    height: auto;
}

.chart-form-group input:focus,
.chart-form-group select:focus,
.chart-form-group textarea:focus {
    outline: none;
    border-color: var(--brand-rose, #e9a3a1);
    box-shadow: 0 0 0 3px rgba(233, 163, 161, 0.2);
}

.chart-form-wide {
    width: 100%;
    margin-bottom: 20px;
}

.chart-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--brand-blush, #f7e3dd);
}

.chart-modal-actions button {
    border: none;
    border-radius: 12px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans, "Pretendard", sans-serif);
}

.chart-modal-actions .btn-outline {
    background: white;
    border: 2px solid var(--brand-plum, #4c2c50);
    color: var(--brand-plum, #4c2c50);
}

.chart-modal-actions .btn-outline:hover {
    background: var(--brand-blush, #f7e3dd);
}

.chart-modal-actions .btn-primary {
    background: var(--brand-plum, #4c2c50);
    color: white;
    box-shadow: 0 4px 14px rgba(76, 44, 80, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.chart-modal-actions .btn-primary:hover {
    background: #5d3860;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(76, 44, 80, 0.3);
}

/* 모달 버튼 내 작은 paw 아이콘 */
.btn-paw-icon-small {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

body.modal-open {
    overflow: hidden;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-card {
    position: relative;
    background: white;
    padding: 40px 48px;
    border-radius: 24px;
    text-align: center;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* 랜덤 발바닥 캔버스 - 카드 안에서만 */
.paw-canvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

/* 발바닥 이미지 */
.paw-print {
    position: absolute;
    width: 32px;
    height: 32px;
    background-image: url('/static/icon/paw-32.png');
    background-size: contain;
    background-repeat: no-repeat;
    animation: paw-stamp 1.2s ease-out forwards;
    opacity: 0;
}

@keyframes paw-stamp {
    0% { 
        opacity: 0;
        transform: scale(0.5);
    }
    15% { 
        opacity: 0.8;
        transform: scale(1.1);
    }
    30% { 
        transform: scale(1);
    }
    100% { 
        opacity: 0.15;
        transform: scale(1);
    }
}

.loading-content {
    position: relative;
    z-index: 1;
}

.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--toss-gray-900);
    font-family: var(--font-serif);
    margin-bottom: 12px;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--brand-rose, #e9a3a1);
    border-radius: 50%;
    animation: dot-bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* 모달 폼 모바일 반응형 */
@media (max-width: 576px) {
    .chart-modal-dialog {
        padding: 24px 20px;
    }
    
    .chart-toggle-row {
        gap: 1rem;
    }
    
    .chart-toggle-btn {
        padding: 0.5rem 0.85rem;
        font-size: 13px;
    }
    
    .chart-input-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .chart-input-field {
        width: 100%;
    }
    
    .chart-modal-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .chart-modal-actions button {
        width: 100%;
    }
}
