/* ============================================================
   龍神カード記録アプリ 見た目（スタイル）
   ------------------------------------------------------------
   色や大きさはここでまとめて調整できます。
   いちばん上の :root で「色のテーマ」を決めています♪
   ============================================================ */

:root {
  --bg: #f4f3fb;          /* 背景の色（ほんのり藤色） */
  --card-bg: #ffffff;     /* カードの白 */
  --primary: #1d0b87;     /* メインの深い藍（原画の龍神カラー） */
  --primary-dark: #140a5e;
  --text: #1f2937;        /* 文字の色 */
  --muted: #6b7280;       /* うすい文字 */
  --line: #e6e3f2;        /* 区切り線 */
  --accent: #d19c47;      /* アクセント（金色） */
  --radius: 14px;         /* 角の丸み */
  --tabbar-h: 64px;       /* 下タブの高さ */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
               "Yu Gothic", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* かくす用 */
.hidden { display: none !important; }

/* ---- ヘッダー ---- */
.app-header {
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, #0b0533, var(--primary) 55%, #3b1f9e);
  color: #fff;
  padding: env(safe-area-inset-top) 16px 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 2px solid var(--accent);
}
.header-logo {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  object-fit: cover;
  flex: 0 0 auto;
}
.app-header h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  padding: 14px 0;
  text-align: center;
}

/* ---- ヒーローバナー（今日の記録の上の龍神画像） ---- */
.hero {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: 0 3px 12px rgba(20,10,94,.2);
  background: #0b0533;
}
.hero-img {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
  object-position: center 30%;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11,5,51,0) 40%, rgba(11,5,51,.75) 100%);
}
.hero-text {
  position: absolute;
  left: 14px;
  bottom: 10px;
  margin: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
  letter-spacing: .04em;
}

/* ---- メイン（タブの分だけ下に余白） ---- */
#app-main {
  padding: 16px;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
  max-width: 640px;
  margin: 0 auto;
}

.view { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.lead { color: var(--muted); font-size: 14px; margin: 4px 0 14px; }
.today-date { font-size: 15px; font-weight: 700; color: var(--primary-dark); margin: 0 0 2px; }

/* ---- おしらせ（今日はもう引いています） ---- */
.notice {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}

/* ---- 今日の指針（選んだカードを大きく表示） ---- */
.today-result {
  background: var(--card-bg);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: 0 3px 14px rgba(209,156,71,.22);
}
.today-result-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #a06f1a;
  letter-spacing: .08em;
  margin-bottom: 8px;
}
.today-result-msg {
  margin: 6px 0 0;
  font-size: 21px;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.5;
}

/* ---- カード一覧 ---- */
.card-list { display: flex; flex-direction: column; gap: 10px; }

.card-item {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 16px;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card-item:active { transform: scale(0.98); }
.card-item.selectable:hover { box-shadow: 0 3px 10px rgba(31,111,235,.15); }

/* ---- カレンダー ---- */
.calendar-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.cal-title { font-size: 17px; font-weight: 700; }
.nav-btn {
  background: var(--card-bg); border: 1px solid var(--line);
  border-radius: 10px; width: 44px; height: 40px; font-size: 16px;
  cursor: pointer; color: var(--primary-dark);
}
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal-head {
  text-align: center; font-size: 12px; color: var(--muted);
  padding: 4px 0;
}
.cal-cell {
  background: var(--card-bg); border: 1px solid var(--line);
  border-radius: 8px; min-height: 56px; padding: 4px;
  font-size: 11px; cursor: default; overflow: hidden;
}
.cal-cell.empty { background: transparent; border: none; }
.cal-cell.has-record { border-color: var(--primary); cursor: pointer; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day { font-size: 12px; font-weight: 700; color: var(--text); }
.cal-msg { color: var(--primary-dark); margin-top: 2px; line-height: 1.3; }
.cal-more { color: var(--muted); }

/* ---- 統計 ---- */
.pie-wrap { text-align: center; margin-bottom: 18px; }
.pie-chart {
  width: 200px; height: 200px; border-radius: 50%;
  margin: 6px auto; box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.pie-total { color: var(--muted); font-size: 13px; }

.ranking { list-style: none; padding: 0; margin: 0; counter-reset: rank; }
.rank-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card-bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px;
}
.rank-no {
  flex: 0 0 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.rank-item .swatch { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }
.rank-medal { flex: 0 0 28px; font-size: 22px; text-align: center; }
.rank-msg { flex: 1; font-size: 14px; }
.rank-pct { font-weight: 700; color: var(--primary-dark); font-size: 14px; }
.rank-count { color: var(--muted); font-size: 12px; }

/* ---- 検索 ---- */
.search-input {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 14px; background: #fff;
}
.search-input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

/* ---- 設定 ---- */
.settings-box {
  background: var(--card-bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.settings-note { font-size: 13px; color: var(--muted); margin: 0 0 16px; }
.settings-msg { font-size: 13px; color: var(--primary-dark); margin-top: 12px; min-height: 18px; }

.big-btn {
  display: block; width: 100%; padding: 14px;
  font-size: 15px; font-weight: 700; color: #fff;
  background: var(--primary); border: none; border-radius: var(--radius);
  cursor: pointer; margin-bottom: 10px;
}
.big-btn:active { background: var(--primary-dark); }
.big-btn.secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }

/* ---- 下タブ ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--line);
  display: flex; z-index: 10;
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 20px; color: var(--muted); padding: 0;
}
.tab span { font-size: 10px; }
.tab.active { color: var(--primary); }

/* ---- ポップアップ（全文表示） ---- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 20;
}
.modal-box {
  background: #fff; border-radius: 18px; padding: 20px;
  width: 100%; max-width: 420px; max-height: 80vh; overflow-y: auto;
}
.modal-date { font-weight: 700; color: var(--primary-dark); margin: 0 0 12px; }
.modal-body { margin-bottom: 16px; }
.modal-msg {
  background: var(--bg); border-left: 5px solid var(--primary);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; font-size: 15px;
}
