/* ─── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: #fff7ed;
  color: #1c1917;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Header ─────────────────────────────────────── */
header {
  background: #ea580c;
  color: #fff;
  padding: 0 1rem;
  height: 52px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(234,88,12,.35);
}
.header-inner { max-width: 900px; width: 100%; margin: 0 auto; }
.logo { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }

/* ─── Main ───────────────────────────────────────── */
main { max-width: 900px; width: 100%; margin: 0 auto; padding: 1.5rem 1rem 3rem; flex: 1; }

/* ─── Hero ───────────────────────────────────────── */
.hero { text-align: center; margin-bottom: 1.5rem; }
.hero-icon { font-size: 3rem; margin-bottom: .5rem; }
.hero h1 { font-size: 1.75rem; font-weight: 800; color: #ea580c; margin-bottom: .5rem; }
.description { color: #57534e; font-size: .95rem; line-height: 1.7; }

/* ─── Card ───────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 14px;
  border: 1.5px solid #fed7aa;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(234,88,12,.07);
  margin-bottom: 1rem;
}
.card h2 { font-size: 1.05rem; font-weight: 700; color: #ea580c; margin-bottom: .85rem; }

/* ─── Field ──────────────────────────────────────── */
.field { margin-bottom: .85rem; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: flex; align-items: center; gap: .35rem;
  font-size: .82rem; font-weight: 700; color: #44403c;
  margin-bottom: .3rem;
}
.field-opt { font-size: .68rem; color: #a8a29e; }
.field input[type="text"], .field input[type="number"] {
  width: 100%;
  border: 1.5px solid #e7e5e4;
  border-radius: 9px;
  padding: .6rem .85rem;
  font-size: .9rem;
  font-family: inherit;
  color: #1c1917;
  background: #fafaf9;
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: #ea580c; background: #fff; }
.field-hint { font-size: .72rem; color: #a8a29e; margin-top: .3rem; }

/* ─── Title row ─────────────────────────────────── */
.title-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 1rem;
  margin-bottom: .85rem;
}

/* ─── Options row ────────────────────────────────── */
.options-row {
  display: flex; flex-wrap: wrap; gap: .75rem;
  margin-bottom: .85rem;
  align-items: flex-end;
}
.option-group { display: flex; flex-direction: column; gap: .3rem; }
.option-label { font-size: .78rem; font-weight: 700; color: #44403c; }
.btn-group { display: flex; gap: .3rem; }
.opt-btn {
  padding: .3rem .7rem;
  border: 1.5px solid #e7e5e4;
  border-radius: 999px;
  font-size: .77rem; font-weight: 600;
  color: #57534e; background: #fff;
  cursor: pointer; transition: all .12s;
  font-family: inherit;
}
.opt-btn:hover  { border-color: #fb923c; color: #ea580c; }
.opt-btn.active { border-color: #ea580c; background: #ea580c; color: #fff; }

/* ─── Item list ─────────────────────────────────── */
.item-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.item-row {
  display: grid;
  grid-template-columns: 1fr 90px 32px;
  gap: .5rem;
  align-items: center;
}
.item-row input[type="text"] {
  border: 1.5px solid #e7e5e4;
  border-radius: 8px;
  padding: .45rem .7rem;
  font-size: .88rem;
  font-family: inherit;
  color: #1c1917;
  background: #fafaf9;
  outline: none;
  transition: border-color .15s;
}
.item-row input[type="text"]:focus { border-color: #ea580c; background: #fff; }
.item-num-wrap {
  display: flex; align-items: center; gap: 2px;
}
.item-num-wrap input[type="number"] {
  width: 58px;
  border: 1.5px solid #e7e5e4;
  border-radius: 8px;
  padding: .45rem .5rem;
  font-size: .88rem;
  font-family: inherit;
  text-align: right;
  color: #1c1917;
  background: #fafaf9;
  outline: none;
  -moz-appearance: textfield;
}
.item-num-wrap input:focus { border-color: #ea580c; background: #fff; }
.item-num-wrap input::-webkit-inner-spin-button,
.item-num-wrap input::-webkit-outer-spin-button { -webkit-appearance: none; }
.item-unit { font-size: .78rem; color: #a8a29e; }
.item-dot {
  width: 14px; height: 14px; border-radius: 50%;
  flex-shrink: 0;
}
.btn-del-item {
  width: 32px; height: 32px;
  border: 1.5px solid #e7e5e4; border-radius: 8px;
  background: #fff; font-size: .85rem;
  color: #a8a29e; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s; font-family: inherit;
}
.btn-del-item:hover { border-color: #fca5a5; color: #dc2626; background: #fee2e2; }

.btn-add-item {
  padding: .38rem .85rem;
  border: 1.5px dashed #e7e5e4;
  border-radius: 8px;
  background: #fafaf9; font-size: .8rem; font-weight: 600;
  color: #78716c; cursor: pointer;
  transition: all .12s;
  font-family: inherit; width: 100%;
  margin-bottom: .5rem;
}
.btn-add-item:hover { border-color: #fb923c; color: #ea580c; background: #fff7ed; }

/* ─── Generate button ─────────────────────────────── */
.btn-generate {
  width: 100%;
  background: #ea580c; color: #fff;
  border: none; border-radius: 10px;
  padding: .72rem;
  font-size: .97rem; font-weight: 700;
  cursor: pointer; transition: background .15s;
  font-family: inherit;
}
.btn-generate:hover { background: #c2410c; }

/* ─── Preview ─────────────────────────────────────── */
.preview-wrap {
  text-align: center;
  margin-bottom: .85rem;
}
#chart-canvas {
  max-width: 100%;
  border-radius: 10px;
  border: 1.5px solid #e7e5e4;
}
.canvas-placeholder {
  padding: 3rem 1rem;
  color: #a8a29e;
  font-size: .88rem;
  border: 2px dashed #fed7aa;
  border-radius: 10px;
  text-align: center;
}

/* ─── Result actions ──────────────────────────────── */
.result-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.btn-action {
  padding: .42rem .95rem;
  border: 1.5px solid #e7e5e4;
  border-radius: 8px;
  background: #fff; font-size: .82rem; font-weight: 600;
  color: #57534e; cursor: pointer;
  transition: background .12s, border-color .12s;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex; align-items: center;
}
.btn-action:hover { background: #f5f5f4; border-color: #d6d3d1; }
.btn-action.primary {
  background: #ea580c; color: #fff; border-color: #ea580c;
}
.btn-action.primary:hover { background: #c2410c; }

/* ─── Amazon ──────────────────────────────────────── */
.amazon-card h2 { margin-bottom: 0.2rem; }
.amazon-note { font-size: 0.8rem; color: #a8a29e; margin-bottom: .85rem; }
.amazon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.65rem; }
.amazon-item {
  display: block; border: 1px solid #e0e0e0; border-radius: 10px;
  padding: 0.85rem; 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.6rem; margin-bottom: 0.3rem; }
.amazon-item-name { font-size: 0.85rem; font-weight: bold; margin-bottom: 0.18rem; }
.amazon-item-desc { font-size: 0.74rem; color: #888; line-height: 1.5; margin-bottom: 0.4rem; }
.amazon-item-link { font-size: 0.76rem; color: #FF9900; font-weight: bold; }

/* ─── Toast ───────────────────────────────────────── */
#mc-toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: #1c1917; color: #fff;
  padding: .6rem 1.2rem; border-radius: 8px;
  font-size: .85rem; font-weight: 600;
  z-index: 9999; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
#mc-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Footer ──────────────────────────────────────── */
footer {
  text-align: center; padding: 1.5rem 1rem;
  font-size: .82rem; color: #a8a29e;
  border-top: 1px solid #e7e5e4; margin-top: auto;
}
footer a { color: #ea580c; text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer p + p { margin-top: .3rem; }

/* ─── Responsive ──────────────────────────────────── */
@media (max-width: 620px) {
  .title-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.4rem; }
  .amazon-grid { grid-template-columns: 1fr; }
}

/* ─── 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: 480px) {
  .hero h1 { font-size: 1.25rem; }
  .item-row { grid-template-columns: 1fr 80px 32px; }

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

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