/* 基本スタイル */
body {
    margin: 0;
    padding: 20px;
    font-family: Arial, sans-serif;
    background-color: #c9cee1;
}

.container {
    max-width: 1320px;
    margin: 0 auto;
}

header {
    display: flex;
    align-items: center;
    gap: 40px;  /* タイトルとボタングループの間隔を広げる */
    margin-bottom: 20px;
    padding: 0;
}

.title-with-help {
    display: flex;
    align-items: center;
    gap: 8px;
}

h2 {
    color: #2d3436;
    margin: 0;
    font-size: 1.2em;
    white-space: nowrap;  /* タイトルを1行に */
}

.help-icon-container {
    position: relative;
    display: inline-block;
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    color: #2d3436;
    cursor: help;
    transition: all 0.3s ease;
    line-height: 1;
    text-align: center;
}

.help-icon:hover {
    background-color: #2d3436;
    color: white;
}

.help-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    background-color: #3f717e;
    color: white;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9em;
    line-height: 1.4;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 1000;
}

.help-tooltip::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 5px 5px 5px;
    border-style: solid;
    border-color: transparent transparent #2d3436 transparent;
}

.help-tooltip p {
    margin: 6px 0;
}

.help-tooltip ul {
    margin: 6px 0;
    padding-left: 20px;
}

.help-tooltip li {
    margin: 4px 0;
}

.help-icon-container:hover .help-tooltip {
    visibility: visible;
    opacity: 1;
}

/* メインコンテナ */
.simulation-container {
    display: flex;
    gap: 20px;
    min-height: calc(100vh - 100px);
    margin: 0 auto;
    padding: 0;
}

/* コンテンツエリア（シミュレーション+グラフ） */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

/* シミュレーションエリア */
.simulation-area {
    flex: 2;
    background-color: #2d3436;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

#simulationField {
    width: 100%;
    height: 100%;
    display: block;
}

/* グラフエリア */
.graph-area {
    flex: 1;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    padding: 15px;
}

#populationGraph {
    width: 100%;
    height: 100%;
}

/* 設定パネル */
.control-panel {
    width: 352px;  /* 440px の 80% */
    flex-shrink: 0;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.settings {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
}

.settings > *:first-child {
    margin-top: 0;
}

h3 {
    color: rgba(0, 0, 0, 0.6);
    font-family: sans-serif;
    font-weight: bold;
    font-size: 15px;
    margin: 20px 0 10px 0;
    padding: 0 0 15px 0;
    border-bottom: 1px solid #eee;
    text-align: center;
}

.setting-item {
    margin-bottom: 12px;
}

.initial-count label {
    font-family: monospace;
    font-size: 0.85em;
    color: #2d3436;
    white-space: nowrap;
    margin-right: 10px;
}

.params-group {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 15px;
}

.param-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 6px 0;
}

.param-label {
    font-family: monospace;
    font-size: 0.85em;
    color: #2d3436;
    white-space: nowrap;
    margin-right: 10px;
}

input[type="number"] {
    width: 80px;
    padding: 4px 8px;
    border: 1px solid #dfe6e9;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    text-align: right;
}

input[type="number"]:focus {
    border-color: #74b9ff;
    outline: none;
}

.controls {
    display: flex;
    gap: 10px;
}

/* ボタンのベーススタイル */
button {
    width: 100px;
    padding: 8px 0;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
    text-align: center;
}

button:hover {
    transform: translateY(-1px);
}

button:disabled {
    background-color: #b2bec3;
    cursor: not-allowed;
    transform: none;
}

#startButton {
    background-color: #00b894;
}

#startButton:hover {
    background-color: #00a884;
}

#pauseButton {
    background-color: #f39c12;  /* より濃いオレンジ色 */
}

#pauseButton:hover {
    background-color: #e67e22;  /* ホバー時も濃いめ */
}

#fastForwardButton {
    background-color: #3498db;  /* 青色 */
}

#fastForwardButton:hover,
#fastForwardButton.active {
    background-color: #2980b9;  /* ホバー時と早送り中は濃い青 */
}

#resetButton {
    background-color: #e17055;
}

#resetButton:hover {
    background-color: #d16045;
}

/* ヘルプポップアップ */
.help-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.help-popup.show {
    display: flex;
}

.help-popup-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.help-popup-content h3 {
    margin-top: 0;
    padding-top: 0;
    text-align: left;
    border-bottom: none;
}

.help-popup-content p {
    margin: 10px 0;
    line-height: 1.5;
}

.help-popup-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.help-popup-content li {
    margin: 5px 0;
    line-height: 1.5;
}

.close-popup {
    display: block;
    width: 100%;
    margin-top: 15px;
    background-color: #2d3436;
}

.close-popup:hover {
    background-color: #1e2527;
}