/* ==========================================================
   令和8年度 ケアマネ試験対策 1分読み物 スタイル
   医療法人社団 石橋内科
   方針：スマホ最優先・文字大きめ・行間ゆったり・高コントラスト
   ========================================================== */

:root {
  --bg: #f7f5ef;            /* 紙のようなクリーム背景 */
  --text: #243246;          /* 濃紺（高コントラスト） */
  --text-sub: #55617a;
  --card: #ffffff;
  --primary: #3a5ba0;       /* 読み物らしい深い藍色 */
  --primary-dark: #2c4a8a;
  --secondary: #e8772e;     /* オレンジ（アクセント） */
  --danger: #c0392b;
  --line: #ded8c9;
  --key: #c62828;           /* 重要キーワード（赤系） */
  --hot: #d96b00;           /* 頻出（オレンジ系） */
  --gold: #f5b301;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(36, 50, 70, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 17px; }

body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.hidden { display: none !important; }

.screen { animation: screen-in 0.25s ease; }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 共通パーツ ---------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title { font-size: 1.05rem; margin-bottom: 10px; }

.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 12px;
  transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease;
  min-height: 52px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--primary); border: 2px solid var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-text { background: none; color: var(--text-sub); text-decoration: underline; min-height: auto; padding: 6px; font-weight: 500; }
.btn-big { font-size: 1.2rem; padding: 18px 16px; }

.icon-btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 1.3rem;
  width: 48px;
  height: 48px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 14px;
}

.screen-header-title {
  font-weight: 800;
  font-size: 1.05rem;
  flex: 1;
}

/* ---------- ホーム画面 ---------- */

.home-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin: 8px 0 12px;
}

.title-block { flex: 1; }

.app-title {
  font-size: 1.15rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.title-main {
  font-size: 1.9rem;
  color: var(--primary);
  letter-spacing: 0.06em;
}

.app-org {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 4px;
  letter-spacing: 0.08em;
}

.daily-message {
  background: #fff7e0;
  border: 1px solid #f0dfa8;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.streak-card { text-align: center; padding: 24px 20px; }

.streak-flames {
  font-size: 2.6rem;
  line-height: 1.2;
  animation: flame-sway 1.6s ease-in-out infinite;
}
@keyframes flame-sway {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

.streak-main { font-size: 1.7rem; font-weight: 800; margin-top: 6px; }
.streak-sub  { color: var(--text-sub); font-size: 0.95rem; margin-top: 4px; }
.streak-best { color: var(--text-sub); font-size: 0.85rem; margin-top: 10px; }

.countdown-card {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 14px;
  background: #edf1fa;
  border: 1px solid #cdd8ee;
}

.overall-progress-text {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.overall-bar {
  background: #e9e3d4;
  border-radius: 9px;
  height: 16px;
  overflow: hidden;
  margin-bottom: 16px;
}

.overall-bar-fill {
  height: 100%;
  border-radius: 9px;
  background: linear-gradient(90deg, var(--primary), #6c8cd5);
  width: 0;
  transition: width 0.6s ease;
}

.cat-row { margin-bottom: 12px; }
.cat-row:last-child { margin-bottom: 0; }

.cat-name {
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.cat-name .cat-detail {
  font-weight: 600;
  color: var(--text-sub);
  font-size: 0.85rem;
  white-space: nowrap;
}

.cat-bar {
  background: #ece6d8;
  border-radius: 7px;
  height: 10px;
  margin-top: 4px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--primary), #6c8cd5);
  width: 0;
  transition: width 0.6s ease;
}

.cat-bar-fill.master { background: linear-gradient(90deg, var(--gold), #ffd95e); }

.achievements-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge-chip {
  background: #fff4d6;
  border: 1px solid #ecd591;
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 0.88rem;
  font-weight: 700;
}

.badge-chip.master {
  background: #fdebd2;
  border-color: #efc18a;
}

.home-footer {
  text-align: center;
  color: var(--text-sub);
  font-size: 0.8rem;
  margin-top: 20px;
  line-height: 1.9;
}

/* ---------- マイルストーン（10日ごと）演出 ---------- */

.milestone-banner {
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 16px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.25);
  background: linear-gradient(120deg, #ff5e62, #f5b301, #2fae8f, #4f74e3, #ff5e62);
  background-size: 400% 400%;
  animation: milestone-gradient 5s ease infinite;
  box-shadow: 0 4px 16px rgba(245, 179, 1, 0.45);
}
@keyframes milestone-gradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

body.celebrating {
  background: linear-gradient(160deg, #fff8e1, #ffe9f0, #e8f0fb, #fff8e1);
  background-size: 300% 300%;
  animation: milestone-gradient 8s ease infinite;
}

/* ---------- 読み物画面 ---------- */

.article-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.article-category {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 14px;
}

.fav-btn {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-sub);
  cursor: pointer;
  flex-shrink: 0;
}

.fav-btn.on {
  background: #fff4d6;
  border-color: var(--gold);
  color: #8a5a00;
}

.article-card { padding: 24px 20px; }

.article-title {
  font-size: 1.3rem;
  line-height: 1.6;
  margin-bottom: 14px;
  color: var(--primary-dark);
}

.article-body {
  font-size: 1.06rem;
  line-height: 2.05;
  letter-spacing: 0.01em;
}

/* 重要語句ハイライト */
.article-body .key {
  color: var(--key);
  font-weight: 800;
}

.article-body .hot {
  color: var(--hot);
  font-weight: 800;
}
.article-body .hot::after {
  content: "🔥";
  font-size: 0.85em;
  margin-left: 1px;
}

.point-card {
  background: #fffbea;
  border: 1.5px solid #f0dfa8;
}

.point-label {
  font-weight: 800;
  margin-bottom: 6px;
  color: #8a5a00;
}

.article-point {
  font-size: 0.98rem;
  line-height: 1.9;
}

.praise-msg {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-dark);
  background: #edf1fa;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  animation: screen-in 0.3s ease;
}

/* ---------- 設定画面 ---------- */

.settings-desc {
  font-size: 0.92rem;
  color: var(--text-sub);
  margin-bottom: 12px;
}

.settings-desc strong { color: var(--danger); }

.date-input {
  display: block;
  width: 100%;
  font-size: 1.1rem;
  font-family: inherit;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
  background: #fff;
  color: var(--text);
}

.settings-saved { color: #1e8e3e; font-weight: 700; }

/* ---------- 300本読破オーバーレイ ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.overlay-inner {
  text-align: center;
  padding: 24px;
  position: relative;
}

.overlay-skip {
  margin-top: 26px;
  font-size: 0.9rem;
  opacity: 0.85;
  font-weight: 700;
}

.overlay-complete {
  background: radial-gradient(circle at center, rgba(255, 240, 180, 0.97), rgba(255, 205, 64, 0.94));
  animation: overlay-in 0.25s ease;
  color: #5c3d00;
}
@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.complete-glow {
  position: absolute;
  inset: -60px;
  background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(255,215,64,0) 60%);
  animation: glow-pulse 1s ease-in-out infinite;
  pointer-events: none;
}
@keyframes glow-pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%      { transform: scale(1.25); opacity: 1; }
}

.complete-emoji {
  position: relative;
  font-size: 4rem;
  animation: complete-pop 0.5s cubic-bezier(0.2, 2.2, 0.4, 1);
}

.complete-text {
  position: relative;
  font-size: 2.6rem;
  font-weight: 900;
  color: #8a5a00;
  text-shadow: 0 2px 0 #fff, 0 4px 14px rgba(138, 90, 0, 0.35);
  animation: complete-pop 0.55s cubic-bezier(0.2, 2.2, 0.4, 1);
}
@keyframes complete-pop {
  0%   { transform: scale(0.2) rotate(-6deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.complete-sub {
  position: relative;
  margin-top: 10px;
  font-size: 1.3rem;
  font-weight: 800;
}

/* ---------- 紙吹雪 ---------- */

#confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -24px;
  border-radius: 2px;
  animation-name: confetti-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(112vh) rotate(680deg); opacity: 0.6; }
}

/* ---------- レスポンシブ ---------- */

@media (max-width: 420px) {
  html { font-size: 16px; }
  .title-main { font-size: 1.6rem; }
  .complete-text { font-size: 2rem; }
}

@media (min-width: 700px) {
  #app { padding-top: 32px; }
}
