/* =========================================================
   ひみつの秘書アプリ - 見た目
   ========================================================= */

:root {
  --text: #33405c;
  --muted: #7c89a6;
  --line: #e6ecf8;
  --card: #ffffff;

  --memo: #6f8ff5;
  --memo-dark: #4f6fd8;
  --memo-soft: #eef2ff;

  --task: #ff9f45;
  --task-dark: #e2802a;
  --task-soft: #fff4e8;

  --review: #a77bf3;
  --review-dark: #8659d6;
  --review-soft: #f5efff;

  --todo: #ffc93c;
  --done: #38b87c;
  --danger: #f3736f;

  --radius: 22px;
  --shadow: 0 6px 0 rgba(80, 100, 160, .08), 0 14px 28px rgba(80, 100, 160, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 28px 16px 40px;
  font-family: "BIZ UDPGothic", "Hiragino Maru Gothic ProN", "Yu Gothic UI",
               "Meiryo", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 214, 150, .38), transparent 42%),
    radial-gradient(circle at 88% 12%, rgba(150, 200, 255, .38), transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(200, 180, 255, .30), transparent 55%),
    #fdfaf5;
  background-attachment: fixed;
  min-height: 100vh;
}

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

/* ---------------- キャラクター共通 ---------------- */

.ch, .panel-face, .stat-face { overflow: visible; }

.eye { fill: #3a4763; transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
.cheek { fill: #ffb0c4; }
.mouth { stroke: #3a4763; stroke-width: 5; fill: none; stroke-linecap: round; }
.shadow { fill: rgba(90, 110, 160, .13); }
.bob { transform-box: fill-box; transform-origin: bottom center; animation: bob 3.2s ease-in-out infinite; }
.blip { animation: blip 2s ease-in-out infinite; }

@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(.1); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(-1.5deg); }
}
@keyframes blip {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

/* ---------------- ヒーロー ---------------- */

.hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.hero-mascot { flex: 0 0 auto; width: 132px; }
.hero-mascot svg { width: 100%; height: auto; display: block; }

.hero-text { flex: 1; min-width: 0; }

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  letter-spacing: .02em;
  color: #2c3a5c;
  text-shadow: 0 2px 0 #fff;
}

/* ふきだし */
.speech {
  position: relative;
  background: var(--card);
  border: 3px solid #ffe0b8;
  border-radius: 20px;
  padding: 12px 18px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.speech::before,
.speech::after {
  content: "";
  position: absolute;
  left: -14px;
  top: 22px;
  border-style: solid;
}

.speech::before {
  border-width: 10px 16px 10px 0;
  border-color: transparent #ffe0b8 transparent transparent;
}

.speech::after {
  left: -9px;
  border-width: 8px 13px 8px 0;
  border-color: transparent var(--card) transparent transparent;
}

.speech.pop { animation: pop .45s ease; }

@keyframes pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.05) rotate(-.6deg); }
  100% { transform: scale(1); }
}

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

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

.stat {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  transition: transform .15s ease;
}

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

.stat-face { width: 52px; height: 52px; flex: 0 0 auto; }

.stat-info { display: flex; flex-direction: column; min-width: 0; }

.stat-label {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.4;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.1;
  text-shadow: 0 2px 0 rgba(255, 255, 255, .85);
}

.stat-memo {
  border-color: #a9c0ff;
  background: linear-gradient(140deg, #eaf0ff, #d5e2ff);
  box-shadow: 0 6px 0 #b9caff, 0 14px 24px rgba(111, 143, 245, .22);
}
.stat-memo .stat-value { color: #3c5cc4; }
.stat-memo .stat-label { color: #5d74b8; }

.stat-task {
  border-color: #ffc48a;
  background: linear-gradient(140deg, #fff2e2, #ffe0c2);
  box-shadow: 0 6px 0 #ffcf9c, 0 14px 24px rgba(255, 159, 69, .24);
}
.stat-task .stat-value { color: #d9761c; }
.stat-task .stat-label { color: #bf7f45; }

.stat-todo {
  border-color: #ffd85c;
  background: linear-gradient(140deg, #fff9dd, #ffefb0);
  box-shadow: 0 6px 0 #ffe07a, 0 14px 24px rgba(255, 201, 60, .26);
}
.stat-todo .stat-value { color: #c98a00; }
.stat-todo .stat-label { color: #a98a34; }

.stat-value.bump { animation: bump .5s ease; }

/* ダッシュボードの中の「さいきんのふりかえり」 */
.latest {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(140deg, #f4ecff, #e6d7ff);
  border: 3px solid #c9adf7;
  border-radius: var(--radius);
  padding: 12px 18px;
  box-shadow: 0 6px 0 #d8c6ff, 0 14px 24px rgba(167, 123, 243, .24);
}

.latest-face { width: 58px; height: 58px; flex: 0 0 auto; }

.latest-body { min-width: 0; }

.latest-label {
  display: inline-block;
  font-size: .74rem;
  font-weight: 700;
  color: var(--review-dark);
  background: #fff;
  border-radius: 999px;
  padding: 0 12px;
  margin-right: 8px;
}

.latest-week {
  font-weight: 800;
  line-height: 1.4;
  color: var(--review-dark);
}

.latest-comment {
  margin: 2px 0 0;
  font-size: .95rem;
  color: #4b5877;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ---------------- お知らせ ---------------- */

.message {
  margin: 0 0 16px;
  padding: 12px 18px;
  border-radius: 16px;
  background: #fff0ef;
  border: 3px solid #ffd0ce;
  color: #c8524e;
  font-weight: 700;
}

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

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

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

.panel-memo { border-color: #d6e0ff; }
.panel-task { border-color: #ffdfbe; }
.panel-review { grid-column: 1 / -1; border-color: #e3d7ff; }

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-face { width: 62px; height: 62px; flex: 0 0 auto; }

.panel-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.panel-sub {
  margin: 0;
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.4;
}

/* ---------------- 入力フォーム ---------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--memo-soft);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 18px;
}

.panel-task .form { background: var(--task-soft); }
.panel-review .form { background: var(--review-soft); }

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

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

input, textarea, select {
  font: inherit;
  width: 100%;
  padding: 10px 14px;
  border: 2.5px solid #fff;
  border-radius: 14px;
  background: #fff;
  color: inherit;
  resize: vertical;
  box-shadow: inset 0 2px 4px rgba(80, 100, 160, .06);
}

select { cursor: pointer; font-weight: 700; }

input::placeholder, textarea::placeholder { color: #b6c0d6; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--memo);
  box-shadow: 0 0 0 4px rgba(111, 143, 245, .22);
}

.panel-task input:focus, .panel-task textarea:focus {
  border-color: var(--task);
  box-shadow: 0 0 0 4px rgba(255, 159, 69, .25);
}

.panel-review input:focus,
.panel-review textarea:focus,
.panel-review select:focus {
  border-color: var(--review);
  box-shadow: 0 0 0 4px rgba(167, 123, 243, .25);
}

/* ---------------- ボタン ---------------- */

.btn {
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  color: #fff;
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
}

.btn-memo { background: var(--memo); box-shadow: 0 5px 0 var(--memo-dark); }
.btn-task { background: var(--task); box-shadow: 0 5px 0 var(--task-dark); }
.btn-review { background: var(--review); box-shadow: 0 5px 0 var(--review-dark); }

.btn:hover { filter: brightness(1.06); }

.btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 currentColor;
}

.btn:focus-visible {
  outline: 3px solid #2c3a5c;
  outline-offset: 3px;
}

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

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

.item {
  position: relative;
  border: 2.5px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  background: #fdfdff;
  animation: appear .35s ease;
}

@keyframes appear {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.item-title {
  font-weight: 700;
  word-break: break-word;
}

.item-body {
  margin: 4px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: .95rem;
  color: #4b5877;
}

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

/* メモの付せん風マーク */
.panel-memo .item { border-color: #dfe6ff; }
.panel-memo .item::before {
  content: "";
  position: absolute;
  left: -2.5px;
  top: 14px;
  bottom: 14px;
  width: 6px;
  border-radius: 6px;
  background: var(--memo);
}

/* ---------------- 振り返り ---------------- */

.panel-review .item { border-color: #e8dfff; background: #fdfbff; }

.review-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.review-week {
  font-weight: 800;
  color: var(--review-dark);
}

.badge-week {
  color: var(--review-dark);
  border-color: #d8c6ff;
  background: var(--review-soft);
}

.review-comment {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.panel-task .item { border-color: #ffe3c6; }

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

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

/* 大きな「できた！」ボタン */
.check {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid #ffd3a3;
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform .1s ease, background .2s ease, border-color .2s ease;
}

.check svg { width: 26px; height: 26px; }
.check path { stroke: #e7c9a5; stroke-width: 5; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.check:hover { transform: scale(1.08); }
.check:active { transform: scale(.92); }

.check:focus-visible { outline: 3px solid var(--task-dark); outline-offset: 3px; }

.task-done .check { background: var(--done); border-color: var(--done); }
.task-done .check path { stroke: #fff; }

.task-done .item-title { text-decoration: line-through; color: var(--muted); }
.task-done { background: #f3fbf7; border-color: #c6ecd8 !important; }

.badge {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  border: 2px solid;
}

.badge-done { color: var(--done); border-color: var(--done); background: #eafaf2; }
.badge-todo { color: var(--task-dark); border-color: #ffcf9c; background: #fff5eb; }

.btn-delete {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2.5px solid #ffd5d4;
  background: #fff;
  color: var(--danger);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: transform .1s ease, background .2s ease;
}

.btn-delete:hover { background: #fff0ef; transform: rotate(90deg); }
.btn-delete:focus-visible { outline: 3px solid var(--danger); outline-offset: 2px; }

/* お祝いのキラキラ */
.spark {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  pointer-events: none;
  animation: spark .7s ease-out forwards;
}

@keyframes spark {
  from { opacity: 1; transform: translate(0, 0) scale(1); }
  to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.2); }
}

/* ---------------- そのほか ---------------- */

.empty {
  margin: 6px 0 0;
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  background: #f7f9fd;
  border-radius: 16px;
  border: 2.5px dashed var(--line);
}

.foot {
  margin-top: 22px;
  text-align: center;
  font-size: .78rem;
  color: var(--muted);
}

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

@media (max-width: 760px) {
  .columns { grid-template-columns: 1fr; }
  .dashboard { grid-template-columns: 1fr; }
  .hero-mascot { width: 96px; }
  .stat-value { font-size: 1.8rem; }
}

/* 動きが苦手な人のために */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
}
