:root {
  --bg: #f4f2f5; --card: #ffffff; --ink: #2b2530; --muted: #8e8794; --line: #ebe7ee;
  --pink: #f2557d; --pink2: #ff8aa6; --soft: #fff0f4;
  --shadow: 0 2px 10px rgba(40, 20, 50, .06);
  --tabh: 58px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141116; --card: #221d25; --ink: #f3eef6; --muted: #a39aa9; --line: #332c37; --soft: #3a2430; --shadow: 0 2px 10px rgba(0,0,0,.35); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body.with-tabs { padding-bottom: calc(var(--tabh) + env(safe-area-inset-bottom)); }
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; width: 100%; outline: none; }
input:focus, textarea:focus { border-color: var(--pink2); }
h2 { font-size: 19px; line-height: 1.5; margin: 6px 0; }
h3 { font-size: 13px; margin: 0 0 10px; color: var(--muted); font-weight: 700; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.7; }
.small { font-size: 12px; }
.pad { padding: 12px 16px 24px; }
.pad-x { padding: 4px 12px 24px; }
.center { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; gap: 6px; min-height: 60dvh; }

/* 上のバー */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--line); padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: baseline; gap: 10px; }
.topbar[hidden] { display: none; }
.logo { font-size: 20px; margin: 0; font-weight: 800; letter-spacing: .3px; }
.logo span { color: var(--pink); }
.logo.big { font-size: 40px; }
.page-title { margin: 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.banner { margin: 8px 12px 0; padding: 8px 12px; border-radius: 8px; background: var(--soft); font-size: 12px; color: var(--muted); }
main { flex: 1; display: flex; flex-direction: column; }

/* 下のメニュー */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); }
.tabbar[hidden] { display: none; }
.tabbtn { flex: 1; max-width: 120px; height: var(--tabh); border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 700; color: var(--muted); }
.tabbtn .ti { position: relative; }
.tabbtn svg { width: 24px; height: 24px; fill: currentColor; display: block; }
.tabbtn.on { color: var(--pink); }
.tabbtn b { position: absolute; top: -4px; right: -10px; background: var(--pink); color: #fff; font-size: 10px; min-width: 17px; height: 17px; line-height: 17px; border-radius: 9px; padding: 0 4px; text-align: center; }

/* ボタン類 */
.btn { border: 0; border-radius: 999px; padding: 14px 20px; font-weight: 800; width: 100%; margin-top: 12px; font-size: 15px; }
.btn.primary { background: linear-gradient(90deg, var(--pink), var(--pink2)); color: #fff; box-shadow: 0 6px 16px rgba(242, 85, 125, .3); }
.btn.primary:disabled { opacity: .5; box-shadow: none; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.like { background: linear-gradient(90deg, var(--pink), var(--pink2)); color: #fff; margin: 0; flex: 1; font-size: 17px; box-shadow: 0 6px 16px rgba(242, 85, 125, .35); }
.btn.done { background: var(--line); color: var(--muted); margin: 0; }
.round { width: 54px; height: 54px; flex: none; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); font-size: 22px; color: var(--muted); }

/* ログイン */
.auth { flex: 1; display: flex; flex-direction: column; background: linear-gradient(170deg, #ff7a9c 0%, #ffb3c4 45%, var(--bg) 45.2%); }
.auth-hero { color: #fff; text-align: center; padding: calc(56px + env(safe-area-inset-top)) 16px 28px; }
.auth-hero .logo span { color: #fff2c6; }
.auth-hero p { margin: 6px 0 0; font-size: 14px; font-weight: 700; opacity: .95; }
.auth-card { background: var(--card); margin: 0 16px 24px; border-radius: 18px; padding: 18px 18px 16px; box-shadow: 0 10px 30px rgba(40, 20, 50, .12); }
.tabs { display: flex; background: var(--bg); border-radius: 999px; padding: 4px; }
.tab { flex: 1; border: 0; background: none; border-radius: 999px; padding: 9px 4px; font-weight: 800; font-size: 14px; color: var(--muted); }
.tab.on { background: var(--card); color: var(--pink); box-shadow: var(--shadow); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 14px; }
.check { display: flex; gap: 8px; align-items: center; margin: 14px 0 0; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--pink); }
.err { color: #e5484d; font-size: 13px; min-height: 18px; margin: 8px 0 0; }
.note { font-size: 12px; color: var(--muted); line-height: 1.7; text-align: center; margin: 14px 0 0; }

/* 理想のタイプ */
.lead { font-size: 14px; color: var(--muted); margin: 4px 0 12px; }
.panel { background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 13px; font-size: 14px; }
.chip.on { background: var(--pink); border-color: var(--pink); color: #fff; font-weight: 700; }
.heart-pulse { font-size: 52px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.18); } }

/* さがす */
.cond { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; margin: 10px 0 4px; background: var(--card); border: 0; border-radius: 10px; padding: 11px 14px; box-shadow: var(--shadow); text-align: left; font-size: 13px; }
.cond span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cond b { color: var(--pink); flex: none; font-size: 12px; }
.sub { font-size: 13px; color: var(--muted); margin: 14px 4px 8px; }
.sub b { color: var(--ink); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gcard { border: 0; padding: 0; background: var(--card); border-radius: 12px; overflow: hidden; text-align: left; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.gcard:active { transform: scale(.98); }
.gphoto { position: relative; aspect-ratio: 3 / 4; background: linear-gradient(160deg, #ffd6e2, #fff1f5); overflow: hidden; }
.gphoto svg { width: 100%; height: 100%; }
.photo-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gtext { padding: 8px 10px 10px; font-size: 13px; }
.gtext b { font-size: 15px; }
.gtext p { margin: 3px 0 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcompat { display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 800; color: var(--pink); background: var(--soft); border-radius: 999px; padding: 2px 8px; }
.new-tag, .liked-tag { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 800; border-radius: 6px; padding: 3px 7px; }
.new-tag { background: var(--pink); color: #fff; }
.liked-tag { background: rgba(43, 37, 48, .72); color: #fff; }
.empty { text-align: center; padding: 40px 12px 10px; }
.empty.small { padding: 10px 4px; text-align: left; }

/* プロフィール詳細 */
.detail { background: var(--card); min-height: 100dvh; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.dphoto { position: relative; aspect-ratio: 3 / 4; max-height: 70dvh; width: 100%; background: linear-gradient(160deg, #ffd6e2, #fff1f5); overflow: hidden; }
.dphoto svg { width: 100%; height: 100%; }
.dback { position: absolute; left: 12px; top: calc(12px + env(safe-area-inset-top)); width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .38); color: #fff; font-size: 26px; line-height: 1; padding-bottom: 3px; }
.ai-tag { position: absolute; right: 12px; top: calc(14px + env(safe-area-inset-top)); background: rgba(0, 0, 0, .45); color: #fff; font-size: 11px; font-weight: 800; border-radius: 6px; padding: 3px 7px; }
.dbody { padding: 16px 18px; }
.dbody h2 { font-size: 22px; margin: 0; }
.dbody h2 small { font-size: 14px; color: var(--muted); font-weight: 500; }
.dcatch { margin: 6px 0 12px; font-weight: 700; }
.compat-box { display: flex; align-items: center; gap: 10px; background: var(--soft); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.compat-box b { color: var(--pink); white-space: nowrap; font-size: 15px; }
.likes-you { background: #fff6e5; color: #b26b00; font-size: 13px; font-weight: 700; border-radius: 10px; padding: 9px 12px; margin: 10px 0 0; }
.dbody h3 { margin: 22px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.dbio { font-size: 14px; line-height: 1.85; margin: 0; white-space: pre-wrap; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { background: var(--bg); font-size: 12px; border-radius: 999px; padding: 5px 11px; }
.basic { width: 100%; border-collapse: collapse; font-size: 14px; }
.basic th { text-align: left; color: var(--muted); font-weight: 500; width: 34%; padding: 9px 0; border-bottom: 1px solid var(--line); }
.basic td { padding: 9px 0; border-bottom: 1px solid var(--line); }
.dactions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; max-width: 480px; margin: 0 auto; display: flex; gap: 12px; align-items: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--card) 30%); }
.dactions .btn.primary { margin: 0; }

/* マッチ演出 */
.modal { position: fixed; inset: 0; background: rgba(30, 10, 25, .7); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.modal[hidden] { display: none; }
.match-box { background: var(--card); border-radius: 22px; padding: 24px 20px; text-align: center; width: 100%; max-width: 340px; animation: pop .35s; line-height: 1.7; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
.match-title { font-size: 26px; font-weight: 900; margin: 0; color: var(--pink); }
.match-avatar { width: 140px; height: 140px; margin: 14px auto; border-radius: 50%; overflow: hidden; border: 4px solid var(--soft); background: var(--soft); }
.match-avatar svg { width: 100%; height: 120%; }
.toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: rgba(43, 37, 48, .9); color: #fff; font-size: 13px; padding: 10px 16px; border-radius: 999px; z-index: 30; white-space: nowrap; animation: pop .25s; }

/* メッセージ一覧 */
.list { background: var(--card); }
.row { display: flex; gap: 12px; align-items: center; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; text-align: left; }
.row-av { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: var(--soft); flex: none; }
.row-av svg { width: 100%; height: 130%; }
.row-av .photo-img, .chat-av .photo-img, .mini-av .photo-img, .match-avatar .photo-img { object-position: center 22%; }
.row-main { flex: 1; min-width: 0; }
.row-top { display: flex; justify-content: space-between; }
.row-time { font-size: 11px; color: var(--muted); }
.row-main p { margin: 4px 0 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main p.unread { color: var(--ink); font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pink); flex: none; }

/* チャット */
.chat { display: flex; flex-direction: column; height: 100dvh; background: var(--bg); }
.chat-head { display: flex; gap: 10px; align-items: center; padding: calc(8px + env(safe-area-inset-top)) 12px 8px 4px; background: var(--card); border-bottom: 1px solid var(--line); }
.cback { border: 0; background: none; font-size: 30px; width: 36px; height: 40px; line-height: 1; color: var(--muted); }
.chat-av { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--soft); flex: none; border: 0; padding: 0; }
.chat-av svg { width: 100%; height: 130%; }
.chat-who { line-height: 1.3; }
.meter { height: 5px; width: 140px; background: var(--soft); border-radius: 5px; overflow: hidden; margin: 5px 0 2px; }
.meter div { height: 100%; background: linear-gradient(90deg, var(--pink2), var(--pink)); transition: width .6s; }
.level { color: var(--pink); font-weight: 700; }
.msgs { flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.line { display: flex; align-items: flex-end; gap: 6px; }
.line.me { justify-content: flex-end; }
.mini-av { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: var(--soft); flex: none; align-self: flex-start; }
.mini-av svg { width: 100%; height: 130%; }
.bubble { max-width: 72%; padding: 10px 13px; border-radius: 16px; line-height: 1.6; font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.bubble.her { background: var(--card); border-top-left-radius: 4px; box-shadow: var(--shadow); }
.bubble.me { background: var(--pink); color: #fff; border-top-right-radius: 4px; }
.btime { font-size: 10px; color: var(--muted); }
.typing { display: flex; gap: 4px; padding: 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }
.sys { align-self: center; font-size: 12px; color: var(--muted); }
.composer { display: flex; gap: 8px; align-items: center; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.composer input { border-radius: 999px; padding: 10px 16px; background: var(--bg); border-color: transparent; }
.send { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; background: var(--pink); display: flex; align-items: center; justify-content: center; }
.send svg { width: 20px; height: 20px; fill: #fff; }

/* マイページ */
.me-card { display: flex; gap: 14px; align-items: center; background: var(--card); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.me-card p { margin: 2px 0 0; }
.me-av { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, var(--pink), var(--pink2)); color: #fff; font-size: 24px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--card); border-radius: 14px; margin: 10px 0; box-shadow: var(--shadow); }
.stats div { text-align: center; padding: 14px 4px; display: flex; flex-direction: column; gap: 2px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats b { font-size: 20px; color: var(--pink); }
.stats span { font-size: 11px; color: var(--muted); }
.menu { background: var(--card); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.menu button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 0; background: none; padding: 15px 16px; text-align: left; font-size: 15px; }
.menu button + button { border-top: 1px solid var(--line); }
.menu small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; margin-left: auto; }
.menu button::after { content: "›"; color: var(--muted); font-size: 20px; }
.menu.danger { margin-top: 10px; }
.menu.danger button { color: #e5484d; }
.btn.danger { background: #e5484d; color: #fff; }
.sheet { background: var(--card); border-radius: 20px; padding: 20px; width: 100%; max-width: 380px; animation: pop .25s; }
.sheet .btn.ghost { margin-top: 8px; }
.check a { color: var(--pink); }
.forgot { display: block; margin: 12px auto 0; border: 0; background: none; color: var(--pink); font-size: 13px; text-decoration: underline; }
.plan-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--card); border-radius: 14px; padding: 14px 16px; margin-top: 10px; box-shadow: var(--shadow); }
.plan-card p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.plan-card.premium { background: linear-gradient(135deg, #fff4dc, #ffe3ec); }
@media (prefers-color-scheme: dark) { .plan-card.premium { background: linear-gradient(135deg, #3a2f1c, #3a2430); } }
.btn.mini { width: auto; margin: 0; padding: 9px 14px; font-size: 13px; flex: none; }
.link-btn { border: 0; background: none; color: var(--muted); font-size: 13px; text-decoration: underline; flex: none; }
.compare { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.compare th, .compare td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.compare td:first-child { text-align: left; color: var(--muted); }
.compare .hl { color: var(--pink); font-weight: 800; }
.price { text-align: center; margin: 12px 0 4px; } .price b { font-size: 24px; color: var(--pink); }
.fine { font-size: 11px; color: var(--muted); line-height: 1.7; } .fine a { color: var(--pink); }
.read { align-self: flex-end; font-size: 10px; color: var(--muted); margin-top: -6px; }
.card-box { margin: 10px 0 4px; min-height: 56px; }
