/* マチアプ無双 */
:root {
  --bg: #FBF7F4;
  --card: #FFFFFF;
  --ink: #231F20;
  --ink-2: #4A4341;
  --sub: #6B6360;
  --line: #EDE6E1;
  --line-2: #E2D9D3;
  --muted: #F1EBE6;
  --accent: #CF4429;
  --accent-text: #B63A22;
  --accent-deep: #8F2C18;
  --accent-soft: #FDEBE5;
  --ok: #1F6B50;
  --ok-dot: #1F8A63;
  --ok-soft: #E2F3EC;
  --chat-bg: #F4EEEA;
  --head-h: 56px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom);
  --app-h: 100vh;
  --round: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  background: #E8E1DB; color: var(--ink); font-size: 15px; -webkit-font-smoothing: antialiased;
  /* サイト共通ヘッダーを上に置き、残りの高さをアプリが使う（固定ヘッダーがアプリに重ならないように） */
  /* 高さは index.html の head で実測値（innerHeight）を --app-h に入れる。PWA/WebView では 100dvh が画面より大きくなり下端が見切れるため */
  display: flex; flex-direction: column; height: var(--app-h);
  padding-top: env(safe-area-inset-top);
}
@supports (height: 100dvh) { :root { --app-h: 100dvh; } }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: none; background: none; cursor: pointer; padding: 0; }
[hidden] { display: none !important; }
img { display: block; }
svg { flex-shrink: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

body > .header { position: relative; flex-shrink: 0; }
#app {
  position: relative; flex: 1; min-height: 0; width: 100%; max-width: 480px; margin: 0 auto;
  background: var(--bg); overflow: hidden;
}
@media (min-width: 481px) { #app { box-shadow: 0 0 40px rgba(35, 31, 32, .12); } }

/* ---------- 共通パーツ ---------- */
.app-logo { font-family: var(--round); font-weight: 900; font-size: 20px; letter-spacing: .02em; }
.app-logo span { color: var(--accent); }
.app-logo.big { font-size: 40px; letter-spacing: .04em; line-height: 1.1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 22px; font-weight: 700; font-size: 15px; white-space: nowrap;
  transition: transform .1s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:disabled { background: #D9CEC7; cursor: default; transform: none; }
.btn.soft { background: var(--muted); color: var(--ink); }
.btn.ghost { background: var(--accent-soft); color: var(--accent-deep); }
.btn.small { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 17px; }
.btn.lg { height: 54px; border-radius: 27px; font-size: 16px; }
.btn.block { width: 100%; }
.btn.white { background: #fff; color: var(--accent-text); }
.btn.outline-white { border: 1.5px solid rgba(255, 255, 255, .75); color: #fff; }

.icon-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 22px; }
.icon-btn svg, .float-back svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.chip {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 15px;
  background: var(--muted); font-size: 13px;
}
.chip.same { background: var(--accent); color: #fff; font-weight: 700; }

.empty { padding: 56px 32px; text-align: center; color: var(--sub); font-size: 13px; line-height: 1.9; }
.empty svg { width: 48px; height: 48px; fill: none; stroke: var(--line-2); stroke-width: 1.5; margin: 0 auto 12px; display: block; }
.loading { grid-column: 1 / -1; padding: 60px; text-align: center; color: var(--sub); }
.disclaimer { margin: 0; padding: 8px 20px 24px; text-align: center; font-size: 11px; color: var(--sub); line-height: 1.6; }

/* ---------- ヘッダー・タブ ---------- */
.head-right { display: flex; gap: 6px; align-items: center; }
.mp-pill { display: flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; border-radius: 16px; background: var(--muted); }
.mp-pill span { font-size: 10px; font-weight: 700; color: var(--sub); }
.mp-pill b { font-size: 14px; font-variant-numeric: tabular-nums; }
.app-head {
  position: absolute; top: 0; left: 0; right: 0; height: var(--head-h); z-index: 5;
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.points { display: flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-deep); }
.points svg { width: 16px; height: 16px; fill: var(--accent); }
.points b { font-size: 14px; font-variant-numeric: tabular-nums; }
.points small { font-size: 11px; font-variant-numeric: tabular-nums; }
.points #pt-next:not(:empty) { margin-left: 4px; padding-left: 6px; border-left: 1px solid rgba(143, 44, 24, .25); }

.view { position: absolute; top: var(--head-h); bottom: calc(var(--tab-h) + var(--safe-b)); left: 0; right: 0; overflow-y: auto; display: none; overscroll-behavior: contain; }
.view.active { display: block; }

.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border-top: 1px solid var(--line);
}
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--sub); }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--accent-text); font-weight: 700; }
.tab.active svg { stroke-width: 2.4; }
.badge {
  position: absolute; top: 8px; left: 54%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: none; align-items: center; justify-content: center;
}
.badge.on { display: flex; }

/* ---------- さがす ---------- */
.filters { display: flex; gap: 8px; padding: 12px 16px 4px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex-shrink: 0; height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--line-2); background: var(--card); font-size: 13px; }
.filters button.active { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px 12px 16px; }
.card { background: var(--card); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); text-align: left; transition: transform .12s; }
.card:active { transform: scale(.98); }
.card .ph { position: relative; aspect-ratio: 4 / 5; background: var(--muted); }
.card .ph img { width: 100%; height: 100%; object-fit: cover; }
.card .meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 10px 8px;
  background: linear-gradient(transparent, rgba(35, 31, 32, .6)); color: #fff; font-size: 14px; font-weight: 700;
}
.card .body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
.card .catch { font-size: 12px; line-height: 1.5; color: var(--ink-2); height: 36px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card .common { font-size: 11px; font-weight: 700; color: var(--accent-deep); }
.card .common.none { font-weight: 400; color: var(--sub); }
.state {
  position: absolute; top: 8px; left: 8px; height: 22px; padding: 0 8px; border-radius: 11px;
  display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; background: #fff;
}
.state.online { color: var(--ok); }
.state.online::before, .dot::before { content: ""; width: 6px; height: 6px; border-radius: 3px; background: var(--ok-dot); }
.state.liked { color: var(--accent-text); }
.state.fromher { background: var(--ok); color: #fff; }
.state.matched { background: var(--accent); color: #fff; }
.state.new { background: var(--accent); color: #fff; }
.sentinel { height: 1px; }
.ptr { height: 0; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; gap: 6px; padding-bottom: 8px; box-sizing: border-box;
  font-size: 12px; color: var(--sub); transition: height .2s; }
.ptr.dragging { transition: none; }
.ptr svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.ptr.ready { color: var(--accent-text); }
.ptr.ready svg { transform: rotate(180deg); }
.ptr.loading svg { animation: ptr-spin .8s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* ---------- リスト（いいね・トーク） ---------- */
.seg { display: flex; margin: 12px 16px 4px; background: var(--muted); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; height: 38px; border-radius: 10px; font-size: 13px; color: var(--sub); }
.seg button.active { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.list { background: var(--card); margin-top: 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; width: 100%; text-align: left; position: relative; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 80px; right: 0; border-top: 1px solid var(--line); }
.row .av { width: 52px; height: 52px; border-radius: 26px; object-fit: cover; background: var(--muted); }
.row .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row .name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.row .name small { font-weight: 400; font-size: 12px; color: var(--sub); }
.row .sub { font-size: 13px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub.unread { color: var(--ink); font-weight: 700; }
.row .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; align-self: stretch; justify-content: center; }
.row .time { font-size: 11px; color: var(--sub); }
.row .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.row.blocked { opacity: .45; }
.tag-date { height: 18px; padding: 0 6px; border-radius: 9px; background: var(--ok-soft); color: var(--ok); font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; }
.list-note { padding: 12px 16px 0; font-size: 12px; color: var(--sub); }

/* ---------- オーバーレイ ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 20; background: var(--bg); display: flex; flex-direction: column;
  transform: translateX(100%); visibility: hidden; transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s .28s;
}
.overlay.open { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.ov-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.plain-head { height: var(--head-h); flex-shrink: 0; display: flex; align-items: center; padding: 0 6px; background: var(--card); border-bottom: 1px solid var(--line); }
.plain-head .ttl { flex: 1; text-align: center; font-weight: 700; font-size: 16px; }

/* ---------- プロフィール詳細 ---------- */
#profile { background: var(--card); }
.pf-photo { position: relative; height: min(440px, 56dvh); background: var(--muted); }
.pf-slides { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.pf-slides::-webkit-scrollbar { display: none; }
.pf-slides img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: start; }
.pf-dots { position: absolute; top: 14px; left: 64px; right: 64px; display: flex; gap: 6px; }
.pf-dots i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .5); box-shadow: 0 0 2px rgba(0, 0, 0, .2); }
.pf-dots i.on { background: #fff; }
.pf-nav { position: absolute; top: 64px; bottom: 40px; width: 30%; }
.pf-nav.prev { left: 0; }
.pf-nav.next { right: 0; }
.pf-sheet { position: relative; margin-top: -20px; border-radius: 20px 20px 0 0; background: var(--card); padding: 20px 20px 120px; display: flex; flex-direction: column; gap: 18px; }
.pf-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pf-name { font-size: 24px; font-weight: 700; }
.pf-age { font-size: 17px; }
.pf-pref { font-size: 14px; color: var(--sub); }
.pf-login { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--sub); display: flex; align-items: center; gap: 4px; }
.pf-login.on { color: var(--ok); }
.pf-login.on::before { content: ""; width: 7px; height: 7px; border-radius: 4px; background: var(--ok-dot); }
.pf-catch { padding: 12px 14px; background: var(--accent-soft); border-radius: 12px; font-size: 14px; line-height: 1.6; }
.pf-stats { display: flex; gap: 18px; font-size: 12px; color: var(--sub); margin-top: -6px; }
.pf-stats b { font-size: 15px; color: var(--accent-text); }
.pf-sec { display: flex; flex-direction: column; gap: 8px; }
.pf-h { font-size: 13px; font-weight: 700; color: var(--sub); }
.pf-bio { font-size: 14px; line-height: 1.85; white-space: pre-wrap; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.info { width: 100%; border-collapse: collapse; font-size: 14px; }
.info th { text-align: left; font-weight: 400; color: var(--sub); width: 36%; padding: 11px 0; border-bottom: 1px solid var(--line); }
.info td { padding: 11px 0; border-bottom: 1px solid var(--line); }
.float-back {
  position: absolute; top: 12px; left: 12px; z-index: 2; width: 40px; height: 40px; border-radius: 20px;
  background: rgba(255, 255, 255, .92); display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
.float-back svg { width: 20px; height: 20px; }
.pf-actions {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 12px; align-items: center;
  padding: 24px 20px calc(20px + var(--safe-b)); background: linear-gradient(rgba(255, 255, 255, 0), #fff 35%);
}
.pf-actions .skip { width: 56px; height: 56px; border-radius: 28px; border: 1px solid var(--line-2); background: #fff; display: flex; align-items: center; justify-content: center; }
.pf-actions .skip svg { width: 22px; height: 22px; fill: none; stroke: var(--sub); stroke-width: 2.4; stroke-linecap: round; }
.pf-actions .like { flex: 1; height: 56px; border-radius: 28px; font-size: 17px; }
.pf-actions .like svg { width: 20px; height: 20px; fill: #fff; }
.pf-actions .like small { font-size: 12px; font-weight: 400; }
.like.pulse { animation: pulse .45s ease; }
@keyframes pulse { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* ---------- マッチング ---------- */
.match {
  position: absolute; inset: 0; z-index: 40; background: var(--accent); color: #fff;
  display: none; flex-direction: column; overflow-y: auto;
}
.match.open { display: flex; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.match-inner { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 28px; padding: max(80px, 12dvh) 28px calc(32px + var(--safe-b)); text-align: center; }
.match-title { font-family: var(--round); font-weight: 900; font-size: 44px; letter-spacing: .06em; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.match p { margin: -14px 0 0; font-size: 15px; line-height: 1.7; }
.match-pics { display: flex; align-items: center; animation: pop .6s .1s cubic-bezier(.2, 1.4, .4, 1) both; }
.match-pics img { width: 132px; height: 132px; border-radius: 66px; border: 5px solid #fff; object-fit: cover; background: var(--muted); }
.match-heart { width: 52px; height: 52px; border-radius: 26px; background: #fff; margin: 0 -18px; z-index: 1; display: flex; align-items: center; justify-content: center; }
.match-heart svg { width: 26px; height: 26px; fill: var(--accent); }
.match-common { font-size: 13px; padding: 6px 14px; border-radius: 15px; background: rgba(255, 255, 255, .2); }
.match-common:empty { display: none; }
.match-btns { margin-top: auto; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.match-btns .btn { height: 56px; border-radius: 28px; font-size: 16px; }
@keyframes pop { 0% { transform: scale(.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ---------- トーク ---------- */
#chat { background: var(--chat-bg); }
.chat-head { position: relative; z-index: 2; height: 60px; flex-shrink: 0; display: flex; align-items: center; gap: 4px; padding: 0 4px; background: var(--card); border-bottom: 1px solid var(--line); }
.chat-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; }
.chat-who img { width: 36px; height: 36px; border-radius: 18px; object-fit: cover; background: var(--muted); }
.chat-who .nm { font-size: 15px; font-weight: 700; }
.chat-who .nm small { font-weight: 400; font-size: 12px; color: var(--sub); }
.chat-who .st { font-size: 11px; color: var(--sub); }
.chat-who .st.on { color: var(--ok); }
.chat-head .icon-btn[data-action] svg { fill: var(--ink); stroke-width: 1.4; }
.pop-menu { position: absolute; top: 54px; right: 8px; min-width: 190px; background: var(--card); border-radius: 12px; box-shadow: 0 6px 24px rgba(35, 31, 32, .18); overflow: hidden; }
.pop-menu button { width: 100%; height: 48px; padding: 0 16px; text-align: left; font-size: 14px; color: #B42318; }
.meter-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 10px; color: var(--sub); }
.hearts { display: flex; gap: 2px; }
.hearts svg { width: 14px; height: 14px; fill: var(--line-2); transition: fill .3s; }
.hearts svg.on { fill: var(--accent); }
.chat-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.msgs { padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 8px; }
.day { align-self: center; font-size: 11px; color: var(--sub); padding: 3px 12px; border-radius: 12px; background: rgba(35, 31, 32, .06); margin: 4px 0; }
.sys { align-self: center; font-size: 12px; color: var(--sub); padding: 6px 14px; border-radius: 14px; background: var(--card); text-align: center; max-width: 90%; }
.sys.good { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ok); background: var(--ok-soft); padding: 8px 16px; }
.sys.good svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.sys.bad { color: var(--sub); background: rgba(35, 31, 32, .06); }
.msg { display: flex; align-items: flex-end; gap: 6px; }
.msg .bubble { max-width: 70%; padding: 10px 14px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.msg .stamp { font-size: 10px; color: var(--sub); line-height: 1.4; white-space: nowrap; }
.msg.me { flex-direction: row-reverse; }
.msg.me .bubble { background: var(--accent); color: #fff; border-radius: 18px 4px 18px 18px; }
.msg.me .stamp { text-align: right; }
.msg.her { align-items: flex-start; }
.msg.her .av { width: 32px; height: 32px; border-radius: 16px; object-fit: cover; background: var(--muted); }
.msg.her .av.ghost { visibility: hidden; }
.msg.her .wrap { display: flex; align-items: flex-end; gap: 6px; min-width: 0; max-width: calc(100% - 38px); }
.msg.her .bubble { max-width: 100%; background: var(--card); border-radius: 18px; }
.msg.her.first .bubble { border-top-left-radius: 4px; }
.msg.in { animation: msgin .25s ease; }
@keyframes msgin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.typing .bubble { display: flex; gap: 4px; padding: 14px 16px; }
.typing .bubble i { width: 7px; height: 7px; border-radius: 4px; background: var(--line-2); animation: blink 1.2s infinite; }
.typing .bubble i:nth-child(2) { animation-delay: .2s; }
.typing .bubble i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { background: var(--line-2); } 40% { background: var(--sub); } }
.composer { flex-shrink: 0; display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(10px + var(--safe-b)); background: var(--card); border-top: 1px solid var(--line); }
.composer textarea {
  flex: 1; min-width: 0; resize: none; min-height: 44px; max-height: 120px; padding: 11px 16px;
  border: 1px solid var(--line); border-radius: 22px; background: var(--bg); font-size: 16px; line-height: 1.35; outline: none;
}
.composer textarea:focus { border-color: var(--accent); }
.composer .send { width: 44px; height: 44px; border-radius: 22px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.composer .send svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linejoin: round; }
.chat-closed { flex-shrink: 0; padding: 16px 16px calc(16px + var(--safe-b)); text-align: center; font-size: 13px; color: var(--sub); background: var(--card); border-top: 1px solid var(--line); }

/* ---------- マイページ ---------- */
.mp { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.mp-card { display: flex; align-items: center; gap: 16px; padding: 18px; background: var(--card); border-radius: 16px; border: 1px solid var(--line); text-align: left; width: 100%; }
.mp-photo { position: relative; width: 76px; height: 76px; flex-shrink: 0; }
.mp-photo img { width: 76px; height: 76px; border-radius: 38px; object-fit: cover; background: var(--muted); }
.mp-photo span { position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 14px; background: var(--ink); border: 2px solid #fff; display: flex; align-items: center; justify-content: center; }
.mp-photo span svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.2; }
.mp-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.mp-name { font-size: 18px; font-weight: 700; }
.mp-name small { font-size: 13px; font-weight: 400; }
.mp-comp { font-size: 12px; color: var(--sub); }
.mp-comp b { color: var(--accent-text); }
.bar { height: 6px; border-radius: 3px; background: var(--muted); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-big { padding: 16px; border-radius: 16px; color: #fff; display: flex; flex-direction: column; gap: 4px; }
.stat-big.a { background: var(--accent); }
.stat-big.b { background: var(--ink); }
.stat-big .l { font-size: 12px; }
.stat-big .n { font-family: var(--round); font-size: 34px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-big .s { font-size: 11px; opacity: .9; }
.stat-sm { padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; display: flex; justify-content: space-between; align-items: baseline; }
.stat-sm span { font-size: 12px; color: var(--sub); }
.stat-sm b { font-size: 20px; font-variant-numeric: tabular-nums; }
.title-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.title-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-align: left; }
.title-row > svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--sub); stroke-width: 2; transform: rotate(90deg); transition: transform .2s; }
.title-card.open .title-row > svg { transform: rotate(-90deg); }
.title-list { list-style: none; margin: 0; padding: 4px 16px 10px; border-top: 1px solid var(--line); }
.title-list li { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; font-size: 14px; color: var(--sub); }
.title-list li + li { border-top: 1px dashed var(--line); }
.title-list li.got { color: inherit; font-weight: 700; }
.title-list li.cur span { color: var(--accent-text); }
.title-list li.cur span::after { content: '現在'; margin-left: 6px; padding: 1px 6px; border-radius: 8px; background: var(--accent-soft); font-size: 11px; }
.title-list small { font-size: 12px; color: var(--sub); font-weight: 400; }
.title-row .ic { width: 40px; height: 40px; border-radius: 20px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
.title-row .ic svg { width: 20px; height: 20px; fill: none; stroke: var(--accent-text); stroke-width: 2; }
.title-row .t { flex: 1; }
.title-row .t div:first-child { font-size: 12px; color: var(--sub); }
.title-row .t div:last-child { font-size: 15px; font-weight: 700; }
.title-row .nx { font-size: 12px; color: var(--sub); text-align: right; }
.menu { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.menu button { width: 100%; height: 52px; padding: 0 16px; display: flex; align-items: center; gap: 8px; font-size: 15px; text-align: left; }
.menu button + button { border-top: 1px solid var(--line); }
.menu button .v { margin-left: auto; font-size: 13px; color: var(--sub); }
.menu button svg { width: 16px; height: 16px; fill: none; stroke: var(--sub); stroke-width: 2; }
.menu button.danger { color: #B42318; }
.privacy {
  display: flex; gap: 8px; align-items: flex-start; padding: 12px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; font-size: 12px; color: var(--sub); line-height: 1.6;
}
.privacy svg { width: 16px; height: 16px; margin-top: 2px; fill: none; stroke: var(--sub); stroke-width: 2; }

/* ---------- ようこそ ---------- */
.welcome {
  position: absolute; inset: 0; z-index: 60; background: var(--bg);
  display: none; flex-direction: column; gap: 24px; padding: max(40px, 6dvh) 24px calc(28px + var(--safe-b)); overflow-y: auto;
}
.welcome.open { display: flex; }
.wl-mosaic { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.wl-mosaic img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; background: var(--muted); }
.wl-mosaic img:nth-child(3n+2) { transform: translateY(20px); }
.wl-mosaic img:nth-child(n+4) { margin-top: -12px; }
.wl-title { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; min-height: 140px; }
.wl-title p { margin: 0; font-size: 15px; color: var(--sub); line-height: 1.7; }
.wl-foot { display: flex; flex-direction: column; gap: 12px; }

/* ---------- プロフィール作成・編集 ---------- */
.setup { z-index: 50; }
.setup-head { height: var(--head-h); flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.setup-head .ttl { flex: 1; text-align: center; font-weight: 700; font-size: 16px; }
.progress { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.step-count { width: 52px; text-align: center; font-size: 13px; color: var(--sub); }
.setup-body { padding: 12px 24px 24px; }
.setup-foot { flex-shrink: 0; display: flex; gap: 12px; padding: 12px 24px calc(24px + var(--safe-b)); }
.setup-foot .btn { height: 54px; border-radius: 27px; font-size: 16px; }
.setup-foot .btn.primary { flex: 1; }
.s-title { margin: 0 0 6px; font-family: var(--round); font-size: 24px; line-height: 1.4; }
.s-lead { margin: 0 0 24px; font-size: 13px; color: var(--sub); line-height: 1.6; }
.s-sec { margin-bottom: 28px; }
.s-sec > h3 { margin: 0 0 12px; font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.field > label, .field-label { font-size: 13px; font-weight: 700; }
.req { color: var(--accent-text); font-size: 11px; margin-left: 4px; }
.input {
  height: 52px; border: 1px solid var(--line-2); border-radius: 12px; padding: 0 16px; background: var(--card);
  font-size: 16px; outline: none; width: 100%;
}
.input:focus { border: 1.5px solid var(--accent); }
.counter { font-size: 12px; color: var(--sub); text-align: right; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.select-wrap { position: relative; }
.select-wrap select {
  appearance: none; -webkit-appearance: none; width: 100%; height: 52px; border: 1px solid var(--line-2); border-radius: 12px;
  padding: 0 36px 0 14px; background: var(--card); font-size: 16px; outline: none;
}
.select-wrap select:focus { border: 1.5px solid var(--accent); }
.select-wrap::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--sub); border-bottom: 2px solid var(--sub); transform: rotate(45deg); pointer-events: none;
}
.photo-pick { display: flex; gap: 16px; align-items: center; }
.photo-pick label {
  position: relative; width: 96px; height: 96px; border-radius: 48px; border: 2px dashed #D9CEC7; background: var(--card);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; overflow: hidden;
}
.photo-pick label.has { border: none; }
.photo-pick label img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick label svg { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.photo-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.photo-pick p { margin: 0; font-size: 12px; color: var(--sub); line-height: 1.7; }
.photo-pick .rm { font-size: 12px; color: var(--accent-text); text-decoration: underline; margin-top: 4px; }
.plist { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.prow { position: relative; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; font-size: 15px; }
.prow + .prow { border-top: 1px solid var(--line); }
.prow .v { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.prow .v.unset { color: var(--sub); font-weight: 400; }
.prow .v::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--line-2); border-bottom: 2px solid var(--line-2); transform: rotate(-45deg); }
.prow select { position: absolute; inset: 0; opacity: 0; width: 100%; font-size: 16px; cursor: pointer; }
.prow:focus-within { background: var(--bg); }
.comp-box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--accent-soft); border-radius: 12px; margin-top: 16px; }
.comp-box .l { font-size: 12px; color: var(--accent-deep); font-weight: 700; }
.comp-box .bar { flex: 1; background: #fff; }
.comp-box .p { font-size: 13px; color: var(--accent-deep); font-weight: 700; font-variant-numeric: tabular-nums; }
.tag-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-pick button { height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid var(--line-2); background: var(--card); font-size: 14px; transition: background .15s; }
.tag-pick button.on { border: 1.5px solid var(--accent); background: var(--accent); color: #fff; font-weight: 700; }
.tag-count { text-align: center; font-size: 13px; color: var(--sub); margin-top: 16px; }
.tag-count b { color: var(--accent-text); }
.bio-area {
  width: 100%; min-height: 200px; border: 1px solid var(--line-2); border-radius: 12px; padding: 14px 16px;
  background: var(--card); font-size: 16px; line-height: 1.7; resize: vertical; outline: none;
}
.bio-area:focus { border: 1.5px solid var(--accent); }
.examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.preview-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.preview-card .top { display: flex; gap: 14px; align-items: center; padding: 18px; }
.preview-card .top img { width: 72px; height: 72px; border-radius: 36px; object-fit: cover; background: var(--muted); }
.preview-card .nm { font-size: 18px; font-weight: 700; }
.preview-card .nm small { font-size: 13px; font-weight: 400; color: var(--sub); }
.preview-card .bio { padding: 0 18px 16px; font-size: 13px; line-height: 1.7; color: var(--ink-2); white-space: pre-wrap; max-height: 110px; overflow: hidden; }
.preview-card .tags { padding: 0 18px 18px; }
.tips { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.tip { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; font-size: 13px; }
.tip.done { color: var(--sub); }
.tip .ck { width: 22px; height: 22px; border-radius: 11px; border: 2px solid var(--line-2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.tip.done .ck { background: var(--ok-dot); border-color: var(--ok-dot); }
.tip.done .ck::after { content: ""; width: 6px; height: 10px; border-right: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(45deg) translate(-1px, -1px); }
.tip .plus { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--accent-text); }

/* ---------- トースト ---------- */
#toast {
  position: absolute; left: 50%; top: calc(var(--head-h) + 10px); z-index: 100; transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  background: rgba(35, 31, 32, .92); color: #fff; font-size: 13px; padding: 10px 18px; border-radius: 20px; transition: all .25s; max-width: 90%; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.pop { animation: toast-pop .4s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes toast-pop {
  0% { transform: translate(-50%, -10px) scale(.85); box-shadow: 0 0 0 0 rgba(207, 68, 41, .55); }
  55% { transform: translate(-50%, 0) scale(1.07); }
  100% { transform: translate(-50%, 0) scale(1); box-shadow: 0 0 0 12px rgba(207, 68, 41, 0); }
}
@media (prefers-reduced-motion: reduce) { #toast.pop { animation: none; } }

/* ---------- スペック強化 ---------- */
.spec { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.spec-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: var(--ink); color: #fff; }
.spec-head .l { font-size: 12px; opacity: .85; }
.spec-head .n { font-family: var(--round); font-size: 28px; font-weight: 900; line-height: 1.15; font-variant-numeric: tabular-nums; }
.spec-head .n small { font-size: 13px; }
.spec-earn { font-size: 11px; line-height: 1.6; text-align: right; opacity: .85; }
.spec-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.spec-row + .spec-row { border-top: 1px solid var(--line); }
.spec-info { flex: 1; min-width: 0; }
.spec-label { font-size: 12px; color: var(--sub); }
.spec-label small { font-weight: 700; color: var(--accent-text); }
.spec-val { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spec-val span { font-size: 12px; font-weight: 400; color: var(--sub); }
.spec-row .btn { min-width: 92px; }
.spec-row .btn[aria-disabled="true"] { color: var(--sub); }
.spec-max { font-size: 12px; font-weight: 800; color: var(--accent-text); padding: 0 12px; }
.prow.locked { width: 100%; text-align: left; }
.prow.locked .v::after { content: none; }
.prow.locked .v::before { content: "MP"; font-size: 10px; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; }
.s-note { margin: 0 0 20px; font-size: 12px; color: var(--sub); line-height: 1.6; }

/* ---------- サイトへの組み込み ---------- */
.share-x { background: var(--ink); color: #fff; }
.ad-slot { padding: 0 16px 24px; }
.ad-slot:empty { display: none; }
.ad-slot.in-grid { padding: 6px 12px; min-height: 262px; }
#grid > .grid { padding-bottom: 0; }
#grid { padding-bottom: 16px; }

/* ---------- MPショップ ---------- */
.fx-bar { position: absolute; top: var(--head-h); left: 0; right: 0; height: 30px; z-index: 4; display: flex; align-items: center; justify-content: center; gap: 14px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; }
.fx-bar span { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.fx-bar b { font-variant-numeric: tabular-nums; margin-left: 2px; }
.fx-bar svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#app.fx-on .view { top: calc(var(--head-h) + 30px); }
.chat-fx { flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--accent); color: #fff; font-size: 12px; line-height: 1.5; }
.chat-fx b { font-variant-numeric: tabular-nums; }
.chat-fx small { font-size: 11px; opacity: .9; }
.chat-fx svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shop-head { flex-wrap: wrap; border-radius: 16px; row-gap: 10px; }
.shop-head p { flex-basis: 100%; margin: 0; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .2); font-size: 11px; line-height: 1.5; opacity: .85; }
.item { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.item.on { border: 2px solid var(--accent); padding: 15px; }
.item-top { display: flex; gap: 12px; align-items: flex-start; }
.item-ic { width: 48px; height: 48px; flex-shrink: 0; border-radius: 24px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
.item-ic svg { width: 24px; height: 24px; fill: none; stroke: var(--accent-text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.item.on .item-ic { background: var(--accent); }
.item.on .item-ic svg { stroke: #fff; }
.item-name { display: flex; align-items: center; gap: 8px; font-family: var(--round); font-size: 18px; font-weight: 900; }
.item-name span { font-family: inherit; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.item-desc { margin-top: 3px; font-size: 13px; line-height: 1.55; color: var(--sub); }
.item .btn { height: 44px; border-radius: 22px; }
.item-left { display: flex; justify-content: space-between; font-size: 13px; }
.item-left b { color: var(--accent-text); }
.item-left span { color: var(--sub); font-variant-numeric: tabular-nums; }
.shop-link { width: 100%; display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 700; text-align: left; }
.shop-link > svg:first-child { width: 20px; height: 20px; fill: none; stroke: var(--accent-text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shop-link span { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--sub); }
.shop-link > svg:last-child { width: 16px; height: 16px; fill: none; stroke: var(--sub); stroke-width: 2; }
#app.fx-on #toast { top: calc(var(--head-h) + 40px); }
.shop-sec { margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--sub); }
.item.bot.locked .item-ic { background: var(--muted); }
.item.bot.locked .item-ic svg { stroke: var(--sub); }
.bot-lock { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; font-size: 12px; line-height: 1.6; color: var(--sub); }
.bot-lock svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 3px; fill: none; stroke: var(--sub); stroke-width: 2; }
.bot-rate { font-size: 14px; }
.bot-rate b { font-family: var(--round); font-size: 20px; font-weight: 900; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.bot-rate span { margin-left: 4px; font-size: 12px; color: var(--sub); }
.bot-total { margin-top: -6px; font-size: 12px; color: var(--sub); font-variant-numeric: tabular-nums; }
.tab-lock { position: absolute; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(251, 247, 244, .97); }
.tab-lock-box { max-width: 320px; display: flex; flex-direction: column; gap: 12px; font-size: 14px; line-height: 1.7; color: var(--sub); text-align: center; }
.tab-lock-box p { margin: 0; }
.tab-lock-box .tl-title { font-family: var(--round); font-size: 20px; font-weight: 900; color: var(--ink); }
/* お気に入りの★：外れているときは薄いグレーの線だけ、付いているときは金色で塗る */
.chat-head .icon-btn.fav-btn[data-action] svg, .fav-toggle svg { fill: none; stroke: #BDB3AD; stroke-width: 1.8; stroke-linejoin: round; }
.chat-head .icon-btn.fav-btn[aria-pressed="true"] svg, .fav-toggle[aria-pressed="true"] svg { fill: #E0A100; stroke: #E0A100; }
.fav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin: -8px -6px -8px -4px; border-radius: 15px; cursor: pointer; }
.fav-toggle svg { width: 18px; height: 18px; }
