/* Claude Design準拠の配色・タイポグラフィ
   bg=Ivory #F0EEE6 / card=Ivory Light #FAF9F5 / ink=Slate #141413 / accent=Crail #C15F3C
   見出し=セリフ体（Anthropic Serif相当のGeorgia＋ヒラギノ明朝）、UI=サンセリフ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #F0EEE6;
  --card: #FAF9F5;
  --card2: #F4F3EE;
  --ink: #141413;
  --muted: #838073;
  --faint: #B0AEA5;
  --line: #E3E0D5;
  --accent: #C15F3C;
  --accent-hi: #D97756;
  --pos: #3D7A5C;
  --neg: #B3382C;
  --serif: Georgia, "Times New Roman", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: "Hiragino Sans", "Yu Gothic", -apple-system, BlinkMacSystemFont, sans-serif;
}
body { font-family: var(--sans); background: var(--bg); color: var(--ink);
  padding: 1.4rem; max-width: 1240px; margin: 0 auto;
  -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

#nav { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.2rem; flex-wrap: wrap; gap: .6rem; }
#nav h1 { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; letter-spacing: .01em; }
#nav a { padding: .42rem .95rem; border-radius: 999px; margin-left: .35rem;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); font-size: .88rem; }
#nav a:hover { text-decoration: none; border-color: var(--accent); }
#nav a.active { background: var(--accent); border-color: var(--accent); color: var(--card); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 1.1rem 1.25rem; margin-bottom: 1.1rem;
  box-shadow: 0 1px 3px rgba(20, 20, 19, .05); }
.card h2 { font-family: var(--serif); font-size: 1.05rem; font-weight: 600;
  margin-bottom: .7rem; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 900px) { .duo { grid-template-columns: 1fr; } }
.duo .card { margin-bottom: 1.1rem; }

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: .5rem .6rem; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; cursor: pointer; user-select: none;
  letter-spacing: .02em; }
th.l, td.l { text-align: left; }
tbody tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--card2); }

.badge { display: inline-block; font-size: .72rem; padding: .14rem .5rem; border-radius: 6px;
  margin-right: .3rem; vertical-align: middle; color: var(--card); }
.src-ai { background: #8D6FA8; }
.src-yahoo { background: #6E9BC4; }
.src-tdnet { background: #7A8F6D; }
.src-manual { background: #B1ADA1; color: var(--ink); }

.chips { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: .8rem; }
.chip { padding: .32rem .85rem; border-radius: 999px; background: var(--card2);
  border: 1px solid var(--line); cursor: pointer; font-size: .84rem; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--card); }

.pos { color: var(--pos); } .neg { color: var(--neg); } .muted { color: var(--faint); }

input[type=search] { background: #fff; border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; padding: .45rem .7rem; width: 230px; font-family: var(--sans); }
input[type=search]:focus { outline: 2px solid var(--accent-hi); outline-offset: 1px; border-color: transparent; }

.bar { background: var(--line); border-radius: 999px; height: 13px; overflow: hidden; margin: .3rem 0 .8rem; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); }

.newslist { list-style: none; }
.newslist li { padding: .58rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; line-height: 1.55; }
.newslist li:last-child { border-bottom: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: .8rem; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .75rem .8rem; }
.metric .v { font-size: 1.28rem; font-weight: 700; letter-spacing: -.01em; }
.metric .k { color: var(--muted); font-size: .77rem; margin-bottom: .25rem; }
.metric .v .sub { font-size: .8rem; color: var(--muted); font-weight: 400; }
.note { color: var(--muted); font-size: .78rem; margin-top: .5rem; line-height: 1.5; }

#authgate { position: fixed; inset: 0; background: var(--bg); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 1rem; }
#authgate .card { width: 340px; max-width: 100%; }
#authgate input { display: block; width: 100%; margin-bottom: .7rem; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem;
  font-family: var(--sans); font-size: 1rem; color: var(--ink); }
#authgate input:focus { outline: 2px solid var(--accent-hi); outline-offset: 1px; border-color: transparent; }
#authgate button { width: 100%; padding: .65rem; border: none; border-radius: 999px;
  background: var(--accent); color: var(--card); font-size: 1rem; font-family: var(--sans);
  cursor: pointer; }
#authgate button:hover { background: var(--accent-hi); }

.rangebar { position: relative; width: 64px; height: 6px;
  background: linear-gradient(90deg, #7FA88F, #D9B96A, #C9705A);
  border-radius: 999px; display: inline-block; vertical-align: middle; margin-right: .35rem; }
.rangebar > i { position: absolute; top: -3px; width: 3px; height: 12px;
  background: var(--ink); border-radius: 2px; transform: translateX(-50%); }

/* ===== スマホ最適化（2026-07-24）：カード表示・下タブ・チャート高さ ===== */

/* チャートは親箱の高さに合わせて描く（スマホで潰れないように） */
.chartbox { position: relative; height: 300px; }
.chartbox.tall { height: 330px; }
.chartbox.short { height: 190px; }

/* 銘柄カード（スマホ専用のリスト表示。既定は非表示＝PCではテーブル） */
.mcards, .msort, .tabbar { display: none; }
.mcard { background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: .68rem .85rem; margin-bottom: .55rem; cursor: pointer; }
.mcard .r1 { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.mcard .nm { font-weight: 600; font-size: .95rem; }
.mcard .sub { color: var(--muted); font-size: .73rem; font-weight: 400; }
.mcard .r2 { display: flex; justify-content: space-between; align-items: center;
  gap: .6rem; margin-top: .4rem; }
.mcard .px { font-size: 1.18rem; font-weight: 700; text-align: right; line-height: 1.25;
  letter-spacing: -.01em; }
.mcard .r3 { display: flex; flex-wrap: wrap; gap: .25rem .8rem; margin-top: .45rem;
  font-size: .76rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: .45rem; }
.mcard .r3 b { color: var(--ink); font-weight: 600; }

.msort select { width: 100%; padding: .55rem .6rem; margin-bottom: .7rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-family: var(--sans); font-size: .92rem; color: var(--ink); }

/* 下タブバー（スマホの親指ナビ。証券アプリの定番） */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(250, 249, 245, .96); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: .3rem .5rem calc(.3rem + env(safe-area-inset-bottom));
  justify-content: space-around; }
.tabbar a { flex: 1; text-align: center; color: var(--muted); font-size: .68rem;
  padding: .12rem 0; text-decoration: none; }
.tabbar a:hover { text-decoration: none; }
.tabbar a .ico { display: block; font-size: 1.3rem; line-height: 1.35; }
.tabbar a.active { color: var(--accent); font-weight: 600; }

@media (max-width: 640px) {
  body { padding: .8rem .8rem calc(74px + env(safe-area-inset-bottom)); }
  #nav { margin-bottom: .9rem; }
  #nav h1 { font-size: 1.12rem; }
  #nav .navlinks { display: none; }      /* 上部タブ→下タブバーへ */
  .tabbar { display: flex; }
  .card { padding: .9rem .95rem; border-radius: 12px; margin-bottom: .9rem; }
  .card h2 { font-size: .98rem; }
  .grid { grid-template-columns: 1fr 1fr; gap: .55rem; }
  .metric { padding: .6rem .65rem; }
  .metric .v { font-size: 1.02rem; }
  .metric .v .sub { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden; font-size: .72rem; line-height: 1.45; }
  input[type=search] { width: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: .35rem; margin-bottom: .5rem; }
  .chip { flex: 0 0 auto; }
  .chartbox { height: 240px; }
  .chartbox.tall { height: 260px; }
  .chartbox.short { height: 170px; }
  /* テーブル→カードに切り替え（.mobile-cards が付いたカード内のみ） */
  .mobile-cards .tablewrap { display: none; }
  .mobile-cards .mcards { display: block; }
  .mobile-cards .msort { display: block; }
}
