:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel2: #1f2430;
  --line: #2a3040;
  --text: #e8e6e0;
  --dim: #9aa0ad;
  --amber: #f0b429;
  --amber-dim: #8a6a1a;
  --green: #4caf7d;
  --blue: #5b9dd9;
  --red: #d96b6b;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(15,17,21,0.95);
  backdrop-filter: blur(6px);
  z-index: 10;
  flex-wrap: wrap;
  gap: 8px;
}
.brand { font-weight: 700; font-size: 18px; letter-spacing: 1px; }
.brand span { color: var(--amber); }
nav { display: flex; gap: 6px; }
nav button {
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
nav button:hover { color: var(--text); border-color: var(--dim); }
nav button.active { background: var(--amber); color: #1a1400; border-color: var(--amber); font-weight: 700; }
main { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }
footer {
  text-align: center;
  color: var(--dim);
  font-size: 12px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

/* ---------- 今日ビュー ---------- */
.day-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.day-num { font-size: 30px; font-weight: 800; color: var(--amber); }
.day-date { color: var(--dim); font-size: 14px; }
.week-theme { color: var(--blue); font-size: 13px; margin-bottom: 14px; }
.nav-days { display: flex; gap: 8px; margin-bottom: 14px; }
.nav-days button {
  background: var(--panel); border: 1px solid var(--line); color: var(--dim);
  border-radius: 8px; padding: 3px 12px; cursor: pointer; font-size: 13px;
}
.nav-days button:hover { color: var(--text); }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.card h3 { font-size: 13px; color: var(--dim); font-weight: 600; margin-bottom: 6px; letter-spacing: 1px; }
.concept-name { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.concept-point { color: var(--text); background: var(--panel2); border-left: 3px solid var(--amber); padding: 10px 14px; border-radius: 0 8px 8px 0; font-size: 14.5px; }
.task-text { font-size: 15px; }
.min-card { border-color: var(--amber-dim); }
.min-card .task-text { font-size: 16px; font-weight: 600; }
.friday-note { color: var(--dim); font-size: 13px; margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.tier-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.tier-buttons button {
  flex: 1; min-width: 140px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel2);
  color: var(--text);
  padding: 14px 10px;
  font-size: 15px;
  cursor: pointer;
  transition: all .15s;
  line-height: 1.4;
}
.tier-buttons button small { display: block; color: var(--dim); font-size: 11.5px; }
.tier-buttons button:hover { border-color: var(--amber); transform: translateY(-1px); }
.tier-buttons button.selected { background: var(--amber); color: #1a1400; border-color: var(--amber); font-weight: 700; }
.tier-buttons button.selected small { color: #4a3a00; }
.note-row { display: flex; gap: 8px; margin-top: 12px; }
.note-row input {
  flex: 1; background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 12px; font-size: 14px;
}
.note-row input::placeholder { color: #5a6070; }
.done-banner {
  background: linear-gradient(90deg, rgba(76,175,125,.15), transparent);
  border: 1px solid rgba(76,175,125,.4);
  color: var(--green);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 14px;
  font-weight: 600;
}

/* ---------- 積み上げビュー ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-align: center;
}
.stat .num { font-size: 30px; font-weight: 800; color: var(--amber); }
.stat .lbl { font-size: 12px; color: var(--dim); }
.grid-wrap { overflow-x: auto; }
.week-grid { border-collapse: separate; border-spacing: 4px; margin: 0 auto; }
.week-grid th { font-size: 11px; color: var(--dim); font-weight: 500; padding: 2px 4px; }
.week-grid td {
  width: 34px; height: 34px; border-radius: 7px;
  background: var(--panel2); border: 1px solid var(--line);
  text-align: center; font-size: 11px; color: var(--dim);
  cursor: pointer; transition: transform .1s;
}
.week-grid td:hover { transform: scale(1.12); }
.week-grid td.t1 { background: #5a4a16; border-color: #7a6420; color: #d8c690; }
.week-grid td.t2 { background: #a5821f; border-color: #c49a24; color: #211a00; font-weight: 700; }
.week-grid td.t3 { background: var(--amber); border-color: #ffd76a; color: #211a00; font-weight: 800; }
.week-grid td.missed { background: #241a1d; border-color: #3a262b; }
.week-grid td.future { opacity: .35; cursor: default; }
.week-grid td.today-cell { outline: 2px solid var(--blue); }
.legend { display: flex; gap: 14px; justify-content: center; color: var(--dim); font-size: 12px; margin: 10px 0 20px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.wall { display: flex; flex-wrap: wrap; gap: 6px; }
.brick {
  background: var(--panel2); border: 1px solid var(--amber-dim); color: var(--text);
  border-radius: 6px; padding: 4px 10px; font-size: 12.5px;
}
.brick b { color: var(--amber); font-weight: 700; margin-right: 4px; }

/* ---------- 地図ビュー ---------- */
.chain { position: relative; margin: 10px 0 26px; padding-left: 26px; }
.chain::before { content: ""; position: absolute; left: 9px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.chain-item { position: relative; margin-bottom: 16px; }
.chain-item::before {
  content: ""; position: absolute; left: -23px; top: 7px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--panel2); border: 2px solid var(--dim);
}
.chain-item.now::before { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 10px rgba(240,180,41,.6); }
.chain-span { font-size: 12px; color: var(--dim); }
.chain-label { font-size: 16px; font-weight: 700; }
.chain-item.now .chain-label { color: var(--amber); }
.chain-desc { font-size: 13px; color: var(--dim); }
.milestones .ms {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border-bottom: 1px dashed var(--line); padding: 8px 2px; font-size: 14px;
}
.milestones .ms:last-child { border-bottom: none; }
.ms .cd { color: var(--amber); font-weight: 700; white-space: nowrap; }
.ms.past { opacity: .45; }
.ms.past .cd { color: var(--green); }

/* ---------- 教材ビュー ---------- */
.edit-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.edit-tools button, .btn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 13.5px;
}
.edit-tools button:hover, .btn:hover { border-color: var(--amber); }
.btn.primary { background: var(--amber); color: #1a1400; border-color: var(--amber); font-weight: 700; }
details.week-block { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; background: var(--panel); }
details.week-block summary { cursor: pointer; padding: 12px 16px; font-weight: 600; }
details.week-block summary span { color: var(--dim); font-weight: 400; font-size: 13px; }
.day-row { border-top: 1px solid var(--line); padding: 10px 16px; }
.day-row .dr-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.day-row .dr-title { font-size: 14px; }
.day-row .dr-title b { color: var(--amber); }
.day-row .dr-edited { color: var(--green); font-size: 11px; }
.day-form { margin-top: 10px; display: grid; gap: 8px; }
.day-form label { font-size: 11.5px; color: var(--dim); display: block; }
.day-form input, .day-form textarea {
  width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 13.5px; font-family: inherit; resize: vertical;
}
.muted { color: var(--dim); font-size: 13px; }
h2.section { font-size: 17px; margin: 22px 0 10px; color: var(--text); border-left: 4px solid var(--amber); padding-left: 10px; }
