* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Meiryo", sans-serif;
  background: #f5f7fa;
  color: #222;
}

/* ==============================
   ヘッダー
============================== */

.site-header {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 16px 20px;
}

.site-logo {
  color: #222;
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
}

/* ==============================
   メイン
============================== */

.container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.tool {
  background: #ffffff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

/* ==============================
   タイトル
============================== */

.tool-header {
  text-align: center;
  margin-bottom: 32px;
}

.tool-header h1 {
  margin: 0 0 12px;
  font-size: 30px;
}

.tool-description {
  margin: 0;
  color: #666;
  font-size: 15px;
  line-height: 1.7;
}

/* ==============================
   入力
============================== */

.input-section {
  margin-bottom: 28px;
}

.input-section label {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.input-help {
  margin: 0 0 10px;
  color: #777;
  font-size: 13px;
}

#memberInput {
  width: 100%;
  min-height: 180px;
  padding: 14px 16px;
  resize: vertical;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.6;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

#memberInput:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.member-count {
  margin-top: 8px;
  text-align: right;
  color: #555;
  font-size: 14px;
}

#memberCount {
  font-weight: 700;
}

/* ==============================
   分け方設定
============================== */

.divide-setting {
  margin-bottom: 28px;
  text-align: center;
}

.setting-title {
  margin: 0 0 12px;
  font-weight: 700;
}

/* ==============================
   分け方切り替え
============================== */

.divide-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
  padding: 4px;
  background: #f1f5f9;
  border-radius: 10px;
}

.mode-button {
  border: none;
  border-radius: 8px;
  padding: 11px 10px;
  background: transparent;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}

.mode-button:hover {
  color: #222;
}

.mode-button.active {
  background: #ffffff;
  color: #2563eb;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* ==============================
   チーム数・1チーム人数
============================== */

.team-setting {
  text-align: center;
}

.setting-label {
  margin: 0 0 12px;
  color: #555;
  font-size: 14px;
  font-weight: 600;
}

.team-count-control {
  display: inline-flex;
  align-items: center;
  gap: 20px;
}

.team-count-control button {
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: #eef2f7;
  color: #222;
  font-size: 24px;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.1s;
}

.team-count-control button:hover {
  background: #dfe6ee;
}

.team-count-control button:active {
  transform: scale(0.95);
}

#teamCount,
#membersPerTeam {
  min-width: 30px;
  font-size: 24px;
  font-weight: 700;
}

/* hidden属性が付いている要素は非表示 */
[hidden] {
  display: none !important;
}

/* ==============================
   メインボタン
============================== */

.primary-button {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 15px 20px;
  background: #2563eb;
  color: #ffffff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.1s;
}

.primary-button:hover {
  background: #1d4ed8;
}

.primary-button:active {
  transform: scale(0.99);
}

/* ==============================
   エラー
============================== */

.error-message {
  min-height: 20px;
  margin: 12px 0 0;
  text-align: center;
  color: #dc2626;
  font-size: 14px;
}

/* ==============================
   結果
============================== */

.result-section {
  margin-top: 36px;
  padding-top: 30px;
  border-top: 1px solid #e5e7eb;
}

.result-section h2 {
  margin: 0 0 20px;
  text-align: center;
  font-size: 22px;
}

.team-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.team-member-count {
  margin: -6px 0 10px;
  text-align: center;
  color: #777;
  font-size: 13px;
}

/* ==============================
   チームカード
============================== */

.team-card {
  padding: 20px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.team-card h3 {
  margin: 0 0 14px;
  font-size: 18px;
  text-align: center;
}

.team-member-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.team-member-list li {
  padding: 9px 4px;
  border-bottom: 1px solid #e5e7eb;
  text-align: center;
}

.team-member-list li:last-child {
  border-bottom: none;
}

/* ==============================
   結果ボタン
============================== */

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.secondary-button,
.reset-button {
  border: none;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.secondary-button {
  background: #eef2ff;
  color: #1e40af;
}

.secondary-button:hover {
  background: #dfe7ff;
}

.reset-button {
  background: #f3f4f6;
  color: #555;
}

.reset-button:hover {
  background: #e5e7eb;
}

/* ==============================
   説明コンテンツ
============================== */

.tool-guide,
.tool-about,
.tool-uses,
.tool-faq {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid #e5e7eb;
}

.tool-guide h2,
.tool-about h2,
.tool-uses h2,
.tool-faq h2 {
  margin: 0 0 18px;
  font-size: 21px;
}

.tool-guide p,
.tool-about p,
.tool-uses p,
.tool-faq p {
  margin: 0 0 10px;
  color: #555;
  font-size: 14px;
  line-height: 1.8;
}

/* ==============================
   利用シーン
============================== */

.tool-uses ul {
  margin: 0;
  padding-left: 22px;
}

.tool-uses li {
  margin-bottom: 8px;
  color: #555;
  font-size: 14px;
  line-height: 1.7;
}

/* ==============================
   よくある質問
============================== */

.tool-faq h3 {
  margin: 22px 0 8px;
  font-size: 16px;
}

.tool-faq h3:first-of-type {
  margin-top: 0;
}

/* ==============================
   フッターリンク
============================== */

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  margin-bottom: 12px;
}

/* ==============================
   フッター
============================== */

.site-footer {
  padding: 24px 16px 36px;
  text-align: center;
  color: #777;
  font-size: 13px;
}

.site-footer a {
  color: #555;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ==============================
   スマホ
============================== */

@media (max-width: 600px) {
  .container {
    padding: 24px 14px 40px;
  }

  .tool {
    padding: 22px 16px;
    border-radius: 12px;
  }

  .tool-header h1 {
    font-size: 25px;
  }

  .tool-description {
    font-size: 14px;
  }

  #memberInput {
    min-height: 160px;
    font-size: 16px;
  }

  .team-results {
    grid-template-columns: 1fr;
  }

  .result-actions {
    flex-direction: column;
  }

  .secondary-button,
  .reset-button {
    width: 100%;
  }

  .divide-mode {
    grid-template-columns: 1fr;
  }

  .mode-button {
    padding: 12px 8px;
  }

  .tool-guide,
  .tool-about,
  .tool-uses,
  .tool-faq {
    margin-top: 30px;
    padding-top: 24px;
  }

  .tool-guide h2,
  .tool-about h2,
  .tool-uses h2,
  .tool-faq h2 {
    font-size: 19px;
  }

  .site-footer-links {
    flex-direction: column;
    gap: 8px;
  }
}
