/* 現場のことば 言いかえ帳 — styles
 * tanaoroshiと同じ規律: 白生成りの紙面に藍が骨格。砂色は「選択の瞬間」= 星と現在のチップのみ。
 * トークンは shared/bridge.css v3.0 から転記(このツールは共通シェルを読まないため)。
 */

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

:root {
  --bg: #FBFAF7;
  --bg-2: #F4EFE6;
  --ink: #1B1B1E;
  --ink-2: #45464C;
  --ink-3: #63646B;
  --ink-4: #B6B3AB;
  --line: rgba(27, 27, 30, 0.10);
  --navy: #16233E;
  --blue: #24365C;
  --blue-soft: #8B9BBC;
  --dawn: #A98F63;
  --card: #FFFFFF;
  --shadow: 0 2px 8px rgba(22, 35, 62, 0.04), 0 16px 48px rgba(22, 35, 62, 0.07);
  --mincho: 'Shippori Mincho B1', 'Noto Serif JP', serif;
  --sans: 'Noto Sans JP', sans-serif;
  --en: 'Inter', sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
}
[data-theme="dark"] {
  --bg: #111521;
  --bg-2: #161B2B;
  --ink: #EDEAE2;
  --ink-2: #C2BFB6;
  --ink-3: #8A8D98;
  --ink-4: #565A68;
  --line: rgba(237, 234, 226, 0.10);
  --navy: #D8DEEB;
  --blue: #9FB1D4;
  --blue-soft: #5A6C92;
  --dawn: #C2A97E;
  --card: #181E2E;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.25), 0 16px 48px rgba(0, 0, 0, 0.35);
}

html { -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.9;
  min-height: 100dvh;
  font-feature-settings: "palt" 1;
  transition: background .5s, color .5s;
}
button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--blue); color: #fff; }

.sp { display: inline; }
@media (min-width: 600px) { .sp { display: none; } }
.nowrap { white-space: nowrap; }

/* ---------- 骨格 ---------- */

.wrap {
  max-width: 660px;
  margin: 0 auto;
  padding: 12px 22px calc(64px + env(safe-area-inset-bottom));
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 10px;
}
.bar .name {
  font-family: var(--mincho);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}
.bar .name a { display: inline-flex; align-items: baseline; gap: 9px; }
.bar .name .en {
  font: 600 9px/1 var(--en);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.theme-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  color: var(--ink-3);
  transition: color .3s, border-color .3s;
  position: relative;
}
.theme-btn::before { content: ''; position: absolute; inset: -5px; }
.theme-btn svg { width: 15px; height: 15px; }
.theme-btn:hover { color: var(--ink); border-color: var(--blue-soft); }
.theme-btn .icon-sun { display: none; }
[data-theme="dark"] .theme-btn .icon-sun { display: block; }
[data-theme="dark"] .theme-btn .icon-moon { display: none; }

/* ---------- ビュー切替 ---------- */

.view { display: none; }
.view.on { display: block; animation: rise .45s var(--ease) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .view.on { animation: none; }
}

.eyebrow {
  font: 700 10px/1 var(--en);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before { content: ''; width: 22px; height: 1px; background: var(--dawn); }

/* ---------- ① 入口 ---------- */

.intro-hero { padding: 8vh 0 0; }
.intro-hero h1 {
  font-family: var(--mincho);
  font-weight: 600;
  font-size: clamp(25px, 6.6vw, 36px);
  line-height: 1.7;
  letter-spacing: 0.02em;
  margin: 20px 0 22px;
}
.intro-lead {
  font-size: 14.5px;
  line-height: 2.15;
  color: var(--ink-2);
  max-width: 560px;
  margin-bottom: 14px;
}
.intro-actions { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
.intro-notes {
  margin: 26px 0 0;
  list-style: none;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 2.1;
}
.intro-notes li { padding-left: 16px; position: relative; }
.intro-notes li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.95em;
  width: 6px; height: 1px;
  background: var(--ink-4);
}

.tanaoroshi-link {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  max-width: 560px;
}
.tanaoroshi-link p { font-size: 13px; color: var(--ink-2); line-height: 2.15; }
.tanaoroshi-link a {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  border-bottom: 1px solid var(--dawn);
  padding-bottom: 1px;
  transition: color .2s;
}
.tanaoroshi-link a:hover { color: var(--ink); }

/* ---------- ボタン ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 28px;
  border-radius: 100px;
  font: 700 14px/1.4 var(--sans);
  letter-spacing: 0.05em;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), opacity .2s, border-color .25s, color .25s;
}
.btn.primary { background: var(--blue); color: #fff; }
[data-theme="dark"] .btn.primary { color: #08131E; }
.btn.primary:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.ghost {
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-weight: 500;
  background: transparent;
}
.btn.ghost:hover { border-color: var(--blue-soft); color: var(--ink); }
.btn.quiet {
  min-height: 44px;
  padding: 8px 6px;
  border-radius: 6px;
  color: var(--ink-3);
  font-weight: 500;
  font-size: 13px;
}
.btn.quiet:hover { color: var(--ink); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:disabled:hover { transform: none; box-shadow: none; }

/* ---------- ② 一覧 ---------- */

.view-head { padding: 4vh 0 8px; }
.view-head h2 {
  font-family: var(--mincho);
  font-weight: 600;
  font-size: clamp(21px, 5.4vw, 27px);
  line-height: 1.7;
  margin: 14px 0 10px;
}
.view-head .sub { font-size: 13.5px; color: var(--ink-3); line-height: 2.1; max-width: 540px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chips + .chips { margin-top: 16px; }
.chip {
  min-height: 36px;
  padding: 5px 14px;
  border-radius: 100px;
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-3);
  transition: color .25s, border-color .25s;
  position: relative;
}
.chip::before { content: ''; position: absolute; inset: -4px; }
.chip:hover { color: var(--ink); border-color: var(--blue-soft); }
.chip.on { color: var(--ink); border-color: var(--dawn); }

.list-count {
  font: 600 11px/1 var(--en);
  letter-spacing: 0.08em;
  color: var(--ink-4);
  display: block;
  margin: 18px 0 0;
}

.word-list { margin-top: 8px; border-top: 1px solid var(--line); }
.word-row { border-bottom: 1px solid var(--line); }
.word-main { display: flex; align-items: stretch; gap: 4px; }
.word-toggle {
  flex: 1;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  text-align: left;
  padding: 14px 0 14px 4px;
  min-height: 56px;
}
.word-toggle .genba { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.9; }
.word-toggle .arrow { color: var(--ink-4); font-family: var(--en); font-size: 13px; }
.word-toggle .kotoba { font-size: 13.5px; color: var(--ink-2); line-height: 1.9; }
.word-row.open .word-toggle .kotoba { color: var(--ink); }
.word-star {
  width: 48px;
  display: grid;
  place-items: center;
  color: var(--ink-4);
  transition: color .25s;
  flex-shrink: 0;
}
.word-star svg { width: 19px; height: 19px; }
.word-star:hover { color: var(--ink-2); }
.word-star.on { color: var(--dawn); }

.word-detail { padding: 0 4px 16px; }
.word-detail .d { font-size: 13px; color: var(--ink-2); line-height: 2.05; margin-top: 2px; }
.word-detail .d .k { color: var(--ink-4); font-size: 11px; margin-right: 8px; }
.word-detail .d .k2 { margin-left: 14px; }
.word-detail .meta { color: var(--ink-3); }

.word-empty { padding: 40px 0; color: var(--ink-3); font-size: 13.5px; line-height: 2.1; }

.list-actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px 22px; }

/* ---------- ③ あつめた言葉 ---------- */

.mat-list { margin-top: 20px; border-top: 1px solid var(--line); }
.mat-row { padding: 16px 4px 14px; border-bottom: 1px solid var(--line); }
.mat-row .cat {
  font: 700 10px/1.6 var(--sans);
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.mat-row .pair { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.mat-row .pair .genba { font-size: 14px; font-weight: 600; line-height: 1.9; }
.mat-row .pair .arrow { color: var(--ink-4); font-family: var(--en); font-size: 13px; }
.mat-row .pair .kotoba { font-size: 13.5px; color: var(--ink-2); line-height: 1.9; }
.mat-row .a { font-size: 13px; color: var(--ink-2); line-height: 2.05; margin-top: 4px; }
.mat-row .a .k { color: var(--ink-4); font-size: 11px; margin-right: 8px; }
.mat-row .ops { display: flex; gap: 16px; }
.mat-row .ops button {
  font-size: 12px;
  color: var(--ink-3);
  padding: 4px 2px;
  min-height: 44px;
}
.mat-row .ops button:hover { color: var(--ink); }

.saved-actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.saved-note {
  margin-top: 22px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 2.1;
  max-width: 560px;
}

/* ---------- 戻る導線・フッター ---------- */

.back-line { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 4px 22px; }

.foot {
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 11.5px;
  color: var(--ink-4);
}
.foot a:hover { color: var(--ink-2); }

/* ---------- トースト ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  background: var(--navy);
  color: var(--bg);
  font-size: 13px;
  padding: 10px 22px;
  border-radius: 100px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s var(--ease);
  z-index: 50;
  max-width: calc(100vw - 40px);
}
[data-theme="dark"] .toast { color: #111521; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
