/* Fanfare brand: navy #1c2e69 / sky #61a3d9 */
:root {
  --navy: #1c2e69;
  --sky: #61a3d9;
  --grad: linear-gradient(135deg, #1c2e69 0%, #61a3d9 100%);
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #23304f;
  --sub: #6b7a99;
  --line: #e3eaf4;
  --ok: #2fa06a;
  --danger: #d64550;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font-family: inherit; }

.loading-screen {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--grad); color: #fff;
}
.loading-logo { font-size: 2rem; font-weight: 700; letter-spacing: .08em; }
.loading-sub { opacity: .85; margin-top: .4rem; }

/* ---- auth ---- */
.auth-wrap { min-height: 100vh; background: var(--grad); display: flex; align-items: center; justify-content: center; padding: 1.2rem; }
.auth-card { background: #fff; border-radius: 20px; padding: 1.8rem 1.4rem; width: 100%; max-width: 420px; box-shadow: 0 18px 50px rgba(16,28,66,.35); }
.auth-brand { text-align: center; margin-bottom: 1.2rem; }
.auth-brand .b1 { font-size: 1.5rem; font-weight: 700; color: var(--navy); letter-spacing: .06em; }
.auth-brand .b2 { color: var(--sub); font-size: .9rem; margin-top: .15rem; }
.field { margin-bottom: .9rem; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--navy); margin-bottom: .3rem; }
.field input {
  width: 100%; padding: .8rem .9rem; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 1rem; background: #fafcff; color: var(--text);
}
.field input:focus { outline: none; border-color: var(--sky); background: #fff; }
.btn {
  display: block; width: 100%; padding: .9rem; border: none; border-radius: 12px;
  background: var(--grad); color: #fff; font-size: 1.02rem; font-weight: 700; cursor: pointer;
}
.btn:disabled { opacity: .5; }
.btn.secondary { background: #edf2fa; color: var(--navy); }
.btn.small { display: inline-block; width: auto; padding: .5rem .9rem; font-size: .85rem; border-radius: 9px; }
.seg { display: flex; background: #edf2fa; border-radius: 12px; padding: 4px; margin-bottom: 1.1rem; }
.seg button {
  flex: 1; border: none; background: none; padding: .55rem; border-radius: 9px;
  font-size: .95rem; font-weight: 700; color: var(--sub); cursor: pointer;
}
.seg button.on { background: #fff; color: var(--navy); box-shadow: 0 2px 8px rgba(28,46,105,.12); }
.name-list { max-height: 240px; overflow-y: auto; border: 1.5px solid var(--line); border-radius: 10px; margin-top: .4rem; background: #fff; }
.name-item {
  display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left;
  padding: .65rem .8rem; border: none; border-bottom: 1px solid var(--line); background: #fff;
  font-size: .95rem; color: var(--text); cursor: pointer;
}
.name-item:last-child { border-bottom: none; }
.name-item.dim { color: #b7c3d8; }
.name-item .tag { font-size: .68rem; background: #eef2f8; color: #93a3bf; border-radius: 99px; padding: .1rem .5rem; }
.picked { margin-top: .5rem; background: #eaf6ef; border: 1.5px solid #bfe3cd; border-radius: 10px; padding: .6rem .8rem; font-size: .95rem; color: #1e6b43; }
.picked a { color: var(--sky); font-size: .8rem; margin-left: .4rem; }
.confirm-name {
  text-align: center; font-size: 1.5rem; font-weight: 800; color: var(--navy);
  background: #eaf2fb; border-radius: 14px; padding: 1rem; margin-bottom: .3rem;
}
.warn-banner {
  display: block; width: 100%; text-align: left; background: #fff7e8; border: 1.5px solid #f0d9a8;
  color: #8a6116; border-radius: var(--radius); padding: .8rem 1rem; font-size: .88rem; font-weight: 600;
  margin-bottom: .8rem; cursor: pointer;
}
.badge.warn { background: #fff2e0; color: #c07b18; margin-left: .3rem; }
.sel {
  width: 100%; padding: .7rem .75rem; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 16px; font-family: inherit; background: #fafcff; color: var(--text); margin-top: .35rem;
}
.sel:focus { outline: none; border-color: var(--sky); background: #fff; }
.login-row { padding: .35rem 0; border-bottom: 1px solid var(--line); font-size: .85rem; color: var(--sub); }
.login-row:last-child { border-bottom: none; }
.ai-btn { background: var(--grad); color: #fff; }
.auth-switch { text-align: center; margin-top: 1rem; font-size: .9rem; color: var(--sub); }
.auth-switch a { color: var(--sky); font-weight: 600; text-decoration: none; }
.form-error { color: var(--danger); font-size: .88rem; margin: .5rem 0; min-height: 1.2em; }

/* ---- app shell ---- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--grad); color: #fff;
  padding: calc(.7rem + env(safe-area-inset-top)) 1rem .7rem; display: flex; align-items: center; gap: .6rem;
}
.topbar .back { background: none; border: none; color: #fff; font-size: 1.3rem; padding: .2rem .4rem; cursor: pointer; }
.topbar .title { font-weight: 700; font-size: 1.02rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .save-state { font-size: .75rem; opacity: .9; }
.topbar .menu-btn { background: rgba(255,255,255,.15); border: none; color: #fff; border-radius: 8px; padding: .35rem .6rem; font-size: .8rem; cursor: pointer; }

.container { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 4rem; }

/* ---- home ---- */
.hero { background: var(--grad); color: #fff; padding: calc(1.2rem + env(safe-area-inset-top)) 1.2rem 2.6rem; }
.hero .hello { font-size: .9rem; opacity: .9; }
.hero h1 { font-size: 1.35rem; margin-top: .15rem; }
.hero-actions { position: absolute; top: calc(.9rem + env(safe-area-inset-top)); right: .9rem; display: flex; gap: .4rem; }
.hero-wrap { position: relative; }
.total-card {
  background: var(--card); border-radius: var(--radius); padding: 1rem 1.1rem;
  margin: -1.8rem 1rem 0; box-shadow: 0 10px 26px rgba(28,46,105,.12); max-width: 608px;
}
@media (min-width: 660px) { .total-card { margin-left: auto; margin-right: auto; } }
.total-card .row { display: flex; justify-content: space-between; align-items: baseline; }
.total-card .pct { font-size: 1.5rem; font-weight: 800; color: var(--navy); }
.bar { height: 8px; background: #e8eef7; border-radius: 99px; overflow: hidden; margin-top: .5rem; }
.bar > i { display: block; height: 100%; background: var(--grad); border-radius: 99px; transition: width .4s; }

.sheet-list { display: flex; flex-direction: column; gap: .7rem; margin-top: 1.1rem; }
.sheet-card {
  display: flex; align-items: center; gap: .9rem; background: var(--card); border-radius: var(--radius);
  padding: .95rem 1rem; border: 1px solid var(--line); cursor: pointer; text-align: left; width: 100%;
}
.sheet-card:active { transform: scale(.985); }
.sheet-card .ic { font-size: 1.6rem; }
.icon-badge {
  width: 46px; height: 46px; border-radius: 14px; background: var(--grad); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(28,46,105,.22);
}
.icon-badge svg { width: 24px; height: 24px; display: block; }
.icon-badge.sm { width: 28px; height: 28px; border-radius: 8px; box-shadow: none; }
.icon-badge.sm svg { width: 15px; height: 15px; }
.sheet-card .mid { flex: 1; min-width: 0; }
.sheet-card .t { font-weight: 700; color: var(--navy); }
.sheet-card .d { font-size: .78rem; color: var(--sub); margin-top: .1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sheet-card .bar { margin-top: .45rem; }
.sheet-card .pct { font-size: .85rem; font-weight: 700; color: var(--sky); min-width: 3em; text-align: right; }
.sheet-card .pct.done { color: var(--ok); }

/* ---- sheet editing ---- */
.sheet-desc { background: #eaf2fb; border-left: 4px solid var(--sky); border-radius: 8px; padding: .7rem .9rem; font-size: .85rem; color: #33507a; margin-bottom: 1rem; white-space: pre-wrap; }
.section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .9rem; }
.section h3 { color: var(--navy); font-size: .98rem; margin-bottom: .2rem; }
.section .note { font-size: .8rem; color: var(--sub); margin-bottom: .5rem; white-space: pre-wrap; }
.qa { margin-top: .9rem; }
.qa .q { font-size: .88rem; font-weight: 600; color: var(--navy); }
.qa .hint { font-size: .76rem; color: var(--sub); margin: .1rem 0 .35rem; }
textarea, input.short {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: .65rem .75rem;
  font-size: 16px; font-family: inherit; background: #fafcff; color: var(--text); resize: none; line-height: 1.55;
}
textarea:focus, input.short:focus { outline: none; border-color: var(--sky); background: #fff; }
textarea[disabled], input.short[disabled] { background: #f3f5f9; color: #55617d; opacity: 1; -webkit-text-fill-color: #55617d; }
textarea { min-height: 2.9em; overflow: hidden; }

/* score picker */
.score-row { display: flex; gap: .28rem; flex-wrap: wrap; margin-top: .35rem; }
.score-row button {
  flex: 1 0 7.5%; min-width: 2rem; padding: .45rem 0; border-radius: 9px; border: 1.5px solid var(--line);
  background: #fff; color: var(--sub); font-weight: 700; font-size: .9rem; cursor: pointer;
}
.score-row button.sel { background: var(--grad); border-color: transparent; color: #fff; }

/* checklist */
.check-item {
  display: flex; align-items: center; gap: .8rem; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: .6rem; cursor: pointer; width: 100%; text-align: left;
}
.check-item .box {
  width: 26px; height: 26px; border-radius: 8px; border: 2px solid #c6d4e8; display: flex; align-items: center;
  justify-content: center; color: #fff; font-weight: 800; flex-shrink: 0;
}
.check-item.on .box { background: var(--ok); border-color: var(--ok); }
.check-item .lbl { font-size: .92rem; }
.check-item.on .lbl { color: var(--sub); }
.check-inline { display: flex; align-items: center; gap: .6rem; margin-top: .5rem; cursor: pointer; }
.check-inline .box { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #c6d4e8; color: #fff; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 800; flex-shrink: 0; }
.check-inline.on .box { background: var(--ok); border-color: var(--ok); }
.check-inline .lbl { font-size: .88rem; }

/* moti chart */
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; margin-bottom: 1rem; }
.chart-card svg { width: 100%; height: auto; display: block; }
.age-row { display: flex; align-items: center; gap: .6rem; padding: .55rem .3rem; border-bottom: 1px solid var(--line); cursor: pointer; width: 100%; background: none; border-left: none; border-right: none; border-top: none; text-align: left; }
.age-row .age { width: 3.2em; font-weight: 700; color: var(--navy); font-size: .9rem; flex-shrink: 0; }
.age-row .dotbar { flex: 1; height: 6px; background: #edf1f8; border-radius: 99px; overflow: hidden; }
.age-row .dotbar > i { display: block; height: 100%; background: var(--grad); }
.age-row .val { width: 2em; text-align: right; font-size: .85rem; color: var(--sub); flex-shrink: 0; }
.age-row .has-ep { color: var(--sky); font-size: .8rem; flex-shrink: 0; }
.age-editor { padding: .6rem .2rem 1rem; border-bottom: 1px solid var(--line); }

/* chips (複数選択) */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.chip {
  border: 1.5px solid var(--line); background: #fff; color: var(--sub); border-radius: 99px;
  padding: .38rem .85rem; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.chip.on { background: var(--grad); color: #fff; border-color: transparent; }
.chip:disabled { opacity: .85; }

/* image grid */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; margin-top: .5rem; }
.img-tile { aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #eef2f8; cursor: pointer; }
.img-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-add {
  aspect-ratio: 1; border: 2px dashed #c4d2e6; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; color: var(--sky); font-size: 1.5rem; font-weight: 300; cursor: pointer; background: #f7fafe;
}

/* comp avatar */
.slot-ava { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: #e4ebf5; flex-shrink: 0; display: block; }
.slot-ava .ava { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot-ava .ava-ph { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, #dfe8f4, #cfdcee); }
.slot-ava.lg { width: 56px; height: 56px; }
.slot-head { display: flex; align-items: center; gap: .5rem; }
.slot-head .no { font-size: .72rem; color: var(--sub); font-weight: 700; }
.slot-profile { display: flex; align-items: center; gap: .8rem; margin-bottom: .4rem; }
.slot-profile h3 { margin: 0; }

/* comp slots */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.slot-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .8rem; cursor: pointer; text-align: left; }
.slot-card .no { font-size: .72rem; color: var(--sub); font-weight: 700; }
.slot-card .nm { font-weight: 700; color: var(--navy); font-size: .9rem; margin-top: .15rem; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 1.4em; }
.slot-card .st { font-size: .75rem; margin-top: .3rem; }
.slot-card .st.filled { color: var(--ok); font-weight: 700; }
.slot-card .st.empty { color: #b7c3d8; }

/* admin */
.stu-row { display: flex; align-items: center; gap: .8rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; margin-bottom: .6rem; cursor: pointer; width: 100%; text-align: left; }
.stu-row .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.stu-row .mid { flex: 1; min-width: 0; }
.stu-row .nm { font-weight: 700; color: var(--navy); }
.stu-row .em { font-size: .75rem; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stu-row .bar { margin-top: .35rem; }
.stu-row .pct { font-weight: 800; color: var(--navy); }
.admin-tools { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.adm-search { margin-bottom: .7rem; }
.adm-filters { display: flex; gap: .5rem; margin-top: .5rem; }
.adm-filters select {
  flex: 1; padding: .55rem .6rem; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: .9rem; font-family: inherit; background: #fff; color: var(--text);
}
.stu-meta { color: var(--sky); font-weight: 600; }
.official-val { font-size: 1rem; font-weight: 700; color: var(--navy); padding: .3rem 0; }
.tag-auto { font-size: .68rem; font-weight: 600; background: #eaf2fb; color: var(--sky); border-radius: 99px; padding: .1rem .5rem; margin-left: .3rem; }
.badge { display: inline-block; font-size: .68rem; font-weight: 700; padding: .1rem .5rem; border-radius: 99px; background: #eaf2fb; color: var(--sky); vertical-align: middle; }
.prog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: 1rem; }
.prog-cell { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; font-size: .8rem; display: flex; align-items: center; gap: .45rem; }
.prog-cell b { color: var(--navy); }
.prog-cell .pv { margin-left: auto; font-weight: 800; color: var(--sky); }

/* 使い方ガイド */
.guide-banner {
  display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; width: 100%; text-align: left;
  background: var(--card); border: 1.5px solid var(--sky); border-radius: var(--radius);
  padding: .85rem 1rem; margin-bottom: .8rem; cursor: pointer; font-family: inherit;
}
.guide-banner b { color: var(--navy); font-size: .95rem; }
.guide-banner span { font-size: .78rem; color: var(--sub); }
.guide-banner:active { transform: scale(.985); }
.guide-banner.warn { border-color: #e8a13d; background: #fff8ec; }
.guide-banner.warn b { color: #a5620b; }
.guide-banner.warn span { color: #a5620b; font-weight: 600; }
.guide-steps { margin-top: .6rem; }
.guide-step { background: #f7fafe; border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; }
.guide-step-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; }
.guide-step-head .gnum { font-size: .7rem; font-weight: 800; color: var(--sky); letter-spacing: .05em; }
.guide-step-head b { color: var(--navy); font-size: .95rem; }
.guide-step p { font-size: .85rem; margin: 0; }
.guide-goal { margin-top: .45rem; font-size: .8rem; color: #1e6b43; background: #eaf6ef; border-radius: 8px; padding: .45rem .6rem; }
.guide-arrow { text-align: center; color: #b7c3d8; font-weight: 800; padding: .15rem 0; }
.guide-list { padding-left: 1.2rem; margin-top: .4rem; }
.guide-list li { font-size: .88rem; margin-bottom: .4rem; }

/* 完了CTA */
.cta-card {
  display: flex; align-items: center; gap: .7rem; background: var(--grad); color: #fff;
  border-radius: var(--radius); padding: .95rem 1rem; margin: .2rem 0 .9rem; text-decoration: none;
  box-shadow: 0 8px 20px rgba(28,46,105,.3);
}
.cta-card:active { transform: scale(.985); }
.cta-card .cta-emoji { font-size: 1.5rem; }
.cta-card .cta-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cta-card .cta-mid b { font-size: .95rem; }
.cta-card .cta-mid span { font-size: .75rem; opacity: .9; }
.cta-card .cta-btn {
  background: #fff; color: var(--navy); font-weight: 800; font-size: .82rem;
  border-radius: 99px; padding: .5rem .8rem; white-space: nowrap; flex-shrink: 0;
}
.cta-locked {
  border: 1.5px dashed #c4d2e6; border-radius: var(--radius); padding: .7rem .9rem;
  font-size: .8rem; color: var(--sub); margin-bottom: .9rem; background: #f7fafe;
}
.video-link {
  display: block; background: var(--card); border: 1.5px solid var(--sky); color: var(--navy);
  border-radius: var(--radius); padding: .8rem 1rem; font-size: .88rem; font-weight: 700;
  text-decoration: none; margin-bottom: .7rem;
}
.video-link:active { transform: scale(.985); }

/* インサイト coming soon */
.badge.soon { background: var(--grad); color: #fff; margin-left: .35rem; letter-spacing: .04em; }
.insights-card { border-style: dashed; border-color: #b9c9df; }
.soon-hero {
  background: var(--grad); color: #fff; border-radius: 18px; padding: 2.6rem 1.4rem;
  text-align: center; box-shadow: 0 12px 30px rgba(28,46,105,.3);
}
.soon-hero .soon-emoji { font-size: 3rem; }
.soon-hero .soon-title { font-size: 1.8rem; font-weight: 800; letter-spacing: .05em; margin: .4rem 0 .8rem; }
.soon-hero .soon-desc { font-size: .95rem; line-height: 1.9; }
.soon-hero .soon-sub { font-size: .8rem; opacity: .85; margin-top: .8rem; line-height: 1.8; }
.kpi-callout {
  margin-top: .8rem; background: #fff7e8; border: 1.5px solid #f0d9a8; color: #8a6116;
  border-radius: 12px; padding: .9rem 1rem; font-size: .92rem; line-height: 1.9; text-align: center;
}

.toast {
  position: fixed; bottom: calc(1.2rem + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: .6rem 1.1rem; border-radius: 99px; font-size: .85rem;
  box-shadow: 0 8px 22px rgba(0,0,0,.25); z-index: 50; opacity: 0; transition: opacity .25s; pointer-events: none;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; }
.muted { color: var(--sub); font-size: .85rem; }
.center { text-align: center; }
.mt1 { margin-top: 1rem; }
