body {
    margin: 0;
    background-color: #f0f0f0;
    font-family: sans-serif;
    display: flex;
    justify-content: center;
}

/* --- 전체 레이아웃 --- */
.page-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 600px;
    padding: 10px; 
    box-sizing: border-box;
    gap: 20px;
}

/* --- 본문 영역 --- */
.container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: white;
    border: 2px solid #092207;
    box-sizing: border-box;
}

/* --- 상단 랜덤 이미지 3개 영역 (핵심 수정) --- */
.main {
    display: flex;
    flex-direction: row; 
    justify-content: space-between; /* 이미지들 사이 간격을 균등하게 */
    align-items: center;
    width: 100%;
    height: auto; 
    padding: 10px 5px; /* 양옆 여백을 살짝 줌 */
    padding-bottom: 0px;
    gap: 3px; /* 이미지 사이의 확실한 간격 */
    box-sizing: border-box;
    overflow: hidden; /* 혹시나 넘치는 경우를 대비해 숨김 처리 */
}

.list {
    background-color: #133309;
    width: 100%;
    box-sizing: border-box;
}

ul.nav {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
}

ul.nav > li {
    position: relative;
    line-height: 3em;
    flex: 1;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

ul.nav > li:last-child {
    border-right: none;
}

ul.nav > li > a {
    color: #fff;
    text-decoration: none;
    font-size: clamp(12px, 3.5vw, 15px);
    font-weight: bold;
    display: block;
}

ul.nav > li > a:hover { 
    color: #e9e4b8;
    transition: color 200ms;
}

/* 서브 메뉴 디자인 */
ul.nav > li > ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    width: 150px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    box-shadow: 0px 4px 6px rgba(0,0,0,0.15);
}

ul.nav > li > ul > li {
    display: none;
}

ul.nav > li:hover > ul > li {
    display: block;
}

ul.nav > li > ul > li > a {
    background: #2e5c24;
    color: #fff;
    display: block;
    padding: 10px;
    font-size: 12px;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

ul.nav > li > ul > li > a:hover {
    background: #1b5e20;
}



.img-wrapper {
    flex: 1; 
    min-width: 0; /* flex 자식 요소가 부모보다 커지는 것을 강제로 방지 */
    aspect-ratio: 1 / 1.5; /* 이미지 비율 유지 */
    box-sizing: border-box;
}

.randomImage {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 이미지가 찌그러지지 않게 */
    border: 1px solid #ccc;
}

.plus {
    font-size: clamp(25px, 3vw, 15px);
    font-weight: bold;
    color: #126e0a;
}

/* --- TRIZ 원리 섹션 --- */
.triz-section {
    display: flex;
    width: 98%;
    margin: 15px 0;
    background-color: #333;
    color: white;
    box-sizing: border-box;
    border: 1px solid #222;
    overflow: hidden;
}

.triz-img-box {
    flex: 1; 
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #444; 
    padding: 10px;
    box-sizing: border-box;
}

.triz-img-box img {
    width: 100%;
    max-width: 150px;
    height: auto; /* 비율 유지 */
    object-fit: contain;
}

.triz-text-box {
    flex: 2; 
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
}

/* 트리즈 설명칸 제목, 설명 */
.triz-text-box h3 {
    margin: 0 0 10px 0;
    font-size: clamp(15px, 4vw, 18px); /* 글자 크기 유연하게 */
    color: #e9e4b8;
}

.triz-text-box p {
    margin: 0;
    font-size: clamp(11px, 3.5vw, 14px);
    line-height: 1.5;
    color: #eee;
    white-space: pre-line;
}

/* --- 광고 영역 --- */
.ad-space {
    flex: 1; 
    width: 90%;
    background-color: #e9e9e9;
    display: flex;
    min-height: 50px; /* 모바일에서 너무 길지 않게 수정 */
}

/* --- 랜덤이미지 버튼 --- */
button {
    width: 80%;
    max-width: 250px;
    height: 50px;
    background-color: #0b581c;
    color: #ebeed6;
    font-size: 25px;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    margin: 5px;
    cursor: pointer;
}

.footer {
    display: flex;
    width: 95%;
    gap: 5px;
    margin-bottom: 20px;
}

.r3c1, .r3c2, .r3c3 {
    flex: 1;
    font-size: 10px;
    padding: 5px;
    border: 1px solid #ddd;
    text-align: center;
}

.r3c1 a, .r3c2 a, .r3c3 a {
    text-decoration: none !important;
    color: inherit !important;
    display: block !important;
}

/* --- 반응형 설정 --- */
@media (max-width: 768px) {
    .page-wrapper {
        flex-direction: column; 
    }
    .ad-space {
        min-height: 80px; 

    }
}

@media (max-width: 480px) {
    .triz-section {
        flex-direction: column; /* 휴대폰에선 이미지와 텍스트를 위아래로 */
    }
    .triz-img-box img {
        max-width: 120px;
    }
    .footer {
        flex-direction: row; /* 하단 3개는 가로 유지 (글자가 작으니 가능) */
    }
}

/* 조회수를 감싸는 박스 디자인 */
.counter-box {
    background-color: #ffffff; /* 박스 배경색 */
    padding: 15px 25px;        /* 안쪽 여백 (위아래 15px, 좌우 25px) */
    display: inline-block;     /* 글자 크기만큼만 박스 크기 조절 */
    border-radius: 8px;        /* 테두리 둥글게 */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); /* 은은한 그림자 효과 */
    margin: 20px 0;            /* 위아래 다른 본문과의 간격 */
}

/* 조회수 박스 내부의 기본 글씨 */
.counter-box p {
    margin: 0;
    font-size: 15px;
    color: #333333;
}

/* 조회수 실제 숫자가 표시되는 부분 강조 */
#count {
    font-weight: bold;         /* 글씨 두껍게 */
    color: #075514;            /* 강조 포인트 색상 (주황색) */
    font-size: 1.2em;          /* 숫자만 살짝 더 크게 */
}