/* public/css/mascot.css — マスコット「ルリエ」のパネル。
   スプライトは淡色のバッジの上に必ず置く（白背景だと輪郭が溶けるため）。
   進化段階はバッジの縁色で見分ける（中盤3段階は小さいと姿で区別できないため）。 */

/* ===== ダッシュボード上部のステータス面 =====
   カードを並べず、1枚の面をヘアラインで3つのゾーンに割る。
   線は装飾ではなく「今月／今日の目標／今日の数字」の境界を示すために引く。 */

.dash-status {
  display: grid;
  grid-template-columns: minmax(250px, 0.95fr) minmax(260px, 1fr) minmax(290px, 1.25fr);
  gap: 0;
  margin-bottom: 14px;
  border: 1px solid #d6e6f0;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff 0%, #f4fafd 55%, #eaf4fb 100%);
}

.dash-zone { padding: 14px 18px; min-width: 0; }
.dash-status.is-driver { grid-template-columns: minmax(0, 1fr); }
.dash-zone + .dash-zone { border-left: 1px solid #e2edf4; }

.dash-zone-title {
  margin: 0 0 10px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #5b7a93;
  letter-spacing: .04em;
}

.dash-mascot-slot { min-height: 92px; }

/* --- 今日の目標メーター --- */
.dash-meter + .dash-meter { margin-top: 12px; }

.dash-meter-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.dash-meter-name { font-size: 0.76rem; font-weight: 700; color: #16304a; }
.dash-meter-goal { font-size: 0.7rem; color: #5b7a93; }

.dash-meter-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.dash-meter-cur { font-size: 1.02rem; font-weight: 800; color: #16304a; font-variant-numeric: tabular-nums; }
.dash-meter-remain { font-size: 0.88rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.dash-meter-track {
  height: 7px;
  margin-top: 6px;
  border-radius: 99px;
  background: #fdf0d6;
  overflow: hidden;
}

.dash-meter-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #f6ad3c, #ef6b45);
  transition: width .5s cubic-bezier(.2, .8, .3, 1);
}

.dash-meter-pct { text-align: right; font-size: 0.68rem; color: #8aa3b6; margin-top: 2px; }

/* --- 今日の数字（.stat-card は定期更新が拾うのでクラス名は変えない） --- */
.dash-figures {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 10px;
}

.dash-status .stat-card {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  border-left: 2px solid #dceaf3;
  padding-left: 8px;
}

.dash-status .stat-card .stat-val {
  font-size: 1.06rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dash-status .stat-card .stat-lbl { font-size: 0.66rem; color: #8aa3b6; }
.dash-status .stat-card.purple .stat-val { color: #7c3aed; }

@media (max-width: 1100px) {
  .dash-status { grid-template-columns: 1fr 1fr; }
  .dash-zone-figures { grid-column: 1 / -1; border-left: 0; border-top: 1px solid #e2edf4; }
}

@media (max-width: 680px) {
  .dash-status { grid-template-columns: 1fr; }
  .dash-zone + .dash-zone { border-left: 0; border-top: 1px solid #e2edf4; }
  .dash-figures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.mascot-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  margin-bottom: 14px;
  border-radius: 18px;
  border: 1px solid #d6e6f0;
  background: linear-gradient(135deg, #ffffff 0%, #eaf4fb 60%, #dceef8 100%);
}

/* ステータス面の中に置くときは、面を二重にしないので枠と背景を外す */
.mascot-card.is-inline {
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  gap: 13px;
}

/* PCでは相棒を主役にする：絵を大きく上に置き、レベル以下をその下に重ねる */
.mascot-card.is-inline {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.mascot-card.is-inline .mascot-badge { width: 168px; height: 168px; }
.mascot-card.is-inline .mascot-body { width: 100%; }
.mascot-card.is-inline .mascot-head { justify-content: center; gap: 8px; }
.mascot-card.is-inline .mascot-level { font-size: 2rem; }
.mascot-card.is-inline .mascot-meta { justify-content: center; font-size: .73rem; gap: 2px 14px; }
.mascot-card.is-inline .mascot-next { font-size: .72rem; }

/* 幅が足りないときは横並びに戻して縦の占有を抑える */
@media (max-width: 1100px) {
  .mascot-card.is-inline {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 13px;
  }
  .mascot-card.is-inline .mascot-badge { width: 84px; height: 84px; }
  .mascot-card.is-inline .mascot-level { font-size: 1.45rem; }
  .mascot-card.is-inline .mascot-head,
  .mascot-card.is-inline .mascot-meta { justify-content: flex-start; }
}

.mascot-badge {
  padding: 0;
  border: 0;
  appearance: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  flex: 0 0 auto;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 35%, #ffffff 0%, #ddeef9 70%, #cbe4f3 100%);
  box-shadow: 0 0 0 3px var(--mascot-ring, #e8f1f7), 0 4px 12px rgba(40, 90, 130, .16);
}

.mascot-badge:focus-visible { outline: 3px solid #2687b0; outline-offset: 7px; }
.mascot-motion-wrap { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; }
.mascot-motion-status { display: block; min-height: 18px; margin-top: 5px; font-size: .72rem; line-height: 18px; color: #357a98; font-weight: 600; text-align: center; }
.mascot-badge.is-reacting { animation: mascot-greeting .65s ease-out; }
.mascot-badge.is-evolving { animation: mascot-evolution 1.8s ease-in-out; }
.mascot-badge.is-ultimate { animation: mascot-evolution 2.2s ease-in-out; }
@keyframes mascot-greeting { 0%, 100% { transform: translateY(0) rotate(0); } 35% { transform: translateY(-8px) rotate(-4deg); } 65% { transform: translateY(-3px) rotate(3deg); } }
@keyframes mascot-evolution { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.06); box-shadow: 0 0 0 5px #bce8f5, 0 0 26px 8px rgba(95,192,224,.48); } }

.mascot-sprite {
  width: 84%;
  height: auto;
  display: block;
  animation: mascot-float 3.8s ease-in-out infinite;
}

@keyframes mascot-float {
  0%, 100% { transform: translateY(0) rotate(-1.2deg); }
  50%      { transform: translateY(-6px) rotate(1.2deg); }
}

/* Lv.100 は縁が虹色に回る */
.mascot-card[data-stage="lv100"] .mascot-badge {
  box-shadow: 0 0 0 3px transparent, 0 4px 16px rgba(227, 200, 139, .5);
  background:
    radial-gradient(circle at 50% 35%, #ffffff 0%, #ddeef9 70%, #cbe4f3 100%) padding-box,
    var(--mascot-ring) border-box;
  border: 3px solid transparent;
}

.mascot-card.is-rare .mascot-badge::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 14px 2px rgba(201, 188, 228, .85);
  animation: mascot-rare 2.4s ease-in-out infinite;
}

@keyframes mascot-rare {
  0%, 100% { opacity: .45; }
  50%      { opacity: 1; }
}

.mascot-body { flex: 1 1 auto; min-width: 0; }

.mascot-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.mascot-level { font-size: 1.6rem; font-weight: 700; line-height: 1; color: #16304a; letter-spacing: -.01em; }
.mascot-stage { font-size: .8rem; color: #5b7a93; }

.mascot-rare {
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  color: #4a3a70;
  background: linear-gradient(135deg, #e7dcff, #cfe6f7);
}

.mascot-bar {
  height: 10px;
  border-radius: 99px;
  background: #e3eef5;
  overflow: hidden;
  margin-bottom: 6px;
}

.mascot-bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #9fdcef, #5fc0e0);
  transition: width .6s cubic-bezier(.2, .8, .3, 1);
}

.mascot-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: .76rem;
  color: #5b7a93;
}

.mascot-meta b { color: #16304a; font-size: .84rem; }
.mascot-next { font-size: .74rem; color: #5b7a93; margin-top: 4px; }

.mascot-exp { font-size: .78rem; font-weight: 700; color: #16304a; margin: 5px 0; font-variant-numeric: tabular-nums; }
.mascot-exp span { display: inline-block; margin-left: 10px; font-size: .72rem; color: #5b7a93; font-weight: 400; }
.mascot-task-progress { margin-top: 12px; border-top: 1px solid #d8e8f1; padding-top: 5px; }
.mascot-task-progress-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: .74rem; }
.mascot-task-mark { color: #829cb0; }
.mascot-task-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mascot-task-label b { font-weight: 600; }
.mascot-task-label small { display: block; color: #5b7a93; font-size: .66rem; margin-top: 2px; }
.mascot-task-reward { white-space: nowrap; color: #1684a1; font-size: .7rem; font-variant-numeric: tabular-nums; }
.mascot-task-progress-row.is-done .mascot-task-mark, .mascot-task-progress-row.is-done .mascot-task-reward { color: #15803d; }
.mascot-daily-goal + .mascot-daily-goal { margin-top: 15px; }
.mascot-goal-settlement-note { font-size: .69rem; color: #5b7a93; line-height: 1.65; margin-bottom: 12px; }
.mascot-daily-goal.is-done .mascot-task-reward { color: #15803d; }
.mascot-goal-foot { display: flex; justify-content: space-between; gap: 8px; color: #5b7a93; font-size: .69rem; margin-top: 4px; font-variant-numeric: tabular-nums; }
.mascot-other-goals { border-top: 1px solid #d8e8f1; margin-top: 15px; padding-top: 12px; }
.mascot-other-goals h4 { margin: 0; font-size: .74rem; color: #5b7a93; }
.mascot-other-goals .mascot-task-progress { border: 0; margin-top: 4px; padding: 0; }
.mascot-level-requirements { font-size: .76rem; color: #476b85; margin-top: 12px; }
.mascot-level-requirements summary { cursor: pointer; padding: 7px 0; font-weight: 600; }
.mascot-level-table-wrap { max-height: 300px; overflow: auto; }
.mascot-level-table { width: 100%; border-collapse: collapse; font-size: .74rem; font-variant-numeric: tabular-nums; }
.mascot-level-table th, .mascot-level-table td { text-align: right; padding: 7px; border-bottom: 1px solid var(--border); }
.mascot-level-table th { position: sticky; top: 0; background: #f2f7fb; }
.mascot-level-table th:first-child, .mascot-level-table td:first-child { text-align: left; }
.mascot-expense-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.mascot-task-settings { padding: 18px; }
.main-wrap:has(.mascot-task-settings), .main-wrap:has(.dash-status), .main-wrap:has(.cm-admin) { min-width: 0; }
.mascot-task-settings-head, .mascot-task-section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.mascot-task-settings h2 { margin: 0; font-size: 1rem; }
.mascot-task-settings p { margin: 6px 0; font-size: .78rem; color: var(--text3); line-height: 1.7; }
.mascot-task-help { background: #eff8fc; color: #476b85; font-size: .76rem; padding: 12px; line-height: 1.85; border-radius: 6px; margin-top: 14px; }
.mascot-task-settings-status { min-height: 22px; color: #476b85; font-size: .76rem; padding-top: 10px; }
.mascot-task-section { padding: 14px 0; border-top: 1px solid var(--border); margin-top: 12px; }
.mascot-task-section h3 { font-size: .86rem; margin: 0; }
.mascot-task-section h3 span { font-size: .72rem; font-weight: 400; color: var(--text3); margin-left: 6px; }
.cm-admin { padding: 20px; min-width: 0; }
.cm-admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.cm-admin-heading h2 { margin: 0; font-size: 1.05rem; }
.cm-admin-heading p, .cm-admin-help, #castMascotFeedback { color: var(--text3); font-size: .78rem; line-height: 1.7; }
.cm-admin-filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin: 20px 0; }
.cm-admin-filters label { display: flex; flex-direction: column; gap: 6px; font-size: .8rem; }
.cm-admin-filters input:not([type=checkbox]), .cm-admin-filters select { border: 1px solid var(--border); padding: 8px 10px; border-radius: 7px; background: var(--card,white); color: var(--text); max-width: 100%; }
.cm-admin-filters .cm-admin-retired { flex-direction: row; align-items: center; padding-bottom: 9px; }
.cm-admin-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin: 14px 0; }
.cm-admin-summary > div { display: flex; flex-direction: column; gap: 6px; padding: 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg, #f7fafc); }
.cm-admin-summary span { font-size: .75rem; color: var(--text3); }
.cm-admin-summary strong { font-size: 1.5rem; color: var(--primary,#2784a5); }
.cm-admin-table-wrap { overflow-x: auto; max-width: 100%; margin-top: 12px; }
.cm-admin-table { width: 100%; min-width: 1440px; border-collapse: collapse; font-size: .77rem; }
.cm-admin-reset { color: #b7454c; border: 1px solid #ebc4c7; background: #fff8f8; white-space: nowrap; }
.cm-admin-reset:disabled { opacity: .45; cursor: not-allowed; }
.cm-admin-reset-dialog { width: min(480px,calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; inset: 0; box-sizing: border-box; padding: 24px; border: 1px solid var(--border,#d7e2ed); border-radius: 14px; color: var(--text,#18334a); background: var(--card,#fff); box-shadow: 0 16px 70px #152e4d40; overflow-y: auto; }
.cm-admin-reset-dialog::backdrop { background: #10263b80; }
.cm-admin-reset-dialog h2 { font-size: 1.1rem; margin: 0; }
.cm-admin-reset-dialog p { line-height: 1.8; font-size: .9rem; overflow-wrap: anywhere; }
.cm-admin-reset-dialog .cm-reset-step { margin: 4px 0 18px; font-size: .75rem; color: var(--text3,#70839a); }
.cm-admin-reset-dialog label { display: block; font-size: .85rem; margin-bottom: 6px; }
.cm-admin-reset-dialog input { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid var(--border,#d7e2ed); border-radius: 6px; font-size: 16px; }
.cm-reset-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.cm-admin-reset-dialog .cm-admin-reset-execute { background: #b7454c; border: 1px solid #b7454c; color: #fff; }
.cm-admin-reset-execute:disabled { opacity: .45; cursor: not-allowed; }
.cm-admin-reset-dialog .cm-reset-error { color: #b7454c; }
.cm-admin-table th, .cm-admin-table td { padding: 10px 9px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cm-admin-table th { font-size: .72rem; color: var(--text3); background: var(--bg,#f1f6fa); white-space: nowrap; }
.cm-admin-character { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.cm-admin-character img { width: 44px; height: 44px; object-fit: contain; }
.cm-admin-status { display: inline-block; padding: 5px 8px; border-radius: 20px; font-size: .7rem; white-space: nowrap; background: #edf2f7; color: #526477; }
.cm-admin-status.is-hatched { background: #e8f8ef; color: #20834d; }
.cm-admin-status.is-selected { background: #fff2db; color: #976300; }
.cm-admin-status.is-egg { background: #edf1ff; color: #5367a5; }
.cm-admin-muted { display: block; color: var(--text3); }
.cm-admin-visibility { min-width: 112px; }
.cm-admin-visibility-toggle { min-width: 82px; border: 1px solid #d5dee8; }
.cm-admin-visibility-toggle.is-on { color: #187343; background: #e7f7ed; border-color: #b5dfc5; }
.cm-admin-visibility-toggle.is-off { color: #526477; background: #f0f3f7; }
.cm-admin-visibility-note { color: var(--text3); font-size: .65rem; margin-top: 5px; white-space: nowrap; }
.cm-admin-visibility-note button { border: 0; background: transparent; color: #287ca0; cursor: pointer; font-size: .65rem; padding: 0 0 0 4px; text-decoration: underline; }
.cm-admin-visibility button:disabled { cursor: wait; opacity: .6; }
.cm-admin-empty { text-align: center !important; padding: 30px !important; color: var(--text3); }
.cm-admin-detail-row > td { padding: 16px; background: var(--bg,#f7fafc); }
.cm-admin-detail h3 { margin: 0 0 12px; font-size: .9rem; }
.cm-admin-detail-meta { display: flex; flex-wrap: wrap; gap: 12px 22px; margin-bottom: 14px; color: var(--text3); }
.cm-admin-detail details { margin: 10px 0; }
.cm-admin-detail summary { cursor: pointer; padding: 8px 0; font-weight: 600; }
.cm-admin-detail table { width: 100%; border-collapse: collapse; }
@media (max-width: 680px) {
  .cm-admin { padding: 12px; }
  .cm-admin-summary { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .cm-admin-filters label { max-width: 100%; }
  .cm-admin-filters input[type=search] { width: 185px; }
}
.mascot-task-table-wrap { width: 100%; overflow-x: auto; margin-top: 10px; }
.mascot-task-table { width: 100%; border-collapse: collapse; min-width: 850px; font-size: .76rem; }
.mascot-task-table th { text-align: left; background: #f2f7fb; color: #476b85; padding: 8px 6px; font-weight: 600; white-space: nowrap; }
.mascot-task-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); }
.mascot-task-table input, .mascot-task-table select { font: inherit; padding: 7px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface, #fff); color: var(--text); width: 100%; min-width: 0; }
.mascot-task-table input[type="checkbox"] { width: 16px; height: 16px; }
.mascot-task-table [data-field="label"] { min-width: 165px; }
.mascot-task-table [data-field="target"] { min-width: 110px; }
.mascot-task-table [data-field="exp"] { min-width: 85px; }
.mascot-task-table td:last-child { white-space: nowrap; }
@media (max-width: 680px) {
  .mascot-task-settings { padding: 12px; }
  .mascot-task-help { font-size: .72rem; }
}

@media (max-width: 560px) {
  .mascot-card { gap: 12px; padding: 12px; }
  .mascot-badge { width: 72px; height: 72px; }
  .mascot-level { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .mascot-sprite, .mascot-card.is-rare .mascot-badge::after,
  .mascot-badge.is-reacting, .mascot-badge.is-evolving, .mascot-badge.is-ultimate { animation: none; }
}
