/* AI 매일 한마디 - 파스텔 테마 */
:root {
  --font-main: 'NanumSquareNeo', 'NanumSquare Neo', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --bs-body-font-family: var(--font-main);
  --c-pink: #ffd6e0; --c-lavender: #dcd3ff; --c-mint: #cdf3e4; --c-sky: #cfe8ff; --c-peach: #ffe3cc;
  --brand: #7c6bd6; --brand-rgb: 124, 107, 214; --brand-dark: #6556c0;
  --surface: rgba(255, 255, 255, .82);
  --surface-border: rgba(124, 107, 214, .14);
  --page-bg: #f7f4ff;
  --shadow: 0 10px 30px rgba(124, 107, 214, .12);
  --bs-primary: var(--brand); --bs-primary-rgb: var(--brand-rgb);
  --bs-link-color: var(--brand); --bs-link-hover-color: var(--brand-dark);
  --bs-link-color-rgb: var(--brand-rgb);
}
[data-bs-theme="dark"] {
  --brand: #a99bff; --brand-rgb: 169, 155, 255; --brand-dark: #c1b7ff;
  --surface: rgba(38, 36, 54, .85);
  --surface-border: rgba(169, 155, 255, .16);
  --page-bg: #1b1a26;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --bs-body-bg: #1b1a26;
}
html { scroll-behavior: smooth; }
body { font-family: var(--font-main); background: var(--page-bg); min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; line-height: 1.65; word-break: keep-all; }
.app-main { flex: 1; }

/* 배경 블롭 */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-blobs span { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; animation: blob 18s ease-in-out infinite alternate; }
.bg-blobs span:nth-child(1) { width: 380px; height: 380px; background: var(--c-pink); top: -90px; left: -80px; }
.bg-blobs span:nth-child(2) { width: 420px; height: 420px; background: var(--c-sky); top: 30%; right: -140px; animation-delay: -6s; }
.bg-blobs span:nth-child(3) { width: 340px; height: 340px; background: var(--c-mint); bottom: -100px; left: 25%; animation-delay: -12s; }
[data-bs-theme="dark"] .bg-blobs span { opacity: .16; }
@keyframes blob { to { transform: translate(40px, 30px) scale(1.12); } }

/* 버튼 */
.btn { border-radius: 14px; font-weight: 700; transition: transform .15s, box-shadow .2s, background-color .2s; }
.btn:active { transform: scale(.97); }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark); --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff;
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); box-shadow: 0 6px 16px rgba(var(--brand-rgb), .3); }
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #1b1a26; --bs-btn-hover-color: #1b1a26; --bs-btn-active-color: #1b1a26; }
.btn-primary:hover { transform: translateY(-2px); }
.btn-soft { background: rgba(var(--brand-rgb), .12); color: var(--brand); border: 0; }
.btn-soft:hover, .btn-soft:focus, .btn-soft.show { background: rgba(var(--brand-rgb), .22); color: var(--brand-dark); }
.btn-icon { width: 40px; height: 40px; border-radius: 12px; background: rgba(var(--brand-rgb), .12); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.btn-icon:hover { background: rgba(var(--brand-rgb), .22); color: var(--brand); }
.btn-icon i { transition: transform .4s; }
.btn-icon:hover i { transform: rotate(20deg) scale(1.1); }
/* 상단 내비게이션 버튼: 높이/패딩/간격 통일 */
.app-nav .btn:not(.navbar-toggler) { height: 40px; min-width: 40px; padding: 0 1rem; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; line-height: 1; font-size: .95rem; }
.app-nav .btn-icon { width: 40px; padding: 0; }
.app-nav .navbar-collapse > .d-flex { gap: .5rem; }
.app-nav .navbar-collapse > .d-flex .btn { width: auto; }
@media (min-width: 992px) {
  .app-nav .navbar-nav { gap: .5rem; }
  .app-nav .nav-link { padding: .55rem 1.1rem; }
  .app-nav .navbar-collapse { gap: 1rem; }
  .app-nav .navbar-collapse > .d-flex { gap: .75rem; margin-right: .75rem; }
}
@media (max-width: 991.98px) {
  .app-nav .navbar-nav { gap: .25rem; margin-top: .75rem; }
  .app-nav .navbar-collapse > .d-flex { gap: .75rem; margin-top: .5rem; }
  .app-nav .navbar-collapse > .d-flex { align-items: stretch !important; }
  .app-nav .navbar-collapse > .d-flex .btn, .app-nav .navbar-collapse > .d-flex .dropdown { width: 100%; }
}
.theme-icon-light { display: none; }
[data-bs-theme="dark"] .theme-icon-light { display: inline; }
[data-bs-theme="dark"] .theme-icon-dark { display: none; }
.form-control, .form-select { border-radius: 14px; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .25rem rgba(var(--brand-rgb), .18); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
a { text-decoration-color: rgba(var(--brand-rgb), .4); }

/* 내비게이션 */
.app-nav { background: var(--surface); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--surface-border); }
.app-nav .nav-link { border-radius: 12px; font-weight: 600; padding: .5rem .9rem; }
.app-nav .nav-link.active, .app-nav .nav-link:hover { background: rgba(var(--brand-rgb), .12); color: var(--brand); }
.brand-logo { border-radius: 10px; }
.badge.role-user { background: var(--c-sky); color: #28506f; }
.badge.role-premium { background: #ffe7a8; color: #7a5600; }
.badge.role-admin { background: var(--c-pink); color: #8a2745; }
.tag-lang { background: var(--c-lavender); color: #3f3480; }
.tag-level { background: var(--c-mint); color: #1d6249; }
.tag-topic { background: var(--c-peach); color: #8a4a12; }
[data-bs-theme="dark"] .tag-lang, [data-bs-theme="dark"] .tag-level, [data-bs-theme="dark"] .tag-topic { filter: brightness(.9); }
.badge { font-weight: 700; padding: .45em .8em; border-radius: 99px; }

/* 푸터 */
.app-footer { border-top: 1px solid var(--surface-border); background: var(--surface); }
.app-footer a { text-decoration: none; }
.recaptcha-note { font-size: .72rem; }
.grecaptcha-badge { visibility: hidden !important; }

/* 공통 */
.gradient-text { background: linear-gradient(90deg, #ff8fb1, #8f7bff 60%, #5ec3f0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pill-badge { display: inline-block; padding: .4rem .9rem; border-radius: 99px; background: rgba(var(--brand-rgb), .12); color: var(--brand); font-weight: 700; font-size: .85rem; }
.soft-card, .feature-card, .auth-card, .sample-card, .sentence-card, .loading-card, .history-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 24px; box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.soft-card { padding: 1.25rem; }
.content-wrap { padding-top: 1.75rem; padding-bottom: 3rem; }
.stat small { display: block; color: var(--bs-secondary-color); }
.stat b { font-size: 1.6rem; }
.admin-table tr.clickable { cursor: pointer; }
.info-list dt { color: var(--bs-secondary-color); font-weight: 600; }
.info-list dd { margin-bottom: .6rem; }

/* 랜딩 */
.hero { padding: 3.5rem 0 2.5rem; }
.sample-card { padding: 1.5rem; max-width: 460px; margin: 0 auto; }
.feature-card { padding: 1.6rem; transition: transform .25s, box-shadow .25s; }
.feature-card:hover { transform: translateY(-6px); box-shadow: 0 16px 36px rgba(var(--brand-rgb), .2); }
.feature-icon { width: 58px; height: 58px; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; background: var(--c-lavender); color: #4a3d9a; }
.feature-icon.c-pink { background: var(--c-pink); color: #a43a5c; } .feature-icon.c-mint { background: var(--c-mint); color: #1d6a4e; }
.feature-icon.c-sky { background: var(--c-sky); color: #25618f; } .feature-icon.c-peach { background: var(--c-peach); color: #9a5314; }
.feature-icon.c-lavender { background: var(--c-lavender); color: #4a3d9a; }
.cta-box { padding: 3rem 1.5rem; border-radius: 32px; color: #fff; background: linear-gradient(135deg, #ff9db9, #9d8cff 55%, #66c8f2); box-shadow: 0 20px 50px rgba(124, 107, 214, .35); }
[data-bs-theme="dark"] .cta-box { background: linear-gradient(135deg, #8a4a68, #5b4ea8 55%, #2f7fa0); }

/* 인증 */
.auth-wrap { max-width: 460px; padding-top: 3rem; padding-bottom: 3rem; }
.auth-card { padding: 2rem 1.5rem; }

/* 문장 카드 */
.sentence-card { padding: 1.5rem; margin-bottom: 1rem; }
.sentence-text { font-size: clamp(1.6rem, 5vw, 2.2rem); font-weight: 800; line-height: 1.4; letter-spacing: -.01em; margin-bottom: .35rem; word-break: normal; overflow-wrap: anywhere; }
.reading-line { color: var(--bs-secondary-color); font-size: .95rem; }
.speak-btn { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; box-shadow: 0 6px 14px rgba(var(--brand-rgb), .35); transition: transform .15s; }
[data-bs-theme="dark"] .speak-btn { color: #1b1a26; }
.speak-btn:hover { transform: scale(1.08); }
.speak-btn.playing { animation: pulse 1s infinite; }
.translation-box { background: linear-gradient(135deg, rgba(255, 214, 224, .55), rgba(220, 211, 255, .55)); border-radius: 16px; padding: .9rem 1.1rem; font-weight: 700; font-size: 1.1rem; }
[data-bs-theme="dark"] .translation-box { background: linear-gradient(135deg, rgba(255, 143, 177, .16), rgba(169, 155, 255, .18)); }
.section-title { font-size: .85rem; font-weight: 800; color: var(--brand); margin: 1.25rem 0 .5rem; display: flex; align-items: center; gap: .4rem; }
.word-row { display: flex; gap: .75rem; padding: .55rem .75rem; border-radius: 12px; align-items: baseline; }
.word-row:nth-child(odd) { background: rgba(var(--brand-rgb), .06); }
.word-row b { min-width: 5.2em; flex: none; font-size: 1.05rem; word-break: normal; }
.word-row .w-read { color: var(--bs-secondary-color); font-size: .8rem; display: block; font-weight: 400; }
.word-row .w-note { display: block; font-size: .8rem; color: var(--bs-secondary-color); }
.caution-item { background: rgba(255, 193, 7, .14); border-left: 4px solid #ffc94d; border-radius: 12px; padding: .65rem .9rem; font-size: .92rem; margin-bottom: .5rem; }
.caution-item i { color: #e0a100; }
.history-card { overflow: hidden; }
.history-head { width: 100%; text-align: left; background: none; border: 0; padding: 1rem 1.25rem; display: flex; gap: .75rem; align-items: center; color: inherit; font-family: inherit; }
.history-head .h-sentence { font-weight: 800; font-size: 1.1rem; overflow-wrap: anywhere; word-break: normal; }
.history-head .chev { transition: transform .25s; margin-left: auto; color: var(--bs-secondary-color); }
.history-card.open .chev { transform: rotate(180deg); }
.history-body { display: none; padding: 0 1.25rem 1.25rem; }
.loading-card { padding: 3rem 1.5rem; }
.empty-state { padding: 3rem 0; }

/* 설정 옵션 타일 */
.option-grid { display: grid; gap: .6rem; }
.option-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.option-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.option-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.option-tile { cursor: pointer; margin: 0; }
.option-tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile-body { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; text-align: center; height: 100%; min-height: 64px; padding: .6rem .3rem; border-radius: 16px; border: 2px solid transparent; background: rgba(var(--brand-rgb), .07); transition: all .2s; font-size: .9rem; }
.tile-body small { color: var(--bs-secondary-color); }
.option-tile:hover .tile-body { transform: translateY(-2px); background: rgba(var(--brand-rgb), .13); }
.option-tile input:checked + .tile-body { border-color: var(--brand); background: rgba(var(--brand-rgb), .18); color: var(--brand); box-shadow: 0 6px 16px rgba(var(--brand-rgb), .2); }
.option-tile input:focus-visible + .tile-body { outline: 3px solid rgba(var(--brand-rgb), .4); }
.channel-panel { display: none; animation: fadeUp .3s ease both; }
.channel-panel.show { display: block; }
@media (max-width: 575.98px) {
  .option-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .option-grid.cols-5 { grid-template-columns: repeat(2, 1fr); }
  .option-grid.cols-5 .option-tile:first-child { grid-column: 1 / -1; }
  .hero { padding-top: 2rem; }
}

/* 공통 모달 */
.common-modal { border: 0; border-radius: 28px; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.common-modal-icon { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto; display: flex; align-items: center; justify-content: center; font-size: 1.9rem; }
.common-modal-icon.t-info { background: var(--c-sky); color: #25618f; }
.common-modal-icon.t-success { background: var(--c-mint); color: #1d6a4e; }
.common-modal-icon.t-error { background: var(--c-pink); color: #a43a5c; }
.common-modal-icon.t-warning { background: #fff0b8; color: #8a6400; }
.common-modal-msg { white-space: pre-line; overflow-wrap: anywhere; }
.modal.fade .modal-dialog { transform: scale(.9) translateY(20px); transition: transform .3s cubic-bezier(.2, .9, .3, 1.3), opacity .2s; }
.modal.show .modal-dialog { transform: none; }
.temp-pw { font-family: ui-monospace, Menlo, monospace; font-size: 1.3rem; background: rgba(var(--brand-rgb), .12); border-radius: 12px; padding: .5rem 1rem; display: inline-block; user-select: all; color: var(--bs-body-color); }

/* 애니메이션 */
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes floatY { 50% { transform: translateY(-10px); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(var(--brand-rgb), .0), 0 0 0 0 rgba(var(--brand-rgb), .4); transform: scale(1.1); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.anim-fade-up { animation: fadeUp .6s cubic-bezier(.2, .8, .3, 1) both; }
.anim-pop { animation: pop .5s cubic-bezier(.2, .9, .3, 1.2) both; }
.delay-1 { animation-delay: .1s; } .delay-2 { animation-delay: .2s; } .delay-3 { animation-delay: .3s; } .delay-4 { animation-delay: .4s; }
.float-y { animation: pop .5s both, floatY 6s ease-in-out .6s infinite; }
.shake { animation: shake .4s; }
.stagger > * { animation: fadeUp .5s both; }
.stagger > *:nth-child(2) { animation-delay: .06s; } .stagger > *:nth-child(3) { animation-delay: .12s; } .stagger > *:nth-child(4) { animation-delay: .18s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}


/* 넓은 화면에서 너비 활용: 단어/주의사항 2열 배치 */
.words-grid { display: block; }
@media (min-width: 992px) {
  .sentence-card, .history-body { padding-left: 2rem; padding-right: 2rem; }
  .words-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: .75rem; }
  .words-grid .word-row:nth-child(odd) { background: none; }
  .words-grid .word-row { background: rgba(var(--brand-rgb), .06); }
}

.admin-tabs .nav-link { border-radius: 12px; font-weight: 700; color: var(--brand); background: rgba(var(--brand-rgb), .08); margin-right: .5rem; }
.admin-tabs .nav-link.active { background: var(--brand); color: #fff; }
[data-bs-theme="dark"] .admin-tabs .nav-link.active { color: #1b1a26; }
.sentence-cell { max-width: 360px; overflow-wrap: anywhere; word-break: normal; }

/* 아이콘 수직 정렬 보정: 폰트 메트릭 차이로 아이콘이 위로 떠 보이는 문제 */
.bi::before, .fa-solid, .fa-brands, .fa-regular { vertical-align: 0 !important; }
.bi { line-height: 1; }
.btn, .badge, .dropdown-item, .app-nav .nav-link, .section-title { display: inline-flex; align-items: center; justify-content: center; }
.dropdown-item, .app-nav .nav-link, .section-title { display: flex; justify-content: flex-start; }
.btn-icon i, .feature-icon i, .common-modal-icon i, .speak-btn i { display: flex; align-items: center; justify-content: center; line-height: 1; }
.tile-body i { line-height: 1; display: block; }
.btn.dropdown-toggle { display: inline-flex; }
.btn.dropdown-toggle::after { margin-left: .5em; }

/* 테마 아이콘: 현재 모드에 맞는 하나만 표시 (위 정렬 규칙보다 우선) */
.btn-icon .theme-icon-light { display: none; }
[data-bs-theme="dark"] .btn-icon .theme-icon-light { display: flex; }
[data-bs-theme="dark"] .btn-icon .theme-icon-dark { display: none; }
.speak-btn.speak-sm { width: 34px; height: 34px; font-size: 1rem; box-shadow: 0 3px 8px rgba(var(--brand-rgb), .3); }
