/* つまずきレーダー ― 見た目 */
:root {
  --accent: #1f6f8b; --accent-soft: #eef7fa;
  --r: #f2a3a3; --y: #f7e27a; --g: #a8dca8; --cell-ink: #1f2429;
  --bg: #f1f3f5; --card: #ffffff; --line: #d6d6d6; --line2: #999999; --ink: #1f2429; --muted: #6b7680;
  --head: #f6f7f8; --sel: #fff1c2; --track: #eceff1; --pvbg: #e3e6ea; --warn: #fff8d6; --ok: #1a7f37; --ng: #c62828;
}
html[data-theme="dark"] {
  --accent-soft: #163640;
  --r: #c96b6b; --y: #c9b04a; --g: #5fae6f;
  --bg: #15191d; --card: #1e242a; --line: #2e363d; --line2: #4a555f; --ink: #e6eaee; --muted: #9aa5b0;
  --head: #262d34; --sel: #4a3f12; --track: #2e363d; --pvbg: #0f1316; --warn: #3d3415; --ok: #4ade80; --ng: #f87171;
}
html { color-scheme: light; } html[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif; font-size: 13.5px; color: var(--ink); background: var(--bg); line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, select, textarea, input { font: inherit; color: inherit; }

/* ヘッダー */
.top { display: flex; align-items: center; gap: 14px; background: var(--accent); color: #fff; padding: 0 18px; height: 52px; }
.top__app { font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.top__cls { font-size: 13px; opacity: .9; }
.top__spacer { flex: 1; }
.top__date { font-size: 13px; }
.top__who { font-size: 13px; font-weight: 600; }
.colors { display: flex; gap: 6px; margin-left: 10px; }
.dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); cursor: pointer; padding: 0; opacity: .7; }
.dot.on { opacity: 1; box-shadow: 0 0 0 2px #fff; }
/* レーダーのアイコン（名前の横・ゆっくり回る） */
.radar { display: inline-block; width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); position: relative; vertical-align: -3px; margin-right: 8px; background: rgba(255,255,255,.08); overflow: hidden; }
.radar::before { content: ''; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: #fff; }
.radar i { position: absolute; inset: 0; background: conic-gradient(from 0deg, rgba(255,255,255,.7), rgba(255,255,255,0) 90deg); animation: sweep 3s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
/* 赤いマスが ゆっくり光る */
td.c.r { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.13); } }
@media (prefers-reduced-motion: reduce) { .radar i, td.c.r { animation: none; } }
.theme { display: flex; border: 1px solid rgba(255,255,255,.6); border-radius: 8px; overflow: hidden; margin-left: 8px; }
.theme button { background: transparent; border: 0; color: #fff; font-size: 12px; padding: 4px 9px; cursor: pointer; opacity: .75; }
.theme button.on { background: #fff; color: var(--accent); opacity: 1; font-weight: 700; }

/* 左ボタン */
.layout { display: grid; grid-template-columns: 172px 1fr; min-height: calc(100vh - 52px); }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.nav { display: block; text-align: center; padding: 13px 6px; font-size: 15px; font-weight: 700; border: 2px solid var(--ink); border-radius: 10px; background: var(--card); }
.nav--main { background: var(--accent); border-color: var(--accent); color: #fff; }
.nav.on { box-shadow: 0 0 0 3px #f7b500; }
.side__foot { margin-top: auto; text-align: center; }
.link { background: none; border: 0; color: var(--muted); font-size: 11.5px; cursor: pointer; text-decoration: underline; }
.main { padding: 16px 18px 40px; min-width: 0; }

/* カード */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.card__h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
h2 { font-size: 17px; margin: 0; }
h3 { font-size: 15px; margin: 0 0 8px; }
.title { font-size: 22px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }
.lbl { font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.mt { margin-top: 10px; }
.big { font-size: 15px; padding: 1px 8px; border-radius: 6px; margin-left: 6px; }
.ok { color: var(--ok); font-weight: 700; }
.ng { color: var(--ng); font-weight: 700; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }

/* ボタン */
.btn { display: inline-block; border: 2px solid var(--ink); border-radius: 10px; padding: 10px 16px; font-size: 15px; font-weight: 700; background: var(--card); cursor: pointer; text-align: center; }
.btn--main { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn--wide { display: block; width: 100%; }
.btn:disabled { opacity: .4; cursor: default; }
.toast { background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; margin-bottom: 10px; font-size: 13px; }

/* 数字 */
.nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.num { display: block; background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--accent); border-radius: 10px; padding: 10px 14px; }
.num--hot { border-left-color: #c62828; }
.num__t { font-size: 12px; color: var(--muted); }
.num__v { font-size: 30px; font-weight: 700; line-height: 1.2; }
.num__v small { font-size: 13px; font-weight: 400; color: var(--muted); }
.num__s { font-size: 11.5px; color: var(--muted); }

/* 時間メーター */
.meter { display: flex; gap: 22px; align-items: center; border-left: 6px solid var(--accent); padding: 10px 16px; }
.meter__v { font-size: 30px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.meter__v small { font-size: 13px; font-weight: 400; color: var(--muted); }
.meter__list { font-size: 13px; display: grid; gap: 4px; }
.meter__list .hint { display: block; }
@media (max-width: 820px) { .meter { flex-direction: column; align-items: flex-start; } }

/* 色分け表 */
.hm { overflow: auto; max-height: 560px; border: 1px solid var(--line); border-radius: 6px; }
.hm__t { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.hm__t th, .hm__t td { border-bottom: 1px solid var(--line); padding: 0; text-align: center; }
.hm__t th { background: var(--head); position: sticky; top: 0; font-weight: 700; padding: 7px 3px; font-size: 12px; line-height: 1.25; }
.hm__t th.sel { background: var(--sel); }
.hm__t td a, .hm__t th a { display: block; padding: 6px 3px; }
.hm__name { text-align: left !important; white-space: nowrap; padding-left: 8px !important; }
.hm__class { font-weight: 700; background: var(--head); }
.hm__class td { border-bottom: 2px solid var(--ink); }
td.c.r, .r { background: var(--r); } td.c.y, .y { background: var(--y); } td.c.g, .g { background: var(--g); }
td.c.r, td.c.y, td.c.g, .big.r, .big.y, .big.g, td.sc.r, td.sc.y, td.sc.g { color: var(--cell-ink); }
td.c.none { color: var(--muted); }
td.c.sel { outline: 3px solid #f7b500; outline-offset: -3px; }
.legend { display: flex; gap: 14px; font-size: 12px; margin-top: 8px; color: var(--muted); }
.legend i { display: inline-block; width: 13px; height: 13px; border: 1px solid var(--line2); vertical-align: -2px; margin-right: 4px; background: var(--card); }
.legend i.r { background: var(--r); } .legend i.y { background: var(--y); } .legend i.g { background: var(--g); }

/* 表 */
.t { border-collapse: collapse; width: 100%; font-size: 13px; }
.t th, .t td { border: 1px solid var(--line); padding: 5px 7px; text-align: center; }
.t th { background: var(--head); }
.t td.nm { text-align: left; white-space: nowrap; }
.t td.sc { font-weight: 700; }
.t--people td.nm a { display: block; }
.ar.up { color: var(--ok); } .ar.down { color: var(--ng); }
.tag { display: inline-block; border: 1px solid var(--line2); border-radius: 12px; padding: 1px 9px; font-size: 12px; background: var(--card); margin: 0 4px 4px 0; font-weight: 400; }
.tag--on { background: var(--accent); color: #fff; border-color: var(--accent); }
.lv { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 700; }
.lv--easy { background: #dbeafe; color: #1e40af; } .lv--retry { background: #fde68a; color: #7c4a03; } .lv--normal { background: #e5e7eb; color: #374151; } .lv--chall { background: #fecaca; color: #991b1b; }

/* バー */
.bar { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.bar--unit { font-weight: 700; }
.bar__w { width: 130px; font-size: 12.5px; }
.bar__t { flex: 1; height: 14px; background: var(--track); border-radius: 4px; overflow: hidden; }
.bar__t i { display: block; height: 100%; }
.bar__p { width: 42px; text-align: right; font-size: 13px; }

/* レイアウト */
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cols31 { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(280px, 360px); gap: 14px; }
.q { display: grid; grid-template-columns: 270px 1fr; gap: 14px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab { border: 2px solid var(--ink); border-radius: 8px; padding: 6px 14px; font-weight: 700; font-size: 13.5px; background: var(--card); }
.tab.on { background: var(--ink); color: var(--bg); }
.chk label { display: block; padding: 4px 0; font-size: 14px; }
select { width: 100%; padding: 6px; border: 1px solid var(--line2); border-radius: 6px; background: var(--card); }
textarea { width: 100%; border: 1px solid var(--line2); border-radius: 6px; padding: 8px; resize: vertical; background: var(--card); }
.card--ai { border-left: 5px solid var(--accent); }
.ai { margin: 0; font-size: 14px; }

/* プレビュー・プリント本体 */
.pager { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13.5px; }
.pv { background: var(--pvbg); padding: 14px; border-radius: 10px; }
.pv--empty { color: var(--muted); text-align: center; padding: 60px 10px; }
.sheet { background: #fff; width: 100%; max-width: 520px; margin: 0 auto; padding: 18px 22px; font-size: 13px; box-shadow: 0 2px 6px rgba(0,0,0,.15); color: #000; }
.sheet__head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #000; padding-bottom: 4px; margin-bottom: 8px; }
.sheet__head b { font-size: 15px; }
.sheet__id { font-family: ui-monospace, Menlo, monospace; font-weight: 700; border: 2px solid #000; padding: 0 6px; font-size: 13px; background: #fff; }
.sheet__name { margin-bottom: 8px; }
.sheet__hito { font-weight: 700; font-size: 13.5px; margin: 0 0 8px; padding: 4px 0; border-bottom: 1px dashed #888; }
.sheet__hito::before { content: '★ '; }
.sheet__sec { border: 1px solid #666; padding: 6px 9px; margin-bottom: 8px; background: #f7f7f7; }
.sheet__sec b { display: block; font-size: 11.5px; color: #444; margin-bottom: 2px; }
.sheet__ex { background: #fff; border-style: dashed; }
.sheet__probs { margin: 0; padding-left: 24px; columns: 2; column-gap: 22px; }
.sheet__probs li { margin-bottom: 12px; font-size: 14px; break-inside: avoid; position: relative; }
.sheet__probs .blank { display: inline-block; min-width: 52px; border-bottom: 1px solid #000; margin-left: 6px; color: #1d4ed8; font-family: "Comic Sans MS", "Hiragino Maru Gothic ProN", cursive; }
.sheet__probs li.ok .mark { color: #c62828; font-size: 18px; margin-left: 6px; }
.sheet__probs li.ng .mark { color: #c62828; font-size: 18px; margin-left: 6px; }
.sheet__foot { border-top: 1px solid #999; margin-top: 8px; padding-top: 4px; font-size: 11.5px; color: #444; }

/* 丸つけ */
.drop { border: 3px dashed var(--line2); border-radius: 12px; padding: 26px 10px; text-align: center; background: var(--card); margin-bottom: 14px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop__t { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.readhead { margin-bottom: 8px; }
.t--mark tr.unread td { background: var(--warn); }
.mk { border: 2px solid var(--line2); background: var(--card); border-radius: 6px; width: 30px; height: 28px; font-weight: 700; cursor: pointer; margin: 0 2px; }
.mk.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* 印刷 */
#printarea { display: none; }
@media print {
  html, body { background: #fff; color-scheme: light; }
  .app { display: none; }
  #printarea { display: block; }
  #printarea .sheet { max-width: none; width: auto; box-shadow: none; page-break-after: always; padding: 0; font-size: 14px; min-height: 0; }
  #printarea .sheet__probs { column-gap: 30px; }
  #printarea .sheet__probs li { font-size: 17px; margin-bottom: 38px; }
  #printarea .sheet__probs .blank { min-width: 80px; }
  #printarea .sheet__foot { margin-top: 20px; }
  @page { margin: 16mm; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex: 1; padding: 9px 4px; font-size: 14px; }
  .side__foot { width: 100%; margin-top: 4px; }
  .nums, .cols2, .cols31, .q { grid-template-columns: 1fr 1fr; }
  .cols2, .cols31, .q { grid-template-columns: 1fr; }
}

/* 丸つけ済み */
.card--done { border-left: 5px solid var(--ok); }
.donegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.done__list { margin: 0; padding-left: 18px; font-size: 13.5px; }
.done__list li { margin-bottom: 4px; }
.pv--sm { padding: 8px; }
.pv--sm .sheet { max-width: none; padding: 12px 14px; font-size: 11.5px; }
.pv--sm .sheet__probs li { font-size: 12px; margin-bottom: 6px; }
@media (max-width: 820px) { .donegrid { grid-template-columns: 1fr; } }
