/* ============================================
   🎮 게이미피케이션 만다라트 - 스타일시트
   ============================================ */

/* CSS 변수 - 디자인 시스템 */
:root {
    /* 색상 팔레트 */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #252542;
    --bg-card: #1e1e35;

    /* 강조 색상 */
    --accent-primary: #6c5ce7;
    --accent-secondary: #a29bfe;
    --accent-gradient: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);

    /* 게임 색상 */
    --xp-color: #00d4aa;
    --level-color: #ffd700;
    --complete-color: #00ff88;
    --badge-color: #ff6b6b;

    /* 중앙 그리드 색상 */
    --center-bg: linear-gradient(135deg, #2d1b69 0%, #11998e 100%);
    --center-glow: rgba(108, 92, 231, 0.4);

    /* 텍스트 색상 */
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --text-muted: #6c6c8a;

    /* 그리드 색상 (8개 영역) */
    --area-1: #ff6b6b;
    --area-2: #ffa502;
    --area-3: #ffd700;
    --area-4: #00d4aa;
    --area-5: #00b4d8;
    --area-6: #6c5ce7;
    --area-7: #a29bfe;
    --area-8: #fd79a8;

    /* 크기 */
    --cell-size: clamp(30px, 9vw, 80px);
    /* 모바일대응: 최소값 하향 */
    --cell-gap: clamp(1px, 0.4vw, 4px);
    --area-gap: clamp(2px, 0.8vw, 8px);
    --border-radius: clamp(4px, 0.8vw, 12px);

    /* 애니메이션 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* 리셋 및 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse at top, rgba(108, 92, 231, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(162, 155, 254, 0.1) 0%, transparent 50%);
}

/* ============================================
   헤더 / 스탯 바
   ============================================ */
.stat-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(108, 92, 231, 0.3);
    z-index: 100;
    padding: 12px 24px;
}

.stat-bar-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
    animation: pulse 2s ease-in-out infinite;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats {
    display: flex;
    align-items: center;
    gap: 32px;
    flex: 1;
    justify-content: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 24px;
    font-weight: 900;
}

.stat-item.level .stat-value {
    color: var(--level-color);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.stat-item.progress .stat-value {
    color: var(--xp-color);
}

/* XP 바 */
.stat-item.xp {
    min-width: 200px;
}

.xp-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.xp-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--xp-color), #00ffcc);
    border-radius: 4px;
    transition: width var(--transition-normal);
    position: relative;
}

.xp-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

.xp-text {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* 헤더 버튼 */
.header-actions {
    display: flex;
    gap: 12px;
}

.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon {
    font-size: 18px;
}

.btn-ai {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
}

.btn-ai:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4);
}

.btn-rewards {
    background: linear-gradient(135deg, #ffa502, #ff6b6b);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 165, 2, 0.3);
}

.btn-rewards:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 165, 2, 0.4);
}

.btn-reset {
    background: linear-gradient(135deg, #ff6b6b, #fd79a8);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.btn-tutorial {
    background: #ffd700 !important;
    /* 형광 노란색 */
    color: #000000 !important;
    /* 검은색 글씨 */
    border: 2.5px solid #ffffff !important;
    padding: 0;
    width: 46px !important;
    height: 46px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    font-size: 26px !important;
    font-weight: 900 !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6) !important;
    cursor: pointer;
    z-index: 1000;
}

.btn-tutorial:hover {
    background: #ffffff !important;
    transform: scale(1.1);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-card);
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

/* ============================================
   메인 컨테이너
   ============================================ */
.main-container {
    padding-top: 120px;
    /* 헤더 높이 확보 */
    padding-bottom: 40px;
    padding-left: 10px;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
}

/* ============================================
   만다라트 그리드
   ============================================ */
.mandalart-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: var(--area-gap);
    padding: clamp(8px, 2vw, 20px);
    background: var(--bg-secondary);
    border-radius: 20px;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    max-width: 100%;
    /* 화면 밖으로 나가지 않게 함 */
    margin: 0 auto;
}

.area {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: var(--cell-gap);
    padding: 8px;
    border-radius: var(--border-radius);
    background: var(--bg-card);
    position: relative;
    transition: all var(--transition-normal);
}

.area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    opacity: 0.8;
}

/* 각 영역 색상 */
.area[data-area="0"]::before {
    background: var(--area-1);
}

.area[data-area="1"]::before {
    background: var(--area-2);
}

.area[data-area="2"]::before {
    background: var(--area-3);
}

.area[data-area="3"]::before {
    background: var(--area-4);
}

.area[data-area="4"]::before {
    background: var(--center-bg);
    height: 100%;
    opacity: 0.3;
    border-radius: var(--border-radius);
}

.area[data-area="5"]::before {
    background: var(--area-5);
}

.area[data-area="6"]::before {
    background: var(--area-6);
}

.area[data-area="7"]::before {
    background: var(--area-7);
}

.area[data-area="8"]::before {
    background: var(--area-8);
}

/* 중앙 영역 특별 스타일 */
.area[data-area="4"] {
    background: linear-gradient(135deg, rgba(45, 27, 105, 0.5), rgba(17, 153, 142, 0.3));
    box-shadow:
        0 0 40px var(--center-glow),
        inset 0 0 30px rgba(108, 92, 231, 0.1);
}

.area:hover {
    transform: scale(1.02);
    z-index: 10;
}

/* 셀 스타일 */
.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    background: var(--bg-tertiary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    word-break: keep-all;
    line-height: 1.3;
}

.cell:hover {
    background: rgba(108, 92, 231, 0.2);
    color: var(--text-primary);
    transform: scale(1.05);
}

.cell.empty {
    color: var(--text-muted);
    font-style: italic;
}

.cell.empty::after {
    content: '+';
    font-size: 20px;
    font-weight: 300;
    opacity: 0.5;
}

.cell:not(.empty)::after {
    content: none;
}

/* 중앙 셀 (메인 목표) */
.cell.center-goal {
    background: var(--accent-gradient);
    color: white;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 0 30px rgba(108, 92, 231, 0.5);
}

.cell.center-goal:hover {
    transform: scale(1.08);
    box-shadow: 0 0 50px rgba(108, 92, 231, 0.7);
}

/* 세부 목표 셀 */
.cell.sub-goal {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.3), rgba(162, 155, 254, 0.2));
    color: var(--accent-secondary);
    font-weight: 600;
    border: 1px solid rgba(108, 92, 231, 0.3);
}

/* 완료된 셀 */
.cell.completed {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 212, 170, 0.2));
    color: var(--complete-color);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.cell.completed::before {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 10px;
    color: var(--complete-color);
    opacity: 0.8;
}

/* 완료 애니메이션 */
.cell.completing {
    animation: completeFlash 0.6s ease;
}

@keyframes completeFlash {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.2);
        background: rgba(0, 255, 136, 0.5);
    }

    100% {
        transform: scale(1);
    }
}

/* 셀 글로우 효과 */
.cell.glow {
    animation: cellGlow 2s ease-in-out infinite;
}

@keyframes cellGlow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(108, 92, 231, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(108, 92, 231, 0.6);
    }
}

/* ============================================
   모달
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(108, 92, 231, 0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--bg-tertiary);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--badge-color);
    color: white;
}

.modal-body {
    padding: 24px;
}

.modal-description {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 24px;
    border-top: 1px solid var(--bg-tertiary);
}

/* 폼 스타일 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group small {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-group small a {
    color: var(--accent-secondary);
    text-decoration: none;
}

.form-group small a:hover {
    text-decoration: underline;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* AI 로딩 */
.ai-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 30px;
    color: var(--text-secondary);
}

.ai-loading.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   뱃지 그리드
   ============================================ */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    text-align: center;
    transition: all var(--transition-fast);
}

.badge-item.locked {
    opacity: 0.4;
    filter: grayscale(100%);
}

.badge-item:not(.locked):hover {
    transform: translateY(-4px);
    background: rgba(108, 92, 231, 0.2);
}

.badge-item .badge-icon {
    font-size: 36px;
}

.badge-item .badge-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.badge-item .badge-desc {
    font-size: 10px;
    color: var(--text-muted);
}

/* ============================================
   뱃지 획득 알림
   ============================================ */
.badge-notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a1a2e;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(255, 215, 0, 0.4);
    transform: translateX(120%);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1001;
}

.badge-notification.show {
    transform: translateX(0);
}

.badge-notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge-notification .badge-icon {
    font-size: 32px;
}

.badge-notification .badge-title {
    display: block;
    font-size: 12px;
    font-weight: 500;
    opacity: 0.8;
}

.badge-notification .badge-name {
    font-size: 16px;
    font-weight: 700;
}

/* ============================================
   레벨업 오버레이
   ============================================ */
.level-up-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.level-up-overlay.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.level-up-content {
    text-align: center;
    animation: levelUpBounce 0.8s ease;
}

.level-up-icon {
    font-size: 80px;
    animation: levelUpGlow 1s ease infinite;
}

.level-up-text {
    font-size: 48px;
    font-weight: 900;
    color: var(--level-color);
    text-shadow: 0 0 50px rgba(255, 215, 0, 0.8);
    margin-top: 16px;
}

.level-up-new-level {
    font-size: 24px;
    color: var(--text-secondary);
    margin-top: 8px;
}

@keyframes levelUpBounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes levelUpGlow {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.5);
    }
}

/* ============================================
   셀 편집 팝업
   ============================================ */
.cell-popup {
    position: fixed;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(108, 92, 231, 0.3);
    z-index: 500;
    display: none;
    min-width: 250px;
}

.cell-popup.active {
    display: block;
    animation: popupIn 0.2s ease;
}

@keyframes popupIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.cell-popup textarea {
    width: 100%;
    height: 80px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    resize: none;
}

.cell-popup textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.cell-popup-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
}

/* ============================================
   애니메이션
   ============================================ */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ============================================
   보상 버튼
   ============================================ */
.btn-rewards {
    background: linear-gradient(135deg, #ff6b6b, #ffa502);
    color: white;
}

.btn-rewards:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

/* ============================================
   보상 모달
   ============================================ */
.modal-large {
    max-width: 600px;
}

.rewards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 20px;
}

.reward-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 10px;
}

.reward-item .reward-label {
    flex: 0 0 120px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.reward-item input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid transparent;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-primary);
}

.reward-item input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* ============================================
   보상 축하 알림
   ============================================ */
.reward-celebration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.reward-celebration.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.reward-celebration-content {
    text-align: center;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    padding: 40px 60px;
    border-radius: 24px;
    box-shadow:
        0 30px 100px rgba(255, 107, 107, 0.3),
        0 0 0 2px rgba(255, 165, 2, 0.3);
    animation: celebrationBounce 0.6s ease;
}

.reward-celebration .reward-icon {
    font-size: 80px;
    animation: celebrationPulse 1s ease infinite;
}

.reward-celebration .reward-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--level-color);
    margin: 16px 0 8px;
}

.reward-celebration .reward-text {
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(135deg, #ff6b6b, #ffa502);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 24px;
}

@keyframes celebrationBounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes celebrationPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* 초기화 버튼 */
.btn-reset {
    background: linear-gradient(135deg, #fab1a0, #ff7675);
    color: white;
}

.btn-reset:hover {
    box-shadow: 0 4px 15px rgba(255, 118, 117, 0.4);
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid #ff7675;
    color: #ff7675;
    margin-top: 8px;
    font-size: 13px;
    padding: 8px;
}

.btn-danger-outline:hover {
    background: rgba(255, 118, 117, 0.1);
    transform: translateY(-1px);
}

.btn-tutorial {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-tutorial:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* ============================================
   반응형
   ============================================ */
/* ============================================
   튜토리얼
   ============================================ */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    /* 하이라이트 그림자가 배경을 채우므로 투명하게 처리 */
    z-index: 4000;
    /* 하이라이트 박스(3001)보다 훨씬 높게 설정하여 그림자 위로 올림 */
    display: none;
    align-items: center;
    justify-content: center;
}

.tutorial-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.tutorial-card {
    background: #ffffff !important;
    /* 완전한 순백색 */
    color: #000000 !important;
    /* 텍스트는 선명하게 검은색 */
    padding: 35px;
    border-radius: 28px;
    text-align: center;
    max-width: 340px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8), 0 0 0 8px #6c5ce7;
    /* 훨씬 더 두껍고 명확한 보라색 테두리 */
    position: absolute;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    animation: modalSlideIn 0.3s ease;
    top: 50%;
    transform: translateY(-50%);
    z-index: 4001;
    /* 그림자 위에서 쨍하게 보이도록 설정 */
}

/* 스마트 위치 조정 클래스 */
.tutorial-card.pos-top {
    top: 15%;
    bottom: auto;
    transform: none;
}

.tutorial-card.pos-bottom {
    top: auto;
    bottom: 15%;
    transform: none;
}

.tutorial-icon {
    font-size: 40px;
    margin-bottom: 16px;
    animation: celebrationPulse 1s infinite alternate;
}

.tutorial-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 16px;
    color: #000000 !important;
    /* 제목도 확실한 검은색 */
}

.tutorial-desc {
    font-size: 16px;
    font-weight: 500;
    color: #333333 !important;
    /* 설명은 짙은 회색/검정 */
    margin-bottom: 24px;
    line-height: 1.6;
    margin-bottom: 24px;
    line-height: 1.6;
    word-break: keep-all;
}

.tutorial-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.tutorial-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    transition: all 0.3s ease;
}

.step-dot.active {
    background: var(--accent-primary);
    transform: scale(1.2);
}

.tutorial-skip {
    display: block;
    margin: 16px auto 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
}

/* 튜토리얼 하이라이트 효과 */
.tutorial-highlight {
    position: relative;
    z-index: 3001;
    box-shadow: 0 0 0 5000px rgba(0, 0, 0, 0.85);
    /* 배경 어둡게 */
    border-radius: 12px;
    animation: highlightPulse 1.5s infinite;
    pointer-events: none;
    /* 클릭 통과 */
}

@keyframes highlightPulse {
    0% {
        box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.5), 0 0 0 5000px rgba(0, 0, 0, 0.85);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(108, 92, 231, 0), 0 0 0 5000px rgba(0, 0, 0, 0.85);
    }

    100% {
        box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.5), 0 0 0 5000px rgba(0, 0, 0, 0.85);
    }
}

@media (max-width: 900px) {
    .stat-bar-inner {
        flex-wrap: wrap;
        gap: 12px;
        padding: 5px;
    }

    .stats {
        order: 3;
        width: 100%;
        justify-content: space-around;
        gap: 15px;
    }

    .stat-item.xp {
        min-width: 120px;
        flex: 1;
    }
}

@media (max-width: 600px) {
    :root {
        --cell-size: clamp(28px, 10vw, 40px);
        --area-gap: 3px;
        --cell-gap: 1px;
    }

    .main-container {
        padding-top: 150px;
        /* 3단 헤더 대응 */
    }

    .area {
        padding: 4px;
    }

    .cell {
        font-size: 8px;
        padding: 2px;
        border-radius: 4px;
    }

    .logo-text {
        display: none;
    }

    .btn {
        padding: 8px 12px;
    }

    .btn span:not(.btn-icon) {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}.  
     .form-row {
        grid-template-columns: 1fr;
    }
}

/* 아주 작은 화면 대응 (iPhone SE 등) */
@media (max-width: 360px) {
    :root {
        --cell-size: 8.5vw;
    }
    
    .cell {
        font-size: 7.5px;
    }
}
