/* スタンプカレンダー(#132)。ホームの この 1 しゅうかんの札と ポン、カレンダーの画面。
   見た目は モック(.worktrees/stamp-calendar/.dispatch/mock/cal.css の .week-strip・.cal-*)と同じ */

/* ---------- ホームの この 1 しゅうかん ---------- */
/* なまえ・メニューと同じ「画面にじかに置く 札」(白い地・こげ茶の枠・小さい かげ)。とっくんの 4 つの背景でも 白い札のまま
   (中の字と うすい丸は 白い地の上なので どの背景でも読める) */
.week-strip {
  flex-shrink: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 6px;
  /* 上の間は ヘッダーとの すきま(11/30 ユーザー「上の間隔が狭すぎる」)。下は 題(「けいさんカード」・とっくんの看板)との
     すきまで、上と つりあう くらい あける(11/30 ユーザー「タイトルに被ってる感」。402×812 で 題の箱まで 19px)。
     .home-main は 上下まんなか寄せなので 足した ぶんの 半分だけ 題が 下がる。低い画面は 下の @media で別に決める */
  margin: 14px 4px 4px;
  background: var(--white);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  padding: 6px 8px 6px 10px;
  font: inherit;
  cursor: pointer;
  position: relative;
  z-index: 1; /* ポンの「ポン!」の札を 下の部品より上に */
  -webkit-tap-highlight-color: transparent;
}
.week-strip:active {
  transform: translateY(2px);
  box-shadow: none;
}
.week-strip .days {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}
.week-strip .wd {
  display: grid;
  justify-items: center;
  gap: 0;
}
.week-strip .w {
  font: 700 0.68rem/1.25 var(--font-num);
  opacity: 0.6;
}
.week-strip .sun .w { color: #d9434a; opacity: 0.85; }
.week-strip .sat .w { color: #2f86c0; opacity: 0.85; }
.week-strip .today .w { opacity: 1; font-weight: 900; color: var(--ink); }
.week-strip .slot {
  --slot: 36px;
  width: var(--slot);
  height: var(--slot);
  display: grid;
  place-items: center;
  position: relative;
}
.week-strip .slot svg {
  width: 100%;
  height: 100%;
  display: block;
}
.week-strip .empty {
  width: 72%;
  height: 72%;
  border-radius: 999px;
  background: rgba(69, 58, 47, 0.07);
}
.week-strip .today .empty {
  width: 89%;
  height: 89%;
  box-sizing: border-box;
  background: var(--sun-soft);
  border: 2px dashed var(--sun-deep);
}
.week-strip .go {
  font: 900 1.3rem/1 var(--font-ui);
  opacity: 0.5;
  padding-left: 2px;
}

/* ポン「上から ぎゅっ」(js/pon.js。#132 の 3 回目)。きょうの マスの スタンプは 着くまで 隠す */
.week-strip .slot.pon-wait svg { opacity: 0; }
/* スタンプが 着くまでは まだの 形(黄色の 点線の 丸。モックと 同じ)を 下に 見せる */
.week-strip .today .slot.pon-dash::before {
  content: '';
  position: absolute;
  width: 89%;
  height: 89%;
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--sun-soft);
  border: 2px dashed var(--sun-deep);
}
.week-strip .today .slot.pon-dash svg { position: relative; }
/* ポンの 層: main の 外。fixed に しない(画面いっぱいの fixed は iOS 26/27 の ホーム画面のアプリで ステータスバーが 無地の帯になる。
   body は スクロールしないので absolute でも 同じ所に出る)。暗く しない。出ている あいだは 押すと すぐ おわる */
.pon-layer { position: absolute; inset: 0; z-index: 55; overflow: hidden; }
.pon-layer[hidden] { display: none; }
.pon-layer .pon-fx { position: absolute; pointer-events: none; opacity: 0; }
.pon-layer .pon-fx svg { width: 100%; height: 100%; display: block; }

/* 低い画面(390×658 など): ホームが スクロールしないよう 札の中だけで 詰める(ほかの部品は 変えない)。
   390×658 で ホームの中の あまりは 約 38px(はかった値 2026-11-30)。札は 37px(WebKit 37・Chromium 37.3)で、
   スタンプ 24px だと 1px、上下 2px だと 3px はみ出す */
@media (max-height: 700px) {
  .week-strip {
    border-width: 2px;
    border-radius: 16px;
    padding: 1px 6px 1px 8px;
    /* あまりは 1px なので、上を広げた ぶんだけ 下で もどす(スクロールしない) */
    margin-top: 4px;
    margin-bottom: -4px;
  }
  .week-strip .w {
    font-size: 0.58rem;
    line-height: 1;
  }
  .week-strip .slot { --slot: 22px; }
  .week-strip .go { font-size: 1.1rem; }
}

/* ---------- メニューの「カレンダー」 ---------- */
.chip-calendar { background: var(--paper); }
.chip-calendar svg { width: 24px; height: 24px; display: block; }

/* ---------- カレンダーの画面(きろく・グラフと 同じ 骨組み: 見出し → 中身 → もどる) ---------- */
/* 上下の あき・あいだ・もどるは きろく・グラフと 同じ(style.css の #screen-records, #screen-graph, #screen-calendar) */
.calendar-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.calendar-icon svg {
  width: 38px;
  height: 38px;
  display: block;
  flex: none;
}
/* 中身は もどるの上までの高さ。入らない低い画面(390×658 など)では この中だけ たてに スクロール */
.calendar-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 2px 6px;
}
/* 月の カードの 横すべり(js/calendar-ui.js。前・いま・次の 月を 横に 並べ、ブラウザの スクロールと scroll-snap で 1 まいずつ 止める。
   ホームの 教科の カルーセルと 同じ さわり心地。縦の スクロールは 外の .calendar-body。カードの かげが 切れないよう 下に あき) */
.cal-track {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  gap: 14px; /* となりの カードと くっついて 見えないように */
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding-bottom: 6px;
  margin-bottom: -6px; /* かげの ぶんの あきは 下の 1 行との あいだ(gap)に 重ねる */
}
.cal-track::-webkit-scrollbar { display: none; }
.cal-pane {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

/* 月の カード */
.cal-card {
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 10px 10px 12px;
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 2px 6px;
}
.cal-nav {
  width: 34px;
  height: 34px;
  flex: none;
  padding: 0;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  background: var(--white);
  box-shadow: var(--shadow-xs);
  display: grid;
  place-items: center;
  font: 900 1.05rem/1 var(--font-ui);
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cal-nav:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: none;
}
.cal-nav:disabled {
  opacity: 0.3;
  box-shadow: none;
  cursor: default;
}
.cal-month {
  white-space: nowrap;
  margin: 0;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}
.cal-month .num {
  font-family: var(--font-num);
  font-size: 1.6rem;
  margin-right: 2px;
}
/* 年は 月の前に 小さく(どの月にも)。‹ › と ぶつからないよう 1 行のまま */
.cal-year {
  font-size: 0.9rem;
}
.cal-month .cal-year .num {
  font-size: 1.1rem;
  margin-right: 1px;
}
.cal-sum {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 8px;
}
.cal-sum span {
  background: var(--sun-soft);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 0.85rem;
  font-weight: 700;
}
.cal-sum b {
  font-family: var(--font-num);
  font-size: 1.1rem;
  margin: 0 1px;
}

/* 曜日と 日の マス(日曜 はじまり) */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}
.cal-dow {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.6;
  padding-bottom: 2px;
}
.cal-dow.sun,
.cal-cell.sun .cal-d { color: #d9434a; }
.cal-dow.sat,
.cal-cell.sat .cal-d { color: #2f86c0; }
.cal-cell {
  position: relative;
  min-height: 76px; /* モックと同じ(2 回目は スタンプの下に バッジの しるしが入る) */
  border-radius: 12px;
  background: rgba(69, 58, 47, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 1px 3px;
}
.cal-cell.blank,
.cal-cell.future { background: transparent; }
.cal-cell.future .cal-d { opacity: 0.35; }
.cal-d {
  align-self: flex-start;
  padding-left: 5px;
  font: 700 0.72rem/1.2 var(--font-num);
  opacity: 0.75;
}
.cal-cell.today {
  background: var(--sun-soft);
  box-shadow: inset 0 0 0 2px var(--sun-deep);
}
.cal-cell.today .cal-d { opacity: 1; }
.cal-stamp {
  width: 40px;
  height: 40px;
  max-width: 100%;
  margin-top: -1px;
  display: grid;
  place-items: center;
}
.cal-stamp svg {
  width: 100%;
  height: 100%;
  display: block;
}
.cal-wait {
  width: 32px;
  height: 32px;
  box-sizing: border-box;
  border-radius: 999px;
  border: 2px dashed var(--sun-deep);
  background: rgba(255, 253, 248, 0.7);
}
.cal-today {
  font-size: 0.62rem;
  font-weight: 900;
  color: #9a7417;
}

/* 遊んだ日の マスは ボタン(押すと その日の シート。#132 の 2 回目) */
button.cal-cell {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  width: 100%;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}
button.cal-cell:active {
  background: var(--white);
  box-shadow: inset 0 0 0 3px var(--ink);
}
button.cal-cell.today:active { background: var(--sun-soft); }

/* マスの下の バッジの しるし(2 こまで。3 こ 以上は 1 こ と「+2」) */
.cal-marks {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 15px;
}
.cal-marks svg { width: 17px; height: 17px; display: block; flex: none; }
#screen-calendar .cal-marks .art-todo svg { opacity: 0.25; }
.cal-more { font: 700 0.6rem/1 var(--font-num); padding-left: 1px; }

/* カードの 下の 1 行 */
.cal-hint {
  margin: 0;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.65;
}

/* ---------- その日の シート(js/day-sheet.js。下から せり上がる) ---------- */
/* 幕は 九九の しるしの詳細と同じ .kuku-veil(fixed に しない・上の端の色も同じ)。シートを 下に つける */
.kuku-veil.cal-veil {
  align-items: flex-end;
  padding: 0;
}
.cal-sheet {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  padding: 8px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  max-height: 72%;
  overflow-y: auto;
  animation: cal-sheet-up 0.28s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
@keyframes cal-sheet-up {
  from { transform: translateY(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .cal-sheet { animation: none; }
}
.cal-sheet .handle { width: 44px; height: 5px; border-radius: 99px; background: rgba(69, 58, 47, 0.3); margin: 0 auto 10px; }
.cal-sheet .close { margin: 14px auto 0; display: block; padding: 10px 26px; }
.cal-sheet .day-head { display: flex; align-items: center; gap: 10px; }
.cal-sheet .day-head .big-stamp { width: 56px; height: 56px; flex: none; }
.cal-sheet .day-head .big-stamp svg { width: 100%; height: 100%; display: block; }
.cal-sheet .day-date { margin: 0; font-size: 1.3rem; font-weight: 900; }
.cal-sheet .day-date .num { font-family: var(--font-num); font-size: 1.5rem; }
.cal-sheet .day-plays-n { margin: 0; font-size: 0.9rem; font-weight: 700; opacity: 0.75; }
.cal-sheet .day-plays-n .num { font-family: var(--font-num); }
.cal-sheet .day-sec { margin: 12px 0 6px; font-size: 0.85rem; font-weight: 900; opacity: 0.65; letter-spacing: 0.06em; }
.cal-sheet .day-sec .num { font-family: var(--font-num); }
.cal-sheet .day-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cal-sheet .play-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(69, 58, 47, 0.05);
  border-radius: 12px;
  padding: 6px 10px;
  font-weight: 700;
}
.cal-sheet .play-row .dot { width: 22px; height: 22px; flex: none; }
.cal-sheet .play-row .name { flex: 1; min-width: 0; }
.cal-sheet .play-row .t { font: 700 1.05rem/1 var(--font-num); }
.cal-sheet .play-row .crown { font-size: 0.95rem; min-width: 1.1em; text-align: center; }
.cal-sheet .ach-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: var(--white);
  box-shadow: var(--shadow-xs);
  padding: 6px 10px;
}
.cal-sheet .ach-row .icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; }
.cal-sheet .ach-row .icon svg { width: 40px; height: 40px; display: block; }
.cal-sheet .ach-row .txt { min-width: 0; display: grid; }
.cal-sheet .ach-row b { font-size: 1rem; }
.cal-sheet .ach-row small { font-size: 0.78rem; opacity: 0.7; font-weight: 700; }
.cal-sheet .ach-row small .num { font-family: var(--font-num); }

/* ---------- 「カレンダー | バッジ」の 切りかえ(ホームの ふつう/とっくんモード と 同じ .drill-switch) ---------- */
.cal-switch { flex-shrink: 0; }
.cal-switch .drill-switch-btn { min-width: 116px; }

/* ---------- バッジ 一覧(js/badge-list.js。モックの .ach-top・.shelves) ---------- */
.ach-top {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--sun-soft);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
}
.ach-top > div { min-width: 0; }
.ach-top .count { margin: 0; font-weight: 900; font-size: 1rem; line-height: 1.2; }
.ach-top .count .num { font-family: var(--font-num); font-size: 2.1rem; margin: 0 2px; }
.ach-top .next { margin: 2px 0 0; font-size: 0.85rem; font-weight: 700; }
.ach-top .next .num { font-family: var(--font-num); font-size: 1rem; }
.ach-top .trophy-ico { width: 58px; height: 58px; flex: none; }
.ach-top .trophy-ico svg { width: 100%; height: 100%; display: block; }
#screen-calendar .shelves {
  flex-shrink: 0;
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 8px 10px;
  display: grid;
}
#screen-calendar .shelf { display: grid; gap: 4px; padding: 8px 2px 10px; }
#screen-calendar .shelf + .shelf { border-top: 2px dashed rgba(69, 58, 47, 0.18); }
#screen-calendar .shelf-name { margin: 0; font-size: 0.95rem; font-weight: 900; display: flex; align-items: baseline; gap: 6px; }
#screen-calendar .shelf-name small { font-size: 0.75rem; opacity: 0.6; font-weight: 700; }
#screen-calendar .shelf-row { display: flex; flex-wrap: wrap; gap: 6px 4px; }
#screen-calendar .chip { width: 58px; display: grid; justify-items: center; align-content: start; gap: 1px; text-align: center; }
#screen-calendar .chip svg { width: 44px; height: 44px; display: block; }
#screen-calendar .chip .l { font-size: 0.72rem; font-weight: 700; line-height: 1.15; word-break: keep-all; overflow-wrap: anywhere; }
#screen-calendar .chip.todo .l { opacity: 0.55; }
#screen-calendar .chip.next .l { opacity: 1; color: #b4561f; }
#screen-calendar .art-todo { display: block; opacity: 0.25; filter: grayscale(1); }

/* 低い画面: マスの高さだけ 詰める(中身は .calendar-body の中で たてに スクロールしてよい。横には はみ出さない) */
@media (max-height: 700px) {
  .cal-cell { min-height: 52px; }
  .cal-stamp { width: 34px; height: 34px; }
  .cal-wait { width: 28px; height: 28px; }
}

/* ---------- 重ね画面「バッジ ゲット!」の 品物(js/badge-get.js。#132 の 3 回目。モックの .ach-item・.ach-multi・.ach-medal) ----------
   覆い・光のすじ・文字・ボタンは 九九の「ほうせき ゲット!」(kuku.css の .kuku-fx.gem-get)のまま */
.badge-get .ach-item svg { width: 132px; height: 132px; display: block; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45)); }
.badge-get .ach-multi {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; justify-content: center;
  width: 300px; margin-inline: -50px;
}
.badge-get .ach-multi-it { display: grid; justify-items: center; gap: 6px; width: 92px; }
.badge-get .ach-multi-it > svg { width: 84px; height: 84px; display: block; filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.45)); }
.badge-get .ach-multi-it b { color: #fffdf8; font-size: 0.95rem; line-height: 1.3; word-break: keep-all; overflow-wrap: anywhere; }
/* いくつも: 舞台(200px の 正方形)を 中身の 高さまで のばす(折りかえすと 題に 重なるため) */
.badge-get .fx-stage:has(.ach-multi) { height: auto; min-height: 200px; padding-block: 6px; }
/* 光は 正方形の まま(たてに のびた 楕円が まわると 横に はみ出す) */
.badge-get .fx-stage:has(.ach-multi) .fx-glow { inset: auto; left: -40px; right: -40px; top: 50%; aspect-ratio: 1; transform: translateY(-50%); }
/* 4 こ 以上: 3 こずつ 折りかえして 小さく */
.badge-get .ach-multi.wrap { gap: 8px 6px; }
.badge-get .ach-multi.wrap .ach-multi-it { width: 88px; gap: 4px; }
.badge-get .ach-multi.wrap .ach-multi-it > svg { width: 64px; height: 64px; }
.badge-get .ach-multi.wrap .ach-multi-it b { font-size: 0.85rem; }
/* キリ: リボンの 金メダルに 数字(js/badge-art.js の kiriMedalArt。幅は style で)。数字は 金の 面の まん中(cy 86 / 132) */
.badge-get .kiri-medal { position: relative; display: block; margin-inline: auto; }
.badge-get .kiri-medal svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45)); }
.badge-get .kiri-medal .medal-num {
  position: absolute; left: 0; right: 0; top: 65.2%; transform: translateY(-50%);
  text-align: center; font: 900 2.5rem/1 var(--font-num); color: #8a5a00; text-shadow: 0 1px 0 #fff6c8;
}
.badge-get .ach-multi-it .kiri-medal .medal-num { font-size: 1.35rem; }
.badge-get .ach-multi.wrap .ach-multi-it .kiri-medal .medal-num { font-size: 1.05rem; }
