/* 鋼材ニュース（案B・一覧を上から読む）
   スマホ幅 375px で横スクロールが出ないこと。記事が主役なので、鋼種の色などは使わない。 */

:root {
  --ink:      #1f2933;
  --ink-sub:  #6b7580;
  --ink-thin: #9aa3ad;
  --line:     #e3e6ea;
  --bg:       #ffffff;
  --bg-soft:  #f5f6f8;
  --up:       #c0392b;
  --down:     #1f6fb2;
  --warn:     #b8860b;
  --accent:   #1f2933;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;            /* 375px で横に動かない */
}

body {
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

/* ---------- ログイン ---------- */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg-soft);
  padding: 24px 16px;
  align-items: flex-start;
  justify-content: center;
}
.overlay.show { display: flex; }
.loginBox {
  width: 100%;
  max-width: 360px;
  margin-top: 12vh;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 18px 22px;
}
.loginBox h1 { font-size: 18px; margin: 0 0 6px; }
.loginNote, .denyMsg { font-size: 13px; color: var(--ink-sub); margin: 0 0 16px; }
.denyMsg { color: var(--ink); }
.loginBox input {
  width: 100%;
  font-size: 16px;               /* 16px 未満だと iPhone が勝手に拡大する */
  font-family: inherit;
  padding: 11px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.loginBox button {
  width: 100%;
  min-height: 44px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.loginBox button.ghost {
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  font-weight: 500;
}
.err { color: var(--up); font-size: 13px; margin: 10px 0 0; min-height: 1em; }

/* ---------- 上の帯 ---------- */
#head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.headRow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 6px;
}
.brand { font-weight: 700; font-size: 15px; white-space: nowrap; }
.runInfo {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--ink-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.iconBtn {
  min-width: 44px;
  min-height: 36px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink-sub);
  background: none;
  border: 0;
  cursor: pointer;
}
.staleBand {
  background: var(--up);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
}

/* ---------- チップ ---------- */
/* 1段・横スクロール（指示書 4-6）。375px には収まらないので、
   右に続きがあることが分かるように端をぼかす（スワイプに気づけるように）。 */
.chipWrap { position: relative; }
.chipWrap::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 22px;
  pointer-events: none;
  background: linear-gradient(to right, rgba(255,255,255,0), var(--bg));
}
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 12px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chipGap { flex: 0 0 6px; border-left: 1px solid var(--line); margin: 4px 2px; }
.chip {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink-sub);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  white-space: nowrap;
  cursor: pointer;
}
.chip.on {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.searchRow { display: flex; gap: 6px; padding: 0 12px 10px; }
#q {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-family: inherit;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}
.ghost {
  min-width: 44px;
  min-height: 40px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink-sub);
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

/* ---------- 一覧 ---------- */
main { padding: 0 0 40px; }
.dayHead {
  position: sticky;
  top: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-sub);
  background: var(--bg-soft);
  padding: 5px 12px;
  border-bottom: 1px solid var(--line);
}
.art {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px 9px;
  border-bottom: 1px solid var(--line);
}
.art.gone {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  overflow: hidden;
  border-bottom-width: 0;
  transition: max-height .25s ease, opacity .2s ease, padding .25s ease;
}
.art.leaving { max-height: 160px; opacity: .35; transition: opacity .2s ease; }
.artMain { flex: 1; min-width: 0; }
.meta { font-size: 11.5px; color: var(--ink-thin); }
.meta .hidTag { color: var(--warn); font-weight: 600; }
.title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink);
  text-decoration: none;
  margin: 1px 0 2px;
  overflow-wrap: anywhere;
}
.title:visited { color: var(--ink-sub); }
.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 0 6px;
  margin-right: 4px;
  border-radius: 4px;
  white-space: nowrap;
}
.badge.up   { color: var(--up);   background: #fdecea; }
.badge.down { color: var(--down); background: #e8f1fa; }
.badge.low  { color: var(--warn); background: #fbf3e0; }
/* ✕ は 44px 以上（スマホで押し間違えない） */
.xBtn {
  flex: 0 0 auto;
  width: 44px;
  min-height: 44px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink-thin);
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.xBtn:disabled { opacity: .4; }

.more {
  display: block;
  width: calc(100% - 24px);
  margin: 14px 12px;
  min-height: 44px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.empty { padding: 28px 12px; color: var(--ink-sub); font-size: 14px; text-align: center; }

/* ---------- 🧠 覚えた言葉 ---------- */
.learned { margin: 20px 12px 0; border-top: 1px solid var(--line); padding-top: 10px; }
.learned summary {
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 32px;
  padding: 4px 0;
}
.learnedNote { font-size: 12px; color: var(--ink-sub); margin: 4px 0 10px; }
.exAddRow { display: flex; gap: 6px; margin: 0 0 12px; }
.exAddRow select, .exAddRow input {
  font-size: 16px;               /* 16px 未満だと iPhone が勝手に拡大する */
  font-family: inherit;
  padding: 8px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  min-width: 0;
}
.exAddRow select { flex: 0 0 auto; font-size: 14px; }
.exAddRow input  { flex: 1; }
.exAddRow button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.exRow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.exRow .exWord { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.exRow .exFrom { font-size: 11.5px; color: var(--ink-thin); white-space: nowrap; }
.exRow button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink-sub);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

/* ---------- トースト ---------- */
.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 60;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  line-height: 1.5;
  padding: 11px 13px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}
.toast[hidden] { display: none; }
.toast .learnedMsg { display: block; font-weight: 700; margin-top: 3px; }
.toast button {
  min-height: 36px;
  margin-top: 6px;
  padding: 0 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: #fff;
  background: rgba(255, 255, 255, .18);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
/* 隠したあとのトースト（↩戻す＋「理由の言葉」） */
.toastHead { display: flex; align-items: flex-start; gap: 8px; }
.toastHead span { flex: 1; min-width: 0; }
.toast .tBtn { margin-top: 0; flex: 0 0 auto; white-space: nowrap; }
.toast .tClose {
  flex: 0 0 auto;
  margin-top: 0;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 17px;
  line-height: 1;
  background: none;
  opacity: .7;
}
.toastNote { font-size: 12px; opacity: .8; margin-top: 8px; }
.toast .tInput {
  width: 100%;
  margin-top: 8px;
  padding: 9px 10px;
  font-size: 16px;               /* 16px 未満だと iPhone が勝手に拡大する */
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 8px;
}
.toastChips { display: flex; flex-wrap: wrap; gap: 6px; }
.toast .tChip {
  margin-top: 6px;
  padding: 0 11px;
  min-height: 36px;
  font-weight: 600;
  background: rgba(255, 255, 255, .22);
  border-radius: 18px;
  overflow-wrap: anywhere;
}
.toast .tChip:disabled { opacity: .5; }

@media (min-width: 640px) {
  main, #head { max-width: 720px; margin-left: auto; margin-right: auto; }
  .toast { left: auto; right: 16px; width: 360px; }
}
