@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@700;900&display=swap');

body {
    font-family: 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    background-color: #f0e6d2;
    background-image: 
        radial-gradient(#ffffff 15%, transparent 20%),
        radial-gradient(#ffffff 15%, transparent 20%);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
    color: #4a4a4a;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    font-size: 16px; 
}

.container {
    width: 95%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 10px;
}

header {
    text-align: center;
    margin-bottom: 25px; 
}

header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 56px; 
    font-weight: 900;
    color: #5c4d40; 
    margin-bottom: 0px;
    letter-spacing: 2px;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.1), 1px 1px 0px #ffffff;
}

header p {
    font-size: 16px; 
    color: #888;
    letter-spacing: 1px;
    text-shadow: 1px 1px 0px #ffffff;
    margin-top: 5px;
}

.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 25px; 
    margin-bottom: 20px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
}

.controls {
    display: flex;
    gap: 15px; 
    flex-wrap: wrap;
}

/* ★変更：ドロップダウンが途切れないように枠を広げる */
.control-group {
    flex: 1;
    min-width: 320px; 
    display: flex;
    flex-direction: column;
}

.control-group label {
    font-weight: bold;
    color: #6d6558;
    margin-bottom: 5px;
    font-size: 16px; 
}

/* ★変更：文字サイズを少し下げ、幅いっぱいに使う */
.controls select {
    padding: 12px 10px; 
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px; 
    width: 100%;
    box-sizing: border-box;
    outline: none;
    cursor: pointer;
    background-color: #fafafa;
}

.controls select:focus {
    border-color: #f39c12;
}

.input-container {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.input-header {
    background-color: #6d6558;
    color: #ffffff;
    text-align: center;
    padding: 15px;
    font-size: 18px; 
    font-weight: bold;
}

#text-input {
    width: 100%;
    height: 350px; 
    padding: 20px;
    border: 2px solid #6d6558;
    border-top: none;
    border-radius: 0 0 8px 8px;
    font-size: 18px; 
    line-height: 1.8;
    resize: vertical;
    box-sizing: border-box;
    display: block;
}

#text-input:focus {
    outline: none;
    background-color: #fafdf5;
}

.btn-primary {
    background-color: #f39c12;
    color: white;
    border: none;
    padding: 18px 24px; 
    border-radius: 30px;
    font-size: 20px; 
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: background-color 0.3s, transform 0.1s;
}

.btn-primary:hover {
    background-color: #e67e22;
}

.btn-primary:active {
    transform: scale(0.98);
}

.hidden { display: none; }

h2 { font-size: 24px; color: #6d6558; margin-bottom: 15px; border-bottom: 2px dotted #e0e0e0; padding-bottom: 5px; }
h3 { font-size: 20px; color: #6d6558; margin-bottom: 10px; border-bottom: 2px dotted #e0e0e0; padding-bottom: 5px; margin-top: 25px; }

.section-hint { font-size: 14px; color: #888; margin-top: -5px; margin-bottom: 10px; }

.readability-box {
    background-color: #fffaf0;
    border: 2px dashed #f39c12;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 20px;
}

.readability-title { display: block; font-size: 16px; font-weight: bold; color: #888; margin-bottom: 5px; }
.readability-score { font-size: 42px; font-weight: bold; color: #f39c12; margin-bottom: 5px; } 
.readability-msg { font-size: 18px; font-weight: bold; color: #555; margin: 0; }

.stats { display: flex; gap: 15px; margin-bottom: 20px; }
.stat-box { background-color: #f0f7f9; padding: 15px; border-radius: 8px; flex: 1; text-align: center; border: 1px solid #dbeef5; }
.stat-title { display: block; font-size: 14px; color: #666; margin-bottom: 5px; }
.stat-value { display: block; font-size: 32px; font-weight: bold; color: #5c8ded; } 

.highlight-box {
    padding: 20px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    white-space: pre-wrap;
    line-height: 1.8;
    font-size: 18px; 
    margin-bottom: 20px;
}

.glossary-area {
    background-color: #ffffe0;
    padding: 20px;
    border-radius: 4px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.05);
    border-left: 5px solid #f39c12;
}

.glossary-area ul {
    margin: 0;
    padding-left: 20px;
    line-height: 1.8;
    display: grid;
    grid-template-columns: repeat(2, 1fr); 
    gap: 5px 20px; 
}

.glossary-area li {
    font-size: 16px; 
    color: #333;
    break-inside: avoid; 
}

.glossary-word {
    font-weight: bold;
    color: #e74c3c;
    margin-right: 5px;
    font-size: 18px; 
}

/* =========================================
   ★変更：動的レイアウト設定
   ========================================= */

/* 初期状態：中央配置の1カラム */
.centered-layout {
    max-width: 900px;
    margin: 0 auto;
    display: block;
    transition: all 0.3s ease;
}
.centered-layout .right-panel {
    display: none; /* 結果エリアの枠組みごと隠す */
}
.centered-layout .left-panel {
    position: static;
}

/* 解析後：左右分割の2カラム */
.split-layout {
    display: flex;
    gap: 30px; 
    align-items: flex-start;
    animation: fadeIn 0.4s ease;
}
.split-layout .left-panel {
    flex: 1;
    min-width: 400px;
    position: sticky;
    top: 20px; 
}
.split-layout .right-panel {
    flex: 1.5;
    min-width: 500px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1000px) {
    .split-layout {
        flex-direction: column;
    }
    .split-layout .left-panel {
        position: static;
    }
    .glossary-area ul {
        grid-template-columns: 1fr; 
    }
}

/* =========================================
   シェアセクション
   ========================================= */
.share-section {
    text-align: center;
    margin-top: 40px;
    padding: 30px;
}

.share-section h3 {
    border: none;
    margin-top: 0;
    font-size: 20px;
    color: #333;
}

.share-section p {
    color: #666;
    margin-bottom: 20px;
    font-size: 14px;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 6px;
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.share-btn:hover {
    opacity: 0.8;
}

.btn-x { background-color: #0f1419; }
.btn-fb { background-color: #1877F2; }
.btn-line { background-color: #06C755; }
.btn-copy { background-color: #f8f9fa; color: #333; border: 1px solid #ddd; }

/* =========================================
   フッター
   ========================================= */
footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 10px;
    margin-top: 20px;
    border-top: 1px solid #dcdcdc;
    color: #888;
    font-size: 14px;
}

.footer-links a {
    color: #666;
    text-decoration: none;
    margin-right: 20px;
    font-weight: bold;
}

.footer-links a:hover {
    text-decoration: underline;
    color: #f39c12;
}