/* ========================================
   零探しチェッカー
   ======================================== */

/* --- リセット & ベース --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Noto Sans JP", "Yu Gothic", "游ゴシック", sans-serif;
  background-color: #f5f5f5;
  color: #222222;
  min-height: 100dvh;
  overflow-x: hidden;
  padding: 0 16px 24px 16px;
  padding-top: 64px;
}

/* --- ヘッダー --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 56px;
  background: #1a1a1a;
  border-bottom: 1px solid #333333;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #ffffff;
}

/* --- ハンバーガーメニュー --- */
.hamburger-btn {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 1100;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.2s;
  padding: 0;
}

.hamburger-btn:hover,
.hamburger-btn:active {
  background: rgba(255, 255, 255, 0.1);
}

.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: #cccccc;
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
}

.hamburger-btn.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --- サイドメニュー --- */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.menu-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.side-menu {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: #1a1a1a;
  border-right: 1px solid #333333;
  z-index: 1060;
  transition: left 0.3s ease;
  padding: 72px 0 24px 0;
  overflow-y: auto;
}

.side-menu.active {
  left: 0;
}

.menu-list {
  list-style: none;
}

.menu-list li {
  border-bottom: 1px solid #2a2a2a;
}

.menu-list a {
  display: block;
  padding: 16px 24px;
  color: #bbbbbb;
  text-decoration: none;
  font-size: 15px;
  letter-spacing: 0.05em;
  transition: background 0.2s, color 0.2s;
}

.menu-list a:hover,
.menu-list a:active {
  background: #2a2a2a;
  color: #ffffff;
}

/* --- メインコンテナ --- */
.main-container {
  max-width: 480px;
  margin: 0 auto;
}

/* --- カード風セクション --- */
.card-section {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 20px 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.section-title {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
  color: #222222;
  position: relative;
  padding-bottom: 12px;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 1px;
  background: #cccccc;
}

/* --- 入力グループ --- */
.input-group {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
  flex-wrap: wrap;
}

.input-group.input-row {
  flex-wrap: nowrap;
  overflow: visible;
  gap: 6px;
}

.input-group label {
  flex: 0 0 auto;
  font-size: 14px;
  color: #555555;
  white-space: nowrap;
  min-width: 0;
}

.input-row label {
  font-size: 13px;
  width: 6.5em;
  flex: 0 0 6.5em;
}

.label-break {
  text-align: center;
  line-height: 1.4;
  white-space: normal;
}

/* --- 数値入力 + ステッパーボタン --- */
.stepper-group {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.stepper-btn {
  width: 40px;
  height: 40px;
  background: #f0f0f0;
  border: 1px solid #d0d0d0;
  color: #333333;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  line-height: 1;
  padding: 0;
  font-family: inherit;
}

.stepper-btn:first-child {
  border-radius: 8px 0 0 8px;
}

.stepper-btn:last-child {
  border-radius: 0 8px 8px 0;
}

.stepper-btn:hover {
  background: #e0e0e0;
}

.stepper-btn:active {
  background: #cccccc;
  transform: scale(0.95);
}

.stepper-input {
  width: 52px;
  height: 40px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  font-family: "Noto Sans JP", sans-serif;
  background: #ffffff;
  border: 1px solid #d0d0d0;
  border-left: none;
  border-right: none;
  color: #222222;
  outline: none;
  -moz-appearance: textfield;
}

.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stepper-input:focus {
  background: #fafafa;
  border-color: #aaaaaa;
}

/* --- クイック選択ボタン --- */
.quick-buttons {
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.quick-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  background: #f0f0f0;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  color: #444444;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  flex-shrink: 0;
  text-align: center;
}

.quick-btn:hover {
  background: #e0e0e0;
  border-color: #bbbbbb;
}

.quick-btn:active {
  background: #cccccc;
  transform: scale(0.95);
}

/* --- メインアクションボタン --- */
.action-btn {
  width: 100%;
  padding: 14px 16px;
  background: #2c2c2c;
  border: none;
  border-radius: 10px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  margin-top: 4px;
}

.action-btn:hover {
  background: #444444;
}

.action-btn:active {
  transform: scale(0.98);
  background: #1a1a1a;
}

/* --- 結果表示 --- */
.result-area {
  margin-top: 14px;
  padding: 14px 16px;
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.8;
  color: #333333;
  min-height: 20px;
  display: none;
}

.result-area.visible {
  display: block;
}

.result-area .probability {
  color: #111111;
  font-weight: 700;
}

/* --- セクション区切り --- */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}

.section-divider::before,
.section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #dddddd;
}

.section-divider span {
  font-size: 12px;
  color: #999999;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* --- マリガンボタングリッド --- */
.mulligan-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.mulligan-btn {
  height: 48px;
  background: #f0f0f0;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  color: #333333;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mulligan-btn:hover {
  background: #e0e0e0;
  border-color: #bbbbbb;
}

.mulligan-btn:active {
  background: #cccccc;
  transform: scale(0.95);
}

/* --- 説明テキスト --- */
.explanation {
  font-size: 13px;
  color: #888888;
  font-style: italic;
  margin-bottom: 8px;
  text-align: center;
}

/* --- 装飾的要素 --- */
.ornament {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.6em;
  color: #cccccc;
  margin: 4px 0 16px;
  user-select: none;
}

/* ========================================
   レスポンシブ
   ======================================== */

@media (max-width: 400px) {
  body {
    padding: 0 10px 16px 10px;
    padding-top: 60px;
  }

  .header {
    height: 52px;
  }

  .header-title {
    font-size: 17px;
  }

  .card-section {
    padding: 16px 12px;
    margin-bottom: 12px;
    border-radius: 10px;
  }

  .section-title {
    font-size: 15px;
    margin-bottom: 12px;
  }

  .input-group label {
    font-size: 12px;
  }

  .stepper-btn {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .stepper-input {
    width: 42px;
    height: 36px;
    font-size: 15px;
  }

  .quick-btn {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .action-btn {
    padding: 12px 14px;
    font-size: 15px;
  }

  .mulligan-grid {
    gap: 6px;
  }

  .mulligan-btn {
    height: 44px;
    font-size: 16px;
  }

  .hamburger-btn {
    left: 8px;
    top: 8px;
    width: 36px;
    height: 36px;
  }

  .side-menu {
    width: 260px;
    left: -260px;
  }
}

@media (min-width: 401px) and (max-width: 768px) {
  .mulligan-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 769px) {
  body {
    padding-top: 80px;
  }

  .header {
    height: 64px;
  }

  .header-title {
    font-size: 24px;
  }

  .main-container {
    max-width: 520px;
  }

  .card-section {
    padding: 28px 24px;
    border-radius: 14px;
  }

  .section-title {
    font-size: 19px;
  }

  .stepper-btn {
    width: 44px;
    height: 44px;
    font-size: 24px;
  }

  .stepper-input {
    width: 60px;
    height: 44px;
    font-size: 20px;
  }

  .mulligan-grid {
    grid-template-columns: repeat(8, 1fr);
  }

  .mulligan-btn {
    height: 52px;
    font-size: 20px;
  }

  .hamburger-btn {
    left: 16px;
    top: 12px;
    width: 44px;
    height: 44px;
  }

  .hamburger-btn span {
    width: 22px;
  }
}
