/* ============================================================
   コンセプトメーカー  app.css
   トーン：知的だけど使いやすい / 白背景・黒文字・淡いグリーン系アクセント
   ============================================================ */

/* ---- トークン（ライト） ---- */
:root {
  --bg: #f7f9f7;
  --surface: #ffffff;
  --surface-2: #f1f5f1;
  --text: #1c2420;
  --text-sub: #5c6b63;
  --border: #e2e8e3;
  --border-strong: #cfdacf;

  --accent: #4caf7d;          /* 淡いグリーン系アクセント */
  --accent-strong: #3a9468;
  --accent-soft: #e7f4ec;
  --accent-text: #1f6b48;

  --danger: #c4554d;
  --danger-soft: #f7e9e8;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(28, 36, 32, 0.04), 0 6px 20px rgba(28, 36, 32, 0.06);
  --shadow-sm: 0 1px 2px rgba(28, 36, 32, 0.05);

  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
}


/* ---- ベース ---- */
* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
p {
  margin: 0;
}

/* ---- ボタン ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.7em 1.2em;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    transform 0.05s ease;
  -webkit-appearance: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-strong);
}
.btn-outline {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn-outline:hover {
  background: var(--accent-soft);
}
.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-sub);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}
.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger-soft);
}
/* 生成ボタン：条件で生成（主・濃いグリーングラデ）＋ ランダム生成（副・ニュートラル） */
.btn-generate {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #fff;
  box-shadow: 0 2px 10px rgba(58, 148, 104, 0.28);
}
.btn-generate:hover {
  filter: brightness(1.06);
}
.btn-random {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-random:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn-block {
  width: 100%;
}
.btn-sm {
  padding: 0.4em 0.85em;
  font-size: 0.85rem;
}
.btn.is-copied {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

/* ---- 背景ノイズ（ハンケイサン共通の質感） ---- */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: radial-gradient(rgba(17, 17, 15, 0.1) 1px, transparent 1px);
  background-size: 18px 18px;
  mix-blend-mode: multiply;
  z-index: -1;
}

/* ---- ヘッダー（ハンケイサン共通：ロゴ＋ツール名） ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 15px clamp(18px, 4vw, 44px);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  text-decoration: none;
  color: var(--text);
}
.brand-logo {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex: 0 0 auto;
}
.brand-name {
  font-weight: 800;
  font-size: 17px;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* ---- ヒーロー（公式） ---- */
.hero {
  background: linear-gradient(180deg, var(--accent-soft), transparent);
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.4rem 1.2rem 2rem;
  text-align: center;
}
.formula {
  font-size: clamp(1.15rem, 3.2vw, 1.9rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.5;
}
.formula .op {
  color: var(--accent-strong);
  margin: 0 0.15em;
}
.formula-note {
  margin-top: 0.7rem;
  color: var(--text-sub);
  font-size: clamp(0.9rem, 2vw, 1.02rem);
}

/* ---- レイアウト ---- */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.6rem 1.2rem 3rem;
}
.columns {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1.2rem;
  align-items: start;
}

/* ---- パネル / カード ---- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem;
}
.panel-input {
  position: sticky;
  top: 4.2rem;
}
.panel-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
/* 下部固定ドックのヘッダー（デスクトップでは非表示） */
.dock-head {
  display: none;
}

/* ---- フィールド ---- */
.field {
  margin-bottom: 0.95rem;
}
.field-label {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
}
.field-hint {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--text-sub);
}
.field-select {
  width: 100%;
  font: inherit;
  font-size: 0.98rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.65em 2.2em 0.65em 0.85em;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235c6b63' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.85em center;
}
.field-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.gen-buttons {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.2rem;
}

/* ---- 結果 ---- */
.result-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
/* 高さ制約のある下部ドック内でカードが潰れて中身が切れないようにする */
.result-wrap > * {
  flex: 0 0 auto;
}
.result-empty {
  color: var(--text-sub);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 1.6rem 1.2rem;
  text-align: center;
  font-size: 0.95rem;
}
.result-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25em 0.7em;
  font-size: 0.8rem;
}
.chip-k {
  color: var(--text-sub);
  font-size: 0.72rem;
}
.chip-v {
  font-weight: 700;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.result-card.highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.rc-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.rc-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 0.2em 0.7em;
}
.rc-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-sub);
}
.rc-copy {
  margin-left: auto;
}
.rc-body {
  padding: 1.1rem 1.2rem 1.3rem;
}
.rc-main {
  font-size: clamp(1.1rem, 2.6vw, 1.4rem);
  font-weight: 700;
  line-height: 1.55;
}
.rc-sub {
  margin-top: 0.6rem;
  color: var(--text-sub);
  font-size: 0.95rem;
  padding-left: 0.9em;
  border-left: 2px solid var(--border-strong);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

/* ---- セクション（キープ / 履歴） ---- */
.section {
  margin-top: 2rem;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
  gap: 1rem;
}
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
}
.section-count {
  color: var(--text-sub);
  font-size: 0.9rem;
  font-weight: 500;
}
.keep-empty {
  color: var(--text-sub);
  font-size: 0.92rem;
}

/* キープ一覧 */
.keep-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.9rem;
}
.keep-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.keep-meta {
  font-size: 0.74rem;
  color: var(--text-sub);
}
.keep-main {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.5;
}
.keep-sub {
  font-size: 0.86rem;
  color: var(--text-sub);
}
.keep-item-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

/* 履歴 */
.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.6rem;
}
.history-item {
  text-align: left;
  font: inherit;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.history-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.history-main {
  font-weight: 600;
  font-size: 0.92rem;
}
.history-sub {
  font-size: 0.76rem;
  color: var(--text-sub);
}

/* ---- フッター（ハンケイサン共通：お問い合わせ・ロゴ・コピーライト） ---- */
.site-footer {
  padding: 22px clamp(18px, 4vw, 44px);
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  font-size: 13px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.footer-contact {
  text-decoration: underline;
  text-underline-offset: 4px;
  color: var(--text);
  justify-self: start;
}
.footer-contact:hover {
  color: var(--text-sub);
}
.footer-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
}
.footer-logo {
  display: block;
  width: 86px;
  height: auto;
  max-height: 22px;
  object-fit: contain;
}
.footer-copy {
  justify-self: end;
  margin: 0;
}

/* ---- レスポンシブ（〜1023px：1カラム＋生成結果を画面下部に固定） ---- */
@media (max-width: 1023px) {
  .columns {
    grid-template-columns: 1fr;
  }
  .panel-input {
    position: static;
  }

  /* 出力パネルを画面下部に固定するドックへ（ベネフィットメーカーと同様） */
  .panel-output {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -6px 22px rgba(28, 36, 32, 0.14);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    backdrop-filter: blur(10px);
    overflow: hidden;
    /* 展開時：ヘッダーの下あたりまで伸びる（中身が短ければ中身ぶんだけ） */
    max-height: 86vh;
    max-height: calc(100dvh - 64px);
    transition: max-height 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  }
  /* 閉じている時：ヘッダーバーのみ表示 */
  .panel-output.collapsed {
    max-height: 52px;
  }
  .panel-output .panel-title {
    display: none; /* ドックヘッダーに置き換え */
  }
  .panel-output .dock-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
  }
  .dock-title {
    font-weight: 700;
    font-size: 0.95rem;
  }
  .dock-toggle {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-sub);
    border-radius: 999px;
    width: 34px;
    height: 28px;
    line-height: 1;
    cursor: pointer;
    font-size: 0.8rem;
  }
  .panel-output .result-wrap {
    /* ドックヘッダー(約52px)を除いた高さまで。超えたら内部スクロール */
    max-height: 78vh;
    max-height: calc(100dvh - 64px - 52px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px 16px;
    gap: 0.7rem;
  }

  /* ドック内はコンパクトに */
  .panel-output .result-summary {
    gap: 0.35rem;
  }
  .panel-output .result-card .rc-head {
    padding: 0.45rem 0.7rem;
  }
  .panel-output .rc-body {
    padding: 0.7rem 0.8rem 0.8rem;
  }
  .panel-output .rc-main {
    font-size: 1.05rem;
  }
  .panel-output .result-card.highlight {
    box-shadow: 0 0 0 2px var(--accent-soft);
  }
}

/* ---- SP（〜767px）：余白・文字を全体的にコンパクト化（ヘッダー/フッターは別途維持） ---- */
@media (max-width: 767px) {
  .hero-inner {
    padding: 1.1rem 1rem 0.9rem;
  }
  .formula {
    font-size: 1.12rem;
    line-height: 1.4;
  }
  .formula-note {
    margin-top: 0.4rem;
    font-size: 0.8rem;
  }

  .container {
    padding: 1rem 1rem 1.6rem;
  }
  .panel {
    padding: 1rem;
  }
  .panel-title {
    font-size: 0.98rem;
    margin-bottom: 0.7rem;
    padding-bottom: 0.5rem;
  }

  .field {
    margin-bottom: 0.6rem;
  }
  .field-label {
    font-size: 0.86rem;
    margin-bottom: 0.25rem;
  }
  .field-hint {
    font-size: 0.72rem;
  }
  .field-select {
    font-size: 0.92rem;
    padding: 0.5em 2em 0.5em 0.7em;
  }
  .gen-buttons {
    margin-top: 0.9rem;
    gap: 0.5rem;
  }
  .btn {
    padding: 0.6em 1em;
  }

  /* キープ／履歴セクションも詰める */
  .section {
    margin-top: 1.3rem;
  }
  .section-head {
    margin-bottom: 0.6rem;
  }
  .section-title {
    font-size: 1rem;
  }
  .keep-list,
  .history-list {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .keep-item {
    padding: 0.8rem;
  }
  .history-item {
    padding: 0.55rem 0.7rem;
  }

  /* SP用：ヘッダー（指定どおり変更しない＝既存の見た目を維持） */
  .site-header {
    padding: 12px 16px;
  }
  .brand-logo {
    width: 36px;
    height: 36px;
  }
  .brand-name {
    font-size: 15px;
  }
  .footer-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .footer-contact,
  .footer-copy {
    justify-self: center;
  }

  /* SPの展開時もヘッダー下まで伸ばす（中身が短ければ中身ぶん） */
  .panel-output {
    max-height: 88vh;
    max-height: calc(100dvh - 60px);
  }
  .panel-output .rc-main {
    font-size: 1rem;
    line-height: 1.5;
  }
  .panel-output .rc-sub {
    font-size: 0.85rem;
  }
  .panel-output .chip {
    font-size: 0.74rem;
    padding: 0.2em 0.55em;
  }
}

/* ---- モーション配慮 ---- */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
