* {
  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: 820px;
  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: 30px;
}

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

.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;
}

/* ==============================
   座席設定
============================== */

.seat-setting {
  margin-bottom: 30px;
  padding: 24px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.seat-setting h2 {
  margin: 0 0 22px;
  text-align: center;
  font-size: 19px;
}

.seat-setting-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

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

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

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

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

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

#columnCount,
#rowCount {
  min-width: 28px;
  font-size: 23px;
  font-weight: 700;
}

.total-seat-count {
  margin: 22px 0 0;
  text-align: center;
  color: #555;
  font-size: 14px;
}

#totalSeatCount {
  font-weight: 700;
}

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

.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;
}

.back-label {
  margin: 14px 0 0;
  text-align: center;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

/* ==============================
   座席表
============================== */

/* ==============================
   座席レイアウト全体
============================== */

.seat-layout {
  margin-top: 8px;
}

.front-board {
  margin: 0 auto 18px;
  max-width: 420px;
  padding: 10px 16px;
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}

/* ==============================
   座席表
============================== */

.seat-map {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-x: auto;
  padding: 6px 2px;
}

.seat-header-row,
.seat-row {
  display: grid;
  gap: 12px;
  align-items: stretch;
}

.seat-header-cell,
.row-label {
  min-width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.seat-header-cell.blank {
  color: transparent;
}

.seat {
  min-width: 100px;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  text-align: center;
}

.seat-number {
  margin-bottom: 6px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.seat-name {
  color: #1f2937;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  word-break: break-word;
}

.seat.empty-seat {
  background: #f1f5f9;
}

.seat.empty-seat .seat-name {
  color: #94a3b8;
  font-weight: 500;
}

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

.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;
  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;
  }

  .seat-setting-grid {
    grid-template-columns: 1fr;
  }

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

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

  .front-board {
    font-size: 13px;
  }

  .seat-header-cell,
  .row-label {
    min-width: 34px;
    font-size: 12px;
  }

  .seat {
    min-width: 82px;
    min-height: 76px;
    padding: 8px;
  }

  .seat-number {
    font-size: 11px;
  }

  .seat-name {
    font-size: 13px;
  }

  .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;
  }
}
