/* 
=================================================================================
[Polesent Quiz Hub - Premium Stylesheet]
=================================================================================
*/

:root {
    --bg-main: #F4F6F8;
    --bg-card: #FFFFFF;
    --primary: #007AFF;
    --primary-hover: #0066D6;
    --primary-bg: #EBF5FF;
    --text-dark: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --success: #34C759;
    --danger: #FF3B30;
    --warning: #FFCC00;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 0;
    overflow-x: hidden;
}

.site-container {
    width: 100%;
    max-width: 1000px; /* 데스크톱 웹 페이지 너비로 대폭 확장 */
    margin: 0 auto; /* PC 브라우저 정중앙 정렬 */
    background-color: #FFFFFF;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
}

/* 헤더 스타일 */
.site-header {
    padding: 24px 20px 14px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: #FFFFFF;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 4px;
}

.header-leaf-icon {
    width: 22px;
    height: 22px;
    fill: #9ACDFF;
}
.header-leaf-icon.right {
    transform: scaleX(-1);
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 1px;
}

.header-title {
    font-size: 22px;
    font-weight: 900;
    color: var(--text-dark);
    letter-spacing: -0.5px;
    margin-top: 4px;
}

.header-date-badge {
    font-size: 12px;
    color: var(--primary);
    background-color: var(--primary-bg);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    display: inline-block;
    margin-top: 8px;
    line-height: 1;
}

.date-select-container {
    margin-top: 12px;
    position: relative;
    width: auto;
}

.date-select-dropdown {
    appearance: none;
    -webkit-appearance: none;
    background-color: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 36px 8px 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
    transition: all 0.2s;
    outline: none;
}

.date-select-dropdown:focus {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.1);
}

.date-select-container::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-25%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-muted);
    pointer-events: none;
}

/* 메인 뷰포트 */
.site-main {
    padding: 20px;
    background-color: var(--bg-main);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 지난 날짜를 보고 있을 때 뜨는 "오늘 정답으로 가기" 안내 배너 */
.stale-notice {
    background-color: #FFF8E1;
    border: 1px solid #FFE08A;
    border-radius: 20px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.015);
    animation: staleNoticeIn 0.35s ease;
}

/* 오늘 퀴즈가 아직 등록 전인 경우엔 경고 대신 차분한 정보 톤으로 */
.stale-notice.is-info {
    background-color: var(--primary-bg);
    border-color: #BEDCFF;
}

/* .stale-notice 가 flex 라서 hidden 속성만으로는 감춰지지 않음 */
.stale-notice[hidden],
.stale-notice-btn[hidden] {
    display: none;
}

@keyframes staleNoticeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.stale-notice-body {
    display: flex;
    align-items: flex-start;
    gap: 9px;
}

.stale-notice-icon {
    font-size: 15px;
    line-height: 1.5;
    flex-shrink: 0;
}

.stale-notice p {
    font-size: 13.5px;
    line-height: 1.55;
    color: #8A6100;
}

.stale-notice.is-info p {
    color: #0B4A8F;
}

.stale-notice p strong {
    font-weight: 800;
}

.stale-notice-btn {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 13px;
    background-color: var(--primary);
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
    transition: transform 0.15s, background-color 0.2s;
}

.stale-notice-btn:active {
    transform: scale(0.98);
    background-color: var(--primary-hover);
}

/* 웰컴/가이드 카드 */
.welcome-card {
    background-color: var(--bg-card);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(0, 0, 0, 0.01);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.015);
}

.welcome-card h2 {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.welcome-card p {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.55;
}

.welcome-card p strong {
    color: var(--text-dark);
}

/* 퀴즈 목록 카드 스타일 */
.quiz-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

/* 데스크톱 웹 환경 반응형 그리드 시스템 도입 */
@media (min-width: 768px) {
    .quiz-container {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
    
    /* 5번째 카드를 가로로 꽉 채워 기하학적으로 완벽한 균형감 선사 */
    .quiz-card:nth-child(5) {
        grid-column: span 2 !important;
    }
}

.quiz-card {
    background-color: var(--bg-card);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(0, 0, 0, 0.01);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.015);
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    width: 100%;
}

.quiz-card.unlocked {
    border-left: 4px solid var(--success);
}

.quiz-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.quiz-card-badge {
    background-color: #F1F5F9;
    color: var(--text-dark);
    font-size: 11.5px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    line-height: 1.2;
}

.quiz-card.unlocked .quiz-card-badge {
    background-color: #E8F8EE;
    color: var(--success);
}

.quiz-card-question {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.5;
    margin-bottom: 16px;
}

.quiz-card-question .blank-box {
    display: inline-block;
    border-bottom: 2px dashed #94A3B8;
    min-width: 52px;
    text-align: center;
    color: var(--primary);
    margin: 0 2px;
    font-weight: 800;
}

/* 정답 패널 */
.quiz-answer-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-main);
    padding: 10px 14px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    height: 46px;
}

.quiz-answer-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

.quiz-answer-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quiz-answer-text {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
    filter: blur(6px);
    user-select: none;
    transition: filter 0.5s cubic-bezier(0.1, 0.8, 0.3, 1);
    display: inline-block;
}

.quiz-card.unlocked .quiz-answer-text {
    filter: blur(0);
    color: var(--success);
    user-select: text;
    cursor: pointer;
    transition: transform 0.2s, filter 0.5s cubic-bezier(0.1, 0.8, 0.3, 1);
}

/* 복사 성공 시 통통 튀는 애니메이션 프레임 */
@keyframes copyBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); color: var(--primary); text-shadow: 0 0 8px rgba(0, 122, 255, 0.3); }
    100% { transform: scale(1); }
}
.copied-text-bounce {
    animation: copyBounce 0.4s ease;
    display: inline-block;
}

/* 복사 버튼 */
.quiz-copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94A3B8;
    transition: color 0.2s, transform 0.1s;
}

.quiz-copy-btn:hover {
    color: var(--primary);
}

.quiz-card.unlocked .quiz-copy-btn {
    color: var(--success);
}

.quiz-copy-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* 자물쇠 잠금 해제 커버 */
.quiz-lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(248, 250, 252, 0.5);
    backdrop-filter: blur(1.5px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: opacity 0.3s;
}

.quiz-card.unlocked .quiz-lock-overlay {
    opacity: 0;
    pointer-events: none;
}

.quiz-lock-overlay svg {
    width: 14px;
    height: 14px;
    margin-right: 4px;
    fill: #475569;
}

/* 하단 액션 카드 */
.action-card {
    background-color: var(--bg-card);
    border-radius: 20px;
    padding: 16px;
    border: 1px solid rgba(0, 0, 0, 0.01);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.015);
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cta-button {
    width: 100%;
    height: 52px;
    background-color: var(--primary);
    color: #FFFFFF;
    border: none;
    border-radius: 14px;
    font-size: 15.5px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(0, 122, 255, 0.2);
    transition: all 0.2s ease;
    line-height: 1;
}

.cta-button:active {
    transform: scale(0.98);
    background-color: var(--primary-hover);
}

.cta-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* 정답 활성화 완료 시 cta 스타일 */
.cta-button.completed {
    background-color: var(--success);
    box-shadow: 0 4px 14px rgba(52, 199, 89, 0.2);
}

.cta-button.completed:active {
    background-color: #28a745;
}

.cta-sub-desc {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.4;
}

/* 정답 공유하기 섹션 */
.utility-card {
    display: flex;
    justify-content: center;
    width: 100%;
}

.action-btn {
    background-color: #FFFFFF;
    border: 1px solid var(--border);
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dark);
    transition: all 0.2s;
}

.action-btn:active {
    background-color: #F8FAFC;
    transform: scale(0.97);
}

.action-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* 푸터 및 공지 */
.disclosure-text {
    font-size: 10px;
    color: #A0A5B1;
    text-align: center;
    line-height: 1.4;
    padding: 0 10px;
}

.site-footer {
    padding: 24px 20px;
    text-align: center;
    border-top: 1px solid var(--border);
    background-color: #FFFFFF;
}

.site-footer p {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* 토스트 팝업 */
.toast-popup {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translate(-50%, 50px);
    background-color: rgba(30, 41, 59, 0.95);
    color: #FFFFFF;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.toast-popup.show {
    transform: translate(-50%, 0);
    opacity: 1;
    visibility: visible;
}

.toast-check-icon {
    width: 16px;
    height: 16px;
    fill: #FFFFFF;
}

/* 인앱 알림 모달 오버레이 */
.inapp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.inapp-modal-content {
    background: #FFFFFF;
    width: 100%;
    max-width: 340px;
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: tsPopUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes tsPopUp {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.inapp-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    color: #94A3B8;
    cursor: pointer;
}

.inapp-modal-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.inapp-modal-content h3 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.inapp-modal-content p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
}

.inapp-modal-steps {
    text-align: left;
    padding-left: 20px;
    font-size: 12.5px;
    color: var(--text-dark);
    margin-bottom: 20px;
    line-height: 1.7;
}

.inapp-modal-steps li strong {
    color: var(--primary);
}

.inapp-modal-action-btn {
    width: 100%;
    height: 44px;
    background-color: var(--primary);
    color: #FFFFFF;
    border: none;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}

/* 로딩 스켈레톤 UI */
.skeleton-card {
    background: #E2E8F0;
    height: 128px;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.skeleton-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: skeleton-load 1.5s infinite;
}

@keyframes skeleton-load {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ── 정답 공개 전 광고 레이어 ──────────────────────────
   링크 단축(index.html)의 광고 모달과 같은 방식.
   250x250 카카오 애드핏을 띄우고, 대기가 끝나거나 광고를 누르면 정답이 열린다. */

#quiz-ad-container {
    width: 250px;
    height: 250px;
    margin: 0 auto;
    background: #F8FAFC;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

/* 광고가 로드되기 전(또는 차단되었을 때) 자리를 지키는 안내 */
#quiz-ad-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px;
    text-align: center;
    background: #F8FAFC;
    color: var(--text-muted);
}

.quiz-ad-fallback-emoji {
    font-size: 28px;
}

#quiz-ad-fallback strong {
    font-size: 14px;
    color: var(--text-dark);
}

.quiz-ad-fallback-sub {
    font-size: 11px;
}

/* 남은 시간 강조 */
#ad-timer-text .ad-timer-count {
    color: var(--brand, #2563EB);
    font-variant-numeric: tabular-nums;
}
