/* BRACKET. — ダークアリーナ + アンバー/ゴールド差し色
 * Fable設計書§0-14・独立管理ポリシー§6（LYブランドグラデ不使用・各サイト独自トーン）
 * UIマイクロインタラクション：balance/pretty, tabular-nums, 多層shadow, CLS抑制 */

:root {
  --bg-0: #0a0d10;
  --bg-1: #0f1216;
  --bg-2: #1a1e24;
  --bg-3: #232830;
  --border-1: #2a2e35;
  --border-2: #3a3f47;
  --text-1: #e8ecf0;
  --text-2: #a3aab3;
  --text-3: #6b7280;
  --amber: #e9b464;
  --amber-hi: #f5cd85;
  --amber-lo: #8a6a3a;
  --accent: #d94a3d;
  --success: #4ade80;
  --focus: #7dd3fc;

  --font-sans: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-display: "Impact", "Arial Black", "Helvetica Neue", sans-serif;

  --radius-s: 4px;
  --radius-m: 8px;
  --radius-l: 14px;

  --shadow-1: 0 1px 0 rgba(255,255,255,0.03) inset,
              0 1px 2px rgba(0,0,0,0.4),
              0 4px 8px rgba(0,0,0,0.3);
  --shadow-2: 0 1px 0 rgba(255,255,255,0.05) inset,
              0 2px 6px rgba(0,0,0,0.5),
              0 12px 32px rgba(0,0,0,0.4);
  --shadow-amber: 0 0 0 1px var(--amber-lo) inset,
                  0 1px 0 rgba(255,255,255,0.08) inset,
                  0 6px 20px rgba(233,180,100,0.15),
                  0 2px 8px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-0);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }

a { color: var(--amber); text-decoration: none; }
a:hover { color: var(--amber-hi); }

.hidden { display: none !important; }

/* ── ヘッダー ─────────────────────────────────────── */
.site-header {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border-1);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand { display: flex; flex-direction: column; line-height: 1.2; }
.brand__name {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--amber);
  letter-spacing: 0.08em;
  font-weight: 900;
}
.brand__tag {
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 0.1em;
}
.site-nav a {
  color: var(--text-1);
  margin-left: 20px;
  font-size: 14px;
}
.site-nav a:hover { color: var(--amber); }

/* ── メイン ───────────────────────────────────────── */
.site-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  min-height: calc(100vh - 200px);
}

/* ── Phase select : Hero ─────────────────────────── */
.hero {
  text-align: center;
  padding: 40px 12px 24px;
}
.hero__title {
  font-size: clamp(28px, 6vw, 44px);
  margin: 0 0 12px;
  line-height: 1.2;
  color: var(--text-1);
  letter-spacing: 0.02em;
}
.hero__sub {
  color: var(--amber);
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.hero__lead {
  color: var(--text-2);
  font-size: 16px;
  max-width: 640px;
  margin: 0 auto;
}

/* ── タブ ─────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-1);
  margin: 24px 0 20px;
}
.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: color 160ms, border-color 160ms;
}
.tab-btn.active {
  color: var(--amber);
  border-bottom-color: var(--amber);
}
.tab-btn:hover { color: var(--amber-hi); }

/* ── テンプレ一覧 ─────────────────────────────────── */
.genre-section { margin-bottom: 32px; }
.genre-heading {
  font-size: 14px;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-1);
}
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.template-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-m);
  padding: 16px;
  text-align: left;
  color: var(--text-1);
  cursor: pointer;
  transition: transform 160ms, border-color 160ms, box-shadow 160ms;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-1);
  font-family: inherit;
  min-height: 118px;
}
.template-card:hover {
  transform: translateY(-2px);
  border-color: var(--amber-lo);
  box-shadow: var(--shadow-2);
}
.template-card:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.template-card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--amber);
  text-wrap: balance;
}
.template-card__desc {
  font-size: 13px;
  color: var(--text-2);
  text-wrap: pretty;
}
.template-card__meta {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.05em;
  margin-top: auto;
}

/* ── 自作フォーム ─────────────────────────────────── */
.custom-form {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field__label {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
}
.field input,
.field textarea {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-s);
  color: var(--text-1);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
}
.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--amber);
}
.field textarea {
  resize: vertical;
  min-height: 200px;
}

/* ── ボタン共通 ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border-1);
  background: var(--bg-3);
  color: var(--text-1);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms, background 160ms, box-shadow 160ms;
}
.btn:hover { background: #2c323b; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.btn--primary {
  background: linear-gradient(180deg, var(--amber-hi), var(--amber));
  color: #201603;
  border-color: var(--amber-lo);
  box-shadow: var(--shadow-amber);
}
.btn--primary:hover {
  background: linear-gradient(180deg, #ffd89a, var(--amber-hi));
}
.btn--secondary {
  background: var(--bg-3);
  border-color: var(--border-2);
}
.btn--ghost {
  background: transparent;
  border-color: var(--border-1);
  color: var(--text-2);
}
.btn--lg {
  padding: 14px 28px;
  font-size: 16px;
}

/* ── FAQ ──────────────────────────────────────────── */
.section-title {
  font-size: 22px;
  font-weight: 700;
  margin: 48px 0 16px;
  color: var(--text-1);
  text-wrap: balance;
}
.faq details {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-m);
  padding: 14px 18px;
  margin-bottom: 8px;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-1);
}
.faq details[open] summary { color: var(--amber); }
.faq details p {
  margin: 10px 0 4px;
  color: var(--text-2);
  font-size: 14px;
}

/* ── Phase battle ─────────────────────────────────── */
.battle {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 4px;
}
.battle__header { margin-bottom: 24px; }
.battle__title {
  font-size: 20px;
  margin: 0 0 8px;
  color: var(--amber);
  text-wrap: balance;
  text-align: center;
}
.battle__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
}
.battle__round {
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.battle__progress-text {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  color: var(--text-2);
  letter-spacing: 0.03em;
}
.battle__progress {
  height: 6px;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
}
.battle__progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--amber-lo), var(--amber));
  width: 0%;
  transition: width 260ms ease-out;
}

.battle__vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
  margin: 20px 0;
}
@media (max-width: 640px) {
  .battle__vs {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto 1fr;
  }
}

.battle-card {
  background: var(--bg-2);
  border: 2px solid var(--border-2);
  border-radius: var(--radius-l);
  color: var(--text-1);
  font-family: inherit;
  font-size: clamp(18px, 4vw, 26px);
  font-weight: 700;
  padding: 30px 20px;
  cursor: pointer;
  min-height: 180px;
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 160ms,
              box-shadow 160ms;
  box-shadow: var(--shadow-1);
  text-wrap: balance;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-break: break-word;
}
.battle-card:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: var(--amber);
  box-shadow: var(--shadow-amber);
}
.battle-card:active {
  transform: translateY(-1px) scale(0.99);
}
.battle-card:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.battle__vs-mark {
  font-family: var(--font-display);
  color: var(--amber);
  font-size: 20px;
  letter-spacing: 0.15em;
  align-self: center;
  padding: 0 4px;
  font-weight: 900;
}

.battle__controls {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

/* ── Phase result ─────────────────────────────────── */
.result {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-l);
  padding: 32px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-2);
}
.result__champion-block {
  text-align: center;
  padding: 20px 0 30px;
}
.result__label {
  color: var(--amber-lo);
  letter-spacing: 0.3em;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.result__champion {
  font-size: clamp(32px, 8vw, 56px);
  font-weight: 900;
  color: var(--amber);
  letter-spacing: 0.02em;
  text-wrap: balance;
  line-height: 1.15;
  word-break: break-word;
}
.result__champion::before { content: "🏆 "; font-size: 0.7em; }
.result__runner-up {
  color: var(--text-2);
  font-size: 14px;
  margin-top: 12px;
}
.result__title-small {
  color: var(--text-3);
  font-size: 13px;
  margin-top: 8px;
  letter-spacing: 0.05em;
}
.result__bracket-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--border-1);
  padding-top: 20px;
  -webkit-overflow-scrolling: touch;
}
.result__svg svg {
  display: block;
  max-width: none;
  height: auto;
}

.result__actions,
.result__navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

/* ── アニメーション ───────────────────────────────── */
@keyframes staggerIn {
  0%   { opacity: 0; transform: translateY(12px) scale(0.96); }
  60%  { opacity: 1; transform: translateY(-2px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.stagger-in {
  animation: staggerIn 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── フッター ─────────────────────────────────────── */
.site-footer {
  background: var(--bg-1);
  border-top: 1px solid var(--border-1);
  padding: 24px 20px;
  margin-top: 40px;
}
.site-footer__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.site-footer__meta {
  display: flex;
  gap: 16px;
  color: var(--text-3);
  font-size: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.site-footer__nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
}
.site-footer__nav a {
  color: var(--text-2);
  font-size: 13px;
}
.site-footer__contact-link {
  color: var(--text-3);
  font-size: 12px;
  opacity: 0.7;
}

/* ── トースト ─────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-3);
  color: var(--text-1);
  padding: 12px 24px;
  border-radius: var(--radius-m);
  border: 1px solid var(--border-2);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms, transform 220ms;
  z-index: 100;
  box-shadow: var(--shadow-2);
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════════════════════════════════════
 * S2: SEO層（LP / how-to / examples / /t/ テンプレページ）用スタイル
 * ══════════════════════════════════════════════════════════════ */

/* メインナビ（複数リンク版・トップページ以外の記事ページで使用） */
.site-nav a + a { margin-left: 16px; }

/* パンくず */
.breadcrumb {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--text-3);
  margin-bottom: 16px;
  text-transform: uppercase;
}
.breadcrumb a { color: var(--amber); }
.breadcrumb .sep { color: var(--text-3); margin: 0 8px; }

/* 記事コンテナ */
.article {
  max-width: 780px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}
.article h1 {
  font-size: clamp(26px, 5vw, 36px);
  line-height: 1.3;
  margin: 0 0 18px;
  color: var(--text-1);
  text-wrap: balance;
}
.article .lead {
  font-size: 16px;
  line-height: 1.85;
  color: var(--text-2);
  border-left: 3px solid var(--amber);
  padding-left: 18px;
  margin: 20px 0 32px;
  text-wrap: pretty;
}
.article h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--amber);
  margin: 44px 0 14px;
  letter-spacing: 0.12em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-1);
  text-transform: uppercase;
}
.article h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  margin: 24px 0 10px;
}
.article p {
  font-size: 15px;
  color: var(--text-2);
  margin-bottom: 14px;
  line-height: 1.85;
}
.article p strong,
.article li strong { color: var(--text-1); }
.article ul,
.article ol { padding-left: 22px; margin-bottom: 18px; }
.article ul li,
.article ol li {
  color: var(--text-2);
  font-size: 15px;
  margin-bottom: 10px;
  line-height: 1.85;
}

/* CTAパネル（ツール本体への誘導） */
.cta-panel {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--amber-lo);
  border-radius: var(--radius-l);
  padding: 28px 24px;
  margin: 36px 0;
  text-align: center;
  box-shadow: var(--shadow-1);
}
.cta-panel h3 {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.15em;
  color: var(--text-1);
  margin: 0 0 12px;
  text-transform: uppercase;
}
.cta-panel p {
  color: var(--text-2);
  font-size: 14px;
  margin-bottom: 18px;
}

/* Step card（how-to用） */
.step-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-left: 4px solid var(--amber);
  border-radius: 0 var(--radius-m) var(--radius-m) 0;
  padding: 22px 24px;
  margin: 20px 0;
  box-shadow: var(--shadow-1);
}
.step-num {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--amber);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.step-card h3 { margin: 0 0 10px; font-size: 17px; }
.step-card p:last-child { margin-bottom: 0; }

/* 比較テーブル */
.tbl-wrap { overflow-x: auto; margin: 20px 0; }
.article table {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px;
  font-size: 14px;
}
.article th, .article td {
  border: 1px solid var(--border-1);
  padding: 10px 14px;
  text-align: left;
  color: var(--text-2);
  line-height: 1.7;
}
.article th {
  background: var(--bg-2);
  color: var(--text-1);
  font-weight: 700;
  white-space: nowrap;
}
.article td strong { color: var(--text-1); }
.article table td[data-num] { font-variant-numeric: tabular-nums; }

/* 完成例カード */
.example-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-m);
  overflow: hidden;
  margin: 28px 0;
  box-shadow: var(--shadow-1);
}
.example-card__svg {
  background: var(--bg-0);
  padding: 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-1);
}
.example-card__svg svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.example-card__body { padding: 20px 22px 22px; }
.example-tag {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--amber);
  border: 1px solid var(--amber-lo);
  border-radius: 3px;
  padding: 2px 8px;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.example-card__body h3 { margin: 0 0 8px; font-size: 17px; }
.example-meta {
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 10px;
}

/* テンプレページ用 items grid（/t/<slug>/） */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin: 18px 0 28px;
}
.items-grid__cell {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  color: var(--text-1);
  font-size: 14px;
  text-align: center;
  text-wrap: balance;
}

/* LPの数字強調 */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-m);
  padding: 18px 16px;
  text-align: center;
}
.stat-card__num {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--amber);
  font-weight: 900;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-card__label {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.1em;
  margin-top: 4px;
  text-transform: uppercase;
}
