:root {
  --bg: #0b0f17;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-border: rgba(255, 255, 255, 0.09);
  --item-bg: rgba(255, 255, 255, 0.035);
  --item-border: rgba(255, 255, 255, 0.08);
  --text: #eef2fa;
  --muted: #aab6ca;
  --muted-soft: #8b98ae;
  --accent: #7c8cff;
  --accent-2: #35d6e6;
  --gradient: linear-gradient(135deg, #6d7cff 0%, #35d6e6 100%);
  --danger: #ff6b6b;
  --done: #3ddc97;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 20px 64px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* 背景のほのかな光 */
.glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(700px 420px at 12% -8%, rgba(109, 124, 255, 0.22), transparent 70%),
    radial-gradient(620px 400px at 92% 4%, rgba(53, 214, 230, 0.14), transparent 70%),
    radial-gradient(800px 500px at 50% 108%, rgba(124, 140, 255, 0.10), transparent 70%);
}

/* ------------------------------------------------------------------ ヘッダー */

.site-header {
  max-width: 1040px;
  margin: 0 auto;
  padding: 36px 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--gradient);
  color: #0b0f17;
  box-shadow: 0 8px 24px rgba(109, 124, 255, 0.35);
}

.brand-mark svg { width: 26px; height: 26px; }

.site-header h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.today {
  padding: 7px 15px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

main {
  max-width: 1040px;
  margin: 0 auto;
}

/* -------------------------------------------------------------- ダッシュボード */

.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat {
  position: relative;
  overflow: hidden;
  padding: 18px 20px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
}

/* カード上端のアクセントライン */
.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--gradient);
  opacity: 0.5;
}

.stat-icon {
  grid-row: 1 / 3;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(124, 140, 255, 0.12);
  border: 1px solid rgba(124, 140, 255, 0.22);
  color: var(--accent);
}

.stat-icon svg { width: 21px; height: 21px; }

.stat-accent .stat-icon {
  background: rgba(53, 214, 230, 0.12);
  border-color: rgba(53, 214, 230, 0.26);
  color: var(--accent-2);
}

/* 完了タスクのカードは緑系にして、未完了と見分けやすくする */
.stat-done .stat-icon {
  background: rgba(61, 220, 151, 0.12);
  border-color: rgba(61, 220, 151, 0.28);
  color: var(--done);
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.stat-value {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* 最新の振り返りカード（ダッシュボードの全幅） */
.latest {
  grid-column: 1 / -1;
  position: relative;
  overflow: hidden;
  padding: 16px 20px 18px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
}

.latest::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--gradient);
}

.latest-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.latest-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(53, 214, 230, 0.12);
  border: 1px solid rgba(53, 214, 230, 0.26);
  color: var(--accent-2);
}

.latest-icon svg { width: 15px; height: 15px; }

.latest-week {
  margin-left: auto;
  padding: 3px 11px;
  border: 1px solid var(--item-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.latest-comment {
  margin: 10px 0 0;
  color: #dbe3f0;
  font-size: 14.5px;
  white-space: pre-wrap;
  word-break: break-word;
  /* 長い振り返りはダッシュボードでは3行まで（全文は下の一覧で確認できる） */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.latest-comment.is-placeholder { color: var(--muted); }

/* --------------------------------------------------------------- パネル */

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 22px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--panel-border);
}

.panel-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.chip {
  padding: 3px 11px;
  border: 1px solid var(--item-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- フォーム */

.form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.panel-wide { margin-top: 16px; }

/* 振り返りフォームは横並び（週の選択・コメント・ボタン） */
.form-review {
  flex-direction: row;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}

.field-grow { flex: 1; }

.form-review button { margin-top: 0; }

.form input,
.form select,
.form textarea {
  font: inherit;
  padding: 10px 13px;
  border: 1px solid var(--item-border);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.form input::placeholder,
.form textarea::placeholder { color: #7f8ba3; }

.form select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* 選択肢のリストはOSが描くので、暗い背景でも読める色を指定する */
.form select option {
  background: #141a25;
  color: var(--text);
}

.form input:focus,
.form select:focus,
.form textarea:focus {
  outline: none;
  border-color: rgba(124, 140, 255, 0.7);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(124, 140, 255, 0.16);
}

.form button {
  margin-top: 10px;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-weight: 600;
  padding: 10px 20px;
  border: none;
  border-radius: 11px;
  background: var(--gradient);
  color: #0a0e16;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(109, 124, 255, 0.28);
  transition: transform 0.12s, box-shadow 0.15s, filter 0.15s;
}

.form button svg { width: 16px; height: 16px; }

.form button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(109, 124, 255, 0.36);
}

.form button:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(109, 124, 255, 0.28);
}

.hint {
  margin: 12px 0 0;
  padding: 9px 13px;
  border: 1px solid rgba(53, 214, 230, 0.28);
  border-radius: 10px;
  background: rgba(53, 214, 230, 0.08);
  color: #9fe4ee;
  font-size: 13px;
}

.error {
  margin: 12px 0 0;
  padding: 9px 13px;
  border: 1px solid rgba(255, 107, 107, 0.32);
  border-radius: 10px;
  background: rgba(255, 107, 107, 0.1);
  color: var(--danger);
  font-size: 13px;
}

/* --------------------------------------------------------------- 一覧 */

.list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item {
  position: relative;
  overflow: hidden;
  padding: 13px 15px 13px 17px;
  border: 1px solid var(--item-border);
  border-radius: 13px;
  background: var(--item-bg);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

/* 左端のアクセントバー */
.item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--gradient);
}

.item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateX(2px);
}

.item-title {
  font-weight: 600;
  font-size: 15px;
  word-break: break-word;
}

.item-body {
  margin: 6px 0 0;
  color: #dbe3f0;
  font-size: 14.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.item-meta {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--item-border);
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- タスク */

.task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.task-main { flex: 1; min-width: 0; }

/* チェックボックスを自前で描く */
.task input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 3px 0 0;
  width: 20px;
  height: 20px;
  flex: none;
  position: relative;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.task input[type="checkbox"]:hover { border-color: var(--done); }

.task input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.25);
}

.task input[type="checkbox"]:checked {
  background: var(--done);
  border-color: var(--done);
}

.task input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #0a0e16;
  border-width: 0 2.2px 2.2px 0;
  transform: rotate(45deg);
}

.task.is-done { background: rgba(255, 255, 255, 0.02); }

.task.is-done::before {
  background: var(--done);
  opacity: 0.75;
}

.task.is-done .item-title {
  text-decoration: line-through;
  text-decoration-color: rgba(139, 152, 174, 0.7);
  color: var(--muted);
}

.badge {
  display: inline-block;
  margin-left: 9px;
  padding: 1px 9px;
  border: 1px solid rgba(124, 140, 255, 0.3);
  border-radius: 999px;
  background: rgba(124, 140, 255, 0.12);
  color: #b6bfff;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  vertical-align: 1px;
}

.badge.done {
  border-color: rgba(61, 220, 151, 0.32);
  background: rgba(61, 220, 151, 0.12);
  color: var(--done);
}

.badge.week {
  border-color: rgba(53, 214, 230, 0.3);
  background: rgba(53, 214, 230, 0.12);
  color: var(--accent-2);
}

/* 振り返りの左バーはシアン寄りにして、メモ・タスクと区別する */
.review::before {
  background: linear-gradient(180deg, #35d6e6, #6d7cff);
}

.delete-btn {
  font: inherit;
  font-size: 13px;
  flex: none;
  padding: 5px 12px;
  border: 1px solid var(--item-border);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.delete-btn:hover {
  border-color: rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.12);
  color: var(--danger);
}

.empty {
  margin: 18px 0 4px;
  padding: 22px;
  border: 1px dashed var(--item-border);
  border-radius: 13px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* --------------------------------------------------------------- 画面が狭いとき */

/* 画面が中くらいのときは、ダッシュボードを2列にして数字が潰れないようにする */
@media (max-width: 980px) {
  .dashboard { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 780px) {
  body { padding: 0 14px 48px; }
  .columns { grid-template-columns: 1fr; }
  .dashboard { grid-template-columns: 1fr; }
  .site-header { padding-top: 26px; }
  .stat-value { font-size: 30px; }
  .form-review { flex-direction: column; align-items: stretch; }
  .field { min-width: 0; }
  .form-review button { align-self: flex-start; margin-top: 8px; }
}
