:root {
    --bg-color: #f1f1f1;
    --text-color: #212121;
    --btn-bg: #f1f1f1;
    --btn-text: #212121;
    --btn-border: #212121;
    --font-family: 'Space Mono', monospace;
}

.dark-mode {
    --bg-color: #212121;
    --text-color: #f1f1f1; 
    --btn-bg: #212121;
    --btn-text: #f1f1f1;
    --btn-border: #f1f1f1;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 10px; 
    font-family: var(--font-family);
    font-weight: normal;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center;    
    min-height: 100vh;      
    box-sizing: border-box; 
    transition: background-color 0.3s, color 0.3s;
}

.controls {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

button {
    background-color: var(--btn-bg);
    color: var(--btn-text);
    border: 1px solid var(--btn-border);
    padding: 6px 10px;
    font-family: inherit;
    font-weight: bold;
    font-size: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

button:hover {
    opacity: 0.7;
}

.ascii-container {
    max-width: 100%;
    overflow: hidden;
}

pre {
    font-family: var(--font-family);
    font-size: 10px; 
    line-height: 1.4;
    margin: 0;
    white-space: pre;
}

.header {
    display: flex;
    justify-content: space-between;
}

.terminal-table {
    width: 55ch; 
    max-width: 100%;
    margin: 15px auto;
    border-collapse: collapse;
    font-family: var(--font-family);
    font-size: 10px;
    line-height: 1.3; 
    transition: color 0.3s, border-color 0.3s;
    table-layout: fixed;
}

.table-header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px dashed var(--text-color);
    padding: 6px 10px;
}

.terminal-table td {
    padding: 6px 12px;
    border: 1px dashed var(--text-color);
    vertical-align: middle;
}

.terminal-table .label {
    font-weight: bold;
    width: 16ch;
    border-right: 2px solid var(--text-color); 
}

.table-section,
.modal-entry-content {
    display: none;
}

.table-section.active-section {
    display: table-row-group;
}

.nav-arrow {
    background: none;
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 10px;
    border: 1px solid var(--btn-text);
}

.nav-arrow:hover {
    opacity: 0.5;
}

.diary-index-container {
    width: 55ch;
    max-width: 100%;
    margin: 15px auto;
    text-align: left;
    font-family: var(--font-family);
}

.diary-index-title {
    font-size: 10px;
    font-weight: bold;
    margin-bottom: 8px;
    opacity: 0.8;
}

.log-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.log-item {
    font-size: 10px;
    padding: 6px 8px;
    border: 1px dashed transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.log-item:hover {
    border-color: var(--text-color);
    background-color: var(--btn-text);
    color: var(--btn-bg);
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-window {
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--text-color);
    width: 90%;
    max-width: 50ch;
    max-height: 60vh; 
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background-color: var(--text-color);
    color: var(--bg-color);
    font-size: 10px;
    font-weight: bold;
}

.modal-close-btn {
    background: none;
    border: none;
    color: inherit;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
}

.modal-body {
    padding: 15px;
    overflow-y: auto;
    text-align: left;
}

.modal-entry-content.active-content {
    display: block;
}

.entry-meta { 
    font-size: 10px; 
    opacity: 0.7; 
    margin-bottom: 5px; 
}

.entry-title { 
    font-size: 10px; 
    margin: 0 0 10px 0; 
}

.entry-body p { 
    font-size: 10px; 
    line-height: 1.5; 
    margin: 0 0 10px 0; 
}

@media (min-width: 768px) {
    body, pre { 
        font-size: 11.5px; 
    }
    
    button {
        font-size: 9.5px;
        padding: 5px 10px;
    }

    .terminal-table {
        font-size: 11px;
        width: 68ch; 
    }

    .log-item,
    .entry-title { 
        font-size: 11.5px; 
    }

    .entry-body p { 
        font-size: 11.5px; 
        line-height: 1.6; 
    }
}