:root {
  --bg: #eef1f8;
  --ink: #1f2436;
  --muted: #7a819a;
  --brand: #5b6ef5;
  --brand-2: #8b5cf6;
  --card: #ffffff;
  --line: #e7eaf3;
  --shadow: 0 10px 30px rgba(40, 50, 90, 0.08);
  --shadow-hover: 0 16px 40px rgba(40, 50, 90, 0.16);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans JP", "Segoe UI", "Hiragino Sans", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* 背景の装飾（ふわっとした光） */
.bg-decoration {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(600px 400px at 12% -5%, rgba(91, 110, 245, 0.18), transparent 60%),
    radial-gradient(700px 500px at 100% 0%, rgba(139, 92, 246, 0.16), transparent 55%),
    radial-gradient(500px 400px at 50% 110%, rgba(46, 196, 182, 0.12), transparent 60%);
}

/* ヘッダー */
.app-header {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  padding: 34px 24px 30px;
  box-shadow: 0 8px 24px rgba(91, 110, 245, 0.25);
}

.header-inner {
  max-width: 1040px;
  margin: 0 auto;
}

.app-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.subtitle {
  margin: 8px 0 0;
  opacity: 0.9;
  font-size: 14px;
  font-weight: 400;
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px;
}

/* ダッシュボード */
.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 26px;
}

.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
}

.stat-notes-card::before {
  background: linear-gradient(180deg, #5b6ef5, #8b5cf6);
}
.stat-tasks-card::before {
  background: linear-gradient(180deg, #2ec4b6, #24a1d4);
}
.stat-todo-card::before {
  background: linear-gradient(180deg, #2ec46b, #17a34a);
}
.stat-open-card::before {
  background: linear-gradient(180deg, #ffb020, #ff7a45);
}

.stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.stat-icon {
  font-size: 30px;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #f2f4ff, #eef0fb);
  flex-shrink: 0;
}

.stat-num {
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}

.stat-label {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* 最新の振り返り（ダッシュボード） */
.latest-review {
  background: linear-gradient(135deg, #3b2f63 0%, #4b3a8f 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 26px;
  box-shadow: 0 10px 26px rgba(75, 58, 143, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.lr-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.lr-icon {
  font-size: 18px;
}

.lr-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.lr-week {
  margin-left: auto;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.18);
  padding: 4px 12px;
  border-radius: 999px;
}

.lr-body {
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.lr-body.lr-empty {
  opacity: 0.75;
  font-size: 14px;
}

/* 振り返りパネル */
.review-panel {
  margin-top: 22px;
}

.review-inputs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

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

.field-grow {
  flex: 1 1 260px;
}

.field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.review-form .hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* 2カラム */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.panel h2 {
  margin: 0 0 18px;
  font-size: 19px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-icon {
  font-size: 20px;
}

/* 入力フォーム */
.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.form input,
.form textarea {
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  background: #fbfcff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form input:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(91, 110, 245, 0.12);
}

.btn-primary {
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(91, 110, 245, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(91, 110, 245, 0.4);
  filter: brightness(1.04);
}

.btn-primary:active {
  transform: translateY(0);
}

/* 一覧 */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list li {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px 16px;
  background: linear-gradient(180deg, #ffffff, #fbfcff);
  box-shadow: 0 2px 8px rgba(40, 50, 90, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: pop 0.28s ease;
}

.list li:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(40, 50, 90, 0.1);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.item-title {
  font-weight: 700;
  word-break: break-word;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.item-body {
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  color: #4b5168;
  line-height: 1.6;
}

.item-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.item-meta::before {
  content: "🕒";
  font-size: 11px;
}

.item-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.item-actions button {
  border: none;
  border-radius: 9px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.item-actions button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-done {
  background: linear-gradient(135deg, #2ec4b6, #1f9e92);
  color: #fff;
}

.btn-undo {
  background: linear-gradient(135deg, #ffb020, #f59300);
  color: #fff;
}

.btn-del {
  background: #fff;
  color: #e0483d;
  border: 1.5px solid #f6d3d0 !important;
}

.btn-del:hover {
  background: #fef2f1;
}

/* 完了済みタスク */
.task-done {
  opacity: 0.72;
}

.task-done .item-title {
  text-decoration: line-through;
  text-decoration-color: #b6bccb;
  color: #9aa0b0;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.badge-todo {
  background: #fff2e0;
  color: #c26f00;
}

.badge-done {
  background: #dcf5ee;
  color: #14806f;
}

.empty {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 28px 12px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: #fbfcff;
}

/* タブレット等の中間幅：カードは2列に */
@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* メモ・タスクは狭い画面では縦に積む */
@media (max-width: 720px) {
  .columns {
    grid-template-columns: 1fr;
  }
  .app-header h1 {
    font-size: 23px;
  }
}

/* スマホ：カードも1列に */
@media (max-width: 560px) {
  .dashboard {
    grid-template-columns: 1fr;
  }
}
