:root {
    /* 세련된 다크 그레이 & 웜 오렌지 테마 */
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --header-bg: #2c3e50;
    --text-main: #2c3e50;
    --text-sub: #7f8c8d;
    --accent-color: #e67e22; /* 세련된 펌킨 오렌지 */
    --accent-hover: #d35400;
    --border-color: #ecf0f1;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* === 헤더 디자인 === */
header {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

header .status-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

header .user-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

/* 세련된 로그인 버튼 */
.btn-login {
    background-color: var(--text-main);
    color: white;
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 10px rgba(44, 62, 80, 0.2);
}

.btn-login:hover {
    background-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(230, 126, 34, 0.3);
}

.btn-logout {
    background-color: transparent;
    color: var(--text-sub);
    border: 1px solid var(--border-color);
    padding: 6px 15px;
    border-radius: 50px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background-color: #f1f1f1;
    color: var(--text-main);
}

/* === 메인 컨텐츠 === */
main {
    flex: 1;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.intro-section {
    margin-bottom: 3rem;
    text-align: center;
}

.intro-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.intro-desc {
    color: var(--text-sub);
    font-size: 1.1rem;
}

/* 게임 리스트 그리드 */
.game-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

/* 게임 카드 디자인 */
.game-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    border: none;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    position: relative;
    height: 100%;
}

.card-accent-bar {
    height: 8px;
    background: linear-gradient(90deg, var(--accent-color), #f39c12);
    width: 100%;
}

.card-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.game-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: var(--text-main);
}

.game-desc {
    font-size: 1rem;
    color: var(--text-sub);
    margin-bottom: 2rem;
    line-height: 1.6;
    flex: 1;
}

/* 게임 카드 하단 컨트롤 영역 */
.game-controls {
    display: flex;
    justify-content: space-between; /* 요소들을 양 끝으로 배치 */
    align-items: center;
    margin-top: auto;
    padding-top: 1.5rem;
}

/* 기억 지우기 버튼 (우측) */
.reset-link {
    font-size: 0.8rem;
    color: #bdc3c7;
    cursor: pointer;
    text-decoration: underline;
    transition: all 0.2s;
    opacity: 0.8;
}

/* 이야기 시작하기 링크 (기존 play-link 보완) */
.play-link {
    display: inline-block;
    color: var(--accent-color);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
}

/* 1. 기본 카드 호버 효과 */
.game-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

/* 2. 카드 호버 시 '이야기 시작하기' 강조 */
.game-card:hover .play-link {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* 3. [핵심] 기억 지우기 버튼에 마우스 오버 시 카드 전체 효과 취소 */
.game-card:has(.reset-link:hover) {
    transform: none !important; /* 위로 들리는 효과 제거 */
    box-shadow: var(--shadow-soft) !important; /* 기본 그림자로 고정 */
    cursor: default; /* 카드 전체 클릭 불가능한 느낌 주기 */
}

/* 4. 기억 지우기 버튼 호버 시 '이야기 시작하기' 텍스트 강조 제거 */
.game-card:has(.reset-link:hover) .play-link {
    text-decoration: none !important;
    color: var(--accent-color) !important;
}

/* 5. 기억 지우기 버튼 자체의 호버 스타일 */
.reset-link:hover {
    color: #e74c3c !important; /* 빨간색 강조 */
    text-decoration: underline !important;
    opacity: 1;
}

/* === [중요 수정] 모달(팝업) 디자인 === */
.modal-overlay {
    display: none; /* JS에서 flex로 변경 시 즉시 보이도록 설정 */
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* 배경을 조금 더 어둡게 하여 가독성 확보 */
    z-index: 9999; /* 다른 요소들보다 무조건 위에 오도록 높임 */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);

    /* 기존의 opacity: 0 제거함 (JS 단순 호환성 위해) */
}

/* .modal-overlay.show 관련 코드는 JS가 클래스를 추가하지 않으므로 제거하거나 무시됩니다.
   대신 display: flex가 되면 바로 보이게 됩니다. */

.modal-card {
    background-color: #fff;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    width: 90%;
    max-width: 380px;
    text-align: center;
    /* 애니메이션 제거하고 심플하게 유지 */
    border: 1px solid #eee;
}

.modal-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.modal-desc {
    margin-bottom: 2rem;
    color: #666;
    font-size: 1rem;
    line-height: 1.5;
    word-break: keep-all;
}

/* 구글 버튼 및 공통 버튼 스타일 수정 */
.google-btn, .confirm-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 52px;             /* 높이 고정으로 시각적 통일 */
    border-radius: 12px;
    font-size: 1rem;          /* 글자 크기 동일하게 설정 */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;             /* 기본 테두리 제거 */
}

/* 로그인하고 시작하기 (메인 강조 버튼) */
.confirm-btn {
    background-color: var(--text-main);
    color: white;
}
.confirm-btn:hover {
    background-color: var(--accent-color);
}

/* 그냥 시작하기 (보조 버튼 - 기존 google-btn 스타일 활용) */
#continueAsGuestBtn {
    background-color: #f1f1f1;
    color: #666;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
#continueAsGuestBtn:hover {
    background-color: #e8e8e8;
    color: #333;
}

/* 기존 구글 로그인 버튼 (아이콘 있는 경우) 유지 */
.google-btn {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    color: #1f1f1f;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.google-btn img {
    width: 20px;
    margin-right: 12px;
    flex-shrink: 0; /* 아이콘 크기 고정 */
}

/* 닉네임 인풋 */
.nickname-input {
    width: 100%;
    padding: 14px;
    margin-bottom: 1.2rem;
    border: 2px solid #f1f1f1;
    border-radius: 12px;
    font-size: 1rem;
    text-align: center;
    transition: border-color 0.2s;
}
.nickname-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.confirm-btn {
    width: 100%;
    background-color: var(--text-main);
    color: white;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.confirm-btn:hover {
    background-color: var(--accent-color);
}

/* 나중에 하기 링크 */
.close-link {
    display: inline-block;
    margin-top: 1.2rem;
    font-size: 0.9rem;
    color: #999;
    cursor: pointer;
    text-decoration: underline; /* 명확하게 링크임을 표시 */
    transition: all 0.2s;
}
.close-link:hover {
    color: var(--text-sub);
}

footer {
    /*border-top: 1px solid #e0e0e0; !* 얇은 회색 선 *!*/
    padding-top: 20px;             /* 선과 글자 사이의 간격 */
    margin-top: 20px;              /* 본문(위쪽) 내용과의 간격 */

    text-align: center;
    color: #bdc3c7;
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    main { padding: 2rem 1rem; }
    .intro-title { font-size: 1.6rem; }
    .game-list { grid-template-columns: 1fr; }
}

/* 소셜 아이콘 */
.footer-social {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.footer-social a {
    text-decoration: none;
    border: none;
    outline: none;
    display: inline-block;
    transition: transform 0.2s, opacity 0.2s;
    opacity: 0.8;
}

.footer-social a:hover {
    transform: scale(1.1);
    opacity: 1;
}

.footer-privacy {
    display: flex;             /* 가로 배치 핵심 */
    justify-content: center;   /* 가운데 정렬 */
    align-items: center;       /* 세로 중앙 정렬 */
    gap: 10px;                 /* 요소 사이 간격 */

    margin-top: 30px;          /* 위쪽 여백 */
    padding-top: 20px;         /* 선과 내용 사이 여백 */
    border-top: 1px solid #e0e0e0; /* 위에 얇은 선 긋기 */

    color: #888;               /* 글자색 통일 */
    font-size: 0.8rem;         /* 글자 크기 */
    padding-bottom: 25px;
}

.footer-privacy a {
    text-decoration: none;
    color: #888;
    transition: color 0.2s;
}

.footer-privacy a:hover {
    color: #333; /* 마우스 올리면 진해지게 */
}

.social-icon {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    display: block;
}

/* style.css 하단이나 적절한 위치에 추가/수정 */

/* 로그인 후 상단 영역 레이아웃 */
.logged-in-container {
    display: flex;
    align-items: center;
    gap: 12px; /* 이름과 로그아웃 버튼 사이 간격 */
}

/* 유저 닉네임 텍스트 */
.user-name-display {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

/* 로그아웃 버튼 (기존 btn-logout 수정 및 보완) */
.btn-logout {
    background-color: transparent;
    color: var(--text-sub);
    border: 1px solid #dcdcdc;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background-color: #f1f1f1;
    color: var(--text-main);
    border-color: #bbb;
}

/* style.css 맨 아래에 추가하세요 */

#toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-message {
    background-color: rgba(44, 62, 80, 0.9); /* 짙은 남색 반투명 */
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(20px);
    animation: toast-in-out 3s forwards; /* 3초 동안 떴다 사라짐 */
}

/* 등장 및 퇴장 애니메이션 */
@keyframes toast-in-out {
    0% { opacity: 0; transform: translateY(20px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}