@charset "UTF-8";

/* ================================
   ページタイトル
================================ */
h1 {
  text-align: center;
  font-size: 24px;
  margin-top: 20px;
  margin-bottom: 20px;
}

/* ================================
   メインカード
================================ */
main {
  width: 90%;
  max-width: 900px;
  margin: 20px auto;
  padding: 30px;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  box-sizing: border-box;
}

.tool-container {
  width: 100%;
}

/* ================================
   距離選択コントロール
================================ */
.control-group {
  margin-bottom: 20px;
  background: #f9f9f9;
  padding: 15px;
  border-radius: 8px;
}

.control-group select {
  margin-left: 8px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.hint-text {
  font-size: 12px;
  color: #666;
  margin-top: 5px;
  margin-bottom: 0;
}

/* ================================
   レースブロック
================================ */
.race-block {
  background: #fafafa;
  border: 1px solid #ddd;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  position: relative;
}

.race-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.color-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.race-name-input {
  font-weight: bold;
  border: 1px solid #ccc;
  padding: 6px;
  border-radius: 4px;
  flex-grow: 1;
  max-width: 220px;
  font-size: 14px;
}

.btn-remove {
  margin-left: auto;
  background: #e53935;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.btn-remove:hover {
  background: #c62828;
}

/* ================================
   コピペ入力エリア
================================ */
.paste-area {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

/* ================================
   ラップ入力ボックス
================================ */
.lap-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.lap-box {
  display: flex;
  flex-direction: column;
  width: 60px;
  text-align: center;
}

.lap-box input {
  padding: 5px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.lap-box label {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

/* ================================
   追加ボタン
================================ */
.btn-add {
  background: #01b04a;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  width: 100%;
  margin-bottom: 20px;
  font-size: 16px;
}

.btn-add:hover {
  background: #018c3b;
}

/* ================================
   グラフ
================================ */
.chart-container {
  position: relative;
  height: 420px;
  width: 100%;
  margin-top: 24px;
  padding-top: 4px;
  border-top: 1px solid #f0f0f0;
}

/* ================================
   使い方ヒント
================================ */
.usage-hint {
  margin-top: 16px;
  font-size: 12px;
  color: #555;
  line-height: 1.8;
  padding: 10px 14px;
  background: #f5f5f5;
  border-radius: 6px;
  border-left: 3px solid #01b04a;
}

/* ================================
   保存・読込セクション 共通
================================ */
.persist-section {
  border: 1px solid #e2e8e4;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
  background: #fff;
}

.ps-header {
  background: #f2f7f4;
  border-bottom: 1px solid #e2e8e4;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ps-icon {
  font-size: 15px;
  line-height: 1;
}

.ps-title {
  font-size: 13px;
  font-weight: 700;
  color: #3a4a3d;
  letter-spacing: 0.03em;
}

.ps-body {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* 未ログイン案内 */
.persist-notice {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #666;
  background: #fafcfb;
}

.notice-lock {
  font-size: 16px;
  flex-shrink: 0;
}

.persist-notice a {
  color: #01b04a;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.persist-notice a:hover {
  opacity: 0.75;
}

/* セレクトボックス */
.ps-select {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid #cdd5cf;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  color: #333;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: auto;
}

.ps-select:focus {
  outline: none;
  border-color: #01b04a;
  box-shadow: 0 0 0 3px rgba(1, 176, 74, 0.12);
}

/* テキスト入力 */
.ps-input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid #cdd5cf;
  border-radius: 6px;
  font-size: 14px;
  color: #333;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ps-input:focus {
  outline: none;
  border-color: #01b04a;
  box-shadow: 0 0 0 3px rgba(1, 176, 74, 0.12);
}

.ps-input::placeholder {
  color: #aab5ae;
}

/* ボタングループ（読込・削除） */
.ps-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* アクションボタン共通 */
.btn-ps {
  padding: 9px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.1s;
  line-height: 1;
}

.btn-ps:hover {
  opacity: 0.82;
}

.btn-ps:active {
  transform: scale(0.97);
}

/* 保存ボタン */
.btn-ps-save {
  background: #01b04a;
  color: #fff;
}

/* 読み込みボタン */
.btn-ps-load {
  background: #2d6a4f;
  color: #fff;
}

/* 削除ボタン（アウトライン） */
.btn-ps-del {
  background: #fff;
  color: #c62828;
  border: 1.5px solid #c62828 !important;
}

.btn-ps-del:hover {
  background: #fff5f5 !important;
  opacity: 1 !important;
}

/* ================================
   モバイル対応
================================ */
@media (max-width: 768px) {
  h1 {
    font-size: 20px;
    margin: 10px 0;
  }

  main {
    width: 100%;
    max-width: 100%;
    margin: 10px auto;
    padding: 16px;
  }

  .chart-container {
    height: 280px;
    margin-top: 16px;
  }

  .race-name-input {
    max-width: 150px;
  }

  .lap-box {
    width: 52px;
  }

  /* 保存・読込セクション モバイル */
  .ps-body {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .ps-select,
  .ps-input {
    width: 100%;
  }

  .ps-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .btn-ps {
    flex: 1;
    text-align: center;
  }
}
