/* ============================================================
   Teal & White — 恋愛スキル改善コンサル デザインシステム v2
   参考: くらしのマーケット(フラット・白基調・大見出し・実用系)
         × Pairs系ティールのブランドカラー(配色イメージのみ)
   モバイルファースト / 片手操作 / 主要CTAは1画面1つ
   ============================================================ */
:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F5F6F8;
  --primary: #1CBEC8;        /* ティール(ブランド色) */
  --primary-d: #12969F;
  --primary-soft: #E7F8F9;
  --grad: linear-gradient(92deg, #3BD6A0 0%, #25C6D2 55%, #3FB2E8 100%);
  --secondary: #0F7E88;      /* 濃いティール(強調・相談員側) */
  --secondary-soft: #EAF4F5;
  --text: #1A1A1A;
  --text-2: #6B6F76;
  --text-3: #9CA1A8;
  --success: #2FA874;
  --success-soft: #E9F6F0;
  --warn: #D14D3C;
  --border: #ECEDEF;
  --shadow: 0 1px 3px rgba(20,30,40,.06);
  --shadow-lg: 0 8px 40px rgba(20,30,40,.14);
  --r-card: 12px; --r-btn: 999px; --r-sheet: 20px; --r-pill: 999px;
  --tap: 44px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }

/* ---- アプリフレーム ---- */
.app {
  max-width: 480px; margin: 0 auto; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; background: var(--bg);
  position: relative; overflow: hidden;
}
/* デスクトップではスマホ端末風フレームで表示(アプリ想定) */
@media (min-width: 500px) {
  body { background: #E4E7EB; padding: 18px 0; }
  .app {
    max-width: 400px; height: calc(100dvh - 36px);
    border-radius: 30px; box-shadow: var(--shadow-lg);
    border: 1px solid #D5D9DE;
  }
}

/* ---- 上部アプリバー(白・ヘアライン) ---- */
.appbar {
  flex: none; min-height: 54px; display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--border);
  z-index: 20;
}
.appbar .title { font-size: 17px; font-weight: 800; letter-spacing: .01em; }
.appbar .back {
  width: 40px; height: 40px; margin-left: -8px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px; color: var(--text);
}
.appbar .back:active { background: var(--surface-2); }
.appbar .spacer { flex: 1; }
.coin-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 13px;
  background: var(--primary-soft); color: var(--primary-d); border-radius: var(--r-pill);
  font-weight: 800; font-size: 13.5px;
}

/* ---- ビュー ---- */
.view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.view-pad { padding: 18px 16px 96px; }

/* 大見出し(くらし風: 大きく太く黒) */
.section-label {
  font-size: 19px; font-weight: 800; color: var(--text);
  margin: 28px 2px 12px; letter-spacing: .01em;
}
.section-label:first-child { margin-top: 4px; }

/* ---- 下部ナビ(白・線アイコン・アクティブ黒) ---- */
.bottomnav {
  flex: none; display: flex; background: #fff;
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}
.bottomnav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 10px; color: var(--text-3); font-size: 11px; font-weight: 700;
  position: relative;
}
.bottomnav button .ic { width: 24px; height: 24px; display: block; }
.bottomnav button .ic svg { width: 100%; height: 100%; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bottomnav button.active { color: #111; }
.bottomnav button.active .ic svg { stroke-width: 2.2; }
.bottomnav button .badge-dot {
  position: absolute; top: 6px; left: calc(50% + 6px); min-width: 16px; height: 16px;
  padding: 0 4px; background: #E5483D; color: #fff; border-radius: var(--r-pill);
  font-size: 10px; font-weight: 800; display: grid; place-items: center;
}

/* ---- カード(フラット: 影なし・ヘアライン枠) ---- */
.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 16px; margin-bottom: 12px;
}
.card-tap { cursor: pointer; }
.card-tap:active { background: var(--surface-2); }

/* ---- グリーティング ---- */
.greeting h1 { font-size: 22px; font-weight: 800; }
.greeting p { color: var(--text-2); margin-top: 4px; font-size: 13.5px; }

/* ---- 課題カテゴリ: くらし風 2列グリッドタイル ---- */
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; }
.cat-tile { cursor: pointer; }
.cat-tile .thumb {
  aspect-ratio: 4 / 3; border-radius: 14px; background: var(--primary-soft) center/cover no-repeat;
  display: grid; place-items: center; font-size: 46px; overflow: hidden;
}
.cat-tile:active .thumb { filter: brightness(.95); }
.cat-tile .t { font-weight: 800; font-size: 15.5px; margin-top: 8px; line-height: 1.4; }
.cat-tile .s { color: var(--text-2); font-size: 11.5px; margin-top: 1px; }
.cat-tile .cnt { color: var(--text-3); font-size: 11px; margin-top: 2px; }
.cat-tile .desc { color: var(--text-2); font-size: 12px; margin-top: 4px; line-height: 1.55; }

/* ---- 横スクロールのランキング(くらし風 サービスランキング) ---- */
.rank-block { margin-bottom: 22px; }
.rank-head { font-size: 15px; font-weight: 800; margin: 0 2px 10px; }
.hscroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch; padding: 2px 16px 4px; margin: 0 -16px; }
.hscroll::-webkit-scrollbar { display: none; }
.mini-card { flex: none; width: 148px; scroll-snap-align: start; cursor: pointer; }
.mini-card:active { opacity: .85; }
.mini-card .thumb { position: relative; width: 148px; height: 148px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 46px; overflow: hidden;
  background: var(--secondary-soft); color: var(--secondary); }
.mini-card .thumb.ai { background: var(--success-soft); color: var(--success); }
.mini-card .rankno { position: absolute; top: 2px; left: 2px; width: 28px; height: 28px;
  border-radius: 50%; background: var(--primary); color: #fff; font-size: 14px;
  font-weight: 800; display: grid; place-items: center; border: 2px solid #fff; }
.mini-card .nm { font-weight: 800; font-size: 14px; margin-top: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-card .rt { font-size: 12.5px; margin-top: 2px; color: var(--text-2); }
.mini-card .rt .star { color: var(--primary); font-weight: 800; }
.mini-card .rt b { color: var(--text); }
.mini-card .pr { font-size: 13.5px; font-weight: 800; margin-top: 2px; }
.mini-card .pr small { font-size: 10px; color: var(--text-3); font-weight: 700; }

/* 旧リスト型カテゴリ(未使用フォールバック) */
.cat-card { display: flex; align-items: center; gap: 14px; padding: 14px 4px;
  border-bottom: 1px solid var(--border); }
.cat-card .emoji { width: 46px; height: 46px; flex: none; border-radius: 12px;
  background: var(--primary-soft); display: grid; place-items: center; font-size: 23px; }
.cat-card .body { flex: 1; min-width: 0; }
.cat-card .body .t { font-weight: 800; font-size: 15.5px; }
.cat-card .body .s { color: var(--text-2); font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-card .cnt { color: var(--text-3); font-size: 11px; }
.cat-card .chev { color: var(--text-3); font-size: 20px; }

/* ---- 続きから / タスク カード ---- */
.resume-card {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  border-radius: var(--r-card); margin-bottom: 10px;
  background: var(--secondary); color: #fff;
}
.resume-card.review { background: var(--primary-soft); color: var(--primary-d);
  border: 1px solid #CBEDEF; }
.resume-card .av {
  width: 42px; height: 42px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 17px;
  background: rgba(255,255,255,.18);
}
.resume-card.review .av { background: #fff; color: var(--primary-d); }
.resume-card .body { flex: 1; min-width: 0; }
.resume-card .body .t { font-weight: 800; font-size: 14.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resume-card .body .s { font-size: 12px; opacity: .85; }
.resume-card .go { flex: none; font-size: 13px; font-weight: 800;
  background: rgba(255,255,255,.16); padding: 7px 13px; border-radius: var(--r-pill); }
.resume-card.review .go { background: var(--primary); color: #fff; }
.notif-badge { flex: none; min-width: 22px; height: 22px; padding: 0 6px; background: #E5483D;
  color: #fff; border-radius: var(--r-pill); font-size: 12px; font-weight: 800;
  display: grid; place-items: center; }

/* ---- 改善レコード ---- */
.record { display: flex; gap: 10px; }
.record .cell {
  flex: 1; background: var(--surface-2); border: 0;
  border-radius: var(--r-card); padding: 14px 8px; text-align: center;
}
.record .cell .v { font-size: 24px; font-weight: 800; color: var(--text); line-height: 1.1; }
.record .cell .v.coral { color: var(--primary-d); }
.record .cell .v.green { color: var(--success); }
.record .cell .k { font-size: 11.5px; color: var(--text-2); margin-top: 4px; }
.record-empty {
  background: var(--surface-2); border-radius: var(--r-card); padding: 18px 16px;
  text-align: center; color: var(--text-2); font-size: 13.5px;
}

/* ---- 信頼指標行(★はブランド色・くらし風の数値強調) ---- */
.trust { display: flex; align-items: center; flex-wrap: wrap; font-size: 12.5px; }
.trust .item { display: inline-flex; align-items: baseline; gap: 3px; color: var(--text-2); }
.trust .item b { color: var(--text); font-weight: 800; font-size: 13.5px; }
.trust .sep { width: 1px; height: 12px; background: var(--border); margin: 0 9px; }
.trust .star { color: var(--primary); font-weight: 800; }
.trust .rate-a b { color: var(--secondary); }
.trust .rate-i b { color: var(--success); }
.stars-inline { color: var(--primary); letter-spacing: 1px; }

/* ---- バッジ ---- */
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: 11px; font-weight: 800; }
.badge.rookie { background: var(--surface-2); color: var(--text-2); }
.badge.new { background: var(--primary); color: #fff; }
.badge.standard { background: var(--secondary-soft); color: var(--secondary); }
.badge.premium { background: #EDE7F6; color: #6A4CA5; }
.badge.popular { background: #FDEBDD; color: #C0662A; }
.badge.expert { background: #FBF0DD; color: #B07D1E; }
.badge.ai { background: var(--success-soft); color: var(--success); }
.badge.online { background: var(--success-soft); color: var(--success); }

/* ---- チップ ---- */
.chip { display: inline-flex; align-items: center; height: 30px; padding: 0 13px;
  background: #fff; color: var(--text-2); border: 1px solid var(--border);
  border-radius: var(--r-pill); font-size: 12.5px; font-weight: 700; margin: 0 6px 6px 0; }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- ボタン(主要CTA=グラデーション・丸) ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--tap); padding: 0 22px; border-radius: var(--r-btn);
  background: var(--grad); color: #fff; font-weight: 800; font-size: 15px; }
.btn:active { filter: brightness(.93); }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--text); border: 1.5px solid #D9DBDE; }
.btn.ghost:active { background: var(--surface-2); }
.btn.navy { background: var(--secondary); }
.btn:disabled { background: var(--border); color: var(--text-3); }
.btn.sm { min-height: 36px; padding: 0 15px; font-size: 13px; }

/* 下部固定CTA */
.cta-dock {
  position: sticky; bottom: 0; margin: 8px -16px -96px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255,255,255,0), #fff 34%);
}
.cta-dock .price-line { text-align: center; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.cta-dock .price-line b { color: var(--text); }

/* ---- フォーム ---- */
label.fld { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-2);
  margin: 14px 2px 6px; }
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: 11px 13px; font-size: 15px; font-family: inherit;
  background: #fff; border: 1.5px solid #D9DBDE; border-radius: 10px; color: var(--text);
}
textarea { min-height: 90px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }

/* ---- 空状態 ---- */
.empty { text-align: center; color: var(--text-2); padding: 40px 20px; }
.empty .ic { font-size: 40px; opacity: .5; }
.empty .t { font-weight: 800; color: var(--text); margin-top: 10px; }
.empty .s { font-size: 13px; margin-top: 4px; }

/* ---- ボトムシート ---- */
.sheet-scrim { position: fixed; inset: 0; background: rgba(15,25,30,.45);
  z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.sheet-scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto;
  background: #fff; border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); z-index: 41;
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
  max-height: 88%; overflow-y: auto; box-shadow: 0 -8px 40px rgba(15,25,30,.2);
}
.sheet.open { transform: translateY(0); }
.sheet .grab { width: 40px; height: 4px; background: var(--border); border-radius: 2px;
  margin: 6px auto 14px; }
.sheet h2 { font-size: 18px; font-weight: 800; }

/* ---- トースト ---- */
#toast-root { position: fixed; left: 0; right: 0; bottom: 84px; z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { max-width: 88%; background: #26343C; color: #fff; padding: 11px 18px;
  border-radius: 12px; font-size: 13.5px; box-shadow: var(--shadow-lg);
  animation: toast-in .2s ease; }
.toast.err { background: var(--warn); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---- 相談員リスト行(くらし風: ヘアライン区切りのフラット行) ---- */
.c-row { display: flex; gap: 13px; align-items: flex-start; padding: 15px 2px;
  border-bottom: 1px solid var(--border); cursor: pointer; }
.c-row:active { background: var(--surface-2); }
.c-row .avatar { position: relative; flex: none; }
.c-row .avatar .rankno { position: absolute; top: -2px; left: -2px; width: 26px; height: 26px;
  border-radius: 50%; background: var(--primary); color: #fff; font-size: 13px;
  font-weight: 800; display: grid; place-items: center; border: 2px solid #fff; z-index: 1; }
.c-row .price { font-weight: 800; font-size: 15.5px; color: var(--text); }
.c-row .price small { font-size: 10.5px; color: var(--text-3); font-weight: 700; display: block; }

/* ---- 選択式フィードバック(評価をボタンで) ---- */
.opt-row { display: flex; gap: 7px; margin-top: 8px; }
.opt-btn { flex: 1; min-height: 44px; border: 1.5px solid var(--border); border-radius: 12px;
  background: #fff; font-weight: 700; font-size: 12.5px; color: var(--text-2); }
.opt-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---- 入力中ドット ---- */
.typing-dots { display: inline-flex; gap: 3px; align-items: center; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3);
  animation: td 1s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes td { 0%, 60%, 100% { opacity: .3 } 30% { opacity: 1 } }

/* ---- 通話画面(Talkport風にシンプル) ---- */
.call-overlay { position: absolute; inset: 0; z-index: 50; color: #fff; text-align: center;
  background: linear-gradient(180deg, #0E3A40, #14545C 60%, #0E3A40);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.call-end { width: 66px; height: 66px; border-radius: 50%; background: #E5483D; color: #fff;
  font-size: 26px; display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.call-end:active { transform: scale(.95); }

/* WebRTC: 映像・通話コントロール */
.rtc-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  background: #0B2F34; z-index: 0; }
.rtc-local { position: absolute; right: 14px; top: 14px; width: 96px; height: 128px;
  object-fit: cover; border-radius: 12px; border: 2px solid rgba(255,255,255,.5);
  background: #000; z-index: 2; }
.rtc-panel { position: relative; z-index: 2; display: flex; flex-direction: column;
  align-items: center; gap: 10px; text-shadow: 0 1px 6px rgba(0,0,0,.45); }
.rtc-timer { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rtc-status { font-size: 13px; opacity: .9; }
.rtc-coins { font-size: 12.5px; opacity: .85; min-height: 17px; }
.rtc-controls { position: relative; z-index: 2; display: flex; gap: 26px; align-items: center;
  margin-top: 6px; }
.rtc-mute { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.18);
  color: #fff; font-size: 22px; display: grid; place-items: center; }
.rtc-mute.muted { background: #fff; color: #333; }

/* 着信バナー(相談員・全ページ共通ポーリングで表示) */
.call-banner { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 80;
  width: min(480px, calc(100% - 20px)); display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 16px; background: #2B2530; color: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); animation: cbin .25s ease; }
@keyframes cbin { from { transform: translate(-50%, -80px); opacity: 0; } }
.call-banner .cb-body { flex: 1; min-width: 0; }
.call-banner .cb-t { font-weight: 800; font-size: 14px; }
.call-banner .cb-s { font-size: 11.5px; opacity: .75; margin-top: 2px; }
.call-banner .cb-btn { height: 40px; padding: 0 16px; border-radius: 999px; font-weight: 800;
  font-size: 13px; flex: none; }
.call-banner .cb-btn.accept { background: #2FA36B; color: #fff; }
.call-banner .cb-btn.decline { background: rgba(255,255,255,.16); color: #fff; }

/* 称号バッジ */
.title-badge { display: inline-flex; align-items: center; height: 26px; padding: 0 12px;
  border-radius: 999px; background: #FBF0DD; color: #B07D1E; font-size: 12px; font-weight: 800; }
.title-badge.sm { height: 21px; padding: 0 9px; font-size: 10.5px; }

/* ---- 送信前の料金メーター(§3.3: 文字数と料金を常時表示) ---- */
.fee-meter { display: flex; align-items: center; gap: 8px; padding: 5px 14px 0;
  font-size: 11.5px; color: var(--text-2); background: var(--surface); }
.fee-meter b { color: var(--text); }
.fee-meter .warn { color: var(--warn); font-weight: 700; }
.fee-meter .free { color: var(--success); font-weight: 700; }
.fee-meter .spacer { flex: 1; }
.fee-meter .sum-btn { border: 1.5px solid var(--primary); color: var(--primary-d);
  border-radius: 999px; padding: 2px 10px; font-size: 11px; font-weight: 800; background: #fff; }

/* 確認質問バブルのラベル */
.confirm-label { display: inline-block; font-size: 10px; font-weight: 800;
  color: var(--secondary); background: var(--secondary-soft); border-radius: 999px;
  padding: 1px 8px; margin-bottom: 3px; }

/* 画像の透かし(§5.3) */
.imgwrap { position: relative; display: inline-block; max-width: 100%; }
.imgwrap .wm { position: absolute; bottom: 5px; right: 8px; font-size: 10px;
  color: rgba(255,255,255,.75); text-shadow: 0 0 3px rgba(0,0,0,.8); pointer-events: none; }

/* オンライン状態ドット(アバター右下に重ねる) */
.status-dot { position: absolute; right: 2px; bottom: 4px; width: 15px; height: 15px;
  border-radius: 50%; border: 2.5px solid #fff; background: #C6CAD0; z-index: 1; }
.status-dot.on { background: var(--success); }
.badge.offline { background: var(--surface-2); color: var(--text-3); }

.hidden { display: none !important; }
