/* =========================================================
   まいにち勉強（ダッシュボード）
   色は英単語速習（eitan/app.css）とそろえる
   ========================================================= */
:root, :root[data-theme="light"] {
  --bg: #FBF7F0;
  --surface: #FFFFFF;
  --surface-2: #F6EFE5;
  --ink: #2B2320;
  --muted: #6F625B;
  --line: #EADFD2;
  --primary: #4A63E7;
  --primary-soft: #E9EDFF;
  --primary-text: #3A4BC4;
  --ok: #237032;
  --ok-soft: #E3F6E9;
  --ng: #B4235A;
  --ng-soft: #FFE9EF;
  --flame: #FF7A2F;
  --flame-ink: #C2410C;
  --flame-soft: #FFF1E0;
  --edge: 0 3px 0 var(--line);
  --head: linear-gradient(135deg, #FF9A4D, #F0603A);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1E2E; --surface: #252A3F; --surface-2: #2E3450; --ink: #F3EFE9; --muted: #AAA6BC; --line: #3A4166;
    --primary: #8EA2FF; --primary-soft: #2E3768; --primary-text: #8EA2FF;
    --ok: #6EDB8F; --ok-soft: #1F3B2D; --ng: #FF8FB1; --ng-soft: #40243A;
    --flame: #FF9A4D; --flame-ink: #FFB061; --flame-soft: #3D2E22;
    --head: linear-gradient(135deg, #B8562A, #8E3A22);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1B1E2E; --surface: #252A3F; --surface-2: #2E3450; --ink: #F3EFE9; --muted: #AAA6BC; --line: #3A4166;
  --primary: #8EA2FF; --primary-soft: #2E3768; --primary-text: #8EA2FF;
  --ok: #6EDB8F; --ok-soft: #1F3B2D; --ng: #FF8FB1; --ng-soft: #40243A;
  --flame: #FF9A4D; --flame-ink: #FFB061; --flame-soft: #3D2E22;
  --head: linear-gradient(135deg, #B8562A, #8E3A22);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Yu Gothic UI', sans-serif;
  -webkit-text-size-adjust: 100%; line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.dash { max-width: 720px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.d-head { background: var(--head); color: #FFFFFF; border-radius: 24px; padding: 18px 20px 20px; position: relative; overflow: hidden; }
.d-head::after { content: ""; position: absolute; width: 140px; height: 140px; right: -36px; top: -44px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.d-date { font-size: 14px; font-weight: 700; opacity: .92; }
.d-title { margin: 2px 0 0; font-size: 28px; font-weight: 800; line-height: 1.3; }
.d-lead { margin: 6px 0 0; font-size: 15px; font-weight: 700; }

.d-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.subj { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 2px solid var(--line); box-shadow: var(--edge); border-radius: 22px; padding: 16px; transition: transform 80ms, box-shadow 80ms; }
a.subj:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.subj-top { display: flex; align-items: center; gap: 12px; }
.subj-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; font-weight: 800; flex: none; background: var(--primary-soft); color: var(--primary-text); }
.subj-name { font-size: 18px; font-weight: 800; line-height: 1.3; }
.subj-sub { font-size: 13px; color: var(--muted); font-weight: 700; }
.subj-go { margin-left: auto; color: var(--muted); flex: none; }
.subj-stat { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 14px; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.pill.done { background: var(--ok-soft); color: var(--ok); }
.pill.todo { background: var(--primary-soft); color: var(--primary-text); }
.pill.flame { background: var(--flame-soft); color: var(--flame-ink); }
.pill.weak { background: var(--ng-soft); color: var(--ng); }
.subj-cta { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; border-radius: 14px; background: var(--primary); color: #FFFFFF; font-size: 16px; font-weight: 800; box-shadow: 0 3px 0 rgba(30, 40, 140, .28); }
:root[data-theme="dark"] .subj-cta { color: #141833; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .subj-cta { color: #141833; } }
.subj-cta.done, :root .subj-cta.done { background: var(--ok-soft); color: var(--ok); box-shadow: none; }
.subj.soon { border-style: dashed; box-shadow: none; background: transparent; }
.subj.soon .subj-ic { background: var(--surface-2); color: var(--muted); }
.d-foot { margin: 4px 0 0; text-align: center; font-size: 12px; color: var(--muted); }

.upd-bar { position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 8px; background: var(--ink); color: var(--bg); padding: 6px 6px 6px 14px; border-radius: 14px; font-size: 14px; font-weight: 800; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); white-space: nowrap; }
.upd-bar .go { min-height: 36px; padding: 0 14px; border-radius: 10px; background: var(--primary); color: #FFFFFF; font-weight: 800; }
.upd-bar .x { color: var(--bg); opacity: .7; width: 32px; height: 32px; font-size: 18px; }
@media (prefers-reduced-motion: reduce) { .subj { transition: none; } }

/* ---------- まいにちの記録 ---------- */
/* 教科の色（決まった順に足す）。文字には使わない */
:root { --c-eitan: #4A63E7; --grid: #EFE7DC; --axis: #6F625B; }
:root[data-theme="dark"] { --c-eitan: #8EA2FF; --grid: #333A5A; --axis: #AAA6BC; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c-eitan: #8EA2FF; --grid: #333A5A; --axis: #AAA6BC; } }
.c-eitan { fill: var(--c-eitan); background: var(--c-eitan); }

.rec { display: flex; flex-direction: column; gap: 12px; }
.rec-h { margin: 4px 0 0; font-size: 18px; font-weight: 800; }
.rec-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.st { background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st .lb { font-size: 13px; color: var(--muted); font-weight: 700; }
.st .v { font-size: 24px; font-weight: 800; line-height: 1.2; }
.st .v small { font-size: 14px; margin-left: 2px; }
.st .sm { font-size: 12px; color: var(--muted); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; align-items: start; }
.rec-panel { background: var(--surface); border: 2px solid var(--line); border-radius: 20px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rec-sub { margin: 0; font-size: 15px; font-weight: 800; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal .cw { font-size: 12px; color: var(--muted); font-weight: 700; }
.cal .cw.sun { color: var(--ng); }
.cal .cd { position: relative; aspect-ratio: 1; max-height: 44px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; color: var(--muted); }
.cal .cd b { font-weight: 700; line-height: 1; }
.cal .cd.on { background: var(--surface-2); color: var(--ink); }
.cal .cd.on b { font-weight: 800; }
.cal .cd.today { box-shadow: inset 0 0 0 2px var(--ink); }
.cal .cd.future { opacity: .45; }
.cal .dots { display: flex; gap: 2px; height: 8px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.cal-sum { font-size: 14px; color: var(--muted); font-weight: 700; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cal-sum b { color: var(--ink); font-size: 18px; }
.legend { display: inline-flex; gap: 10px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }

.wk { position: relative; }
.wk-svg { display: block; width: 100%; height: auto; overflow: visible; }
.wk-svg .gl { stroke: var(--grid); stroke-width: 1; }
.wk-svg .bl { stroke: var(--axis); stroke-width: 1; opacity: .6; }
.wk-svg .ax { fill: var(--axis); font-size: 11px; font-weight: 700; font-family: inherit; }
.wk-svg .ax.now { fill: var(--ink); font-weight: 800; }
.wk-svg .val { fill: var(--ink); font-size: 12px; font-weight: 800; font-family: inherit; }
.wk-svg .hit { fill: transparent; cursor: pointer; outline: none; }
.wk-svg .hit.cur, .wk-svg .hit:focus-visible { fill: var(--ink); fill-opacity: .06; }
.wk-tip { position: absolute; top: -8px; transform: translateY(-100%); background: var(--ink); color: var(--bg); border-radius: 10px; padding: 6px 10px; font-size: 13px; font-weight: 700; display: flex; flex-direction: column; gap: 2px; pointer-events: none; white-space: nowrap; z-index: 5; }
.wk-tip[hidden] { display: none; }
.wk-tip span { display: inline-flex; align-items: center; gap: 6px; }
.wk-tip .dot { box-shadow: 0 0 0 2px var(--ink); }
.wk-unit { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 700; }
.wk-unit > span:last-child { margin-left: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 380px) { .st .v { font-size: 20px; } }
