/* Module: @role: デザイントークン、リセット、全体レイアウト、ヘッダー、統計ダッシュボード、および共通ボタンスタイル定義 */
:root {
  --pink-primary: #ff4fa3;
  --pink-dark: #d92b7f;
  --pink-light: #fff0f7;
  --gold-accent: #f6b93b;
  --text-main: #2d2638;
  --text-muted: #6e657f;
  --bg-page: #fdf7fb;
  --bg-card: #ffffff;
  --border-color: #ead7e5;
  --type-cute: #ff5da2;
  --type-cool: #3898ff;
  --type-sexy: #a55eea;
  --type-pop: #ff9f1a;
  --rarity-pr: linear-gradient(135deg, #f6d365 0%, #fda085 50%, #ff5da2 100%);
  --rarity-er: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 50%, #8fd3f4 100%);
  --rarity-r: #d4af37;
  --rarity-n: #8c8299;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 2px 8px rgba(74, 34, 64, 0.08);
  --shadow-md: 0 6px 20px rgba(74, 34, 64, 0.14);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Hiragino Maru Gothic ProN", "Rounded Mplus 1c", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  background-color: var(--bg-page);
  background-image:
    radial-gradient(#ffd6eb 1.5px, transparent 1.5px),
    radial-gradient(#e8dcff 1.5px, #fdf7fb 1.5px);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
  color: var(--text-main);
  line-height: 1.45;
}

.app-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px;
}

/* Header & Dashboard */
.app-header {
  background: linear-gradient(180deg, #ffffff 0%, #fff7fb 100%);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: 0 4px 14px rgba(255, 79, 163, 0.12);
  border: 2px solid #f7c6df;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.app-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #ff5da2 0%, #ffbe55 35%, #70c4ff 70%, #b87aff 100%);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.brand-Area {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-sync {
  gap: 5px;
}

.btn-sync__icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.btn-sync__icon {
  display: none;
  width: 100%;
  height: 100%;
}

@keyframes syncIconSpin {
  to {
    transform: rotate(360deg);
  }
}

.btn-sync[data-state="info"] .btn-sync__icon-wrap,
.btn-sync[data-state="loading"] .btn-sync__icon-wrap {
  color: #1e6fd9;
}

.btn-sync[data-state="info"] .btn-sync__icon--loading,
.btn-sync[data-state="loading"] .btn-sync__icon--loading {
  display: block;
  animation: syncIconSpin 0.85s linear infinite;
}

.btn-sync[data-state="success"] .btn-sync__icon-wrap {
  color: #187a49;
}

.btn-sync[data-state="custom"] .btn-sync__icon-wrap {
  color: var(--pink-dark);
}

.btn-sync[data-state="success"] .btn-sync__icon--check,
.btn-sync[data-state="custom"] .btn-sync__icon--check {
  display: block;
}

.btn-sync[data-state="warn"] .btn-sync__icon-wrap {
  color: #b86200;
}

.btn-sync[data-state="warn"] .btn-sync__icon--warn {
  display: block;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(135deg, #ff5da2 0%, #ff85c0 55%, #b57cff 100%);
  padding: 2px 9px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(255, 79, 163, 0.25);
}

.app-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--pink-dark);
  letter-spacing: -0.01em;
  text-shadow: 0 1px 0 #fff;
}

.stats-dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.stat-card {
  background: linear-gradient(135deg, #f3f6ff 0%, #f8f2ff 100%);
  border: 1.5px solid #cdd9f7;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "gauge head"
    "gauge foot";
  align-items: center;
  column-gap: 10px;
  row-gap: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.stat-card--primary {
  background: linear-gradient(135deg, #fff0f7 0%, #ffe6f3 100%);
  border-color: #f8b4d6;
}

.circular-gauge {
  grid-area: gauge;
  position: relative;
  width: 52px;
  height: 52px;
  max-width: 52px;
  max-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(217, 43, 127, 0.12);
}

.circular-gauge__svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 62px;
  max-height: 62px;
  transform: rotate(-90deg);
}

.circular-gauge__track {
  fill: none;
  stroke: #e9dce6;
  stroke-width: 3.6;
}

.circular-gauge__fill {
  fill: none;
  stroke: var(--pink-primary);
  stroke-width: 3.6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.35s ease, opacity 0.2s ease;
}

.circular-gauge--sub .circular-gauge__fill {
  stroke: #6a89cc;
}

.stat-head {
  grid-area: head;
  min-width: 0;
  display: flex;
  align-items: center;
  align-self: end;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: #5a4468;
  line-height: 1.2;
}

.stat-card--primary .stat-label::before {
  content: "♥ ";
  color: var(--pink-primary);
}

.stat-card:not(.stat-card--primary) .stat-label::before {
  content: "✦ ";
  color: #6a89cc;
}

.stat-rate {
  position: absolute;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--pink-dark);
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-rate--sub {
  color: #4a63a3;
}

.stat-foot {
  grid-area: foot;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  align-self: start;
}

.stat-foot strong {
  font-size: 0.92rem;
  color: var(--text-main);
}

.stat-card--primary .stat-foot strong {
  color: var(--pink-dark);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #ff4fa3 0%, #ff79b8 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(255, 79, 163, 0.28);
}

.btn-secondary {
  background: linear-gradient(135deg, #9b6bff 0%, #6a89cc 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(106, 137, 204, 0.25);
}

.btn-outline {
  background: #fff;
  border-color: #f0c4dd;
  color: #633d58;
}

.btn-outline:hover {
  background: var(--pink-light);
  border-color: var(--pink-primary);
}

.btn-danger-outline {
  background: #fff;
  border-color: #eb4d4b;
  color: #eb4d4b;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.76rem;
}

@media (max-width: 768px) {
  .app-header {
    padding: 8px 10px;
    margin-bottom: 8px;
    border-radius: 14px;
  }
  .header-inner {
    gap: 4px 8px;
    margin-bottom: 6px;
  }
  .brand-Area {
    gap: 6px;
    width: 100%;
    justify-content: space-between;
  }
  .brand-badge {
    font-size: 0.6rem;
    padding: 1px 7px;
    order: 2;
  }
  .app-title {
    font-size: 1rem;
    order: 1;
  }
  .header-actions {
    width: 100%;
    gap: 4px;
    justify-content: flex-start;
  }
  .btn-sync {
    gap: 4px;
  }
  .btn-sync__icon-wrap {
    width: 12px;
    height: 12px;
  }
  .header-actions .btn {
    padding: 3px 8px;
    font-size: 0.7rem;
  }
  header.app-header .stats-dashboard {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }
  header.app-header .stat-card {
    padding: 5px 7px;
    column-gap: 6px;
    row-gap: 1px;
    border-radius: 10px;
    min-width: 0;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "gauge head"
      "gauge foot";
  }
  header.app-header .circular-gauge {
    width: 34px;
    height: 34px;
    max-width: 34px;
    max-height: 34px;
  }
  header.app-header .circular-gauge__svg {
    max-width: 34px;
    max-height: 34px;
  }
  header.app-header .stat-rate {
    font-size: 0.58rem;
  }
  header.app-header .stat-head {
    align-self: end;
  }
  header.app-header .stat-label {
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  header.app-header .stat-foot {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 4px 6px;
    font-size: clamp(0.58rem, 2.5vw, 0.76rem);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
  }
  header.app-header .stat-foot strong {
    font-size: 1.08em;
  }
}

@media (max-width: 360px) {
  header.app-header .stat-card {
    padding: 4px 5px;
    column-gap: 4px;
  }
  header.app-header .circular-gauge {
    width: 30px;
    height: 30px;
    max-width: 30px;
    max-height: 30px;
  }
  header.app-header .circular-gauge__svg {
    max-width: 30px;
    max-height: 30px;
  }
  header.app-header .stat-rate {
    font-size: 0.52rem;
  }
  header.app-header .stat-label {
    font-size: 0.62rem;
  }
  header.app-header .stat-foot {
    font-size: 0.56rem;
    gap: 3px;
  }
}
