/* 希爆塾アプリ 基本スタイル */
:root {
  --navy: #26485a;
  --navy-soft: #e6eef2;
  --accent: #e8833a;
  --accent-soft: #fdf0e5;
  --green: #3f8f5b;
  --green-soft: #e7f4ec;
  --red: #c4483d;
  --red-soft: #fbeceb;
  --yellow-soft: #fff7d6;
  --ink: #23303a;
  --muted: #6b7a85;
  --line: #dde4e8;
  --bg: #f6f4ef;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "BIZ UDPGothic", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  font-size: 1rem;
}

a { color: var(--navy); }
img { max-width: 100%; height: auto; }

/* ===== ヘッダー ===== */
.site-header {
  background: var(--navy);
  color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.site-header .inner {
  max-width: 960px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { color: #fff; font-weight: 700; font-size: 1.125rem; text-decoration: none; letter-spacing: .05em; }
.brand small { font-weight: 400; font-size: 0.75rem; opacity: .8; margin-left: 6px; }
.top-nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.top-nav a {
  color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 0.875rem; opacity: .9;
}
.top-nav a:hover, .top-nav a.active { background: rgba(255,255,255,.15); opacity: 1; }
.user-box { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; }
.user-box button {
  background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff;
  border-radius: 8px; padding: 3px 10px; cursor: pointer; font-size: 0.75rem;
}

/* 子ども向けの下部タブ（スマホ・タブレット・タッチ端末） */
.tab-bar { display: none; }
@media (max-width: 1194px), (pointer: coarse) {
  .student .top-nav { display: none; }
  .student .site-header .inner { justify-content: space-between; }
  .student .tab-bar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
    background: #fff; border-top: 1px solid var(--line);
    padding: 0 max(8px, calc((100vw - 760px) / 2)) env(safe-area-inset-bottom);
    box-shadow: 0 -2px 10px rgba(0,0,0,.04);
  }
  .tab-bar a {
    text-align: center; padding: 6px 0 8px; font-size: 0.6875rem; color: var(--muted); text-decoration: none;
    min-height: 52px;
  }
  .tab-bar a .ico { display: block; font-size: 1.25rem; line-height: 1.3; }
  .tab-bar a.active { color: var(--navy); font-weight: 700; }
  .tab-bar a.record .ico {
    background: var(--accent); color: #fff; width: 2.5rem; height: 2.5rem; line-height: 2.5rem;
    border-radius: 50%; margin: -14px auto 0; box-shadow: var(--shadow);
  }
  .student main { padding-bottom: 110px; }
}

/* ===== メイン ===== */
main { max-width: 960px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 1.5rem; margin: 4px 0 16px; }
h2 { font-size: 1.1875rem; margin: 28px 0 12px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.lead { color: var(--muted); margin-top: -8px; }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.center { text-align: center; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 8px; }
.back { display: inline-block; margin-bottom: 8px; font-size: 0.875rem; text-decoration: none; color: var(--muted); }

/* ===== フラッシュ ===== */
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.flash.notice { background: var(--green-soft); color: var(--green); }
.flash.alert { background: var(--red-soft); color: var(--red); }
.errors { background: var(--red-soft); color: var(--red); padding: 10px 14px 10px 32px; border-radius: 10px; margin-bottom: 16px; }

/* ===== カード ===== */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 14px; border: 1px solid var(--line);
}
.card.soft { background: var(--navy-soft); border-color: transparent; box-shadow: none; }
.card.warm { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.card.yellow { background: var(--yellow-soft); border-color: transparent; box-shadow: none; }
.card-link { display: block; text-decoration: none; color: inherit; }
.card-link:hover .card, a.card:hover { border-color: var(--navy); }
a.card { display: block; text-decoration: none; color: inherit; }

.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid > .card { margin-bottom: 0; }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

/* 目標と作戦 */
.goal-card { border-top: 6px solid var(--navy); }
.goal-card.life { border-top-color: var(--green); }
.goal-card.study { border-top-color: var(--accent); }
.goal-label { font-size: 0.75rem; font-weight: 700; color: var(--muted); letter-spacing: .05em; }
.goal-title { font-size: 1.25rem; font-weight: 700; margin: 2px 0 12px; }
.strategy-box {
  background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px;
}
.strategy-box .label { font-size: 0.75rem; font-weight: 700; color: var(--accent); }
.strategy-box .text { font-size: 1.125rem; font-weight: 700; }
.empty-box { border: 2px dashed var(--line); border-radius: 10px; padding: 12px; color: var(--muted); text-align: center; margin-bottom: 12px; }

/* 記録カード */
.note-card { display: flex; gap: 14px; }
.note-card .photo { flex: 0 0 96px; }
.note-card .photo img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; }
.note-card .content { flex: 1; min-width: 0; }
.note-meta { font-size: 0.75rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.note-body { white-space: pre-wrap; word-break: break-word; }
.note-strategy { font-size: 0.8125rem; color: var(--muted); margin-top: 4px; }
.note-photo-large img { border-radius: 12px; max-height: 480px; }

/* バッジ */
.badge {
  display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  background: var(--navy-soft); color: var(--navy); white-space: nowrap;
}
.badge.tried { background: var(--green-soft); color: var(--green); }
.badge.not_tried { background: var(--red-soft); color: var(--red); }
.badge.no_chance { background: #eee; color: #666; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.yellow { background: var(--yellow-soft); color: #8a6d00; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.star { color: #e0a800; }

/* ===== ボタン ===== */
.btn, button.btn, input[type=submit].btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--navy); color: #fff; border: none; border-radius: 10px;
  padding: 10px 18px; font-size: 0.9375rem; font-weight: 700; cursor: pointer; text-decoration: none;
  font-family: inherit; line-height: 1.4;
}
.btn:hover { filter: brightness(1.1); }
.btn.accent { background: var(--accent); }
.btn.green { background: var(--green); }
.btn.ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--navy); }
.btn.danger { background: #fff; color: var(--red); border: 1.5px solid var(--red); }
.btn.small { padding: 5px 12px; font-size: 0.8125rem; border-radius: 8px; }
.btn.big { padding: 14px 22px; font-size: 1.0625rem; width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link-button { background: none; border: none; color: var(--navy); text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }
form.inline { display: inline; }

/* ===== フォーム ===== */
.field { margin-bottom: 18px; }
.field > label, .field .label { display: block; font-weight: 700; margin-bottom: 6px; }
.hint { font-size: 0.8125rem; color: var(--muted); }
.field .hint { font-size: 0.8125rem; color: var(--muted); margin: -2px 0 6px; }
input[type=text], input[type=password], input[type=date], input[type=search], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; font-size: 1rem; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; font-family: inherit; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-soft); }
textarea { min-height: 96px; resize: vertical; }
input[type=file] { font-size: 0.875rem; }
.check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; cursor: pointer; }
.check input { margin-top: 6px; width: 18px; height: 18px; }

/* 大きな選択ボタン（試した／試せなかった など） */
.choices { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
.choice { position: relative; cursor: pointer; display: flex; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice > span {
  flex: 1; display: flex; flex-direction: column; justify-content: center; font-size: 0.9375rem; line-height: 1.4; text-align: center; padding: 12px 8px; border: 2px solid var(--line); border-radius: 12px;
  background: #fff; font-weight: 700;
}
.choice > span .ico { display: block; font-size: 1.5rem; }
.choice input:checked + span { border-color: var(--navy); background: var(--navy-soft); }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px var(--navy-soft); }
.choice.tried input:checked + span { border-color: var(--green); background: var(--green-soft); }
.choice.not_tried input:checked + span { border-color: var(--red); background: var(--red-soft); }
.choice.no_chance input:checked + span { border-color: #888; background: #eee; }

.search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.search-bar input[type=search] { flex: 1; }
.search-bar .btn { flex: 0 0 auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  display: inline-block; padding: 4px 12px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line);
  text-decoration: none; color: var(--ink); font-size: 0.875rem;
}
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
details > summary { cursor: pointer; font-weight: 700; color: var(--navy); }

/* ===== 成長の足跡 ===== */
.stat { text-align: center; padding: 14px 8px; }
.stat .num { font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1.2; }
.stat .lbl { font-size: 0.8125rem; color: var(--muted); }
.strategy-card { border-left: 5px solid var(--accent); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .compare { grid-template-columns: 1fr; } }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 18px; }
.timeline li::before {
  content: ""; position: absolute; left: -8px; top: 7px; width: 13px; height: 13px; border-radius: 50%;
  background: #fff; border: 3px solid var(--navy);
}
.timeline li.past::before { border-color: #bbb; }
.praise { background: var(--yellow-soft); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.praise .from { font-size: 0.8125rem; color: #8a6d00; font-weight: 700; }

.student-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.student-card-head h3 { margin: 0; font-size: 1.125rem; }
.student-goal { border-left: 4px solid var(--line); padding: 2px 0 2px 10px; margin-top: 8px; }
.student-goal.life { border-left-color: var(--green); }
.student-goal.study { border-left-color: var(--accent); }

/* ===== テーブル ===== */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.list th, table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 0.875rem; }
table.list th { background: var(--navy); color: #fff; font-weight: 700; white-space: nowrap; }

/* ===== 共有 ===== */
.share-section { margin-bottom: 16px; }
.share-section .label { font-size: 0.75rem; font-weight: 700; color: var(--muted); }

/* ===== ログイン ===== */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand-big { text-align: center; font-size: 1.875rem; font-weight: 800; color: var(--navy); margin-bottom: 0; }
.auth-card .sub { text-align: center; color: var(--muted); margin-bottom: 20px; }

/* ===== 運営 ===== */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 2px solid var(--line); }
.tabs a {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; text-decoration: none; color: var(--muted);
  font-weight: 700; font-size: 0.875rem; border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tabs a.active { color: var(--navy); border-bottom-color: var(--navy); }
.tabs .count { font-size: 0.75rem; font-weight: 400; background: var(--navy-soft); color: var(--navy); border-radius: 999px; padding: 0 8px; }
.tabs.compact { border-bottom: 0; margin: 0 0 12px; }
.tabs.compact a { border: 1.5px solid var(--line); border-radius: 999px; margin: 0; background: #fff; }
.tabs.compact a.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar input[type=search] { flex: 1 1 220px; width: auto; }
.filter-bar select { flex: 0 0 auto; width: auto; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 12px; }
.danger-zone { border-color: var(--red-soft); }
.danger-zone h2 { margin-top: 0; font-size: 1rem; }
.notice-card { background: var(--yellow-soft); border-color: transparent; box-shadow: none; }
.notice-card p { margin: 6px 0 0; }
.errors-box { background: var(--red-soft); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; }
.errors-box p { margin: 0 0 6px; }
.steps { margin: 0 0 12px; padding-left: 1.4em; }
tr.is-deactivated td { color: var(--muted); background: #fafafa; }
table.list th.num, table.list td.num { text-align: right; white-space: nowrap; }

.stat-tiles { margin-bottom: 4px; }
.stat-tile { padding: 14px 16px; margin-bottom: 0; }
.stat-label { font-size: 0.8125rem; font-weight: 700; color: var(--muted); }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 0.875rem; font-weight: 700; color: var(--muted); }
.stat-sub { font-size: 0.75rem; color: var(--muted); }

.grid.breakdowns { grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); }
.stat-breakdown { margin-bottom: 0; }
.stat-breakdown h3 { margin: 0 0 10px; font-size: 1rem; }
.hbar { display: grid; grid-template-columns: 9.5em 1fr 6.5em; align-items: center; gap: 10px; padding: 4px 0; font-size: 0.8125rem; }
.hbar:hover { background: var(--navy-soft); border-radius: 6px; }
.hbar-track { height: 10px; background: var(--navy-soft); border-radius: 999px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--navy); border-radius: 999px; }
.hbar-fill.muted { background: #a9b4bb; }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; }
.hbar-value small { color: var(--muted); }

.week-chart { display: flex; align-items: stretch; gap: 6px; height: 180px; border-bottom: 1px solid var(--line); padding-top: 4px; }
.week-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; position: relative; padding-bottom: 22px; }
.week-col:hover { background: var(--navy-soft); border-radius: 6px 6px 0 0; }
.week-bar { display: block; width: min(36px, 70%); background: var(--navy); border-radius: 4px 4px 0 0; min-height: 0; }
.week-value { font-size: 0.75rem; font-weight: 700; color: var(--ink); margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.week-label { position: absolute; bottom: 0; font-size: 0.6875rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 599px) {
  .week-chart { gap: 2px; }
  .week-label { font-size: 0.625rem; }
  .hbar { grid-template-columns: 7em 1fr 5.5em; gap: 6px; }
}
@media print {
  .site-header, .tab-bar, .btn-row, .back { display: none !important; }
}

/* 記録フォーム：横向きタブレット以上では2列 */
@media (min-width: 900px) {
  .form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
  .form-cols .form-col + .form-col { border-left: 1px solid var(--line); padding-left: 28px; }
}

/* ===== タブレット：文字を少し大きく ===== */
@media (min-width: 600px) and (max-width: 1194px), (min-width: 600px) and (pointer: coarse) {
  html { font-size: 106.25%; }               /* 17px（講師・保護者） */
  html:has(body.student) { font-size: 112.5%; } /* 18px（子ども） */
  main { padding: 24px 24px 56px; }
  .tab-bar a { font-size: 0.75rem; padding: 8px 0 10px; }
  .tab-bar a .ico { font-size: 1.5rem; }
  .note-card .photo { flex-basis: 120px; }
  .note-card .photo img { width: 120px; height: 120px; }
}

/* ===== タッチ端末：押しやすい大きさ（目安 44px 以上） ===== */
@media (pointer: coarse), (max-width: 1194px) {
  .site-header .inner { gap: 4px 16px; padding-bottom: 6px; }
  .user-box { margin-left: auto; }
  .top-nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -10px; scrollbar-width: none; }
  .top-nav a { padding: 10px 14px; font-size: 0.9375rem; white-space: nowrap; }
  .user-box button { padding: 8px 14px; font-size: 0.8125rem; }
  .btn, button.btn, input[type=submit].btn { min-height: 48px; padding: 12px 20px; }
  .btn.small { min-height: 44px; padding: 8px 16px; font-size: 0.875rem; }
  .chip { min-height: 44px; display: inline-flex; align-items: center; padding: 6px 16px; }
  .back { padding: 8px 0; }
  .text-link { display: inline-flex; align-items: center; min-height: 44px; }
  .check {
    align-items: center; padding: 10px 12px; margin-bottom: 8px; min-height: 52px;
    background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  }
  .check:has(input:checked) { border-color: var(--navy); background: var(--navy-soft); }
  .check input { margin-top: 0; width: 22px; height: 22px; flex: 0 0 auto; }
  .choice > span { min-height: 64px; }
  input[type=text], input[type=password], input[type=date], input[type=search], input[type=number], select { min-height: 48px; }
  input[type=file] { padding: 10px 0; }
  input[type=file]::file-selector-button {
    padding: 10px 16px; border-radius: 10px; border: 1.5px solid var(--navy); background: #fff; color: var(--navy);
    font-weight: 700; margin-right: 10px; font-family: inherit;
  }
  details > summary { padding: 10px 0; }
  table.list th, table.list td { padding: 12px 14px; font-size: 0.9375rem; }
  table.list td a { display: inline-block; padding: 6px 0; }
}
