@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
    --sea-blue: #002b59;
    --wood-frame: #5d4037;
    --parchment: #e6d5ac;
    --ink-color: #3e2723;
    --retro-shadow: 4px 4px 0px #000000;
    --retro-border: 2px solid #2f1b0c;
}

* {
    box-sizing: border-box;
}

body {
    background-color: #0d0d0d;
    margin: 0;
    padding: 10px;
    font-family: 'VT323', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.5) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.5) 1px, transparent 1px),
        radial-gradient(circle at center, #1a237e 0%, #000000 100%);
    background-size: 4px 4px, 4px 4px, 100% 100%;
}

.main-window {
    width: 100%;
    max-width: 1000px;
    background: var(--sea-blue);
    border: 4px solid #8d6e63;
    outline: 4px solid #3e2723;
    box-shadow: var(--retro-shadow);
    display: flex;
    flex-direction: column;
}

/* 상단 타이틀 바 */
.title-bar {
    background: #001a33;
    color: #ffd700;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid var(--wood-frame);
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.window-controls .btn {
    margin-left: 10px;
    cursor: pointer;
    color: #fff;
    font-family: monospace;
    font-weight: bold;
}

/* 컨텐츠 영역 */
.content-area {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (min-width: 768px) {
    .content-area {
        flex-direction: row;
        align-items: stretch;
    }
    
    .parchment-panel { 
        flex: 1.2; 
    }
    
    .logbook-panel { 
        flex: 0.8; 
        min-height: 600px; 
    }
    
    body { padding: 20px; }
}

/* 패널 공통 스타일 */
.parchment-panel, .logbook-panel {
    border-radius: 0 !important;
    box-shadow: inset 2px 2px 0px rgba(255, 255, 255, 0.2), inset -2px -2px 0px rgba(0, 0, 0, 0.2);
}

/* 좌측 패널 (입력창) */
.parchment-panel {
    background-color: var(--parchment);
    border: var(--retro-border);
    padding: 15px;
}

.game-title {
    text-align: center;
    color: var(--ink-color);
    border-bottom: 4px double var(--ink-color);
    padding-bottom: 5px;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 2.2rem;
    letter-spacing: 2px;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.2);
}

.section-box {
    margin-bottom: 15px;
    background: rgba(62, 39, 35, 0.1);
    padding: 10px;
    border: 2px solid rgba(62, 39, 35, 0.5);
}

.legend-label {
    font-weight: bold;
    color: #3e2723;
    margin-bottom: 8px;
    font-size: 1.3rem;
    display: block;
    text-transform: uppercase;
}

/* 입력 필드 */
.input-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-input {
    width: 50px;
    height: 45px;
    background: #fff;
    border: 2px solid #3e2723;
    border-radius: 0;
    text-align: center;
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    color: #000;
    box-shadow: inset 2px 2px 0px #ccc;
}

.nav-input:focus {
    outline: none;
    background: #fff9c4;
    border-color: #d84315;
}

/* 지도 그리드 (버튼 1줄 배치 최적화) */
.map-grid {
    display: flex;
    gap: 5px;
    justify-content: space-between;
    flex-wrap: wrap;
}

.map-cell {
    flex: 1 1 18%; /* PC에선 1줄, 모바일에서도 최대한 1줄 시도 */
    min-width: 85px; /* 너무 좁아지면 줄바꿈 */
}

.map-cell input { display: none; }

.cell-design {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 60px;
    background: #b0bec5;
    border: 2px solid #37474f;
    border-top-color: #cfd8dc;
    border-left-color: #cfd8dc;
    border-right-color: #455a64;
    border-bottom-color: #455a64;
    cursor: pointer;
    border-radius: 0;
}

.zone-name {
    font-size: 1.1rem;
    font-weight: bold;
    line-height: 1;
    text-shadow: 1px 1px 0 #fff;
    text-align: center;
}

.zone-code {
    font-size: 0.9rem;
    color: #000;
    margin-top: 2px;
}

/* 눌린 효과 */
.map-cell input:checked + .cell-design {
    background: #fff176;
    border: 2px solid #37474f;
    border-top-color: #455a64;
    border-left-color: #455a64;
    border-right-color: #fff9c4;
    border-bottom-color: #fff9c4;
    transform: translateY(2px);
}

.ye .zone-name { color: #f57f17; }
.bl .zone-name { color: #0d47a1; }
.re .zone-name { color: #b71c1c; }
.bk .zone-name { color: #212121; }
.gr .zone-name { color: #1b5e20; }

/* 버튼 */
.anchor-btn {
    width: 100%;
    padding: 12px;
    background: #5d4037;
    color: #ffca28;
    border: 2px solid #000;
    border-top-color: #8d6e63;
    border-left-color: #8d6e63;
    border-right-color: #3e2723;
    border-bottom-color: #3e2723;
    font-family: 'VT323', monospace;
    font-size: 1.8rem;
    cursor: pointer;
    text-shadow: 2px 2px 0 #000;
    margin-top: 15px;
    border-radius: 0;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.5);
}

.anchor-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px rgba(0,0,0,0.5);
    border-top-color: #3e2723;
    border-left-color: #3e2723;
    border-right-color: #8d6e63;
    border-bottom-color: #8d6e63;
}

/* 우측 패널 */
.logbook-panel {
    background: #fff;
    border: 2px solid #000;
    padding: 10px;
    display: flex;
    flex-direction: column;
    font-family: 'VT323', monospace;
    border-radius: 0;
    box-shadow: var(--retro-shadow);
}

.log-title {
    text-align: center;
    border-bottom: 2px dashed #000;
    padding-bottom: 10px;
    margin-bottom: 10px;
    color: #000;
    font-weight: bold;
    font-size: 1.6rem;
}

.log-content-area {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    scrollbar-width: thin;
    scrollbar-color: #5d4037 #efebe9;
}

.log-content-area::-webkit-scrollbar { width: 10px; }
.log-content-area::-webkit-scrollbar-track { background: #efebe9; }
.log-content-area::-webkit-scrollbar-thumb { background: #5d4037; border: 1px solid #efebe9; }

.placeholder-text {
    text-align: center;
    color: #757575;
    margin-top: 40px;
    font-size: 1.4rem;
}

/* 결과 항목 */
.log-entry {
    margin-bottom: 12px;
    padding: 8px;
    background: #e3f2fd;
    border: 2px solid #1565c0;
    box-shadow: 3px 3px 0px #90caf9;
    border-radius: 0;
}

.log-header {
    font-weight: bold;
    color: #0d47a1;
    margin-bottom: 8px;
    border-bottom: 1px solid #1565c0;
    padding-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
}

.sum-badge {
    font-size: 1rem;
    color: #fff;
    background: #e65100;
    padding: 2px 6px;
    border: 1px solid #000;
    border-radius: 0;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.3);
}

.coin-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-top: 5px;
}

.coin {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 34px;
    height: 34px;
    border-radius: 0;
    background: #fff;
    border: 2px solid #000;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.4);
}
