* { box-sizing: border-box; }
body {
  font-family: "Avenir Next", "Hiragino Sans", "Noto Sans JP", sans-serif;
  margin: 0; background: #fafafa; color: #1a1a1a; font-size: 14px;
}
.num, .rng { font-family: "Avenir Next", sans-serif; font-variant-numeric: tabular-nums; }

header {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px; background: #fff; border-bottom: 1px solid #e2e2e2;
}
.logo { font-weight: 600; font-size: 16px; cursor: pointer; }
.hdr-date { color: #888; font-size: 13px; }

main { max-width: 1240px; margin: 0 auto; padding: 14px 18px; }
h2 { font-size: 17px; font-weight: 600; margin: 6px 0 12px; }
.muted { color: #888; font-size: 13px; }
.spacer { flex: 1; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.card {
  background: #fff; border: 1px solid #e2e2e2; border-radius: 10px;
  padding: 14px 16px; cursor: pointer; transition: border-color .15s;
}
.card:hover { border-color: #999; }
.card .q { font-weight: 600; font-size: 15px; }
.card .st { margin-top: 6px; font-size: 12px; }
.st.open { color: #1565c0; }
.st.answered { color: #2e7d32; }

button {
  font-family: inherit; font-size: 13px; padding: 5px 12px;
  background: #fff; border: 1px solid #ccc; border-radius: 7px; cursor: pointer;
}
button:hover { background: #f0f0f0; }
button.active { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
button.primary { background: #1565c0; color: #fff; border-color: #1565c0; font-weight: 600; }
button.primary:hover { background: #0d4f9e; }
button:disabled { opacity: .45; cursor: default; }

.drill-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
#drill-title { font-weight: 600; font-size: 16px; }
.badge {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: #eee; color: #555;
}
.badge.revealed { background: #e3f0fc; color: #0d4f9e; font-weight: 600; }

.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; background: #fff; border: 1px solid #e2e2e2;
  border-radius: 10px 10px 0 0; border-bottom: none;
}
.tb-group { display: flex; align-items: center; gap: 4px; }
.toggles label { font-size: 12px; color: #555; margin-left: 8px; user-select: none; }
.toggles input { vertical-align: -2px; }
.swatch {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; padding: 0;
}
.swatch.active { border-color: #1a1a1a; }

#chart-wrap {
  position: relative; background: #fff;
  border: 1px solid #e2e2e2; border-radius: 0 0 10px 10px;
  height: clamp(420px, calc(100vh - 330px), 760px); overflow: hidden;
}
#cv-chart, #cv-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
#cv-overlay { cursor: crosshair; }
#cv-overlay.locked { cursor: default; }
#hover-info {
  position: absolute; top: 8px; left: 12px; font-size: 12px; color: #555;
  background: rgba(255,255,255,.88); padding: 2px 8px; border-radius: 6px;
  pointer-events: none; white-space: nowrap;
}
#text-input {
  position: absolute; font-family: inherit; font-size: 13px;
  border: 1px solid #1565c0; border-radius: 5px; padding: 2px 6px; outline: none;
  background: #fff; z-index: 5; width: 220px;
  resize: none; overflow: hidden; line-height: 1.45; margin: 0;
}

.answer-bar {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 1px solid #e2e2e2; border-radius: 10px;
  padding: 9px 14px; margin: 10px 0 14px;
  box-shadow: 0 -4px 14px rgba(0,0,0,0.06);
}
.answer-bar[hidden] { display: none; }
.answer-bar label { font-size: 12px; color: #555; }
#dirs.attention { outline: 2px solid #c62828; outline-offset: 3px; border-radius: 8px; }
#save-status { font-size: 12px; max-width: 340px; }
.badge.score-badge { background: #e3f0fc; color: #0d4f9e; font-weight: 600; }
.memo-then {
  background: #fffde7; border-left: 3px solid #f5a623; border-radius: 0;
  padding: 8px 12px; font-size: 13px; margin: 0 0 10px;
}
.near { color: #b26a00; font-weight: 600; }
.dot.void { background: #eee; border-color: #ddd; color: #bbb; }
.tc-wait { margin: 0; color: #8a6d1a; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff; font-size: 13px; padding: 9px 18px;
  border-radius: 999px; z-index: 99; opacity: 0.95;
}

/* ---- 共有版（web/）用 ---- */
.login-box {
  max-width: 420px; margin: 80px auto; background: #fff;
  border: 1px solid #e2e2e2; border-radius: 14px; padding: 28px 32px;
}
.login-box h2 { margin: 0 0 6px; }
.login-row { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.login-row select, .login-row input {
  font-family: inherit; font-size: 14px; padding: 7px 10px;
  border: 1px solid #ccc; border-radius: 7px;
}
.login-row select { min-width: 120px; }
#login-status { min-height: 18px; }

#peers-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 12px; background: #fff; border: 1px solid #e2e2e2;
  border-top: none; font-size: 13px;
}
#peers-row[hidden] { display: none; }
#peers-row .lbl { color: #555; font-size: 12px; }
#member-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.member-chip {
  border-radius: 999px; padding: 4px 14px; font-size: 12.5px; font-weight: 600;
  background: #fff;
}
.member-chip:hover { border-color: #1565c0; color: #1565c0; }
.peer-chip {
  border-radius: 999px; padding: 3px 12px; font-size: 12px;
}
.peer-chip.active { background: #1565c0; color: #fff; border-color: #1565c0; }

#comments-box {
  margin-top: 12px; padding: 12px 14px; background: #fff;
  border: 1px solid #e2e2e2; border-radius: 10px;
}
#comments-box[hidden] { display: none; }

/* ---- ホームv3（サマリーハブ） ---- */
.today-band {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fff; border: 1px solid #e2e2e2; border-radius: 12px;
  padding: 12px 16px; margin-top: 14px;
}
.stats-head { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.stats-head h2 { font-size: 15px; }
.stats-toggle { display: flex; gap: 4px; }
.stats-toggle button { font-size: 12px; padding: 3px 12px; border-radius: 999px; }
.stats-toggle button.active { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
h3.sec { font-size: 14px; font-weight: 600; margin: 20px 0 8px; }
.sec-sub { font-size: 11px; font-weight: 400; }
.trail-box {
  max-height: 236px; overflow-y: auto; padding: 2px 4px 2px 2px;
  background: #f3f3f3; border-radius: 12px;
}
.trail-box.tall { max-height: 340px; }
.trail-box .trail-grid { padding: 8px; }
.feed-box { max-height: 300px; overflow-y: auto; }
.home-main { display: grid; grid-template-columns: 1fr 330px; gap: 20px; margin-bottom: 30px; }
.home-right .sec:first-child { margin-top: 20px; }
@media (max-width: 1000px) { .home-main { grid-template-columns: 1fr; } }
.today-band .tb-title { font-weight: 600; font-size: 14px; }
.band-sep { width: 1px; height: 24px; background: #e2e2e2; }
.band-note { font-size: 12px; margin: 6px 2px 0; }
#home-stats { margin: 14px 0 4px; }
#home-stats .res-card { background: #fff; border: 1px solid #eee; }
.trail-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
}
.tcard {
  background: #fff; border: 1px solid #e5e5e5; border-radius: 10px;
  padding: 8px 10px; cursor: pointer; transition: border-color .15s;
}
.tcard:hover { border-color: #999; }
.tcard.dim { opacity: 0.55; }
.tcard.v-hit { background: #f0faf4; border-color: #b9e2c9; }
.tcard.v-near { background: #fdf8ec; border-color: #ecd9a9; }
.tcard.v-miss { background: #fdf1f0; border-color: #eec6c3; }
.tcard .sc { font-size: 15px; }
.tcard.v-hit .sc { color: #0F6E56; }
.tcard.v-near .sc { color: #854F0B; }
.tcard.v-miss .sc { color: #993C1D; }
.arc-month { font-size: 13px; font-weight: 600; color: #666; margin: 18px 0 8px; }
.arc-tools {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 4px 0 6px; font-size: 12px; color: #555;
}
.arc-tools input[type="date"], .arc-tools input[type="search"] {
  font-family: inherit; font-size: 12px; padding: 4px 8px;
  border: 1px solid #ccc; border-radius: 6px;
}
.arc-tools input[type="search"] { width: 200px; }
.tcard canvas { width: 100%; height: 38px; display: block; }
.tcard .tc-meta { font-size: 11px; color: #888; margin-top: 4px; }
.tcard .tc-line { font-size: 12px; font-weight: 600; margin-top: 1px; }
.tcard .tc-line .sub { font-weight: 400; color: #888; }
.tcard .cm-badge { color: #b26a00; font-weight: 600; font-size: 11px; }
.home-cols {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; margin-bottom: 30px;
}
@media (max-width: 900px) { .home-cols { grid-template-columns: 1fr; } }
.feed { display: flex; flex-direction: column; gap: 6px; }
.feed-row {
  background: #fff; border-left: 3px solid #ccc; border-radius: 0 8px 8px 0;
  padding: 6px 12px; font-size: 12.5px; cursor: pointer;
}
.feed-row:hover { background: #f6f8fb; }
.feed-row .ts { font-size: 10.5px; color: #aaa; }
.feed-row.ev-answer { border-left-color: #534AB7; }
.feed-row.ev-graded { border-left-color: #0F6E56; }
.feed-row.ev-comment { border-left-color: #993C1D; }
.feed-row .unread { color: #c62828; font-weight: 700; font-size: 10.5px; }
.feed-row .masked { color: #aaa; font-style: normal; }
.comment { padding: 7px 0; border-top: 1px solid #f2f2f2; font-size: 13px; }
.comment:first-child { border-top: none; }
.comment b { font-size: 12px; }
.comment-input { display: flex; gap: 8px; margin-top: 10px; }
#comment-text {
  flex: 1; font-family: inherit; font-size: 13px; padding: 6px 10px;
  border: 1px solid #ccc; border-radius: 7px;
}
#dirs button { min-width: 64px; }
#dirs button.active[data-dir="up"] { background: #2e7d32; border-color: #2e7d32; color: #fff; }
#dirs button.active[data-dir="down"] { background: #c62828; border-color: #c62828; color: #fff; }
#dirs button.active[data-dir="range"] { background: #546e7a; border-color: #546e7a; color: #fff; }
input.rng {
  width: 92px; font-size: 13px; padding: 4px 6px;
  border: 1px solid #ccc; border-radius: 6px;
}
textarea {
  width: 100%; margin-top: 10px; font-family: inherit; font-size: 13px;
  border: 1px solid #ccc; border-radius: 8px; padding: 8px 10px; resize: vertical;
}
#save-status { min-height: 18px; margin: 6px 0 20px; }
.ok, #save-status.ok, #grade-status.ok { color: #2e7d32; }
.err, #save-status.err, #grade-status.err { color: #c62828; }

main h2 { margin-top: 22px; }
.badge.streak { background: #fff3e0; color: #b26a00; font-weight: 600; }

.alldone {
  margin: 14px 0; padding: 16px 18px; border-radius: 12px;
  background: #e8f5e9; color: #1b5e20; font-size: 16px; font-weight: 600;
}
.task-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px; margin-top: 12px;
}
.task-card {
  background: #fff; border: 1px solid #e2e2e2; border-radius: 12px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 10px;
}
.tc-head { font-size: 15px; font-weight: 600; }
.tc-note { margin: 0; }
.tc-done { margin: 0; color: #2e7d32; font-weight: 600; }
button.big { font-size: 15px; padding: 10px 16px; border-radius: 9px; align-self: flex-start; }
.ministats { margin-top: 18px; font-size: 13px; }

.dots { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dot {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 4px; border-radius: 999px;
  font-size: 12px; font-weight: 600; cursor: pointer; user-select: none;
  border: 1.5px solid #bbb; color: #888; background: #fff;
  font-variant-numeric: tabular-nums;
}
.dot:hover { border-color: #555; }
.dot.waiting { background: #fff8e1; border-color: #e6c34a; color: #8a6d1a; }
.dot.ready { background: #c62828; border-color: #c62828; color: #fff; }
.dot.done { background: #1565c0; border-color: #1565c0; color: #fff; }
.dot.expired { background: #f0f0f0; border-color: #ddd; color: #aaa; }
.dot.skipped { background: #fafafa; border-style: dashed; border-color: #ccc; color: #aaa; }

.arc-day {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border: 1px solid #e8e8e8; border-radius: 8px;
  padding: 8px 14px; margin-bottom: 6px;
}
.arc-date { font-size: 13px; color: #555; min-width: 92px; }

#result-panel {
  margin-top: 12px; padding: 12px 14px;
  background: #fff; border: 1px solid #e2e2e2; border-radius: 10px;
}
.res-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin: 8px 0 12px;
}
.res-card {
  background: #f7f7f7; border-radius: 8px; padding: 10px 12px;
}
.res-card.score { background: #e3f0fc; }
.rc-l { font-size: 11px; color: #888; }
.rc-v { font-size: 19px; font-weight: 600; margin-top: 2px; }
.res-card.score .rc-v { font-size: 26px; color: #0d4f9e; }
.hit { color: #2e7d32; font-weight: 600; }
.mishit { color: #c62828; font-weight: 600; }

.grade-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grade-row .lbl { font-size: 13px; color: #555; }
#grades button { min-width: 44px; font-size: 15px; }
#grades button.active { background: #1565c0; color: #fff; border-color: #1565c0; }
#grade-note { flex: 1; min-width: 200px; font-size: 13px; padding: 5px 8px;
  border: 1px solid #ccc; border-radius: 6px; }
#grade-status { margin: 8px 0 0; }

#stats-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border: 1px solid #e2e2e2; border-radius: 10px; overflow: hidden;
  font-size: 13px; margin: 16px 0 30px;
}
#stats-table th, #stats-table td { padding: 8px 12px; text-align: left; }
#stats-table thead { background: #f4f4f4; color: #666; font-size: 12px; }
#stats-table tbody tr { border-top: 1px solid #f0f0f0; cursor: pointer; }
#stats-table tbody tr:hover { background: #f8f9fb; }
#stats-trend { display: block; margin: 8px 0 4px; }
