/* style.css */
:root {
    --bg-page: #F9FAFB;
    --bg-surface: #FFFFFF;
    --bg-panel: #F3F4F6;
    --text-main: #111827;
    --text-muted: #4B5563;
    --border-color: #E5E7EB;
    --accent: #FF3B30;
    --accent-hover: #E02424;
    --toast-bg: rgba(17, 24, 39, 0.9);
    --toast-text: #FFFFFF;
}

[data-theme="dark"] {
    --bg-page: #0F111A;
    --bg-surface: #1C1F2B;
    --bg-panel: #2A2E3D;
    --text-main: #F9FAFB;
    --text-muted: #9AA3B2;
    --border-color: #374151;
    --toast-bg: rgba(255, 255, 255, 0.9);
    --toast-text: #111827;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Pretendard Variable', sans-serif; }
body { background-color: var(--bg-page); color: var(--text-main); min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; transition: background-color 0.3s, color 0.3s; }
.hidden { display: none !important; }

/* 헤더부 (ThumbCheck 공통) */
.header-wrapper { width: 100%; background: var(--bg-surface); border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1050px; margin: 0 auto; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; }
.header-logo-link { text-decoration: none; color: var(--text-main); display: flex; align-items: center; }
.header-utils { display: flex; gap: 8px; align-items: center; }
.hub-btn { display: flex; align-items: center; background: var(--bg-panel); border: 1px solid var(--border-color); color: var(--text-main); text-decoration: none; padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 700; transition: 0.2s; }
.hub-btn:hover { border-color: var(--accent); }
.icon-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; width: 36px; height: 36px; border-radius: 8px; display: flex; justify-content: center; align-items: center; transition: 0.2s; }
.icon-btn:hover { background: var(--bg-panel); color: var(--text-main); }
.icon-btn svg { width: 20px; height: 20px; stroke-width: 2.2px; }

/* 메인 레이아웃 */
.container { max-width: 1050px; margin: 0 auto; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; width: 100%; }
.hero { text-align: center; margin-bottom: 40px; }
.hero-logo-text { font-size: 48px; font-weight: 900; font-style: italic; color: var(--accent); letter-spacing: -2px; margin-bottom: 8px; }
.hero-copy { color: var(--text-muted); font-size: 1.05rem; line-height: 1.6; word-break: keep-all; }

/* 게임 컨테이너 (스마트폰 형태) */
#game-wrapper { position: relative; width: 100%; max-width: 420px; height: 750px; border-radius: 24px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,0.3); border: 8px solid var(--border-color); user-select: none; -webkit-touch-callout: none; touch-action: manipulation; background: #F6F7FB; }
#app-container { width: 100%; height: 100%; position: relative; overflow: hidden; }
.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
.flex-center { display: flex; align-items: center; justify-content: center; flex-direction: column; }

/* 인트로 화면 */
#screen-intro { padding: 24px; text-align: center; color: #10141C; background: #F6F7FB; z-index: 10; }
.game-title { font-size: 28px; font-weight: 900; margin-bottom: 8px; }
.game-subtitle { font-size: 15px; color: #5B6472; line-height: 1.6; margin-bottom: 40px; }
.record-badge { display: inline-block; background: #10141C; color: #0EA968; padding: 8px 16px; border-radius: 20px; font-weight: 800; font-size: 14px; margin-bottom: 24px; }

/* 공통 버튼 */
.btn-primary { background: var(--accent); color: white; border: none; padding: 16px 32px; border-radius: 12px; font-size: 18px; font-weight: 800; cursor: pointer; transition: transform 0.1s; width: 100%; }
.btn-primary:active { transform: scale(0.95); }
.btn-secondary { background: var(--bg-panel); color: var(--text-main); border: 1px solid var(--border-color); padding: 16px 32px; border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer; width: 100%; margin-top: 10px; }
.btn-row { width: 100%; display: flex; flex-direction: column; gap: 8px; }

/* 게임 화면 & 화면 흔들림(Rage) 효과 */
#screen-game { background: #FFFFFF; color: #10141C; z-index: 5; }
#game-canvas { width: 100%; height: 100%; position: relative; }
@keyframes shake { 0% { transform: translate(1px, 1px) rotate(0deg); } 20% { transform: translate(-3px, 0px) rotate(1deg); } 40% { transform: translate(1px, -1px) rotate(1deg); } 60% { transform: translate(-3px, 1px) rotate(0deg); } 80% { transform: translate(-1px, -1px) rotate(1deg); } 100% { transform: translate(1px, -2px) rotate(-1deg); } }
.shake-active { animation: shake 0.3s cubic-bezier(.36,.07,.19,.97) both; }

/* 페널티 토스트 */
#penalty-toast { position: absolute; top: 15%; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; opacity: 0; width: 90%; z-index: 50; }
.rage-text { font-size: 32px; font-weight: 900; color: #FF3B30; text-shadow: 0 4px 10px rgba(255,59,48,0.4); font-style: italic; -webkit-text-stroke: 1px white; }
.combo-text { font-size: 20px; font-weight: 800; color: #FFD60A; margin-top: 4px; text-shadow: 0 2px 5px rgba(0,0,0,0.5); }
@keyframes penaltyFlash { 0% { opacity: 0; transform: translate(-50%, -20%) scale(0.8); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 30% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-50%, -70%); } }
.toast-animate { animation: penaltyFlash 0.8s ease-out forwards; }

/* 결과 화면 */
#screen-result { padding: 24px; color: #10141C; background: #F6F7FB; overflow-y: auto; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
.result-title { font-size: 20px; font-weight: 900; color: #10141C; font-style: italic; margin-bottom: 20px; text-align: center; width: 100%; }
.grade-box { text-align: center; margin-bottom: 20px; width: 100%; }
.grade-score { font-size: 64px; font-weight: 900; font-style: italic; line-height: 1; margin-bottom: 8px; }
.grade-desc { font-size: 15px; font-weight: 700; color: #5B6472; word-break: keep-all; }
.stat-card { background: white; border-radius: 16px; padding: 16px; box-shadow: 0 10px 30px rgba(16,20,28,0.06); margin-bottom: 20px; width: 100%; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed #E3E8F0; }
.final-row { background: #10141C; padding: 16px; border-radius: 12px; margin-top: 10px; border-bottom: none; }
.stat-label { font-size: 14px; font-weight: 700; color: #5B6472; }
.stat-val { font-size: 16px; font-weight: 800; font-family: monospace; }
.final-time { color: #0EA968; font-size: 22px; }

/* 랭킹 폼 */
.ranking-form-box { width: 100%; background: white; padding: 16px; border-radius: 12px; margin-bottom: 20px; border: 1px solid var(--accent); }
.ranking-msg { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 10px; text-align: center; }
.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; padding: 10px; border: 1px solid #E5E7EB; border-radius: 8px; font-size: 14px; outline: none; }
.input-group button { background: var(--accent); color: white; border: none; padding: 0 16px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.ranking-feedback { text-align: center; font-size: 14px; font-weight: 700; margin-top: 10px; color: #0EA968; }

/* 명예의 전당 (Leaderboard) */
.leaderboard-section { width: 100%; max-width: 600px; margin-top: 40px; margin-bottom: 40px; }
.section-title { font-size: 1.4rem; font-weight: 800; text-align: center; margin-bottom: 20px; }
.leaderboard-box { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.02); }
.ranking-table { width: 100%; border-collapse: collapse; text-align: center; }
.ranking-table th { background: var(--bg-panel); padding: 12px; font-size: 0.9rem; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border-color); }
.ranking-table td { padding: 14px 12px; font-size: 0.95rem; font-weight: 600; border-bottom: 1px solid var(--border-color); }
.ranking-table tr:last-child td { border-bottom: none; }
.rank-1 td { color: #E0399B; font-weight: 800; background: rgba(224,57,155,0.05); }
.rank-2 td { color: #3B6CF4; font-weight: 800; }
.rank-3 td { color: #0EA968; font-weight: 800; }

/* 게임 내부 스테이지 UI 조각들 */
.fake-btn, .real-btn { cursor: pointer; }
.ui-dim { background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); width: 100%; height: 100%; position: relative; display: flex; align-items: center; justify-content: center; }
.ui-popup { background: white; width: 85%; border-radius: 16px; padding: 32px 24px; text-align: center; position: relative; box-shadow: 0 20px 40px rgba(0,0,0,0.2); }
.popup-x-btn { position: absolute; width: 32px; height: 32px; line-height: 32px; text-align: center; font-size: 20px; font-weight: bold; }
.web-container { padding: 40px 24px; width: 100%; height: 100%; background: #F6F7FB; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.web-big-btn { padding: 18px; border-radius: 8px; text-align: center; font-size: 17px; font-weight: 800; color: white; }
.web-tiny-link { font-size: 12px; text-decoration: underline; text-align: center; padding: 10px; color: #5B6472; }
.ios-alert { background: rgba(255,255,255,0.9); backdrop-filter: blur(20px); width: 270px; border-radius: 14px; text-align: center; display: flex; flex-direction: column; }
.ios-alert-title { font-weight: 600; font-size: 17px; padding: 20px 16px 4px; color: #10141C; }
.ios-alert-desc { font-size: 13px; padding: 0 16px 20px; line-height: 1.3; color: #10141C; }
.ios-alert-actions { display: flex; border-top: 1px solid rgba(60,60,67,0.36); }
.ios-alert-btn { flex: 1; padding: 12px 0; font-size: 17px; background: transparent; border: none; border-right: 1px solid rgba(60,60,67,0.36); }
.ios-alert-btn:last-child { border-right: none; }
.ios-text-blue { color: #007AFF; }
.ios-text-red { color: #FF3B30; }
.captcha-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.captcha-box { padding: 32px 0; text-align: center; color: white; font-size: 20px; font-weight: 800; border-radius: 8px; }
.terms-box { background:white; padding:16px; border:1px solid #E3E8F0; border-radius:8px; font-size:14px; color:#5B6472; }
.loader-spinner { width:40px; height:40px; border:4px solid rgba(255,255,255,0.3); border-top-color:white; border-radius:50%; animation:spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* SEO Article & Footer */
.ad-container { width: 100%; max-width: 728px; height: 90px; background: var(--bg-panel); border: 1px dashed var(--border-color); display: flex; align-items: center; justify-content: center; margin-bottom: 40px; border-radius: 8px; }
.guide-content { background: var(--bg-surface); padding: 40px; border-radius: 16px; border: 1px solid var(--border-color); width: 100%; max-width: 800px; margin-bottom: 40px; }
.guide-content h2 { font-size: 1.4rem; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 2px solid var(--border-color); }
.guide-content h3 { font-size: 1.1rem; margin: 30px 0 12px 0; }
.guide-content p, .faq-item p { color: var(--text-muted); font-size: 1rem; line-height: 1.7; word-break: keep-all; }
.format-list li { margin-bottom: 10px; font-size: 0.95rem; color: var(--text-muted); }
.faq-item { margin-bottom: 20px; background: var(--bg-panel); padding: 20px; border-radius: 8px; }
.faq-item h4 { font-size: 1.05rem; margin-bottom: 10px; color: var(--accent); }
.footer { text-align: center; padding: 0 20px 40px; font-size: 0.85rem; color: var(--text-muted); width: 100%; }
.footer-links a { color: var(--text-muted); margin-left: 10px; }

/* 토스트 */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--toast-bg); color: var(--toast-text); padding: 12px 24px; border-radius: 30px; font-weight: 600; font-size: 0.95rem; opacity: 0; transition: 0.3s; z-index: 1000; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.toast.show { opacity: 1; transform: translate(-50%, -10px); }

@media (max-width: 600px) {
    #game-wrapper { height: 75vh; border-width: 4px; border-radius: 16px; }
    .hero-logo-text { font-size: 38px; }
    .guide-content { padding: 25px 20px; }
}
