:root {
  --bg: #fff6fa;
  --card: #ffffff;
  --ink: #3d3044;
  --sub: #8a7d93;
  --line: #f3dce8;
  --pink: #ff6fae;
  --pink-soft: #ffe3f0;
  --mint: #2fbf9b;
  --mint-soft: #ddf7ef;
  --up: #ff6b6b;
  --radius: 18px;
  --shadow: 0 4px 16px rgba(255, 111, 174, 0.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'M PLUS Rounded 1c', system-ui, -apple-system, 'Hiragino Maru Gothic ProN', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.35; }
h1 { font-size: 22px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 800; }
p { margin: 0 0 8px; }
.sub { color: var(--sub); font-size: 13px; }
.loading { text-align: center; color: var(--sub); padding: 64px 0; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.hero { text-align: center; padding: 28px 8px 12px; }
.logo { font-size: 34px; font-weight: 800; color: var(--pink); letter-spacing: 0.04em; }
.logo small { display: block; font-size: 13px; color: var(--sub); letter-spacing: 0; font-weight: 400; }

label { display: block; font-size: 13px; font-weight: 700; margin: 10px 0 4px; }
input, textarea, select {
  width: 100%; font: inherit; color: inherit; background: #fffafd;
  border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none;
}
input:focus, textarea:focus { border-color: var(--pink); }
textarea { resize: vertical; min-height: 72px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.row > .btn.small { flex: none; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }

button { font: inherit; cursor: pointer; border: 0; }
.btn {
  display: block; width: 100%; margin-top: 14px; padding: 12px; border-radius: 999px;
  background: linear-gradient(135deg, #ff8fbf, #ff6fae); color: #fff; font-weight: 800; font-size: 16px;
  box-shadow: 0 4px 12px rgba(255, 111, 174, 0.35);
}
.btn:disabled { opacity: 0.6; }
.btn.ghost { background: var(--pink-soft); color: var(--pink); box-shadow: none; }
.btn.small { display: inline-block; width: auto; margin: 0; padding: 6px 14px; font-size: 14px; }
.link { background: none; color: var(--pink); font-weight: 700; padding: 4px; }

.tabs { display: flex; background: var(--pink-soft); border-radius: 999px; padding: 4px; margin-bottom: 8px; }
.tabs button { flex: 1; padding: 8px; border-radius: 999px; background: none; color: var(--sub); font-weight: 700; }
.tabs button.on { background: #fff; color: var(--pink); box-shadow: var(--shadow); }

.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; font-size: 14px; margin-top: 12px; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--pink); }

.league-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card); color: inherit;
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 10px; }
.league-item .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.league-item b { display: block; }

.team-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.team-pick label { margin: 0; display: flex; align-items: center; gap: 8px; padding: 10px; border: 2px solid var(--line); border-radius: 12px; font-weight: 700; }
.team-pick input { width: auto; accent-color: var(--pink); }
.team-pick label:has(input:checked) { border-color: var(--pink); background: var(--pink-soft); }

/* ランキング */
.league-head { padding: 4px 4px 12px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--mint-soft); color: var(--mint); }
.badge.pre { background: #fff1d6; color: #c78a12; }
.badge.end { background: #ececf3; color: var(--sub); }
.me-card { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(135deg, #fff, var(--pink-soft)); }
.big { font-size: 28px; font-weight: 800; line-height: 1.2; }
.down { color: var(--mint); }
.up { color: var(--up); }
.zero { color: var(--sub); }

.team { border-left: 6px solid var(--c); padding: 0; overflow: hidden; }
.team summary { list-style: none; display: grid; grid-template-columns: 30px 40px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 14px 14px 14px 8px; cursor: pointer; }
.tinfo { min-width: 0; }
.motto { font-size: 12px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team summary::-webkit-details-marker { display: none; }
.team .rank { font-size: 26px; text-align: center; font-weight: 800; color: var(--sub); }
.team .tname { font-weight: 800; }
.team .trate { font-size: 20px; font-weight: 800; text-align: right; }
.team .mine { font-size: 11px; background: var(--c); color: #fff; padding: 1px 8px; border-radius: 999px; margin-left: 4px; vertical-align: 2px; }
.members { border-top: 1px dashed var(--line); padding: 6px 16px 12px; margin: 0; list-style: none; }
.members li, .history li { gap: 8px; }
.members li { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 14px; border-bottom: 1px solid #faf0f5; }
.member { display: flex; align-items: center; gap: 8px; min-width: 0; }
.who-col { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.bio { font-size: 12px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nums { white-space: nowrap; }
.members li:last-child { border-bottom: 0; }
.members .lock { color: var(--sub); }

/* 記録 */
.chart { width: 100%; height: auto; display: block; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #faf0f5; }
.history li:last-child { border-bottom: 0; }
.x { background: none; color: var(--sub); font-size: 18px; padding: 2px 8px; }

/* タイムライン */
.post { display: grid; grid-template-columns: 40px 1fr; gap: 10px; }
.post-main { min-width: 0; }
.photo { display: block; width: 100%; max-height: 440px; object-fit: cover; border-radius: 12px; margin: 4px 0 8px; background: var(--pink-soft); }
.preview { position: relative; margin-top: 8px; }
.preview img { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; }
.preview .x { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; padding: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; }
.post-tools { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.post-tools .sub { font-size: 12px; }
.post .who { font-weight: 800; font-size: 14px; }
.post .body { white-space: pre-wrap; word-break: break-word; margin: 2px 0 6px; }
.post .acts { display: flex; gap: 8px; align-items: center; }
.cheer { background: var(--pink-soft); color: var(--pink); border-radius: 999px; padding: 3px 12px; font-weight: 700; font-size: 14px; }
.cheer.on { background: var(--pink); color: #fff; }

/* アイコン（写真 or 頭文字） */
.avatar { flex: none; border-radius: 50%; background: var(--c, var(--pink)); color: #fff; display: grid; place-items: center; font-weight: 800; object-fit: cover; }
.avatar.sm { width: 30px; height: 30px; font-size: 13px; }
.avatar.md { width: 40px; height: 40px; font-size: 16px; }
.avatar.xl { width: 88px; height: 88px; font-size: 34px; }
img.avatar { background: var(--pink-soft); }
.avatar-btn { position: relative; flex: none; padding: 0; background: none; border-radius: 50%; }
.avatar-btn .cam { position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #fff; box-shadow: var(--shadow); font-size: 15px; }
.profile-top { display: flex; align-items: center; gap: 16px; margin: 8px 0 4px; }
.pick-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.pick-name small { font-weight: 400; color: var(--sub); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.capped { font-size: 13px; color: #a8700a; background: #fff4da; border-radius: 12px; padding: 8px 12px; margin: -4px 0 14px; }
.rules { margin: 4px 0 0; padding-left: 18px; }
.rules li { margin: 2px 0; }

.code { font-size: 32px; font-weight: 800; letter-spacing: 0.15em; color: var(--pink); text-align: center; margin: 8px 0; }
.code.recovery { font-size: 22px; letter-spacing: 0.06em; word-break: break-all; background: var(--pink-soft); border-radius: 12px; padding: 12px 8px; }
.note .code { font-size: 24px; margin: 6px 0; }
.nums .link { margin-left: 4px; }
.note { font-size: 12px; color: var(--sub); background: #faf6fc; border-radius: 10px; padding: 8px 10px; margin-top: 8px; }
.empty { text-align: center; color: var(--sub); padding: 24px 8px; }

/* 下のナビ */
.nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); backdrop-filter: blur(8px); }
.nav a { flex: 1; max-width: 140px; text-align: center; padding: 8px 0 6px; color: var(--sub); text-decoration: none; font-size: 11px; font-weight: 700; }
.nav a span { display: block; font-size: 22px; line-height: 1.2; }
.nav a.on { color: var(--pink); }

.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; max-width: calc(100% - 32px); z-index: 10; }
