/* ============================================================
   ヤンヤン — 縦積み棒グラフ生成
   style.css（ミンミンデザイン準拠）
   ============================================================ */

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

:root {
  --bg:           #FDF4EA;
  --surface:      #FFFFFF;
  --surface2:     #F5EAD8;
  --border:       rgba(73,167,206,0.15);
  --border2:      rgba(73,167,206,0.30);
  --text:         #2C2C2C;
  --muted:        #7A7A7A;
  --accent:       #49A7CE;
  --accent-dark:  #3388AD;
  --accent-light: rgba(73,167,206,0.10);
  --accent-glow:  rgba(73,167,206,0.20);
  --success:      #2DA870;
  --warning:      #D48A10;
  --danger:       #D64545;
  --danger-bg:    rgba(214,69,69,0.09);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 400;
  min-height: 100vh;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }

/* ── ヘッダー ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border2);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.2rem 2rem;
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo-link { display: flex; align-items: center; flex-shrink: 0; text-decoration: none; }
.logo-img { height: 38px; width: auto; border-radius: var(--radius-sm); display: block; }
.logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.logo-text small {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  font-family: 'Noto Sans JP', sans-serif;
  letter-spacing: 0;
}
.header-title-group { display: flex; align-items: center; gap: 10px; flex: 1; }
.header-free-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
  font-family: 'Noto Sans JP', sans-serif;
  flex-shrink: 0;
}

.header-usage-count {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
  font-family: 'Noto Sans JP', sans-serif;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-usage-count strong {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: var(--accent-dark);
}

/* ── ヒーロー ── */
.hero {
  background: linear-gradient(135deg, #FDF4EA 0%, #FEF1DA 50%, #FDF4EA 100%);
  border-bottom: 2px solid rgba(73,167,206,0.15);
  overflow: hidden;
}
.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.8rem 2rem 0;
  display: flex;
  align-items: flex-end;
  gap: 1rem;
}
.hero-text { flex: 1; padding-bottom: 2.5rem; }
.hero h1 {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: 0.9rem;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-lead { font-size: 0.92rem; color: var(--muted); line-height: 1.8; max-width: 560px; margin-bottom: 1.4rem; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hero-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  border: 1px solid var(--border2);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 500;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: #AAAAAA; flex-shrink: 0; display: inline-block; }
.hero-chara { flex-shrink: 0; width: 300px; height: 300px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.hero-chara img { width: 300px; height: 300px; object-fit: contain; object-position: bottom; display: block; }

/* ── ツール本体ラッパー ── */
.tool-section {
  max-width: 1060px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}
.tool-heading {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tool-heading::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.1em;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── エディタレイアウト ── */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
  align-items: start;
}
.tool-left {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

/* ── パネル共通 ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.75rem;
  box-shadow: 0 2px 12px rgba(73,167,206,0.06);
}
#preview-panel { padding: 0; overflow: hidden; }
.tool-left .panel + .panel {
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 1.25rem 1.75rem;
}
.panel__title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel__title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 1em;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.panel__desc { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.75rem; line-height: 1.6; }

/* ── 列リスト（スプレッドシート項目） ── */
.col-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.col-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  flex-wrap: wrap;
}
.col-row__letter {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--accent-dark);
  background: var(--accent-light);
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.col-row__name {
  flex: 1 1 120px;
  min-width: 90px;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.82rem;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.col-row__name:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.col-row__name:disabled {
  background: var(--surface2);
  color: var(--muted);
  border-color: var(--border);
}
.col-row__code {
  font-family: 'Outfit', monospace;
  font-size: 0.7rem;
  background: var(--surface);
  border: 1px dashed var(--border2);
  color: var(--accent-dark);
  padding: 3px 7px;
  border-radius: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}
.col-row__required {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--danger);
  background: var(--danger-bg);
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
}
.col-row__values {
  font-size: 0.68rem;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}
.col-row__check-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
  cursor: pointer;
}
.col-row__check-label input { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }
.col-row__del {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.col-row__del:hover { background: var(--danger-bg); border-color: var(--danger); }
.col-row__del:disabled { opacity: 0.3; cursor: not-allowed; }
.col-row__del:disabled:hover { background: var(--surface); border-color: var(--border2); }

.btn-add-col {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: var(--accent-light);
  color: var(--accent-dark);
  border: 1px dashed var(--border2);
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: 'Noto Sans JP', sans-serif;
  transition: background 0.15s;
}
.btn-add-col:hover { background: rgba(73,167,206,0.18); }

/* ── 代入コードチップ ── */
.code-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.code-chip {
  font-family: 'Outfit', monospace;
  font-size: 0.7rem;
  background: var(--accent-light);
  color: var(--accent-dark);
  border: none;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.code-chip:hover { background: rgba(73,167,206,0.22); }

/* ── 送信元アドレス注意書き ── */
.form-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.6;
}
.form-hint code {
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'Outfit', monospace;
  color: var(--accent-dark);
}

/* ── 待機時間トグル ── */
.wait-select { display: flex; gap: 6px; }
.wait-select__btn {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  font-family: 'Outfit', sans-serif;
  transition: all 0.15s;
}
.wait-select__btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── DLボタン ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.02em;
}
.btn-primary:hover  { background: var(--accent-dark); }
.btn-primary:active { transform: scale(0.98); }

/* ── コードコピーエリア ── */
.code-tabs-wrap { margin-bottom: 10px; }
.code-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  padding: 3px;
  border-radius: var(--radius-sm);
  width: fit-content;
}
.code-tab {
  padding: 4px 14px;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--muted);
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.code-tab:hover { color: var(--accent-dark); }
.code-tab.active { background: var(--surface); color: var(--accent-dark); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.code-block-wrap {}
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: #1e2130;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.code-block-lang {
  font-family: 'Outfit', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border: 1px solid var(--surface);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--accent-dark);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-copy:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent-dark); }
.btn-copy.copied { background: var(--success); border-color: var(--success); color: #fff; }
pre.code-area {
  margin: 0;
  padding: 14px;
  background: #252838;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow-x: auto;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #444 transparent;
  font-family: 'IBM Plex Mono', 'Consolas', 'Monaco', monospace;
  font-size: 0.72rem;
  line-height: 1.7;
  color: #e8eaf0;
  white-space: pre;
}
pre.code-area .tok-tag   { color: #79b8ff; }
pre.code-area .tok-attr  { color: #ffab70; }
pre.code-area .tok-val   { color: #9ecbff; }
pre.code-area .tok-prop  { color: #79b8ff; }
pre.code-area .tok-num   { color: #f8c555; }
pre.code-area .tok-color { color: #f97583; }
pre.code-area .tok-str   { color: #9ecbff; }
pre.code-area .tok-at    { color: #c8a0f0; }

/* ── CSVプレビュー ── */
.csv-preview {
  background: var(--surface2);
  color: var(--accent-dark);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: 'IBM Plex Mono', 'Consolas', monospace;
  font-size: 0.74rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
  max-height: 160px;
  overflow-y: auto;
}

/* ── 注意書きボックス ── */
.notice-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  margin-top: 2rem;
}
.notice-box__title { font-size: 0.92rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--text); }
.notice-box__list { font-size: 0.82rem; color: var(--muted); padding-left: 1.2rem; list-style: disc; line-height: 1.8; }
.notice-box__list > li { margin-bottom: 6px; }
.notice-box__list > li:last-child { margin-bottom: 0; }
.notice-box__list a { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 2px; }
.notice-box__sublist { list-style: disc; padding-left: 1.1rem; margin-top: 4px; }
.notice-box__sublist li { margin-bottom: 4px; }

/* ── 右カラム：出力エリア（スティッキー） ── */
.tool-right { position: sticky; top: 76px; min-width: 0; display: flex; flex-direction: column; gap: 1.25rem; }

/* ── フォーム共通 ── */
.form-row { margin-bottom: 12px; }
.form-row:last-child { margin-bottom: 0; }
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 5px;
}
.form-section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.form-section-title + .form-row { margin-top: 0; }
.form-section-title:not(:first-child) { margin-top: 20px; }

.form-select,
.form-input,
input.form-input,
select.form-select {
  width: 100%;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.15s;
}
.form-select:focus,
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-color {
  width: 36px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  flex-shrink: 0;
}
.color-input-row { display: flex; align-items: center; gap: 8px; }
/* スライダー行：バー・数値・太さを横並び */
.range-row { display: flex; align-items: center; gap: 6px; }
.range-row .form-range { flex: 1; min-width: 0; accent-color: var(--accent); cursor: pointer; height: 4px; }
.range-row .form-input--num {
  width: 60px !important;
  min-width: 60px !important;
  flex: 0 0 60px;
  text-align: center;
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.2rem;
}
.range-row .form-select--weight {
  width: 50px !important;
  min-width: 50px !important;
  flex: 0 0 50px;
  padding: 0.35rem 0.2rem;
  font-size: 0.78rem;
}
.form-range { flex: 1; accent-color: var(--accent); cursor: pointer; height: 4px; }
.form-unit { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.form-value-display { color: var(--accent); font-weight: 600; }

/* テキストエリア */
.form-textarea {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--text);
  background: var(--surface);
  resize: vertical;
  line-height: 1.8;
  outline: none;
  transition: border-color 0.15s;
}
.form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ラジオトグル */
.toggle-group {
  display: flex;
  gap: 3px;
  background: var(--surface2);
  padding: 3px;
  border-radius: var(--radius-sm);
}
.toggle-btn {
  flex: 1;
  padding: 5px 10px;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
  transition: all 0.15s;
  white-space: nowrap;
  text-align: center;
}
.toggle-btn:hover { color: var(--accent); }
.toggle-btn.active {
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ラジオ inline */
.radio-row { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  cursor: pointer;
}
.radio-label input { accent-color: var(--accent); cursor: pointer; }

/* セパレーター */
.separator { height: 1px; background: var(--border); margin: 0.75rem 0; }

/* ── コンテンツセクション ── */
.content-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2rem;
  border-top: 1px solid var(--border);
}
.section-heading {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-heading::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.2em;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.section-lead { color: var(--muted); font-size: 0.875rem; margin-bottom: 1.75rem; }

/* features */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.35rem;
  transition: box-shadow 0.15s;
}
.feature-card:hover { box-shadow: 0 4px 16px rgba(73,167,206,0.10); }
.feature-card__icon {
  width: 44px; height: 44px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.75rem;
  font-size: 1.5rem;
}
.feature-card__title { font-size: 0.92rem; font-weight: 600; color: var(--text); margin-bottom: 0.4rem; }
.feature-card__desc  { font-size: 0.83rem; color: var(--muted); line-height: 1.65; }

/* usecase */
.usecase-list { display: flex; flex-direction: column; gap: 1rem; }
.usecase-item {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.35rem;
  display: flex; gap: 1rem; align-items: flex-start;
}
.usecase-item__num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700;
  font-family: 'Outfit', sans-serif;
  margin-top: 1px;
}
.usecase-item__body strong { display: block; font-size: 0.92rem; font-weight: 600; color: var(--text); margin-bottom: 0.3rem; }
.usecase-item__body p { font-size: 0.84rem; color: var(--muted); line-height: 1.65; margin: 0; }

/* cost table */
.cost-table-wrap { overflow-x: auto; }
.cost-table { width: 100%; max-width: 480px; border-collapse: collapse; font-size: 0.9rem; }
.cost-table th, .cost-table td { padding: 0.7rem 1.1rem; text-align: left; border-bottom: 1px solid var(--border); background: var(--surface); }
.cost-table th { font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 0.8rem; letter-spacing: 0.05em; color: var(--muted); background: var(--surface2); text-transform: uppercase; }
.cost-table td:nth-child(2), .cost-table td:nth-child(3) { text-align: right; }
.cost-table th:nth-child(2), .cost-table th:nth-child(3) { text-align: right; }
.cost-table__total td { font-weight: 600; color: var(--text); background: var(--accent-light); border-top: 2px solid var(--border2); border-bottom: none; }

/* ── レスポンシブ ── */
@media (max-width: 900px) {
  .editor-grid { grid-template-columns: 1fr; }
  .tool-right { position: static; }
}
@media (max-width: 600px) {
  .hero h1 { font-size: 1.4rem; }
  .hero-chara { display: none; }
  .features-grid { grid-template-columns: 1fr; }
  .tool-section { padding: 1.5rem 1rem; }
  .content-section { padding: 2rem 1rem; }
  .col-row { gap: 6px; }
  .header-usage-count { display: none; }
}
