/* ========================================
   リセット・ベース
   ======================================== */
* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans CJK JP", sans-serif;
  margin: 0;
  padding: 0 0 200px 0;
  background-color: #f5f6f8;
  color: #333;
  line-height: 1.5;
}

/* ========================================
   レイアウト・コンテナ
   ======================================== */
.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 56px 20px 24px;
  background: #fff;
  min-height: 100vh;
}

.index-container {
  max-width: 500px;
  margin: 24px auto;
  background: #fff;
  border-radius: 12px;
  padding: 40px 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  min-height: auto;
}

body:has(.index-container) {
  padding-bottom: 24px;
}

/* ========================================
   タイポグラフィ
   ======================================== */
h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 20px 0;
  text-align: center;
  color: #2c3e50;
  letter-spacing: 0.02em;
}

h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 16px 0 8px 0;
  padding: 8px 0 8px 12px;
  border-left: 4px solid #4a6fa5;
  color: #2c3e50;
}

/* 攻撃側セクション */
h2:nth-of-type(odd) {
  border-left-color: #e8704a;
}

/* 防御側セクション */
h2:nth-of-type(even) {
  border-left-color: #4a90e2;
}

/* ========================================
   フォームグループ
   ======================================== */
.form-group {
  margin: 6px 0;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  color: #444;
}

.form-group label b {
  font-weight: 700;
}

/* ========================================
   入力フィールド
   ======================================== */
input[type=number] {
  font-size: 16px;
  padding: 10px 12px;
  width: 120px;
  border: 1.5px solid #d0d5dd;
  border-radius: 6px;
  background: #fff;
  color: #333;
  transition: border-color 0.2s;
  -moz-appearance: textfield;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number]:focus {
  outline: none;
  border-color: #4a6fa5;
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.15);
}

select {
  font-size: 15px;
  padding: 10px 12px;
  border: 1.5px solid #d0d5dd;
  border-radius: 6px;
  background: #fff;
  color: #333;
  cursor: pointer;
  transition: border-color 0.2s;
  max-width: 100%;
}

select:focus {
  outline: none;
  border-color: #4a6fa5;
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.15);
}

/* ========================================
   +/- 調整ボタン
   ======================================== */
.adjustBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  margin-left: 6px;
  font-size: 15px;
  font-weight: 600;
  color: #444;
  background-color: #e9ecef;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
  user-select: none;
  -webkit-user-select: none;
}

.adjustBtn:hover {
  background-color: #d3d7dc;
}

.adjustBtn:active {
  background-color: #c5cad0;
  transform: scale(0.95);
}

/* ========================================
   送信ボタン
   ======================================== */
input[type=submit] {
  background-color: #4a6fa5;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  padding: 12px;
  width: 100%;
  border-radius: 8px;
  transition: background-color 0.2s;
}

input[type=submit]:hover {
  background-color: #3a5a8a;
}

/* ========================================
   トップページ ボタン一覧
   ======================================== */
.button-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px auto;
  width: 100%;
  gap: 12px;
}

.button {
  display: block;
  width: 100%;
  max-width: 360px;
  padding: 14px 20px;
  background-color: #4a6fa5;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.button:hover {
  background-color: #3a5a8a;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.button:active {
  transform: scale(0.98);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ========================================
   結果パネル（固定下部）
   ======================================== */
.result-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #eaecf0;
  border-top: 2px solid #d0d5dd;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
  z-index: 10;
  max-height: 60vh;
  overflow-y: auto;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  cursor: pointer;
}

.result-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #2c3e50;
}

.result-toggle {
  background-color: #4a6fa5;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.result-toggle:hover {
  background-color: #3a5a8a;
}

.result-content {
  padding: 0 20px 12px;
}

.result-content .form-group {
  margin: 0;
}

.result-content label {
  display: block;
  font-size: 14px;
  font-weight: 400;
  color: #555;
  padding: 1px 0;
  margin-bottom: 0;
}

.result-content b {
  font-size: 18px;
  color: #1a6b30;
  font-weight: 700;
}

.result-panel.result-collapsed .result-content {
  display: none;
}

/* ========================================
   ナビゲーション ハンバーガー
   ======================================== */
.hamburger {
  position: fixed;
  top: 8px;
  left: 8px;
  width: 48px;
  height: 48px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  z-index: 20;
  color: #444;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition: background-color 0.2s;
}

.hamburger:hover {
  background: rgba(255, 255, 255, 1);
}

/* ========================================
   ナビゲーション ドロワー
   ======================================== */
.drawer {
  position: fixed;
  top: 0;
  left: -340px;
  width: 300px;
  height: 100%;
  background: #fff;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
  padding: 16px;
  padding-bottom: 72px;
  transition: left 0.25s ease;
  z-index: 25;
  overflow-y: auto;
}

.drawer.open {
  left: 0;
}

.drawer-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  margin-left: auto;
  display: block;
  padding: 4px 8px;
  color: #666;
  border-radius: 4px;
}

.drawer-close:hover {
  background: #f0f0f0;
}

.drawer ul {
  list-style: none;
  padding: 0;
  margin: 12px 0 0 0;
}

.drawer li {
  margin: 0;
  border-bottom: 1px solid #eef0f3;
}

.drawer a {
  color: #333;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  display: block;
  padding: 12px 8px;
  border-radius: 4px;
  transition: background-color 0.15s;
}

.drawer a:hover {
  background-color: #f5f6f8;
  text-decoration: none;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 15;
  display: none;
}

.drawer-backdrop.show {
  display: block;
}

.drawer-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  color: #2c3e50;
  padding: 4px 0 0 0;
}

.drawer-title:hover {
  text-decoration: none;
  color: #4a6fa5;
}

/* ========================================
   レスポンシブ（480px以下）
   ======================================== */
@media (max-width: 480px) {
  body {
    padding-bottom: 180px;
  }

  .container {
    padding: 52px 16px 20px;
  }

  h1 {
    font-size: 18px;
    margin-bottom: 16px;
  }

  h2 {
    font-size: 14px;
    margin-top: 20px;
  }

  input[type=number] {
    width: 100px;
    font-size: 15px;
    padding: 8px 10px;
  }

  select {
    font-size: 14px;
    padding: 8px 10px;
  }

  .adjustBtn {
    min-width: 40px;
    min-height: 40px;
    font-size: 14px;
    margin-left: 4px;
  }

  .result-header {
    padding: 12px 16px;
  }

  .result-content {
    padding: 0 16px 16px;
  }

  .result-content b {
    font-size: 16px;
  }

  .button {
    padding: 12px 16px;
    font-size: 14px;
  }

  .index-container {
    margin: 16px 12px;
    padding: 28px 16px;
  }
}
