/* =============================================
   IQ 패턴 테스트 게임 스타일
   ============================================= */

html { background: #000; }

.iq-body {
    overflow: hidden;
    height: 100dvh;
    max-width: 480px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #f0f0f0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* Game Area */
.iq-game {
    width: 100%;
    height: 100dvh;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: background-color 0.15s;
}

/* Top Bar */
.iq-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    z-index: 10;
    flex-shrink: 0;
}
.iq-back {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}
.iq-back:hover { color: #fff; }
.iq-info-badge {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
}

/* Timer */
.iq-timer-wrap {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}
.iq-timer-bar {
    height: 100%;
    width: 100%;
    border-radius: 0 3px 3px 0;
    transition: width 0.1s linear, background 0.3s;
}

/* Content */
.iq-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    overflow-y: auto;
}

/* ===== States ===== */

/* Intro */
.state-intro { background: #0f0f23; }
.state-intro .iq-content {
    justify-content: flex-start;
    padding-top: 40px;
}

.iq-intro-emoji { font-size: 72px; margin-bottom: 16px; }
.iq-intro-title {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
}
.iq-intro-desc {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    margin-bottom: 24px;
    text-align: center;
}
.iq-intro-desc strong { color: #a78bfa; }

.iq-best {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 10px 18px;
    margin-bottom: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.iq-challenge {
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 24px;
    font-size: 16px;
    color: #ffd700;
    text-align: center;
}
.iq-challenge strong { font-size: 22px; }

.iq-btn-start {
    display: inline-block;
    padding: 16px 48px;
    background: #8B5CF6;
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}
.iq-btn-start:active { transform: scale(0.95); }

/* Playing */
.state-playing { background: #0f0f23; }
.state-playing .iq-content {
    justify-content: flex-start;
    padding-top: 8px;
}

.iq-status-bar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 400px;
    margin-bottom: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}
.iq-status-bar strong {
    color: #fff;
    font-weight: 700;
}

/* 패턴 그리드 */
.iq-pattern-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
    max-width: 300px;
    margin-bottom: 16px;
}
.iq-pattern-cell {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.iq-pattern-cell-question {
    border: 2px dashed rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.08);
}
.iq-question-mark {
    font-size: 32px;
    font-weight: 900;
    color: rgba(139, 92, 246, 0.5);
}

/* 도형 CSS */
.iq-shape {
    transition: all 0.2s;
}
.iq-shape-circle {
    border-radius: 50%;
}
.iq-shape-square {
    border-radius: 4px;
}
.iq-shape-triangle {
    width: 0 !important;
    height: 0 !important;
    border-left: solid transparent;
    border-right: solid transparent;
    border-bottom: solid;
    background: transparent !important;
}
.iq-shape-diamond {
    transform: rotate(45deg);
    border-radius: 4px;
}
.iq-shape-star {
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* 보기 영역 */
.iq-choices-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 8px;
    font-weight: 600;
}
.iq-choices {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 360px;
}
.iq-choice-btn {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    position: relative;
}
.iq-choice-btn:hover {
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.1);
}
.iq-choice-btn:active { transform: scale(0.95); }
.iq-choice-num {
    position: absolute;
    top: 4px;
    left: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 700;
}

.iq-choice-correct {
    border-color: #34D399 !important;
    background: rgba(52, 211, 153, 0.15) !important;
}
.iq-choice-wrong {
    border-color: #EF4444 !important;
    background: rgba(239, 68, 68, 0.15) !important;
}

/* Feedback */
.iq-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: 900;
    z-index: 100;
    animation: iqPop 0.5s ease forwards;
    pointer-events: none;
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
@keyframes iqPop {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Result — 공통 game-result.css 사용 */
.state-result { background: #0f0f23; }
.state-result .iq-content {
    justify-content: flex-start;
    padding-top: 32px;
}

/* Toast */
.iq-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    white-space: nowrap;
}
.iq-toast-show {
    opacity: 1;
    pointer-events: auto;
}

/* Responsive */
@media (max-width: 480px) {
    .iq-pattern-grid { max-width: 260px; }
    .iq-choices { max-width: 320px; }
}
