/* Mazelingo web — 緑基調のシンプルなツールページ */

:root {
  --bg: #F6FAF4;
  --ink: #22331F;
  --muted: #66755F;
  --line: #DCE6D6;
  --mix-green: #3ECF6E;
  --mix-green-deep: #16A34A;
  --green-ink: #1E7A43;
  --green-ink-hover: #166534;
  --green-tint: #E7F6EA;
  --card: #FFFFFF;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.8;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: inherit; }

button { font-family: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--green-ink);
  outline-offset: 2px;
}

/* --- header --- */
.site-header {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wordmark {
  font-weight: 700;
  font-size: 19px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wordmark-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* devのみ表示のモデル比較用セレクタ。目立たせない */
.model-select {
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--card);
}

.header-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}
.header-link:hover { color: var(--green-ink); text-decoration: underline; }

/* --- hero --- */
.hero { padding: 28px 0 26px; }

h1 {
  font-size: clamp(21px, 4vw, 27px);
  font-weight: 700;
  line-height: 1.5;
}

.hero-sub {
  margin-top: 10px;
  max-width: 38em;
  color: var(--muted);
}

/* --- tool --- */
.tool {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}

.tool-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

#sourceText {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #FFFFFF;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.8;
  padding: 12px 14px;
}

#sourceText:focus { outline: 2px solid var(--green-ink); outline-offset: 0; border-color: transparent; }

.textarea-wrap { position: relative; }

.tool-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.tool-meta-left {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.secondary-button {
  background: var(--card);
  border: 1px solid var(--green-ink);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--green-ink);
  padding: 9px 18px;
}
.secondary-button:hover { background: var(--green-tint); }

/* テキストエリア内の右下に重ねて表示(リサイズグリップを避けて少し左に) */
.char-count {
  position: absolute;
  right: 20px;
  bottom: 10px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.85);
  padding: 0 4px;
  border-radius: 4px;
  pointer-events: none;
}
.char-count.is-over { color: #B4231F; font-weight: 700; }

.primary-button {
  background: var(--green-ink);
  color: #FFFFFF;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 24px;
}
.primary-button:hover { background: var(--green-ink-hover); }
.primary-button:disabled { background: var(--muted); cursor: wait; }

.error-box {
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid #E3B7B5;
  background: #FBF1F0;
  color: #8C2B27;
  border-radius: 6px;
  font-size: 13.5px;
}

/* --- result --- */
/* scroll-margin-top: 自動スクロールの着地点をセクションより100px上にする */
.result { padding: 26px 0 8px; scroll-margin-top: 100px; }

/* 翻訳結果カード: 「言語の割合」(拡張機能と同じ [−] バー [＋] + 内訳)と
   ミックスされた本文を同じ枠に収める。割合部分はカード内stickyで読みながら調整できる */
.mix-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.mix-panel-head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card);
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
}

.mix-panel-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.ratio-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ratio-step {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}
.ratio-step:hover { background: var(--green-tint); }

.ratio-bar {
  flex: 1;
  height: 10px;
  border-radius: 5px;
  background: #ECEEF1;
  cursor: pointer;
  overflow: hidden;
}

.ratio-fill {
  height: 100%;
  width: 30%;
  border-radius: 5px;
  background: var(--mix-green);
  transition: width 0.18s ease;
}

@media (prefers-reduced-motion: reduce) {
  .ratio-fill { transition: none; }
}

.ratio-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ratio-legend-fx { color: var(--mix-green-deep); }
.ratio-legend-ja { color: var(--muted); }

.result-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

#resultArea {
  font-size: 16px;
  line-height: 2;
  padding: 16px 18px;
}

#resultArea p { margin-bottom: 1.1em; }
#resultArea p:last-child { margin-bottom: 0; }

/* 記事の出典表示 */
.article-credit {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--green-tint);
  border-radius: 6px;
  padding: 8px 12px;
}

.article-credit a { color: var(--green-ink); }

/* 文スパン: 切り替えの視線維持はJS側のmorphアニメーション(拡張機能と同実装)が担う */
.sent { cursor: pointer; border-radius: 2px; transition: background 0.18s ease; }

.sent:hover { background: var(--green-tint); }

/* hover吹き出し(拡張機能の .mlg-tooltip と同デザイン。表示専用) */
.bubble {
  position: fixed;
  z-index: 100;
  background-color: #ffffff;
  border: 1px solid #f3f4f6;
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 12px;
  line-height: 1.4;
  color: #374151;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.14);
  display: none;
  pointer-events: none;
}

.bubble::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  background-color: #ffffff;
  left: calc(var(--bubble-arrow-left, 18px) - 6px);
  bottom: -6px;
  transform: rotate(45deg);
  border-right: 1px solid #f3f4f6;
  border-bottom: 1px solid #f3f4f6;
}

/* --- benefits ---
   LP風の全幅カラー帯。mainの外に置いた全幅セクション + 内側コンテナで本文位置を揃える */
.benefits {
  margin-top: 56px;
  padding: 40px 0 48px;
  background: var(--green-tint);
}

.benefits-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

.benefits h2 {
  font-size: 18px;
  font-weight: 700;
}

.benefits-lead {
  margin-top: 10px;
  max-width: 40em;
  color: #4E5F51;
}

.benefits-lead strong { color: var(--ink); }

.benefits ul {
  list-style: none;
  margin-top: 18px;
}

.benefits li {
  max-width: 40em;
  margin-bottom: 18px;
}

/* 緑の縦ラインは本文のみ。例ボックスには付けない */
.benefit-text {
  color: #4E5F51;
  padding-left: 16px;
  border-left: 3px solid var(--mix-green-deep);
}

.benefit-text strong { color: var(--ink); }

.benefit-example {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 8px 0 0 19px;
  color: var(--ink);
  font-size: 13.5px;
}

.benefit-example p + p { margin-top: 4px; }

.benefit-example-note {
  color: var(--muted);
  font-size: 12.5px;
}

.benefit-example-tag {
  display: inline-block;
  background: var(--green-tint);
  color: var(--green-ink);
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: 6px;
}

/* --- CTA --- */
.cta {
  margin: 0;
  padding: 40px 0 8px;
}

.cta h2 {
  font-size: 18px;
  font-weight: 700;
}

.cta-body {
  margin-top: 8px;
  max-width: 38em;
  color: var(--muted);
}

.cta-button {
  display: inline-block;
  margin-top: 16px;
  text-decoration: none;
}

/* --- footer --- */
.site-footer {
  max-width: 720px;
  margin: 44px auto 0;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.site-footer p + p { margin-top: 4px; }

@media (max-width: 560px) {
  .hero { padding: 20px 0 18px; }
  .tool { padding: 16px 14px; }
}
