body {
    font-family: 'Segoe UI', Meiryo, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.6;
}
h1, h2 { color: #005f73; }
.instructions { text-align: center; margin-bottom: 20px; background-color: #e0f7fa; padding: 10px; border-radius: 8px; max-width: 900px; }

.game-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    width: 95%;
    max-width: 1200px;
}

/* === Simulation Panel === */
.simulation-panel {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 20px;
}
#grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    aspect-ratio: 1 / 1;
}

/* === Grid Item (Wells) === */
.grid-item {
    border: 3px solid #a2d2ff;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 5px;
}
.grid-item.selected { border-color: #0077b6; background-color: #e8f7ff; }
.grid-item.set { border-color: #4ade80; }
.well-label { font-weight: bold; font-size: 1.2em; color: #003049; }
.well-status { font-size: 0.8em; color: #555; }
.result-overlay {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    color: white;
    display: none;
    justify-content: center;
    align-items: center;
    font-size: 1.1em;
    font-weight: bold;
    text-align: center;
    border-radius: 6px;
    backdrop-filter: blur(2px);
    padding: 5px;
}

/* === Results Section === */
.results-section { margin-top: 20px; }
#results-grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    aspect-ratio: 1 / 1;
    border: 2px solid #ccc;
    padding: 10px;
    border-radius: 8px;
}
.result-item {
    background-color: #e9ecef;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    font-weight: bold;
    color: #495057;
    transition: background-color 0.5s;
}


/* 履歴カードの見た目 */
.result-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-radius: 10px;
  background: #1f2430;
  color: #fff;
  border: 1px solid #3a3f4b;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  min-height: 92px;
}
.result-item .header { display:flex; justify-content:space-between; font-weight:700; }
.result-item .state { font-size:0.85rem; opacity:.9; }
.result-item .yield { font-size:1.4rem; font-weight:800; margin-top:2px; }
.result-item .actions button {
  margin-top: 6px; width: 100%; border: none; border-radius: 6px;
  padding: 6px 8px; cursor: pointer; background:#2f80ed; color:#fff;
}
.result-item .actions button:hover { background:#1c61bb; }

.result-item.yield-high   { background: linear-gradient(135deg, #1f2430, #214a2c); border-color:#2d6a4f; }
.result-item.yield-medium { background: linear-gradient(135deg, #1f2430, #4a3f21); border-color:#b08900; }
.result-item.yield-low    { background: linear-gradient(135deg, #1f2430, #4a2e21); border-color:#bb5a00; }
.result-item.yield-fail   { background: linear-gradient(135deg, #1f2430, #30343b); border-color:#6c757d; }

/* グリッドが横に詰まりすぎる場合に段組を広げたいとき（任意） */
/* #results-grid-container { grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); } */

/* Yield Category Colors */
.yield-fail { background-color: #6c757d; } /* 失敗 */
.yield-low { background-color: #f77f00; } /* 低収率 */
.yield-medium { background-color: #fcbf49; } /* 中程度の収率 */
.yield-high { background-color: #4caf50; } /* 高収率 */

/* === Control Panel === */
.control-panel { background-color: white; border-radius: 8px; padding: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.control-panel h2 { margin-top: 0; }
.hidden { display: none; }
#condition-form { border: 1px solid #ddd; border-radius: 8px; padding: 15px; margin-top: 15px; }
#condition-form h3 { margin-top: 0; color: #0077b6; }
.form-group { margin-bottom: 10px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; font-size: 0.9em; }
.form-group select { width: 100%; padding: 8px; border-radius: 4px; border: 1px solid #ccc; }

.main-controls { margin-top: 20px; }
button {
    width: 100%; padding: 12px 15px; margin-bottom: 10px;
    border: none; border-radius: 4px; cursor: pointer;
    font-size: 16px; font-weight: bold; transition: background-color 0.2s;
}
#set-condition-btn { background-color: #0096c7; color: white; }
#run-all-btn { background-color: #4caf50; color: white; }
#reset-btn { background-color: #f44336; color: white; }
button:disabled { background-color: #aaa; cursor: not-allowed; }
