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

:root {
    --vh: 1vh;
}

body {
    font-family: 'Noto Serif JP', 'Yu Mincho', 'Hiragino Mincho Pro', serif;
    background-color: #f5f5f0;
    color: #333;
    height: 100vh;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    overflow: hidden;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
}

/* ヘッダー */
.header {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    width: 80px;
    background-color: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    z-index: 1000;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.site-title {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: 24px;
    margin-bottom: auto;
    letter-spacing: 0.2em;
}

.new-post-btn {
    writing-mode: vertical-rl;
    text-orientation: upright;
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 15px 10px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
    margin-bottom: 20px;
}

.new-post-btn:hover {
    background-color: #c0392b;
}

/* メインコンテンツ */
.main-content {
    margin-left: 80px;
    height: 100vh;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.posts-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    gap: 20px;
}

/* 投稿 */
.post {
    writing-mode: vertical-rl;
    text-orientation: upright;
    background-color: white;
    min-width: 300px;
    max-width: 400px;
    height: calc(100vh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    height: calc(100dvh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    height: calc((var(--vh, 1vh) * 100) - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s;
}

.post:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.post.new-post {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.post-header {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.post-author {
    font-weight: bold;
    font-size: 18px;
    display: block;
    margin-bottom: 10px;
}

.post-time {
    font-size: 14px;
    color: #666;
}

.post-content {
    flex: 1;
    font-size: 16px;
    line-height: 1.8;
    letter-spacing: 0.05em;
    white-space: pre-wrap;
}

.post-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.like-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    writing-mode: horizontal-tb;
    transition: transform 0.3s;
}

.like-btn:hover {
    transform: scale(1.1);
}

.like-btn.liked .like-icon {
    color: #e74c3c;
}

.like-icon {
    color: #ccc;
    transition: color 0.3s;
}

.like-btn.like-animation {
    animation: heartBeat 0.3s;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 40px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
    color: #666;
}

.close-btn:hover {
    color: #333;
}

.modal-title {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
}

.author-input,
.post-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    font-family: inherit;
}

.post-input {
    height: 200px;
    resize: vertical;
}

.submit-btn {
    width: 100%;
    padding: 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.submit-btn:hover {
    background-color: #2980b9;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .header {
        width: 60px;
        padding: 15px 0;
        padding-top: calc(15px + env(safe-area-inset-top));
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }
    
    .site-title {
        font-size: 18px;
        margin-bottom: auto;
    }
    
    .new-post-btn {
        font-size: 16px;
        padding: 10px 8px;
        margin-bottom: 15px;
    }
    
    .main-content {
        margin-left: 60px;
    }
    
    .post {
        min-width: 250px;
        max-width: 300px;
        padding: 20px;
    }
    
    .modal-content {
        padding: 30px 20px;
        max-height: calc(90vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        max-height: calc(90dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        max-height: calc((var(--vh, 1vh) * 90) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        overflow-y: auto;
    }
    
    .post-input {
        max-height: 150px;
    }
}

/* スクロールバーのスタイリング */
.main-content::-webkit-scrollbar {
    height: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.main-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}