/* =========================================
   메인 콘텐츠 래퍼 (안쪽 테두리 추가 버전)
   ========================================= */
.main-content-wrapper {
    position: relative;
    padding: 40px 24px;
    background: linear-gradient(135deg, #1a2332 0%, #0f1219 100%);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    min-height: 580px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

/* 도승하 평가사 스타일의 장식용 테두리 */
.main-content-wrapper::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 4px double rgba(212, 175, 55, 0.4); /* 금색 이중 테두리 */
    border-radius: 16px;
    pointer-events: none;
    z-index: 1;
}

.main-content-wrapper::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    border: 1px solid rgba(212, 175, 55, 0.15); /* 아주 연한 안쪽 테두리 */
    border-radius: 12px;
    pointer-events: none;
    z-index: 1;
}

.category-container {
    position: relative;
    z-index: 10;
}

/* =========================================
   헤더 (타이틀) - 상단 중앙
   ========================================= */
.main-header {
    text-align: center;
    margin-bottom: 32px;
    margin-top: 10px;
}

.game-title {
    line-height: 1.3;
    margin: 0;
}

.title-line1 {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 4px;
}

.title-main {
    display: block;
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(to right, #fde68a, #fbbf24, #fde68a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.9; }
    50% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 0.9; }
}

.title-sub {
    display: block;
    font-family: 'serif';
    font-style: italic;
    font-size: 14px;
    color: #94a3b8;
    margin-top: 12px;
}

/* =========================================
   개념연습 / 빈출OX연습 카드
   ========================================= */
.law-type-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.mode-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.law-type-card {
    background: #1e293b;
    border: 2px solid #334155;
    border-radius: 16px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.law-type-card:hover {
    border-color: #6366f1;
    background: rgba(49, 46, 129, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.3);
}

.law-type-card[data-mode="CONCEPT"] {
    background: linear-gradient(to bottom right, #312e81, #1e293b);
    border-color: rgba(99, 102, 241, 0.4);
}

.law-type-card[data-mode="ARTICLE_OX"], .law-type-card[data-mode="ARTICLE"] {
    background: linear-gradient(to bottom right, #1e3a8a, #1e293b);
    border-color: rgba(59, 130, 246, 0.4);
}

.card-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.card-title {
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 4px;
}

.card-desc {
    font-size: 12px;
    color: #94a3b8;
}

/* =========================================
   도전! 랜덤 버튼들 (그리드 내부로 이동)
   ========================================= */
.challenge-btn {
    display: flex;
    flex-direction: column; /* 세로로 쌓아서 글자가 정중앙에 오도록 개선 */
    align-items: center;
    justify-content: center;
    background: #8b1111; /* 첨부 이미지의 짙은 빨간색 */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    color: white;
    width: 100%;
}

.challenge-btn:hover {
    background: #a51414;
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.challenge-icon {
    font-size: 20px;
    margin-right: 0;
    margin-bottom: 4px; /* 아이콘을 글자 위로 배치 */
}

.challenge-text {
    text-align: center;
}

.challenge-title {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 2px;
}

.challenge-desc {
    font-size: 10px;
    color: #fde68a; /* 노란색 포인트로 통일 */
}

/* #btn-random-article .challenge-desc 제거 (상위 클래스에서 처리) */

/* =========================================
   하단 버튼들 (오답통 / 건의하기)
   ========================================= */
.bottom-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.bottom-btn {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 12px 14px;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.bottom-btn:hover {
    background: #334155;
    border-color: #6366f1;
    color: #ffffff;
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 18px;
}

.btn-text-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.btn-main-text {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.btn-sub-text {
    font-size: 9px;
    color: #94a3b8;
    font-weight: 500;
    margin-top: 2px;
}

/* =========================================
   회원가입/로그인 섹션 및 링크
   ========================================= */
.auth-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.auth-btn {
    width: 80%;
    margin-left: auto;
    margin-right: auto;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    border: 1px solid #4338ca;
    border-radius: 14px;
    padding: 14px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.auth-btn:hover {
    background: linear-gradient(135deg, #312e81 0%, #4338ca 100%);
    border-color: #6366f1;
    transform: translateY(-2px);
}

.signup-link-wrapper {
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
}

.link-btn {
    background: none;
    border: none;
    color: #6366f1;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    margin-left: 5px;
}

/* 카페 홍보 문구 스타일 (더 눈에 띄게 강조) */
.cafe-info-section {
    width: 80%;
    margin-left: auto;
    margin-right: auto;
    margin-top: 50px;
    padding: 15px 12px;
    background: rgba(212, 175, 55, 0.15);
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 14px;
    text-align: center;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

.cafe-info-section p {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    margin: 0;
    line-height: 1.6;
    word-break: keep-all;
}

.cafe-info-section a {
    color: #fcd34d;
    text-decoration: underline;
    font-weight: 800;
    margin-left: 4px;
    transition: all 0.2s;
    display: inline-block;
}

.cafe-info-section a:hover {
    color: #ffffff;
    transform: scale(1.05);
}

/* 탈퇴하기 버튼 스타일 */
.footer-section {
    margin-top: 40px;
    text-align: center;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.footer-section:hover {
    opacity: 1;
}

.tiny-btn {
    background: none;
    border: none;
    color: #475569;
    font-size: 10px;
    cursor: pointer;
    text-decoration: underline;
}

/* 기타 추가 버튼 */
.extra-buttons {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.extra-btn {
    width: 80%;
    background: #0f172a;
    border: 1px dashed #334155;
    border-radius: 10px;
    padding: 10px;
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.extra-btn:hover {
    border-color: #6366f1;
    color: #ffffff;
    background: #1e293b;
}

/* =========================================
   모달 공통 스타일 (인증/관리자용)
   ========================================= */
.auth-modal {
    max-width: 400px !important;
    padding: 30px !important;
}

.auth-title {
    margin-bottom: 25px;
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-group label {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 700;
}

.input-group input, .auth-select, .auth-form textarea {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 12px;
    color: white;
    font-size: 14px;
}

.auth-submit-btn {
    background: #6366f1;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    margin-top: 10px;
}

.auth-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 13px;
}

/* 관리자 테이블 스타일 */
.admin-modal-content {
    max-width: 95vw !important;
    width: 1000px !important;
    max-height: 90vh;
    overflow-y: auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #334155;
}

.admin-tab {
    background: none;
    border: none;
    padding: 10px 20px;
    color: #94a3b8;
    cursor: pointer;
}

.admin-tab.active {
    color: #6366f1;
    border-bottom: 2px solid #6366f1;
}

.table-wrapper {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}

.admin-table th, .admin-table td {
    border: 1px solid #334155;
    padding: 12px;
    text-align: left;
}

.admin-table th {
    background: #1e293b;
    color: #94a3b8;
}

.admin-stats {
    margin-bottom: 15px;
    font-weight: 700;
    color: #fbbf24;
}

.force-del-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.check-btn {
    background: #10b981;
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
}

.delete-btn {
    background: #475569;
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
}

.close-icon-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

/* =========================================
   법률 선택 화면 (기존 유지)
   ========================================= */
#law-screen {
    width: 100%;
}

.back-btn {
    background: transparent;
    border: 1px solid #475569;
    border-radius: 12px;
    padding: 10px 20px;
    font-size: 14px;
    color: #fbbf24;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 20px;
    transition: all 0.2s;
    display: block;
}

.back-btn:hover {
    background-color: #1e293b;
    border-color: #fbbf24;
}

/* 3x3 법률 그리드 (Indigo 스타일로 고도화) */
.law-list-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2열 배열로 복구 */
    gap: 12px;
    padding-bottom: 30px;
    margin-top: 10px;
    width: 80%; /* 컨테이너 너비를 80%로 축소 */
    margin-left: auto;
    margin-right: auto;
}

.law-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 16px 12px;
    aspect-ratio: auto; /* 정사각형 해제하여 직사각형으로 변경 */
    font-size: 14px; /* 13px -> 14px로 확대 */
    font-weight: 700;
    color: #f1f5f9;
    text-align: center;
    word-break: break-all;
    line-height: 1.4;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 80px; /* 최소 높이 설정으로 직사각형 형태 유지 */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.law-card:hover {
    border-color: #6366f1;
    background: #1e1b4b; /* Indigo deep */
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.law-card:active {
    transform: scale(0.97);
}

.law-card span {
    display: block;
    width: 100%;
}

/* =========================================
   화면 헤더 (돌아가기 + 홈으로 버튼)
   ========================================= */
.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* 윗윗 줄을 맞추기 위해 flex-start 적용 */
    margin-bottom: 25px;
    margin-top: 0;
    padding: 0;
    width: 100%;
}

.screen-header .back-btn, .screen-header .home-btn {
    width: 95px; /* 대칭을 위해 고정 너비 부여 */
    height: 36px; /* 높이 고정으로 더 정갈하게 */
    padding: 0;
    margin: 0; /* 불필요한 마진 제거 */
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: 8px;
    background: #1a1f2c;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: normal;
}

.screen-header .back-btn:hover, .screen-header .home-btn:hover {
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.1);
    color: #d4af37;
    transform: translateY(-2px);
}

.back-btn:hover, .home-btn:hover {
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.1);
    color: #d4af37;
}

.back-btn:active, .home-btn:active {
    transform: scale(0.95);
}