/* ============================================================
 * つむぎ 共通スタイル v2（2026-07-05 UIリニューアル）
 * 水彩・柔らかい・アプリ型。外部CDN不使用（Google Fontsのみ各ページでlink）
 * パレット: クリーム#FBF6EF / 紙#FFFDF8 / 柿色#D9765A〜#E8836B / 抹茶#8FA97E / 焦茶#5D4A3A
 * ============================================================ */
:root {
  /* --- 新トークン --- */
  --cream:  #FBF6EF;   /* 背景 */
  --paper:  #FFFDF8;   /* カード面（紙） */
  --kaki:   #D9765A;   /* 柿色（アクセント） */
  --kaki2:  #E8836B;   /* 柿色 明 */
  --kaki-soft: #F7E3DB; /* 柿色 うすめ（面） */
  --matcha: #8FA97E;   /* 抹茶 */
  --matcha-soft: #EAF0E3;
  --brown:  #5D4A3A;   /* 焦茶（本文・真っ黒禁止） */
  --brown-soft: #9C8874; /* 補助文字 */
  --line:   #F0E6D8;   /* うす罫線（余白優先・控えめに） */
  --radius: 20px;
  --radius-s: 14px;
  --shadow: 0 6px 22px rgba(93, 74, 58, 0.08);
  --shadow-soft: 0 3px 12px rgba(93, 74, 58, 0.06);
  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;

  /* --- 旧名エイリアス（既存インラインstyle・JS参照互換） --- */
  --kinari: var(--cream);
  --washi:  var(--paper);
  --sumi:   var(--brown);
  --usuzumi: var(--brown-soft);
  --akane:  var(--kaki);
  --kincha: #E5D3B3;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--cream);
  color: var(--brown);
  font-family: var(--font);
  line-height: 1.85;
  font-size: 16px;
}
.serif, h1, h2, h3 { font-family: var(--font); font-weight: 700; letter-spacing: 0.04em; }
a { color: var(--kaki); }
img { max-width: 100%; }
button { font-family: var(--font); }

/* 上部の赤い糸ライン（つむぎモチーフ・細く控えめ） */
.kasane {
  height: 3px;
  background: repeating-linear-gradient(90deg,
    var(--kaki2) 0 14px, transparent 14px 22px);
  opacity: 0.55;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 16px 18px 72px; }
body.has-tabbar .wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

/* ---------- ヘッダー（アプリバー） ---------- */
header.site {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 12px; padding: 10px 0 12px;
}
header.site .brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 24px; font-weight: 900; letter-spacing: 0.22em;
  text-decoration: none; color: var(--brown); line-height: 1.25;
}
header.site .brand .yarn { font-size: 26px; letter-spacing: 0; filter: saturate(0.9); }
header.site .brand small {
  font-size: 11px; letter-spacing: 0.1em; color: var(--brown-soft);
  display: block; font-weight: 500;
}
nav.global { display: flex; gap: 4px; flex-wrap: wrap; font-size: 13.5px; align-items: center; }
nav.global a {
  color: var(--brown); text-decoration: none;
  padding: 8px 13px; min-height: 40px; display: inline-flex; align-items: center;
  border-radius: 999px; font-weight: 500;
}
nav.global a:hover { background: var(--kaki-soft); }
nav.global a.on { background: var(--kaki); color: #fff; font-weight: 700; }

h1.page { font-size: 25px; margin: 22px 0 6px; line-height: 1.5; }
p.lede { color: var(--brown-soft); font-size: 14px; margin-bottom: 20px; }

/* ---------- 赤い糸の区切り ---------- */
.ito {
  border: 0; height: 14px; margin: 26px auto; max-width: 260px;
  background-repeat: no-repeat; background-position: center;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='14' viewBox='0 0 260 14'><path d='M2 8 q 20 -8 40 0 t 40 0 q 8 -3 14 0 a 5 5 0 1 0 6 -2 q 4 -4 14 2 t 40 0 t 40 0 t 40 0' fill='none' stroke='%23E8836B' stroke-width='1.6' stroke-linecap='round' opacity='0.75'/></svg>");
}

/* ---------- カード ---------- */
.card {
  background: var(--paper); border: 1px solid rgba(240, 230, 216, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft); padding: 22px 22px; margin-bottom: 18px;
}
.card h2 { font-size: 18px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h2::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--kaki2); flex: none; }
.card h3 { font-size: 15px; margin: 14px 0 6px; color: var(--matcha); }

/* 写真つきカード（機能カード） */
.fcard {
  background: var(--paper); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); text-decoration: none; color: var(--brown);
  display: flex; flex-direction: column; border: 1px solid rgba(240,230,216,.6);
  transition: transform .18s ease, box-shadow .18s ease;
}
.fcard:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(93,74,58,.13); }
.fcard img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.fcard .fbody { padding: 14px 16px 16px; }
.fcard .fbody b { font-size: 16px; display: block; margin-bottom: 2px; }
.fcard .fbody span { font-size: 12.5px; color: var(--brown-soft); line-height: 1.7; display: block; }
.fgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .fgrid { grid-template-columns: repeat(2, 1fr); } }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, var(--kaki2), var(--kaki));
  color: #fff; font-size: 15px; font-weight: 700;
  padding: 12px 26px; min-height: 48px;
  font-family: var(--font); letter-spacing: 0.06em; text-decoration: none;
  box-shadow: 0 4px 14px rgba(217, 118, 90, 0.28);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(217,118,90,.34); }
.btn:active { transform: translateY(0); }
.btn.sub {
  background: var(--paper); color: var(--brown);
  border: 1.5px solid var(--kincha); box-shadow: var(--shadow-soft);
}
.btn.ghost { background: transparent; color: var(--matcha); border: 1.5px solid var(--matcha); box-shadow: none; }

/* ---------- フォーム ---------- */
label.f { display: block; font-size: 13px; color: var(--brown-soft); margin: 14px 0 4px; font-weight: 500; }
input.f, textarea.f, select.f {
  width: 100%; padding: 12px 16px; font-size: 16px; font-family: var(--font);
  border: 1.5px solid var(--line); border-radius: var(--radius-s);
  background: #fff; color: var(--brown); min-height: 48px;
}
input.f:focus, textarea.f:focus, select.f:focus { outline: 2px solid var(--kaki2); outline-offset: 1px; border-color: transparent; }

.msg-err { color: var(--kaki); font-size: 14px; margin-top: 10px; min-height: 1.4em; }
.msg-ok  { color: var(--matcha); font-size: 14px; margin-top: 10px; }

.pill {
  display: inline-block; font-size: 11.5px; padding: 3px 12px; border-radius: 999px;
  background: var(--matcha-soft); color: #6d8560; margin-left: 8px; vertical-align: middle;
  font-weight: 700; letter-spacing: .04em;
}
.pill.soon { background: #f4ede2; color: var(--brown-soft); font-weight: 500; }

/* ---------- 元気度（花の満ち具合） ---------- */
.scorewrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.score-num { font-size: 50px; font-weight: 900; color: var(--kaki); line-height: 1; }
.score-num small { font-size: 15px; color: var(--brown-soft); font-weight: 500; }
.hana-row { display: flex; gap: 6px; font-size: 30px; line-height: 1; }
.hana-row .h { filter: grayscale(1) opacity(0.28); transition: filter .3s; }
.hana-row .h.on { filter: none; }
.genki-word { font-size: 15px; font-weight: 700; color: var(--matcha); }
.gauge { flex: 1; min-width: 120px; height: 12px; background: #F2E9DC; border-radius: 999px; overflow: hidden; }
.gauge > i { display: block; height: 100%; background: linear-gradient(90deg, var(--matcha), var(--kaki2)); border-radius: 999px; }

/* 統計チップ */
.stat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.stat-chips .chip {
  background: var(--cream); border-radius: 999px; padding: 6px 14px;
  font-size: 12.5px; color: var(--brown);
}
.stat-chips .chip b { color: var(--kaki); }

/* ---------- 表 ---------- */
table.plain { width: 100%; border-collapse: collapse; font-size: 14px; }
table.plain th, table.plain td { text-align: left; padding: 9px 10px; border-bottom: 1px dashed var(--line); vertical-align: top; }
table.plain tr:last-child th, table.plain tr:last-child td { border-bottom: 0; }
table.plain th { color: var(--brown-soft); font-weight: 700; white-space: nowrap; }

.copybox { display: flex; gap: 8px; align-items: center; }
.copybox input { flex: 1; }

/* ---------- ポータルメニュー（画像つき行） ---------- */
.portal-list { display: flex; flex-direction: column; gap: 10px; }
.portal-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--cream); border-radius: 16px; padding: 10px 14px 10px 10px;
  text-decoration: none; color: var(--brown); min-height: 64px;
  transition: background .15s ease;
}
a.portal-item:hover { background: var(--kaki-soft); }
.portal-item .thumb {
  width: 54px; height: 54px; border-radius: 14px; object-fit: cover; flex: none;
  box-shadow: var(--shadow-soft);
}
.portal-item .thumb.emoji {
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; background: #fff;
}
.portal-item b { font-size: 14.5px; display: block; }
.portal-item span.d { font-size: 12px; color: var(--brown-soft); display: block; line-height: 1.6; }
.portal-item.soon { opacity: .62; }

/* ---------- 下部固定タブバー（アプリ型） ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-around; align-items: stretch;
  background: rgba(255, 253, 248, 0.96);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 18px rgba(93, 74, 58, 0.07);
}
.tabbar a {
  flex: 1; max-width: 130px; min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; text-decoration: none; color: var(--brown-soft);
  font-size: 10.5px; font-weight: 700; border-radius: 14px;
}
.tabbar a .ic { font-size: 22px; line-height: 1.2; }
.tabbar a.on { color: var(--kaki); background: var(--kaki-soft); }
@media print { .tabbar { display: none !important; } }
/* PC幅のみ上部ナビでタブバー非表示。タブレット(iPad Air 11" 横1180px含む)は
 * 下部タブバーを常時表示＝「アカウント」導線を必ず出す（App Store 5.1.1(v)対応）。 */
@media (min-width: 1200px) {
  .tabbar { display: none; }
  body.has-tabbar .wrap { padding-bottom: 72px; }
}

/* ---------- ヒーロー・見出し画像 ---------- */
.hero {
  position: relative; border-radius: 24px; overflow: hidden;
  box-shadow: var(--shadow); margin: 6px 0 26px;
}
.hero img { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; }
.hero .copy {
  position: absolute; inset: auto 0 0 0;
  padding: 56px 26px 22px;
  background: linear-gradient(180deg, rgba(251,246,239,0) 0%, rgba(251,246,239,.86) 62%, rgba(251,246,239,.97) 100%);
}
.hero .copy h1 { font-size: 27px; font-weight: 900; line-height: 1.55; letter-spacing: .06em; }
.hero .copy p { font-size: 13.5px; color: var(--brown-soft); margin-top: 4px; }
@media (max-width: 640px) {
  .hero img { aspect-ratio: 4 / 3; }
  .hero .copy { padding: 40px 18px 16px; }
  .hero .copy h1 { font-size: 20px; }
  .hero .copy p { font-size: 12px; }
}

/* ページ見出し帯（カード画像を柔らかく敷く） */
.page-hero {
  display: flex; align-items: center; gap: 18px;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-soft);
  padding: 14px 18px; margin: 8px 0 20px; border: 1px solid rgba(240,230,216,.6);
}
.page-hero img { width: 88px; height: 88px; border-radius: 18px; object-fit: cover; flex: none; box-shadow: var(--shadow-soft); }
.page-hero h1 { font-size: 21px; line-height: 1.5; margin: 0; }
.page-hero p { font-size: 12.5px; color: var(--brown-soft); margin-top: 2px; }
@media (max-width: 480px) {
  .page-hero { gap: 14px; }
  .page-hero img { width: 72px; height: 72px; }
  .page-hero h1 { font-size: 18px; }
}

/* ---------- フッター ---------- */
footer.site { margin-top: 44px; padding-top: 18px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--brown-soft); }
footer.site p { margin-bottom: 4px; }

.notice { font-size: 12.5px; color: var(--brown-soft); background: var(--kaki-soft); border-radius: var(--radius-s); padding: 12px 16px; margin-top: 14px; }
