/* ══════════════════════════════════════════════════════════
   ルーレット・くじ引き・ビンゴ — スタイル
   テーマカラー: Emerald (#059669)
   ══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #ecfdf5;
  color: #1c1917;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── ヘッダー ── */
header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 16px;
  height: 52px;
  display: flex;
  align-items: center;
}
.logo { font-weight: 700; font-size: 1.1rem; color: #059669; text-decoration: none; }
.logo:hover { color: #047857; }

/* ── メイン ── */
main {
  flex: 1;
  max-width: 740px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  width: 100%;
}

/* ── ヒーロー ── */
.hero { text-align: center; padding: 28px 0 20px; }
.hero-icon { font-size: 3rem; margin-bottom: 10px; }
.hero h1 { font-size: 1.75rem; font-weight: 700; color: #065f46; margin-bottom: 6px; }
.description { color: #059669; font-size: 0.95rem; line-height: 1.7; }

/* ── モードタブ ── */
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.mode-tab {
  padding: 11px 8px;
  border: 2px solid #a7f3d0;
  border-radius: 12px;
  background: #f0fdf4;
  color: #059669;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  touch-action: manipulation;
}
.mode-tab:hover { border-color: #6ee7b7; background: #d1fae5; }
.mode-tab.active {
  background: #059669;
  border-color: #059669;
  color: #fff;
  box-shadow: 0 2px 10px rgba(5,150,105,.35);
}

/* ── ツールラップ ── */
.tool-wrap {
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 16px rgba(5,150,105,.1);
}

/* ══════════════════════════════
   ルーレット
   ══════════════════════════════ */
.wheel-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}

.canvas-wrap {
  position: relative;
  margin-bottom: 16px;
}
.canvas-wrap canvas {
  display: block;
  border-radius: 50%;
  box-shadow: 0 4px 24px rgba(5,150,105,.2);
}
.pointer {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.8rem;
  color: #dc2626;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
  line-height: 1;
  z-index: 2;
}

.spin-btn {
  padding: 14px 48px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 4px 16px rgba(5,150,105,.4);
  touch-action: manipulation;
  margin-top: 8px;
}
.spin-btn:hover  { background: #047857; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(5,150,105,.45); }
.spin-btn:active { transform: translateY(0); }
.spin-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* 結果ボックス */
.result-box {
  text-align: center;
  margin-bottom: 12px;
  padding: 12px 24px;
  background: #d1fae5;
  border: 2px solid #34d399;
  border-radius: 14px;
  animation: pop-in .35s cubic-bezier(.34,1.56,.64,1);
}
.result-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #059669;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 4px;
}
.result-text {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: #065f46;
  word-break: break-all;
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(.85); }
  to   { opacity: 1; transform: scale(1); }
}

/* 項目リスト */
.items-section {
  border-top: 1px solid #d1fae5;
  padding-top: 20px;
}
.items-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.items-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #065f46;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.add-item-btn {
  padding: 5px 12px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .15s;
}
.add-item-btn:hover { background: #047857; }

.item-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 12px;
}
.item-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.item-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.item-input {
  flex: 1;
  padding: 7px 10px;
  border: 1.5px solid #a7f3d0;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #1c1917;
  background: #f0fdf4;
  outline: none;
  transition: border-color .15s;
}
.item-input:focus { border-color: #059669; background: #fff; }
.item-del-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.item-del-btn:hover { background: #fca5a5; }

.items-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.action-btn {
  padding: 7px 16px;
  border: 1.5px solid #a7f3d0;
  border-radius: 20px;
  background: #f0fdf4;
  color: #065f46;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  touch-action: manipulation;
}
.action-btn:hover { background: #059669; color: #fff; border-color: #059669; }
.action-btn.sm { padding: 4px 10px; font-size: 0.75rem; }

.remove-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #374151;
  cursor: pointer;
  user-select: none;
}
.remove-toggle input[type="checkbox"] {
  accent-color: #059669;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ══════════════════════════════
   くじ引き
   ══════════════════════════════ */
.lottery-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-bottom: 20px;
}

.lottery-draw-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lottery-box {
  width: 140px;
  height: 140px;
  border: 3px dashed #34d399;
  border-radius: 20px;
  background: #f0fdf4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all .2s;
}
.lottery-box:hover { border-color: #059669; background: #d1fae5; transform: scale(1.04); }
.lottery-box-icon { font-size: 2.5rem; }
.lottery-box-count { font-size: 0.85rem; font-weight: 700; color: #059669; }

.draw-btn {
  padding: 13px 32px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 4px 14px rgba(5,150,105,.35);
  touch-action: manipulation;
  width: 100%;
}
.draw-btn:hover:not(:disabled)  { background: #047857; transform: translateY(-1px); }
.draw-btn:active { transform: translateY(0); }
.draw-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.lottery-setup { display: flex; flex-direction: column; gap: 10px; }
.lottery-input-header { display: flex; align-items: baseline; gap: 8px; }
.lottery-hint { font-size: 0.75rem; color: #6b7280; }

.lottery-textarea {
  width: 100%;
  height: 140px;
  padding: 10px 12px;
  border: 1.5px solid #a7f3d0;
  border-radius: 10px;
  background: #f0fdf4;
  font-size: 0.9rem;
  color: #1c1917;
  resize: vertical;
  outline: none;
  line-height: 1.6;
  font-family: inherit;
  transition: border-color .15s;
}
.lottery-textarea:focus { border-color: #059669; background: #fff; }

.lottery-setup-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* 履歴 */
.history-section {
  border-top: 1px solid #d1fae5;
  padding-top: 16px;
}
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.history-list { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #f0fdf4;
  border-radius: 8px;
  font-size: 0.875rem;
}
.history-num {
  font-size: 0.72rem;
  color: #9ca3af;
  min-width: 24px;
}
.history-text { font-weight: 600; color: #065f46; }

/* ══════════════════════════════
   ビンゴ
   ══════════════════════════════ */
.bingo-controls {
  margin-bottom: 24px;
}
.bingo-range {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: #f0fdf4;
  border-radius: 12px;
  border: 1px solid #d1fae5;
  font-size: 0.875rem;
  color: #374151;
}
.range-input {
  width: 58px;
  padding: 5px 6px;
  border: 1.5px solid #a7f3d0;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  color: #1c1917;
  background: #fff;
  outline: none;
  -moz-appearance: textfield;
  transition: border-color .15s;
}
.range-input::-webkit-outer-spin-button,
.range-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.range-input:focus { border-color: #059669; }

.bingo-draw-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.bingo-number-display {
  text-align: center;
  padding: 20px 32px;
  background: #d1fae5;
  border: 2px solid #34d399;
  border-radius: 20px;
  min-width: 200px;
}
.bingo-num {
  display: block;
  font-size: 4rem;
  font-weight: 900;
  color: #065f46;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: all .2s;
}
.bingo-num-label {
  display: block;
  font-size: 0.78rem;
  color: #059669;
  font-weight: 600;
  margin-top: 6px;
}
.bingo-stats { font-size: 0.82rem; color: #6b7280; }

.bingo-draw-btn { min-width: 160px; }

/* ビンゴグリッド */
.bingo-grid-wrap { margin-top: 8px; }
.bingo-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.bingo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bingo-cell {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #059669;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: cell-pop .3s cubic-bezier(.34,1.56,.64,1);
}
.bingo-cell.latest {
  background: #dc2626;
  box-shadow: 0 0 0 3px #fca5a5;
}
@keyframes cell-pop {
  from { opacity: 0; transform: scale(.5); }
  to   { opacity: 1; transform: scale(1); }
}

/* ══════════════════════════════
   汎用カード
   ══════════════════════════════ */
.card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(5,150,105,.06);
}
.card h2 { font-size: 1.1rem; font-weight: 700; color: #065f46; margin-bottom: 16px; }
.how-item { margin-bottom: 14px; }
.how-item:last-child { margin-bottom: 0; }
.how-item h3 { font-size: 0.95rem; font-weight: 600; color: #059669; margin-bottom: 4px; }
.how-item p  { font-size: 0.875rem; color: #374151; line-height: 1.65; }

/* ── フッター ── */
footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 0.8rem;
  color: #9ca3af;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
footer a { color: #059669; text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer p + p { margin-top: 4px; }

.hidden { display: none !important; }

/* ══════════════════════════════
   スクロールバー
   ══════════════════════════════ */
.item-list::-webkit-scrollbar,
.history-list::-webkit-scrollbar { width: 5px; }
.item-list::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track { background: #f0fdf4; border-radius: 10px; }
.item-list::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb { background: #6ee7b7; border-radius: 10px; }

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

/* ─── Tips grid (rank-tracker 統一パターン) ──────── */
.tips-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.tip-item { display: flex; gap: .65rem; }
.tip-icon { font-size: 1.4rem; flex-shrink: 0; }
.tip-text strong { display: block; font-weight: 700; margin-bottom: .15rem; font-size: .88rem; }
.tip-text p { font-size: .8rem; color: #78716c; line-height: 1.55; }
@media (max-width: 540px) {
  .hero h1 { font-size: 1.35rem; }
  .tool-wrap { padding: 20px 16px; }

  .mode-tab { font-size: 0.8rem; padding: 10px 4px; }

  .lottery-main { grid-template-columns: 1fr; }
  .lottery-draw-area { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .lottery-box { width: 110px; height: 110px; }

  .bingo-num { font-size: 3rem; }
  .bingo-cell { width: 38px; height: 38px; font-size: 0.82rem; }

  .tips-grid { grid-template-columns: 1fr; }
}

/* ━━━ Amazonおすすめ ━━━ */
.amazon-card h2 { margin-bottom: 0.25rem; }
.amazon-note { font-size: 0.82rem; color: #999; margin-bottom: 1rem; }
.amazon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.amazon-item {
  display: block;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 0.9rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}
.amazon-item:hover {
  border-color: #FF9900;
  box-shadow: 0 2px 8px rgba(255,153,0,0.15);
  transform: translateY(-1px);
}
.amazon-item-icon { font-size: 1.7rem; margin-bottom: 0.35rem; }
.amazon-item-name { font-size: 0.88rem; font-weight: bold; margin-bottom: 0.2rem; }
.amazon-item-desc { font-size: 0.76rem; color: #888; line-height: 1.5; margin-bottom: 0.45rem; }
.amazon-item-link { font-size: 0.78rem; color: #FF9900; font-weight: bold; }

.amazon-notice {
  font-size: 0.72rem;
  color: #bbb;
  margin-top: 0.2rem;
}

/* ━━━ FAQ ━━━ */
.faq-list { display: flex; flex-direction: column; }
.faq-item { padding: .9rem 0; border-bottom: 1px solid #f0f0f0; }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-size: .9rem; font-weight: 700; color: #1a73e8; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #555; line-height: 1.75; }
