/* ============================================================
   パーソナルメンター デザイントークン v3 — Co-Star 型
   コンセプト:
     - 漆黒 × 象牙 × タイプライター/明朝
     - 装飾ゼロ。テキストが主役
     - 中央揃え基調 + 大幅な余白
     - 「経営者の朝の一言」をクールに見せる
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Noto+Serif+JP:wght@400;500;700;900&family=Shippori+Mincho:wght@500;700;800;900&display=swap');

:root {
  /* ─ 配色:漆黒 × 象牙 × 真鍮 ─ */
  --color-bg:        #0A0908;  /* 漆黒 */
  --color-bg-soft:   #15130F;  /* わずかに浮く層 */
  --color-text:      #F4F1E8;  /* 象牙 */
  --color-text-soft: #BFB9A9;  /* 二次テキスト */
  --color-muted:     #6E6960;  /* 三次テキスト */
  --color-accent:    #D9C77E;  /* 真鍮(控えめなアクセント) */
  --color-warm:      #C8553D;  /* 朱(緊急/警告のみ) */
  --color-divider:   #2A2724;
  --color-error:     #C8553D;

  /* ─ タイポ:明朝(主役) + JetBrains Mono(メタ情報) ─ */
  --font-display:  'Shippori Mincho', 'Noto Serif JP', serif;
  --font-serif:    'Noto Serif JP', serif;
  --font-mono:     'JetBrains Mono', 'Courier New', monospace;
  --font-num:      'JetBrains Mono', monospace;

  /* ─ 余白 ─ */
  --space-page:    28px;
  --space-section: 64px;
  --line-height:   1.85;

  /* ─ レイアウト ─ */
  --content-max:   580px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  /* iOS ホームバー / ノッチ対応 */
  height: 100%;
}
body {
  min-height: 100vh;
  min-height: 100dvh;  /* iOS Safari のアドレスバー込み */
  color: var(--color-text);
  background: var(--color-bg);
  font-family: var(--font-display);
  line-height: var(--line-height);
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding:
    calc(env(safe-area-inset-top) + clamp(36px, 8vw, 64px))
    clamp(20px, 5vw, 32px)
    calc(env(safe-area-inset-bottom) + 96px)  /* 下タブバー分の余白 */
    clamp(20px, 5vw, 32px);
  animation: page-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

main {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  text-align: center;
}

/* ─── マストヘッド:1行メタ情報のみ ───────── */
.masthead {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-bottom: clamp(72px, 14vw, 120px);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-soft);
  letter-spacing: 0.32em;
  text-transform: uppercase;
}
.masthead .dot {
  width: 4px; height: 4px;
  background: var(--color-accent);
  border-radius: 50%;
  opacity: 0.85;
}
.masthead .sekki {
  color: var(--color-accent);
  letter-spacing: 0.4em;
}
.masthead .pub {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.45em;
  color: var(--color-text-soft);
  text-transform: uppercase;
}

/* 旧 seal は表示しない(Co-Star 型では削除) */
.masthead .seal { display: none; }
.masthead .left { display: contents; }
.masthead .pub-title { display: none; }
.masthead .y-m-d { color: var(--color-text-soft); }

/* ─── 本日の学び:Co-Star 級の主役級ヘッドライン ─ */
.learning-block {
  margin-bottom: clamp(72px, 14vw, 120px);
}
.learning-eyebrow { display: none; }  /* セクションラベルは削る */
.learning {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 7.5vw, 46px);
  line-height: 1.6;
  letter-spacing: 0.02em;
  color: var(--color-text);
  text-align: center;
  text-wrap: balance;
}

/* ─── 三つの行動:01 02 03 ────────────────── */
.actions-block {
  margin-bottom: clamp(72px, 14vw, 120px);
  border-top: 1px solid var(--color-divider);
  padding-top: clamp(40px, 8vw, 56px);
}
.actions-eyebrow { display: none; }
.actions {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.actions li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 18px;
  align-items: baseline;
  text-align: left;
  cursor: pointer;
  transition: opacity 0.2s;
}
.actions li.checked { opacity: 0.35; }
.actions li.checked .body { text-decoration: line-through; text-decoration-color: var(--color-muted); }
.actions .kanji {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 13px;
  color: var(--color-accent);
  letter-spacing: 0.05em;
  padding-top: 4px;
}
.actions .body {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(16px, 4.2vw, 18px);
  line-height: 1.85;
  color: var(--color-text);
}

/* ─── メンターからの問い:1行に圧縮 ──────── */
.question-block {
  margin-bottom: clamp(64px, 12vw, 104px);
  padding-top: clamp(40px, 8vw, 56px);
  border-top: 1px solid var(--color-divider);
}
.question-block::before { display: none; }
.question {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(18px, 4.8vw, 22px);
  line-height: 1.75;
  color: var(--color-accent);
  letter-spacing: 0.02em;
  text-align: center;
}

/* ─── 署名:── KAZUO 風 ───────────────── */
.signature {
  margin-top: 0;
  padding-top: clamp(40px, 8vw, 56px);
  border-top: 1px solid var(--color-divider);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--color-text-soft);
}
.signature .quote {
  font-family: var(--font-display);
  font-size: clamp(14px, 3.8vw, 16px);
  color: var(--color-text-soft);
  font-style: italic;
  text-align: center;
  max-width: 440px;
  line-height: 1.8;
}
.signature .quote::before { content: ''; }
.signature .name {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--color-text);
  text-transform: uppercase;
  margin-top: 12px;
}
.signature .name::before { content: '── '; color: var(--color-muted); letter-spacing: 0.1em; }
.signature .tone {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-muted);
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

/* ─── 下固定タブバー(iOS HIG / Material Bottom Navigation 準拠) ── */
nav.tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  background: rgba(10, 9, 8, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-divider);
}
nav.tabs a {
  flex: 1;
  min-height: 48px;  /* タップターゲット 48px+ */
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-decoration: none;
  color: var(--color-muted);
  text-transform: uppercase;
  position: relative;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
nav.tabs a:active { color: var(--color-text-soft); }
nav.tabs a.active { color: var(--color-accent); }
nav.tabs a.active::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--color-accent);
}

/* ─── empty state:挑発的に短く ──────────── */
.empty-state {
  text-align: center;
  padding: clamp(64px, 14vw, 120px) 0;
}
.empty-state .lead {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(20px, 5.5vw, 26px);
  line-height: 1.85;
  color: var(--color-text-soft);
  margin-bottom: 56px;
  text-wrap: balance;
}
.empty-state .lead .vermilion { color: var(--color-accent); font-weight: 700; }

.btn-primary {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  min-height: 48px;
  padding: 14px 32px;
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  text-transform: uppercase;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover,
.btn-primary:active { background: var(--color-text); color: var(--color-bg); }
.btn-primary:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-secondary {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.28em;
  color: var(--color-text-soft);
  background: transparent;
  border: 1px solid var(--color-divider);
  min-height: 44px;
  padding: 10px 18px;
  cursor: pointer;
  text-transform: uppercase;
  transition: border-color 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-secondary:hover,
.btn-secondary:active { border-color: var(--color-text-soft); color: var(--color-text); }

.btn-ghost {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-muted);
  background: transparent;
  border: 0;
  min-height: 44px;
  padding: 10px 14px;
  cursor: pointer;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-ghost:hover,
.btn-ghost:active { color: var(--color-accent); }

.btn-block { width: 100%; }

/* sticky bottom 保存バー(設定画面) */
.sticky-save {
  position: sticky;
  bottom: calc(64px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--color-bg) 30%);
  padding: 24px 0 16px;
  margin: 0 -1px;
  z-index: 50;
}

/* ─── スピナー:細い円弧 ───────────────── */
.brush-spinner {
  width: 36px;
  height: 36px;
  margin: 12px auto 18px;
  display: block;
}
.brush-spinner circle {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 40 200;
  transform-origin: center;
  animation: brush-rot 1.2s linear infinite;
}
@keyframes brush-rot {
  to { transform: rotate(360deg); }
}
.loading-poem {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-soft);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* ─── トースト ────────────────────────────── */
.toast {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 14px 32px;
  background: var(--color-text);
  color: var(--color-bg);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 9999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--color-warm); color: var(--color-text); }

/* ─── 設定:シングルスクロール ───────────── */
.settings-intro {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--color-text-soft);
  line-height: 1.95;
  margin-bottom: clamp(36px, 6vw, 48px);
  text-align: left;
}
.settings-section {
  margin-bottom: clamp(36px, 7vw, 52px);
}
.settings-section + .settings-section {
  border-top: 1px solid var(--color-divider);
  padding-top: clamp(36px, 7vw, 52px);
}

.field { margin-bottom: 28px; }
.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3em;
  color: var(--color-accent);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.field-label .num {
  color: var(--color-muted);
  margin-right: 8px;
}
.field-hint {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--color-muted);
  line-height: 1.7;
  margin-bottom: 10px;
}
.field input[type="text"],
.field textarea,
.field select {
  width: 100%;
  font-family: var(--font-display);
  font-size: 16px;  /* iOS 自動ズーム防止 (16px 以上必須) */
  color: var(--color-text);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-divider);
  padding: 14px 16px;
  line-height: 1.7;
  min-height: 48px;  /* タップターゲット */
  transition: border-color 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;  /* iOS のデフォルト角丸を消す */
}
.field input[type="text"]::placeholder,
.field textarea::placeholder { color: var(--color-muted); }
.field input[type="text"]:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--color-accent);
}
.field textarea { resize: vertical; min-height: 90px; }

.row { display: flex; gap: 10px; }
.row > input { flex: 1; }

.mentor-card {
  background: var(--color-bg-soft);
  border: 1px solid var(--color-divider);
  padding: 18px 22px;
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  transition: border-color 0.2s;
  cursor: pointer;
}
.mentor-card.active { border-color: var(--color-accent); }
.mentor-card .mini-seal { display: none; }  /* 朱印は削除 */
.mentor-card .mc-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--color-text);
}
.mentor-card .mc-sub {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--color-text-soft);
  margin-top: 4px;
  line-height: 1.65;
}
.mentor-card.active .mc-name::before {
  content: '◆ ';
  color: var(--color-accent);
}

.tone-option {
  display: block;
  margin-bottom: 10px;
  padding: 16px 20px;
  background: var(--color-bg-soft);
  border: 1px solid var(--color-divider);
  cursor: pointer;
  transition: all 0.18s;
}
.tone-option:hover { border-color: var(--color-text-soft); }
.tone-option input { display: none; }
.tone-option.selected {
  border-color: var(--color-accent);
  background: var(--color-bg);
}
.tone-option.selected .tone-name::before {
  content: '◆ ';
  color: var(--color-accent);
}
.tone-option .tone-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--color-text);
}
.tone-option .tone-desc {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--color-text-soft);
  margin-top: 6px;
  line-height: 1.7;
}

.step-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
}
.step-nav .left, .step-nav .right { display: flex; gap: 12px; }

.tone-preview-box {
  margin-top: 20px;
  padding: 24px;
  background: var(--color-bg-soft);
  border-left: 2px solid var(--color-accent);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.95;
  color: var(--color-text);
  text-align: left;
}

/* 小型画面の余白さらに最適化(iPhone SE 等) */
@media (max-width: 380px) {
  :root { --space-section: 48px; }
  .learning { font-size: 26px; }
}

@media print {
  body { background: #fff; color: #000; padding: 24px; animation: none; }
  nav.tabs, .empty-state .btn-primary, .btn-ghost, .btn-secondary { display: none !important; }
}
