body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f4f8; /* 柔らかい背景色 */
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* 上部に寄せる */
    min-height: 100vh;
    margin: 0;
    padding: 40px 20px;
    box-sizing: border-box;
}

.main-container {
    background-color: #fff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 95%;
    max-width: 1200px;
}

h1, h2 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 10px;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 5px;
}

h2 {
    text-align: left;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.description {
    color: #555;
    text-align: left;
    margin-bottom: 30px;
    line-height: 1.6;
}

.input-container {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
}

.panel {
    flex: 1;
    background-color: #fdfdfd;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e0e6ed;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

textarea {
    width: 100%;
    height: 200px;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    resize: vertical;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 1em;
    box-sizing: border-box;
    background-color: #f9fbfd;
    transition: border-color 0.3s;
}

textarea:focus {
    border-color: #3498db;
    outline: none;
}

.result-container {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

.result-panel {
    flex: 1;
    background-color: #fdfdfd;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e0e6ed;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.table-container {
    overflow-x: auto; /* テーブルがはみ出した場合にスクロール */
    min-height: 150px;
    background-color: #ecf0f1;
    border-radius: 8px;
    padding: 5px;
    border: 1px solid #c0c8d1;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 1em;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #c0c8d1;
    white-space: pre-wrap;
    word-break: break-all;
}

th {
    background-color: #dce4e8;
    color: #2c3e50;
    font-weight: bold;
    position: relative; /* 矢印表示のため */
    padding-right: 30px; /* 矢印のスペースを確保 */
}

th.sortable {
    cursor: pointer;
    user-select: none; /* テキスト選択を防ぐ */
}
th.sortable:hover {
    background-color: #ced9df;
}

/* --- ▼ここから変更▼ --- */

/* 並べ替えの矢印アイコンの共通設定 */
th.sortable::after {
    content: '\2195'; /* デフォルトの矢印: ↕ */
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
    font-size: 1.1em;
    color: #2c3e50;
}

/* 昇順（Ascending）の矢印 */
th.sort-asc::after {
    content: '\25B2'; /* 上向きの黒三角: ▲ */
    opacity: 1;
}

/* 降順（Descending）の矢印 */
th.sort-desc::after {
    content: '\25BC'; /* 下向きの黒三角: ▼ */
    opacity: 1;
}

/* --- ▲ここまで変更▲ --- */


tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:nth-child(even) {
    background-color: #f6f8fa;
}

tbody tr:nth-child(odd) {
    background-color: #ecf0f1;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .input-container, .result-container {
        flex-direction: column;
    }
}