/* ─── 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; }
.hero-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem; margin-top: .85rem; }
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .28rem .75rem;
  background: #ffedd5; color: #9a3412;
  border: 1px solid #fdba74;
  border-radius: 999px;
  font-size: .78rem; font-weight: 700;
}

/* ─── 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"] {
  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; }

/* ─── Mode grid ───────────────────────────────────── */
.mode-section-label {
  font-size: .82rem; font-weight: 700; color: #44403c; margin-bottom: .55rem;
}
.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  margin-bottom: 1.1rem;
}
.mode-btn {
  display: flex; flex-direction: column;
  padding: .6rem .7rem;
  border: 1.5px solid #e7e5e4;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s;
  font-family: inherit;
}
.mode-btn:hover { border-color: #d6d3d1; background: #fafaf9; }
.mode-btn-label { font-size: .83rem; font-weight: 700; color: #44403c; margin-bottom: .12rem; }
.mode-btn-desc  { font-size: .66rem; color: #a8a29e; line-height: 1.3; }

/* Mode color variants */
.mode-btn.mode-blue:hover    { border-color: #93c5fd; }
.mode-btn.mode-blue.active   { border-color: #3b82f6; background: #eff6ff; }
.mode-btn.mode-blue.active   .mode-btn-label { color: #1d4ed8; }
.mode-btn.mode-blue.active   .mode-btn-desc  { color: #3b82f6; }

.mode-btn.mode-amber:hover   { border-color: #fcd34d; }
.mode-btn.mode-amber.active  { border-color: #f59e0b; background: #fffbeb; }
.mode-btn.mode-amber.active  .mode-btn-label { color: #92400e; }
.mode-btn.mode-amber.active  .mode-btn-desc  { color: #b45309; }

.mode-btn.mode-green:hover   { border-color: #86efac; }
.mode-btn.mode-green.active  { border-color: #22c55e; background: #f0fdf4; }
.mode-btn.mode-green.active  .mode-btn-label { color: #15803d; }
.mode-btn.mode-green.active  .mode-btn-desc  { color: #16a34a; }

.mode-btn.mode-rose:hover    { border-color: #fda4af; }
.mode-btn.mode-rose.active   { border-color: #f43f5e; background: #fff1f2; }
.mode-btn.mode-rose.active   .mode-btn-label { color: #be123c; }
.mode-btn.mode-rose.active   .mode-btn-desc  { color: #e11d48; }

.mode-btn.mode-violet:hover  { border-color: #c4b5fd; }
.mode-btn.mode-violet.active { border-color: #8b5cf6; background: #f5f3ff; }
.mode-btn.mode-violet.active .mode-btn-label { color: #6d28d9; }
.mode-btn.mode-violet.active .mode-btn-desc  { color: #7c3aed; }

.mode-btn.mode-indigo:hover  { border-color: #a5b4fc; }
.mode-btn.mode-indigo.active { border-color: #6366f1; background: #eef2ff; }
.mode-btn.mode-indigo.active .mode-btn-label { color: #4338ca; }
.mode-btn.mode-indigo.active .mode-btn-desc  { color: #4f46e5; }

/* ─── Format toggle ───────────────────────────────── */
.format-row {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: 1rem;
}
.format-label { font-size: .82rem; font-weight: 700; color: #44403c; white-space: nowrap; }
.format-toggle { display: flex; gap: .3rem; }
.fmt-btn {
  padding: .32rem .75rem;
  border: 1.5px solid #e7e5e4;
  border-radius: 999px;
  font-size: .78rem; font-weight: 600;
  color: #57534e; background: #fff;
  cursor: pointer;
  transition: all .12s;
  font-family: inherit;
}
.fmt-btn:hover  { border-color: #fb923c; color: #ea580c; }
.fmt-btn.active { border-color: #ea580c; background: #ea580c; color: #fff; }

/* ─── Names grid ──────────────────────────────────── */
.names-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 1rem;
}

/* ─── 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;
  margin-top: .35rem;
}
.btn-generate:hover { background: #c2410c; }
.btn-generate:active { transform: scale(.98); }

/* ─── Result ──────────────────────────────────────── */
.result-empty {
  text-align: center;
  padding: 1.5rem;
  color: #a8a29e;
  font-size: .88rem;
  border: 2px dashed #fed7aa;
  border-radius: 10px;
}

.result-text-wrap { position: relative; margin-bottom: .9rem; }
.result-text {
  width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafc;
  border: 1.5px solid #e7e5e4;
  border-radius: 10px;
  padding: 1rem 1rem 2.8rem;
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  font-size: .92rem;
  line-height: 1.9;
  color: #1c1917;
  min-height: 5rem;
}
.btn-copy-result {
  position: absolute;
  bottom: .6rem; right: .6rem;
  padding: .28rem .75rem;
  background: #ea580c; color: #fff;
  border: none; border-radius: 7px;
  font-size: .76rem; font-weight: 700;
  cursor: pointer; transition: background .12s;
  font-family: inherit;
}
.btn-copy-result:hover { background: #c2410c; }

/* ─── Meter ───────────────────────────────────────── */
.meter-section { margin-bottom: .9rem; }
.meter-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: .35rem;
}
.meter-label { font-size: .82rem; font-weight: 700; color: #44403c; }
.meter-score { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.meter-bar-bg {
  background: #f0efed; border-radius: 999px;
  height: 10px; overflow: hidden; margin-bottom: .4rem;
}
.meter-bar-fill {
  height: 100%; border-radius: 999px;
  transition: width .04s linear;
  min-width: 3px;
}
.meter-comment {
  font-size: .8rem; font-weight: 600;
  padding: .25rem .65rem;
  border-radius: 6px;
  display: inline-block;
}
.score-perfect { background: #dcfce7; color: #15803d; }
.score-great   { background: #d1fae5; color: #065f46; }
.score-good    { background: #ecfccb; color: #3f6212; }
.score-mid     { background: #fef9c3; color: #854d0e; }
.score-low     { background: #ffedd5; color: #9a3412; }
.score-bad     { background: #fee2e2; color: #991b1b; }

/* ─── Result tags ─────────────────────────────────── */
.result-tags {
  display: flex; flex-wrap: wrap; gap: .35rem;
  margin-bottom: .75rem;
}
.result-tag {
  display: inline-flex; align-items: center;
  padding: .18rem .6rem;
  border-radius: 6px;
  font-size: .74rem; font-weight: 600;
  border: 1px solid;
}
.tag-mode  { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.tag-fmt   { background: #f0f9ff; color: #0369a1; border-color: #bae6fd; }
.tag-score { /* color & border set inline */ }

/* ─── Result actions ──────────────────────────────── */
.result-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-action {
  padding: .38rem .85rem;
  border: 1.5px solid #e7e5e4;
  border-radius: 8px;
  background: #fff; font-size: .8rem; font-weight: 600;
  color: #57534e; cursor: pointer;
  transition: background .12s, border-color .12s;
  font-family: inherit;
}
.btn-action:hover { background: #f5f5f4; border-color: #d6d3d1; }

/* ─── History ─────────────────────────────────────── */
.history-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .6rem;
}
.btn-clear-hist {
  font-size: .75rem; color: #a8a29e;
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-weight: 600;
  transition: color .12s;
}
.btn-clear-hist:hover { color: #dc2626; }

.history-empty { font-size: .85rem; color: #a8a29e; text-align: center; padding: .5rem; }
.history-list { display: flex; flex-direction: column; gap: .5rem; }
.history-item {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .65rem .8rem;
  border: 1.5px solid #e7e5e4;
  border-radius: 10px;
  background: #fafaf9;
  transition: border-color .12s;
}
.history-item:hover { border-color: #fed7aa; }
.history-info { flex: 1; min-width: 0; }
.history-preview {
  font-size: .8rem; color: #44403c;
  line-height: 1.5; margin-bottom: .3rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.history-mode  { font-size: .72rem; font-weight: 700; color: #ea580c; }
.history-score { font-size: .72rem; color: #78716c; }
.history-date  { font-size: .7rem;  color: #a8a29e; }
.history-actions { flex-shrink: 0; }
.btn-hist-copy {
  padding: .22rem .5rem;
  border: 1.5px solid #e7e5e4; border-radius: 6px;
  background: #fff; font-size: .72rem; font-weight: 700;
  color: #57534e; cursor: pointer;
  transition: background .12s; font-family: inherit;
}
.btn-hist-copy:hover { background: #fff7ed; border-color: #fb923c; color: #ea580c; }

/* ─── Note card ───────────────────────────────────── */
.note-card { border-color: #fde68a; background: #fffbeb; }
.note-card h2 { color: #b45309; }
.note-text { font-size: .83rem; color: #78716c; line-height: 1.75; }
.note-text strong { color: #57534e; }

/* ─── 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 ───────────────────────────────────────── */
#teiji-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);
}
#teiji-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; }

/* ─── 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; }

/* ─── Scene grid ─────────────────────────────────── */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-top: .5rem;
}
.scene-item {
  background: #fff7ed;
  border: 1.5px solid #fed7aa;
  border-radius: 12px;
  padding: .9rem .85rem;
}
.scene-item .scene-icon { font-size: 1.5rem; margin-bottom: .35rem; }
.scene-item strong { display: block; font-size: .83rem; font-weight: 700; color: #9a3412; margin-bottom: .25rem; }
.scene-item p { font-size: .76rem; color: #78716c; line-height: 1.55; }

/* ─── Related tools ──────────────────────────────── */
.related-tools { display: flex; flex-direction: column; gap: .55rem; }
.related-tool-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem .9rem;
  border: 1.5px solid #fed7aa;
  border-radius: 10px;
  background: #fff;
  text-decoration: none; color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.related-tool-item:hover { border-color: #fb923c; box-shadow: 0 2px 6px rgba(234,88,12,.1); }
.related-tool-icon { font-size: 1.4rem; flex-shrink: 0; }
.related-tool-name { font-size: .85rem; font-weight: 700; color: #ea580c; margin-bottom: .1rem; }
.related-tool-desc { font-size: .76rem; color: #78716c; }

/* ─── Responsive ──────────────────────────────────── */
@media (max-width: 620px) {
  .mode-grid   { grid-template-columns: repeat(2, 1fr); }
  .names-grid  { grid-template-columns: 1fr; }
  .hero h1     { font-size: 1.4rem; }
  .format-row  { flex-wrap: wrap; }
  .scene-grid  { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .hero h1     { font-size: 1.25rem; }
  .amazon-grid { grid-template-columns: 1fr; }
  .tips-grid   { grid-template-columns: 1fr; }
  .scene-grid  { grid-template-columns: 1fr; }
}

.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: #ea580c; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #555; line-height: 1.75; }
