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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    color: #333;
    padding-top: 80px; /* 固定ヘッダーの高さ分のパディング */
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: #333;
    width: 100%;
    padding: 15px 20px;
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

header h1 {
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    flex: 1;
    margin: 0;
}

.header-btn {
    background: none;
    color: #fff;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 2rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
}

.header-btn:hover {
    color: #ccc;
    transform: translateY(-2px);
}

.header-btn i {
    font-size: 2rem;
}

.settings-btn {
    margin-right: auto;
}

.help-btn {
    margin-left: auto;
}

/* ポップアップスタイル */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.popup-header {
    background: #333;
    color: #fff;
    padding: 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn i {
    font-size: 1.2rem;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.popup-body {
    padding: 30px;
    max-height: 60vh;
    overflow-y: auto;
}

.popup-body h3 {
    color: #333;
    font-size: 1.3rem;
    font-weight: 600;
    margin: 25px 0 15px 0;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
}

.popup-body h4 {
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 20px 0 10px 0;
}

.popup-body ul {
    margin: 10px 0 20px 0;
    padding-left: 20px;
}

.popup-body li {
    margin: 8px 0;
    line-height: 1.6;
    color: #555;
    text-indent: 0;
    padding-left: 0;
    list-style-position: outside;
}

.popup-body p {
    margin: 10px 0;
    font-weight: 600;
    color: #333;
}

.height-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.height-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.height-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.action-btn {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.download-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.clear-btn {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
}

/* 設定ポップアップのボタンサイズ統一 */
#downloadAllBtn, #clearAllBtn {
    height: auto;
    min-height: 50px;
    font-size: 1rem;
    padding: 15px 25px;
    line-height: 1.2;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.height-btn {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    color: #495057;
    border: 1px solid #ced4da;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 1.0rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 50px;
}

.height-btn:hover {
    background: linear-gradient(135deg, #dee2e6 0%, #ced4da 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.height-btn.active {
    background: linear-gradient(135deg, #8b9dc3 0%, #6c7b7f 100%);
    color: white;
    border-color: #6c7b7f;
    box-shadow: 0 2px 8px rgba(139, 157, 195, 0.3);
}

.controls button {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.controls button:active {
    transform: translateY(0);
}

.editor-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.editor-window {
    background: #FFFFE0;
    border-radius: 12px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.editor-window:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12);
}

.editor-header {
    background: linear-gradient(135deg, #8b9dc3 0%, #6c7b7f 100%);
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.editor-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.edit-icon {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.editor-title {
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 2px 6px;
    border-radius: 4px;
    outline: none;
    margin: 0;
}

.title-container:hover .edit-icon {
    color: rgba(255, 255, 255, 0.9);
    transform: scale(1.1);
}

.editor-title:hover {
    background: rgba(255, 255, 255, 0.2);
}

.editor-title:focus {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.editor-title:focus + .edit-icon {
    color: rgba(255, 255, 255, 1);
}

.char-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    gap: 15px;
    align-items: center;
}

.editor-textarea {
    width: 100%;
    height: 400px;
    padding: 15px;
    border: none;
    resize: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #333;
    background: transparent;
    outline: none;
    transition: background-color 0.3s ease;
}

.editor-textarea:focus {
    background: #FFFFE0;
}

.editor-textarea::placeholder {
    color: #a0aec0;
    font-style: italic;
}

.editor-controls {
    padding: 12px 15px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 8px;
}

.copy-btn, .paste-btn, .download-btn, .undo-btn {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 18px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.paste-btn {
    background: linear-gradient(135deg, #8b9dc3 0%, #6c7b7f 100%);
}

.undo-btn {
    background: linear-gradient(135deg, #8b9dc3 0%, #6c7b7f 100%);
}

.copy-btn:hover, .paste-btn:hover, .download-btn:hover, .undo-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.copy-btn:active, .paste-btn:active, .download-btn:active, .undo-btn:active {
    transform: translateY(0);
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    body {
        padding-top: 120px; /* モバイル時の固定ヘッダーの高さ分のパディング */
    }
    
    .container {
        padding: 15px;
    }
    
    header {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .controls {
        justify-content: center;
        flex-direction: column;
        gap: 15px;
    }
    
    .height-controls {
        margin-right: 0;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .editor-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .editor-window {
        height: 300px;
    }
    
    .editor-textarea {
        height: 400px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    body {
        padding-top: 140px; /* 小画面時の固定ヘッダーの高さ分のパディング */
    }
    
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .controls button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .editor-header {
        padding: 12px 15px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .editor-controls {
        padding: 12px 15px;
        flex-direction: column;
    }
}

/* スクロールバーのカスタマイズ */
.editor-textarea::-webkit-scrollbar {
    width: 8px;
}

.editor-textarea::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.editor-textarea::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #8b9dc3 0%, #6c7b7f 100%);
    border-radius: 4px;
}

.editor-textarea::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #7a8bb0 0%, #5d6a6e 100%);
}

/* アニメーション */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.editor-window {
    animation: fadeInUp 0.6s ease forwards;
}

.editor-window:nth-child(1) { animation-delay: 0.1s; }
.editor-window:nth-child(2) { animation-delay: 0.2s; }
.editor-window:nth-child(3) { animation-delay: 0.3s; }
.editor-window:nth-child(4) { animation-delay: 0.4s; }
.editor-window:nth-child(5) { animation-delay: 0.5s; }
.editor-window:nth-child(6) { animation-delay: 0.6s; }
.editor-window:nth-child(7) { animation-delay: 0.7s; }
.editor-window:nth-child(8) { animation-delay: 0.8s; }
.editor-window:nth-child(9) { animation-delay: 0.9s; }
.editor-window:nth-child(10) { animation-delay: 1.0s; }

/* フッタースタイル */
footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    border-top: 1px solid #444;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

footer a {
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: inline-block;
}

footer a:hover {
    transform: translateY(-2px);
    text-decoration: underline;
}

footer i {
    font-size: 1.5rem;
}

/* フッター言語ボタン */
.footer-btn {
    position: absolute;
    left: 30px;
    background: none;
    color: #fff;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-btn:hover {
    color: #ccc;
    transform: translateY(-2px);
}

.footer-btn i {
    font-size: 2rem;
}

/* 言語選択ボタン */
.language-selection {
    text-align: center;
}

.language-selection h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

.language-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

.language-selection .language-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 20px;
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.language-selection .language-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
}

.language-selection .language-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: #fff;
}

.language-selection .language-btn.active:hover {
    background: #0056b3;
    border-color: #0056b3;
    color: #fff;
}

.language-selection .language-btn i {
    font-size: 1.2rem;
}
