/* 전체 기본 설정 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Gowun Dodum', sans-serif;
}

body {
    background-color: #f4f9f4;
    color: #333;
    padding: 20px 10px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.05);
    padding: 20px;
}

/* 헤더 */
.hero {
    text-align: center;
    padding: 20px 0;
    border-bottom: 2px dashed #e2eee2;
    margin-bottom: 16px;
}

.hero .logo {
    font-size: 3rem;
    margin-bottom: 5px;
}

.hero h1 {
    font-family: 'Gowun Batang', serif;
    color: #2e7d32;
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.hero p {
    font-size: 0.9rem;
    color: #666;
}

/* 중단원 탭 */
.unit-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.unit-tab-btn {
    padding: 12px 8px;
    background-color: #f1f8e9;
    border: 2px solid #dcedc8;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    color: #558b2f;
    transition: all 0.2s;
}

.unit-tab-btn.active {
    background-color: #8bc34a;
    color: white;
    border-color: #7cb342;
}

/* 채팅창 */
.chat-section {
    margin-bottom: 24px;
}

.chat-window {
    max-height: 420px;
    min-height: 100px;
    border: 2px solid #c8e6c9;
    border-radius: 15px;
    background-color: #fafafa;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-window .bot,
.chat-window .user {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 15px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-window .bot {
    background-color: #e8f5e9;
    align-self: flex-start;
    border-top-left-radius: 0;
    color: #1b5e20;
}

.chat-window .bot p {
    margin-top: 6px;
}

.chat-window .user {
    background-color: #4caf50;
    color: white;
    align-self: flex-end;
    border-top-right-radius: 0;
    word-break: break-word;
}

/* 답변 안의 사진 */
.answer-thumb {
    display: block;
    width: 100%;
    max-width: 220px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: zoom-in;
    border: 1px solid #c8e6c9;
}

.answer-thumb-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 220px;
    aspect-ratio: 4 / 3;
    font-size: 2.6rem;
    background: #d7ecd9;
    border-radius: 10px;
    margin-bottom: 8px;
}

.chat-window .bot .cat-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 10px;
    background-color: #c8e6c9;
    color: #1b5e20;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: bold;
}

.addr-link {
    display: inline-block;
    margin-top: 8px;
    color: #1565c0;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: bold;
    background: #e3f2fd;
    padding: 5px 10px;
    border-radius: 8px;
}

.addr-link:hover {
    text-decoration: underline;
}

.addr-link-sub {
    font-weight: normal;
    color: #5a7fa8;
}

.addr-missing {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #999;
}

/* 단원별 콘텐츠 */
.unit-content {
    display: none;
}

.unit-content.active {
    display: block;
}

.content-section h2 {
    font-size: 1.05rem;
    color: #2e7d32;
    margin: 4px 0 6px 0;
}

.guide-text {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.5;
}

/* 보기(장소) 버튼 Grid */
.place-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.place-btn {
    text-align: left;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #dcedc8;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s, transform 0.1s;
}

.place-btn:hover {
    background: #f1f8e9;
}

.place-btn:active {
    transform: scale(0.97);
}

/* 탐구 활동 안내 섹션 */
.howto-section {
    margin-top: 24px;
    border-top: 2px dashed #e2eee2;
    padding-top: 20px;
}

.howto-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.howto-list li {
    background: #f1f8e9;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.88rem;
}

.map-link-btn {
    display: block;
    text-align: center;
    background-color: #2e7d32;
    color: white;
    text-decoration: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 0.9rem;
}

.map-link-btn:hover {
    background-color: #256428;
}

/* 푸터 */
footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 0.8rem;
    color: #999;
}

/* 사진 크게 보기 모달 */
.img-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.img-modal.open {
    display: flex;
}

.img-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
}

.img-modal-box {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    z-index: 1;
}

.img-modal-box img {
    display: block;
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 12px;
    object-fit: contain;
}

.img-modal-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #ffffff;
    color: #2e7d32;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
