@font-face {
  font-family: "Clash Royale";
  src: url("./fonts/clash-heavy.woff2") format("woff2");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101827;
  color: #f8fafc;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --app-max-width: 720px;
  --surface: rgb(15 23 42 / 88%);
  --surface-soft: rgb(30 41 59 / 72%);
  --border: rgb(255 255 255 / 11%);
  --muted: #a9b6c9;
  --accent: #93c5fd;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #101827;
  touch-action: pan-y;
}

body {
  position: fixed;
  inset: 0;
  min-width: 320px;
  margin: 0;
  background-color: #101827;
  background-image: linear-gradient(180deg, rgb(23 35 58 / 76%) 0%, rgb(16 24 39 / 82%) 52%, rgb(12 20 34 / 88%) 100%);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}

button,
a,
input,
select,
textarea,
label {
  touch-action: manipulation;
}

img {
  -webkit-user-drag: none;
  user-select: none;
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(100%, var(--app-max-width));
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) calc(112px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  background-image:
    linear-gradient(180deg, rgb(23 35 58 / 76%) 0%, rgb(16 24 39 / 82%) 52%, rgb(12 20 34 / 88%) 100%),
    url("./images/ui/ui-tex.webp");
  background-repeat: no-repeat, repeat;
  background-position: center, center top;
  background-size: 100% 100%, 152px auto;
  background-attachment: local, local;
}

.app-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 4px 2px 24px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #dbeafe;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-mark img {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  padding: 5px;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1 {
  font-family: "Clash Royale", system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.eyebrow,
.section-kicker,
.card-label {
  margin: 0;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 3px 0 0;
  font-size: clamp(1.35rem, 6vw, 1.9rem);
  line-height: 1.05;
}

.app-content {
  width: 100%;
}

.app-view {
  animation: view-enter 160ms ease-out;
}

.view-heading {
  display: flex;
  min-height: 130px;
  padding: 26px 24px;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgb(0 0 0 / 22%);
}

.view-heading h2 {
  margin: 7px 0 0;
  font-size: clamp(2rem, 11vw, 3.3rem);
  line-height: 0.98;
}

.view-heading p:last-child {
  max-width: 38rem;
  margin: 16px 0 0;
  color: #cbd5e1;
  line-height: 1.6;
}

.today-view-heading {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 130px;
  gap: 20px;
  align-items: stretch;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.today-heading-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
}

.today-heading-copy h2 {
  overflow-wrap: normal;
  white-space: nowrap;
}

.today-view-heading[data-phase="training"] {
  border-color: rgb(115 213 169 / 34%);
  background:
    radial-gradient(circle at 90% 12%, rgb(115 213 169 / 12%), transparent 38%),
    var(--surface);
  box-shadow: inset 0 1px 0 rgb(196 255 228 / 8%), 0 24px 60px rgb(0 0 0 / 22%);
}

.today-view-heading[data-phase="war"] {
  border-color: rgb(195 158 248 / 34%);
  background:
    radial-gradient(circle at 90% 12%, rgb(178 115 247 / 13%), transparent 38%),
    var(--surface);
  box-shadow: inset 0 1px 0 rgb(239 224 255 / 8%), 0 24px 60px rgb(0 0 0 / 22%);
}

.today-phase-countdown {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 72px;
  align-self: center;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid rgb(147 197 253 / 24%);
  border-radius: 20px;
  background: rgb(8 15 27 / 48%);
}

#today-phase-countdown[hidden],
.today-phase-countdown[data-phase="idle"],
.today-phase-countdown.is-preparing {
  display: grid !important;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.82);
}

.today-phase-countdown.is-entering {
  animation: today-countdown-pop 420ms cubic-bezier(0.2, 1.45, 0.4, 1) both;
}

.today-phase-icon {
  display: grid;
  width: 54px;
  min-height: 72px;
  place-items: center;
  border-right: 1px solid rgb(255 255 255 / 10%);
}

.today-phase-icon img {
  display: block;
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.today-phase-countdown-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 5px 11px;
}

.today-phase-countdown-copy small,
.today-phase-countdown-copy strong {
  display: block;
  min-width: 0;
  overflow-wrap: normal;
  white-space: nowrap;
}

.today-phase-countdown-copy small {
  overflow: hidden;
  color: #a9b6c9;
  font-size: clamp(0.62rem, 2.75vw, 0.78rem);
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
}

.today-phase-countdown-copy strong {
  color: #f8fafc;
  font-size: clamp(1.02rem, 4.5vw, 1.3rem);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.today-phase-countdown[data-phase="training"] {
  border-color: rgb(115 213 169 / 36%);
}

.today-phase-countdown[data-phase="training"] .today-phase-icon {
  background: linear-gradient(145deg, rgb(115 213 169 / 42%), rgb(50 114 82 / 34%));
}

.today-phase-countdown[data-phase="training"] .today-phase-countdown-copy strong {
  color: #c8f9df;
}

.today-phase-countdown[data-phase="war"] {
  border-color: rgb(195 158 248 / 38%);
}

.today-phase-countdown[data-phase="war"] .today-phase-icon {
  background: linear-gradient(145deg, rgb(195 158 248 / 42%), rgb(135 70 205 / 34%));
}

.today-phase-countdown[data-phase="war"] .today-phase-countdown-copy strong {
  color: #eadcff;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.summary-card,
.content-card {
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.summary-card {
  min-height: 150px;
  padding: 20px;
  border-radius: 22px;
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.summary-card strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(1.9rem, 9vw, 2.8rem);
  line-height: 1;
}

#today-battles-value,
#today-medals-value {
  font-size: clamp(1.25rem, 6.7vw, 2.25rem);
  letter-spacing: -0.025em;
  overflow-wrap: normal;
  white-space: nowrap;
}

.summary-card small {
  display: block;
  margin-top: 18px;
  color: #8794a8;
  line-height: 1.35;
}

.content-card {
  margin-top: 14px;
  padding: 24px;
  border-radius: 24px;
}

.content-card h3 {
  margin: 8px 0 0;
  font-size: 1.25rem;
  line-height: 1.25;
}

.content-card p:last-child {
  margin: 12px 0 0;
  color: #cbd5e1;
  line-height: 1.6;
}

.empty-state {
  display: grid;
  min-height: 240px;
  align-content: center;
  justify-items: start;
}

.empty-state-mark {
  display: grid;
  min-width: 58px;
  height: 58px;
  padding: 0 12px;
  place-items: center;
  border: 1px solid rgb(147 197 253 / 28%);
  border-radius: 18px;
  color: #bfdbfe;
  font-weight: 800;
}

.settings-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 7px rgb(74 222 128 / 12%);
}

.bottom-nav {
  position: fixed;
  z-index: 10;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  left: max(12px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(calc(100% - 24px), calc(var(--app-max-width) - 24px));
  margin: 0 auto;
  padding: 8px;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 24px;
  background: rgb(8 15 27 / 92%);
  box-shadow: 0 18px 48px rgb(0 0 0 / 44%);
  backdrop-filter: blur(18px);
}

.nav-item {
  min-width: 0;
  min-height: 66px;
  padding: 7px 4px 8px;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: #8f9caf;
  cursor: pointer;
  font-size: clamp(0.68rem, 2.8vw, 0.78rem);
  font-weight: 700;
}

.nav-item span {
  display: block;
}

.nav-icon {
  display: grid !important;
  width: 31px;
  height: 31px;
  margin: 0 auto 4px;
  place-items: center;
  pointer-events: none;
}

.nav-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.58;
  filter: saturate(0.76) brightness(0.9);
  transform: scale(0.94);
  transition: opacity 140ms ease, filter 140ms ease, transform 140ms ease;
}

.nav-item.is-active {
  background: rgb(59 130 246 / 18%);
  color: #dbeafe;
}

.nav-item.is-active .nav-icon img {
  opacity: 1;
  filter: none;
  transform: scale(1.04);
}

.nav-item[data-target="today"][data-phase="training"].is-active {
  border: 1px solid rgb(115 213 169 / 62%);
  background: linear-gradient(145deg, rgb(89 175 134 / 46%), rgb(50 114 82 / 30%));
  box-shadow: inset 0 1px 0 rgb(210 255 235 / 14%), 0 8px 24px rgb(50 114 82 / 18%);
  color: #effff7;
}

.nav-item[data-target="today"][data-phase="training"].is-active .nav-icon img {
  filter: drop-shadow(0 3px 7px rgb(50 114 82 / 42%));
}

.nav-item[data-target="today"][data-phase="training"]:not(.is-active) .nav-icon img {
  opacity: 0.82;
  filter: saturate(0.92) drop-shadow(0 2px 5px rgb(50 114 82 / 28%));
}

.nav-item[data-target="today"][data-phase="training"]:not(.is-active) #today-nav-label {
  color: #8fd8b4;
}

.nav-item[data-target="today"][data-phase="war"].is-active {
  border: 1px solid rgb(195 158 248 / 62%);
  background: linear-gradient(145deg, rgb(178 115 247 / 48%), rgb(135 70 205 / 32%));
  box-shadow: inset 0 1px 0 rgb(238 224 255 / 14%), 0 8px 24px rgb(135 70 205 / 20%);
  color: #fbf7ff;
}

.nav-item[data-target="today"][data-phase="war"].is-active .nav-icon img {
  filter: drop-shadow(0 3px 7px rgb(135 70 205 / 46%));
}

.nav-item[data-target="today"][data-phase="war"]:not(.is-active) .nav-icon img {
  opacity: 0.84;
  filter: saturate(0.96) drop-shadow(0 2px 5px rgb(135 70 205 / 30%));
}

.nav-item[data-target="today"][data-phase="war"]:not(.is-active) #today-nav-label {
  color: #c6a3f7;
}

#today-nav-label {
  overflow-wrap: normal;
  white-space: nowrap;
}

.nav-item:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes today-countdown-pop {
  0% {
    visibility: visible;
    opacity: 0;
    transform: scale(0.72);
  }

  72% {
    opacity: 1;
    transform: scale(1.05);
  }

  100% {
    visibility: visible;
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 390px) {
  .app-shell {
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
  }

  .app-header {
    gap: 10px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
  }

  .view-heading,
  .content-card {
    padding: 21px;
  }

  .summary-card {
    min-height: 140px;
    padding: 17px;
  }
}

@media (min-width: 721px) {
  .bottom-nav {
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-view {
    animation: none;
  }

  .today-phase-countdown {
    animation: none;
  }
}

.today-status-card {
  min-height: 320px;
}

.card-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.refresh-button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid rgb(147 197 253 / 28%);
  border-radius: 14px;
  background: rgb(59 130 246 / 14%);
  color: #dbeafe;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 750;
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.refresh-button:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.today-details {
  display: grid;
  gap: 0;
  margin: 22px 0 0;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 46px;
  border-top: 1px solid rgb(255 255 255 / 8%);
}

.detail-row dt {
  color: var(--muted);
  font-size: 0.88rem;
}

.detail-row dd {
  margin: 0;
  color: #f8fafc;
  font-weight: 750;
  text-align: right;
}

.content-card .data-meta {
  margin: 18px 0 0;
  color: #8794a8;
  font-size: 0.78rem;
  line-height: 1.45;
}

.summary-card[data-state="loading"] strong,
.today-status-card[data-state="loading"] h3,
.today-status-card[data-state="loading"] dd {
  color: #94a3b8;
}

.today-status-card[data-state="error"] {
  border-color: rgb(248 113 113 / 32%);
}

.today-status-card[data-state="error"] h3,
.today-status-card[data-state="error"] .data-meta {
  color: #fecaca;
}

@media (max-width: 390px) {
  .card-heading-row {
    gap: 12px;
  }

  .refresh-button {
    padding: 8px 10px;
  }

  .detail-row {
    gap: 14px;
  }
}

.today-status-card[data-state="stale"] {
  border-color: rgb(251 191 36 / 30%);
}

.today-status-card[data-state="stale"] .data-meta {
  color: #fde68a;
}


.profile-picker-card {
  min-height: 150px;
}

.field-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.profile-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.profile-select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 38px 9px 12px;
  border: 1px solid rgb(147 197 253 / 28%);
  border-radius: 14px;
  background: rgb(8 15 27 / 72%);
  color: #f8fafc;
  font: inherit;
  font-size: 1rem;
}

.profile-select:disabled {
  color: #8794a8;
  opacity: 0.72;
}

.profile-select:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.profile-picker-card[data-state="error"] {
  border-color: rgb(248 113 113 / 32%);
}

.profile-picker-card[data-state="error"] .data-meta {
  color: #fecaca;
}

.profile-picker-card[data-state="stale"] {
  border-color: rgb(251 191 36 / 30%);
}

.profile-picker-card[data-state="stale"] .data-meta {
  color: #fde68a;
}

.profile-hero-avatar {
  display: flex;
  width: clamp(90px, 24vw, 124px);
  height: clamp(108px, 29vw, 150px);
  align-items: center;
  justify-content: flex-end;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.profile-hero-avatar img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgb(0 0 0 / 30%));
}

.profile-hero-avatar-fallback {
  color: #dbeafe;
  font-size: 1.15rem;
  font-weight: 850;
  letter-spacing: 0.07em;
}

.profile-card,
.profile-stats-card {
  min-height: 0;
}

.profile-card-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.profile-war-badge {
  display: grid;
  width: 96px;
  height: 96px;
  place-items: center;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.profile-war-badge img {
  display: block;
  width: 88%;
  height: 88%;
  object-fit: contain;
  filter: drop-shadow(0 7px 9px rgb(0 0 0 / 32%));
}

.profile-war-badge-fallback {
  color: #cbd5e1;
  font-size: 1.2rem;
  font-weight: 850;
}

.profile-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.profile-identity-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.profile-identity-copy .card-label {
  white-space: nowrap;
}

.profile-identity-copy h3 {
  font-family: "Clash Royale", system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
  word-break: normal;
}

.profile-role-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 30px;
  margin-top: 10px;
  padding: 5px 11px;
  align-items: center;
  gap: 7px;
  border: 1px solid rgb(147 197 253 / 30%);
  border-radius: 999px;
  background: rgb(59 130 246 / 12%);
  color: #dbeafe;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.1;
}

.profile-role-badge[data-role]::before {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  content: "";
}

.profile-role-badge[data-role="leader"]::before {
  background-image: url("./images/roles/leader.webp");
}

.profile-role-badge[data-role="co-leader"]::before {
  background-image: url("./images/roles/co-leader.webp");
}

.profile-role-badge[data-role="elder"]::before {
  background-image: url("./images/roles/elder.webp");
}

.profile-role-badge[data-role="member"]::before {
  background-image: url("./images/roles/member.webp");
}

.profile-details {
  display: grid;
  gap: 0;
  margin: 22px 0 0;
}

.profile-gdc-stats {
  margin-top: 16px;
  border-top: 1px solid rgb(255 255 255 / 9%);
}

.profile-gdc-stats .detail-row {
  min-height: 58px;
}

.profile-gdc-stats dt {
  min-width: 0;
  flex: 1 1 auto;
  padding-right: 18px;
}

.profile-gdc-stats dd {
  flex: 0 0 auto;
  text-align: right;
}

.profile-analysis-card {
  min-height: 0;
}

.profile-analysis {
  padding-top: 0;
  border-top: 0;
}

.profile-analysis-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.profile-analysis-heading h4 {
  margin: 4px 0 0;
  color: #f8fafc;
  font-size: clamp(1.25rem, 4.5vw, 1.65rem);
  line-height: 1.05;
}

.profile-analysis-score {
  display: grid;
  justify-items: end;
  gap: 5px;
  text-align: right;
}

.profile-analysis-score strong {
  color: #f8fafc;
  font-size: 1.05rem;
  font-weight: 900;
  white-space: nowrap;
}

.profile-analysis-score span,
.profile-analysis-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgb(147 197 253 / 26%);
  border-radius: 999px;
  background: rgb(59 130 246 / 12%);
  color: #bfdbfe;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.15;
}

.profile-analysis-score span[data-state="good"],
.profile-analysis-badge[data-state="good"] {
  border-color: rgb(74 222 128 / 32%);
  background: rgb(34 197 94 / 12%);
  color: #bbf7d0;
}

.profile-analysis-score span[data-state="warn"],
.profile-analysis-badge[data-state="warn"] {
  border-color: rgb(251 191 36 / 32%);
  background: rgb(245 158 11 / 12%);
  color: #fde68a;
}

.profile-analysis-score span[data-state="bad"],
.profile-analysis-badge[data-state="bad"] {
  border-color: rgb(248 113 113 / 34%);
  background: rgb(239 68 68 / 12%);
  color: #fecaca;
}

.profile-analysis-body {
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.profile-radar {
  width: 100%;
  max-width: 330px;
  justify-self: center;
}

.profile-radar svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.profile-radar-grid {
  fill: none;
  stroke: rgb(255 255 255 / 16%);
  stroke-width: 1;
}

.profile-radar-axis {
  stroke: rgb(255 255 255 / 18%);
  stroke-width: 1;
}

.profile-radar-shape {
  fill: rgb(255 86 99 / 35%);
  stroke: rgb(255 255 255 / 72%);
  stroke-width: 2;
}

.profile-radar-point {
  fill: #fff;
  stroke: #ff5663;
  stroke-width: 1.5;
}

.profile-radar-label {
  fill: #dbeafe;
  font-size: 10px;
  font-weight: 800;
  text-anchor: middle;
}

.profile-analysis-metrics {
  display: grid;
  gap: 8px;
}

.profile-analysis-metric {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid rgb(255 255 255 / 11%);
  border-radius: 13px;
  background: rgb(8 15 27 / 34%);
}

.profile-analysis-metric span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-analysis-metric strong {
  color: #f8fafc;
  font-size: 0.9rem;
  font-weight: 900;
  white-space: nowrap;
}

.profile-analysis-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.profile-analysis-empty {
  margin-top: 0;
  padding: 16px;
  border: 1px dashed rgb(147 197 253 / 22%);
  border-radius: 16px;
  background: rgb(8 15 27 / 22%);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}


.profile-history-card {
  min-height: 0;
}

.profile-history-heading h4 {
  margin: 4px 0 0;
  color: #f8fafc;
  font-size: clamp(1.25rem, 4.5vw, 1.65rem);
  line-height: 1.05;
}

.profile-history-table-wrap {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 11%);
  border-radius: 16px;
  background: rgb(8 15 27 / 34%);
}

.profile-history-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.profile-history-table th,
.profile-history-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
  white-space: nowrap;
}

.profile-history-table th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-history-table tbody tr:last-child td {
  border-bottom: 0;
}

.profile-history-table th:first-child,
.profile-history-table td:first-child {
  width: 40%;
}

.profile-history-gdc {
  color: #e2e8f0;
  font-weight: 800;
  text-align: left;
  vertical-align: middle;
}

.profile-history-gdc img {
  display: inline-block;
  width: 26px;
  height: 26px;
  margin-right: 8px;
  object-fit: contain;
  vertical-align: middle;
}

.profile-history-battles {
  color: #e2e8f0;
  font-weight: 850;
  text-align: center;
}

.profile-history-battles[data-state="complete"] { color: #bbf7d0; }
.profile-history-battles[data-state="partial"] { color: #fde68a; }
.profile-history-battles[data-state="missed"] { color: #fecaca; }

.profile-history-medals {
  color: #f8fafc;
  font-weight: 850;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.profile-history-empty {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.profile-empty-state {
  min-height: 210px;
}

@media (max-width: 560px) {
  .profile-hero-avatar {
    width: clamp(82px, 23vw, 104px);
    height: clamp(100px, 28vw, 128px);
  }

  .profile-card-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
  }

  .profile-war-badge {
    width: 88px;
    height: 88px;
    border-radius: 21px;
  }

  .profile-gdc-stats .detail-row {
    align-items: center;
    gap: 12px;
  }

  .profile-gdc-stats dt {
    padding-right: 0;
  }

  .profile-picker-row {
    grid-template-columns: 1fr;
  }

  .profile-picker-row .refresh-button {
    width: 100%;
  }

  .profile-analysis-heading {
    align-items: flex-start;
  }

  .profile-history-table th,
  .profile-history-table td {
    padding: 10px 9px;
    font-size: 0.78rem;
  }

  .profile-history-gdc img {
    width: 23px;
    height: 23px;
    margin-right: 6px;
  }

  .profile-analysis-body {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .profile-radar {
    max-width: 300px;
  }

  .profile-analysis-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

.clan-overview-card {
  min-height: 300px;
}

.clan-overview-details {
  display: grid;
  gap: 0;
  margin: 22px 0 0;
}

.clan-race-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.clan-race-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 18px;
  background: rgb(15 23 42 / 48%);
}

.clan-race-row.is-home {
  border-color: rgb(251 191 36 / 58%);
  background: linear-gradient(145deg, rgb(146 98 22 / 38%), rgb(72 47 16 / 30%));
  box-shadow: inset 0 0 0 1px rgb(253 224 71 / 9%);
}

.clan-race-row-header {
  display: grid;
  grid-template-columns: 36px 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.clan-race-rank {
  display: flex;
  width: 36px;
  height: 36px;
  padding: 3px 0 0;
  align-items: center;
  justify-content: center;
  border: 1px solid rgb(147 197 253 / 28%);
  border-radius: 11px;
  background: rgb(59 130 246 / 13%);
  color: #f8fafc;
  font-family: "Clash Royale", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1;
  text-align: center;
}

.clan-race-row[data-rank="1"] .clan-race-rank {
  border-color: rgb(253 224 71 / 58%);
  background: rgb(234 179 8 / 22%);
}

.clan-race-row[data-rank="2"] .clan-race-rank {
  border-color: rgb(203 213 225 / 48%);
  background: rgb(148 163 184 / 17%);
}

.clan-race-row[data-rank="3"] .clan-race-rank {
  border-color: rgb(251 146 60 / 50%);
  background: rgb(194 65 12 / 19%);
}

.clan-race-emblem {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #94a3b8;
  font-size: 1.1rem;
}

.clan-race-emblem img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform: translateY(-3px);
}

.clan-race-emblem.is-fallback {
  border: 1px solid rgb(255 255 255 / 11%);
  border-radius: 12px;
  background: rgb(15 23 42 / 38%);
}

.clan-race-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.clan-race-identity strong {
  min-width: 0;
  overflow: hidden;
  color: #f8fafc;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clan-race-score {
  color: #f8fafc;
  font-family: "Clash Royale", system-ui, sans-serif;
  font-size: clamp(0.92rem, 4.2vw, 1.18rem);
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.clan-race-progress {
  position: relative;
  height: 9px;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 999px;
  background: rgb(148 163 184 / 18%);
}

.clan-race-progress-current,
.clan-race-progress-projected {
  position: absolute;
  top: 0;
  bottom: 0;
}

.clan-race-progress-current {
  left: 0;
  background: linear-gradient(90deg, #168dd5, #36b7ef);
}

.clan-race-progress-projected {
  background: linear-gradient(90deg, rgb(125 211 252 / 78%), rgb(186 230 253 / 72%));
}

.clan-race-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #a9b6c9;
  font-size: 0.74rem;
  line-height: 1.2;
}

.clan-race-meta span:last-child {
  color: #dbeafe;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

.clan-race-placeholder {
  padding: 16px 0 2px;
}

@media (max-width: 390px) {
  .clan-race-row {
    gap: 9px;
    padding: 12px;
  }

  .clan-race-row-header {
    grid-template-columns: 32px 28px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .clan-race-rank {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 0.92rem;
  }

  .clan-race-emblem {
    width: 28px;
    height: 28px;
  }

  .clan-race-identity strong {
    font-size: 0.82rem;
  }

  .clan-race-score {
    font-size: clamp(0.82rem, 4vw, 1rem);
  }

  .clan-race-meta {
    font-size: 0.68rem;
  }
}

.clan-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.count-badge {
  display: grid;
  min-width: 42px;
  min-height: 34px;
  padding: 6px 10px;
  place-items: center;
  border: 1px solid rgb(147 197 253 / 28%);
  border-radius: 999px;
  background: rgb(59 130 246 / 12%);
  color: #dbeafe;
  font-size: 0.82rem;
  font-weight: 800;
}

.member-list {
  display: grid;
  gap: 0;
  margin-top: 18px;
}

.member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 64px;
  padding: 12px 0;
  border-top: 1px solid rgb(255 255 255 / 8%);
}

.member-row-identity,
.member-row-activity {
  min-width: 0;
}

.member-row-identity strong,
.member-row-identity span,
.member-row-activity strong,
.member-row-activity span {
  display: block;
}

.member-row-identity strong {
  overflow-wrap: anywhere;
  font-size: 0.94rem;
}

.member-row-identity span,
.member-row-activity span {
  margin-top: 4px;
  color: #8794a8;
  font-size: 0.76rem;
  line-height: 1.35;
}

.member-row-activity {
  text-align: right;
}

.member-row-activity strong {
  color: #f8fafc;
  font-size: 1rem;
}

.list-placeholder {
  margin: 0;
  padding: 18px 0 2px;
  color: #8794a8;
  line-height: 1.55;
}

.clan-overview-card[data-state="loading"] h3,
.clan-overview-card[data-state="loading"] dd,
.clan-list-card[data-state="loading"] .count-badge {
  color: #94a3b8;
}

.clan-overview-card[data-state="error"],
.clan-list-card[data-state="error"] {
  border-color: rgb(248 113 113 / 32%);
}

.clan-overview-card[data-state="error"] h3,
.clan-overview-card[data-state="error"] .data-meta {
  color: #fecaca;
}

.clan-overview-card[data-state="stale"],
.clan-list-card[data-state="stale"] {
  border-color: rgb(251 191 36 / 30%);
}

.clan-overview-card[data-state="stale"] .data-meta {
  color: #fde68a;
}

@media (max-width: 390px) {
  .member-row {
    gap: 10px;
  }

  .member-row-identity span {
    font-size: 0.72rem;
  }
}



.today-personal-heading {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.today-personal-heading .card-label {
  min-width: 0;
  padding-top: 7px;
}

.today-personal-status-row {
  flex: 0 0 auto;
  margin: 0;
}

.today-personal-status {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 6px 11px;
  border: 1px solid rgb(148 163 184 / 24%);
  border-radius: 999px;
  background: rgb(15 23 42 / 54%);
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 800;
}

.today-personal-status[data-state="loading"],
.today-personal-status[data-state="refreshing"] {
  border-color: rgb(147 197 253 / 30%);
  background: rgb(59 130 246 / 13%);
  color: #bfdbfe;
}

.today-personal-status[data-state="complete"] {
  border-color: rgb(74 222 128 / 30%);
  background: rgb(34 197 94 / 12%);
  color: #bbf7d0;
}

.today-personal-status[data-state="pending"],
.today-personal-status[data-state="stale"] {
  border-color: rgb(251 191 36 / 32%);
  background: rgb(245 158 11 / 12%);
  color: #fde68a;
}

.today-personal-status[data-state="inactive"] {
  border-color: rgb(148 163 184 / 25%);
  background: rgb(100 116 139 / 12%);
  color: #cbd5e1;
}

.today-personal-status[data-state="error"] {
  border-color: rgb(248 113 113 / 32%);
  background: rgb(239 68 68 / 12%);
  color: #fecaca;
}

.today-personal-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.today-personal-stat {
  min-width: 0;
  min-height: 96px;
  padding: 14px 12px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 17px;
  background: rgb(8 15 27 / 34%);
}

.today-personal-stat span,
.today-personal-stat strong {
  display: block;
}

.today-personal-stat span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
  line-height: 1.35;
}

.today-personal-stat strong {
  margin-top: 11px;
  font-size: clamp(1.25rem, 6vw, 1.85rem);
  line-height: 1;
}

.today-personal-card[data-state="error"] {
  border-color: rgb(248 113 113 / 32%);
}

.today-personal-card[data-state="stale"],
.today-personal-card[data-state="pending"] {
  border-color: rgb(251 191 36 / 26%);
}

.today-personal-card[data-state="complete"] {
  border-color: rgb(74 222 128 / 24%);
}

@media (max-width: 390px) {
  .today-personal-stat {
    min-height: 88px;
    padding: 12px 9px;
  }

  .today-personal-stat span {
    font-size: 0.7rem;
  }
}

/* v0.9.0 — lecture immédiate des obligations sur Aujourd’hui */
.today-status-card {
  min-height: 360px;
}

.today-guidance {
  display: grid;
  gap: 5px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgb(147 197 253 / 20%);
  border-radius: 17px;
  background: rgb(8 15 27 / 34%);
}

.today-guidance strong,
.today-guidance span {
  display: block;
}

.today-guidance strong {
  color: #f8fafc;
  font-size: 0.94rem;
  line-height: 1.3;
}

.today-guidance span {
  color: #a9b6c9;
  font-size: 0.78rem;
  line-height: 1.45;
}

.today-guidance[data-state="complete"] {
  border-color: rgb(74 222 128 / 24%);
  background: rgb(34 197 94 / 9%);
}

.today-guidance[data-state="complete"] strong {
  color: #bbf7d0;
}

.today-guidance[data-state="pending"],
.today-guidance[data-state="stale"] {
  border-color: rgb(251 191 36 / 28%);
  background: rgb(245 158 11 / 9%);
}

.today-guidance[data-state="pending"] strong,
.today-guidance[data-state="stale"] strong {
  color: #fde68a;
}

.today-guidance[data-state="warning"],
.today-guidance[data-state="error"] {
  border-color: rgb(248 113 113 / 30%);
  background: rgb(239 68 68 / 9%);
}

.today-guidance[data-state="warning"] strong,
.today-guidance[data-state="error"] strong {
  color: #fecaca;
}

.today-guidance[data-state="loading"] {
  opacity: 0.76;
}

.today-personal-status[data-state="training"] {
  border-color: rgb(115 213 169 / 34%);
  background: rgb(89 175 134 / 14%);
  color: #c8f9df;
}

.today-personal-status[data-state="warning"] {
  border-color: rgb(248 113 113 / 32%);
  background: rgb(239 68 68 / 12%);
  color: #fecaca;
}

.today-personal-stat {
  min-height: 118px;
}

.today-personal-stat small {
  display: block;
  margin-top: 10px;
  color: #8794a8;
  font-size: 0.68rem;
  line-height: 1.35;
}

.today-personal-stat[data-state="complete"] {
  border-color: rgb(74 222 128 / 22%);
  background: rgb(34 197 94 / 8%);
}

.today-personal-stat[data-state="warning"] {
  border-color: rgb(248 113 113 / 28%);
  background: rgb(239 68 68 / 8%);
}

.today-personal-stat[data-state="pending"],
.today-personal-stat[data-state="stale"] {
  border-color: rgb(251 191 36 / 24%);
  background: rgb(245 158 11 / 8%);
}

.today-personal-card[data-state="training"],
.summary-card[data-state="training"],
.today-status-card[data-state="training"] {
  border-color: rgb(115 213 169 / 28%);
}

.today-personal-card[data-state="war"],
.summary-card[data-state="war"],
.today-status-card[data-state="war"] {
  border-color: rgb(195 158 248 / 26%);
}

.today-status-card[data-state="training"],
.today-status-card[data-state="inactive"] {
  min-height: 0;
}

.today-personal-card[data-state="warning"] {
  border-color: rgb(248 113 113 / 30%);
}

.summary-card[data-state="inactive"] strong,
.summary-card[data-state="training"] strong {
  font-size: clamp(1.45rem, 7vw, 2.1rem);
}

.today-clan-guidance {
  margin-top: 22px;
}

@media (max-width: 480px) {
  .today-personal-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #today-personal-duel-stat {
    grid-column: 1 / -1;
  }

  .today-personal-stat {
    min-height: 108px;
  }
}

@media (max-width: 390px) {
  .today-guidance {
    padding: 13px 14px;
  }

  .today-personal-stat {
    padding: 13px 11px;
  }
}


/* v0.9.2 — identité visuelle des phases GDC */
@media (max-width: 420px) {
  .nav-icon {
    width: 29px;
    height: 29px;
  }

  #today-nav-label {
    position: relative;
    left: 50%;
    width: max-content;
    font-size: clamp(0.52rem, 2.35vw, 0.64rem);
    letter-spacing: -0.025em;
    text-align: center;
    transform: translateX(-50%);
  }

  .view-heading {
    min-height: 108px;
    padding: 22px 18px;
  }

  .today-view-heading {
    min-height: 108px;
    gap: 12px;
  }

  .today-heading-copy h2 {
    font-size: clamp(2.35rem, 11.5vw, 3.15rem);
  }

  .today-phase-countdown {
    grid-template-columns: 46px minmax(0, 1fr);
    min-height: 64px;
  }

  .today-phase-icon {
    width: 46px;
    min-height: 64px;
  }

  .today-phase-icon img {
    width: 40px;
    height: 40px;
  }

  .today-phase-countdown-copy {
    padding: 4px 8px;
  }

  .today-phase-countdown-copy small {
    font-size: clamp(0.58rem, 2.65vw, 0.7rem);
  }

  .today-phase-countdown-copy strong {
    font-size: clamp(0.96rem, 4.25vw, 1.2rem);
  }
}


/* v0.9.2.3 — avatar et badge GDC du joueur */
.profile-hero-avatar[hidden],
.profile-war-badge[hidden],
.profile-hero-avatar img[hidden],
.profile-avatar img[hidden],
.profile-war-badge img[hidden],
.profile-hero-avatar-fallback[hidden],
.profile-avatar-fallback[hidden],
.profile-war-badge-fallback[hidden] {
  display: none !important;
}

@media (max-width: 390px) {
  .profile-hero-avatar {
    width: 78px;
    border-radius: 22px;
  }

  .profile-war-badge {
    width: 82px;
    height: 82px;
    border-radius: 19px;
  }
}

@media (max-width: 390px) {
  .profile-analysis-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .profile-analysis-score span {
    max-width: 118px;
    white-space: normal;
  }

  .profile-analysis-metrics {
    grid-template-columns: 1fr;
  }
}

.clan-history-card { min-height: 0; }
.clan-history-table { margin-top: 18px; overflow: hidden; border: 1px solid rgb(255 255 255 / 12%); border-radius: 18px; background: rgb(8 15 27 / 28%); }
.clan-history-row { display: grid; grid-template-columns: minmax(120px, 1fr) 64px minmax(150px, 1fr); align-items: center; min-height: 58px; padding: 0 16px; border-bottom: 1px solid rgb(255 255 255 / 12%); }
.clan-history-row:last-child { border-bottom: 0; }
.clan-history-header { min-height: 48px; color: var(--muted); font-size: .78rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; text-align: center; }
.clan-history-gdc { display: flex; align-items: center; gap: 10px; text-align: left; }
.clan-history-gdc img { width: 28px; height: 28px; object-fit: contain; }
.clan-history-rank { text-align: center; font-weight: 850; }
.clan-history-trophies { display: flex; align-items: center; justify-content: flex-end; gap: 8px; text-align: right; white-space: nowrap; }
.clan-history-trophies small { min-width: 34px; color: var(--muted); font-weight: 800; text-align: right; }
.clan-history-trophies small[data-state="positive"] { color: #bbf7d0; }
.clan-history-trophies small[data-state="negative"] { color: #fecaca; }
.clan-history-trophies img { width: 25px; height: 25px; object-fit: contain; }
@media (max-width: 420px) {
  .clan-history-row { grid-template-columns: minmax(104px, 1fr) 48px minmax(126px, 1fr); padding: 0 11px; }
  .clan-history-gdc { gap: 7px; }
  .clan-history-gdc img { width: 24px; height: 24px; }
  .clan-history-trophies { gap: 5px; }
  .clan-history-trophies img { width: 22px; height: 22px; }
}


/* v0.9.3.33 — masque les icônes de phase jusqu'à résolution des données */
#today-phase-icon:not([src]),
#today-nav-icon:not([src]),
#today-phase-icon.is-preparing,
#today-nav-icon.is-preparing {
  visibility: hidden;
}


/* v0.9.3.39 — accomplissements GDC interactifs du profil */
.profile-badges-card {
  min-height: 0;
}

.profile-badges-heading {
  display: grid;
  gap: 4px;
}

.profile-badges-heading h4 {
  margin: 0;
  font-size: clamp(1.2rem, 3.8vw, 1.55rem);
}

.profile-badges-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.profile-achievement-badge {
  display: grid;
  min-width: 0;
  padding: 0;
  align-content: start;
  justify-items: center;
  border: 0;
  border-radius: 24px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  appearance: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.profile-achievement-visual {
  width: min(100%, 88px);
  height: auto;
  aspect-ratio: 1;
}

.profile-badges-grid .profile-war-badge {
  width: min(100%, 112px);
  height: auto;
  aspect-ratio: 1;
}

.profile-clean-days-visual {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgb(96 165 250 / 58%);
  border-radius: 24px;
  background:
    radial-gradient(circle at 30% 22%, rgb(147 197 253 / 34%), transparent 38%),
    linear-gradient(145deg, rgb(37 99 235 / 42%), rgb(15 23 42 / 92%));
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 8%),
    0 9px 18px rgb(0 0 0 / 24%);
}

#profile-clean-days-value {
  font-family: "Clash Royale", "Trebuchet MS", sans-serif;
  color: #f8fafc;
  font-size: clamp(1.55rem, 6vw, 2.3rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: 0 3px 0 rgb(15 23 42 / 72%);
}

.profile-clean-days-check {
  position: absolute;
  right: 8px;
  bottom: 7px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #22c55e;
  color: #052e16;
  font-size: 0.85rem;
  font-weight: 950;
  box-shadow: 0 3px 8px rgb(0 0 0 / 32%);
}

.profile-badges-grid .profile-war-badge img {
  width: 100%;
  height: 100%;
  transform: scale(1.34);
  transform-origin: center;
}

.profile-badges-grid .profile-duel-badge img {
  transform: scale(1.3);
}

.profile-war-badge-item {
  position: relative;
  z-index: 1;
}

/* Reflet diagonal limite au contour des badges Assiduite GDC legendaires. */
.profile-achievement-badge.has-legendary-assiduity-reflection .profile-assiduity-badge,
.profile-badge-dialog-visual.has-legendary-assiduity-reflection,
.profile-badge-celebration-visual.has-legendary-assiduity-reflection {
  --profile-legendary-assiduity-reflection-scale: 1;
  --profile-legendary-assiduity-spark-left: 31%;
  --profile-legendary-assiduity-spark-top: 37%;
  --profile-legendary-assiduity-spark-size: 24%;
  position: relative;
  isolation: isolate;
  overflow: visible;
}

.profile-achievement-badge.has-legendary-assiduity-reflection .profile-assiduity-badge {
  --profile-legendary-assiduity-reflection-scale: 1.34;
  --profile-legendary-assiduity-spark-left: 24.5%;
  --profile-legendary-assiduity-spark-top: 32.5%;
  --profile-legendary-assiduity-spark-size: 32%;
}

.profile-badge-dialog-visual.has-legendary-assiduity-reflection {
  --profile-legendary-assiduity-reflection-scale: 1.22;
  --profile-legendary-assiduity-spark-left: 27%;
  --profile-legendary-assiduity-spark-top: 34%;
  --profile-legendary-assiduity-spark-size: 29%;
}

.profile-badge-celebration-visual.has-legendary-assiduity-reflection {
  --profile-legendary-assiduity-reflection-scale: 1.08;
  --profile-legendary-assiduity-spark-left: 29.5%;
  --profile-legendary-assiduity-spark-top: 36%;
  --profile-legendary-assiduity-spark-size: 26%;
}

.profile-achievement-badge.has-legendary-assiduity-reflection .profile-assiduity-badge > img,
.profile-badge-dialog-visual.has-legendary-assiduity-reflection > img,
.profile-badge-celebration-visual.has-legendary-assiduity-reflection > img {
  position: relative;
  z-index: 1;
}

.profile-achievement-badge.has-legendary-assiduity-reflection .profile-assiduity-badge::before,
.profile-badge-dialog-visual.has-legendary-assiduity-reflection::before,
.profile-badge-celebration-visual.has-legendary-assiduity-reflection::before {
  position: absolute;
  z-index: 3;
  top: var(--profile-legendary-assiduity-spark-top);
  left: var(--profile-legendary-assiduity-spark-left);
  width: var(--profile-legendary-assiduity-spark-size);
  aspect-ratio: 1;
  content: "";
  pointer-events: none;
  background: url("./images/badges/eclat-de-lumiere.webp") center / contain no-repeat;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(0deg) scale(0.12);
  transform-origin: center;
  will-change: opacity, transform;
  animation: profile-legendary-assiduity-spark 5.925s linear infinite;
}

.profile-achievement-badge.has-legendary-assiduity-reflection .profile-assiduity-badge::after,
.profile-badge-dialog-visual.has-legendary-assiduity-reflection::after,
.profile-badge-celebration-visual.has-legendary-assiduity-reflection::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(
    135deg,
    transparent 36%,
    rgb(255 255 255 / 0%) 42%,
    rgb(255 255 255 / 42%) 47%,
    rgb(255 255 255 / 100%) 50%,
    rgb(224 242 254 / 72%) 53%,
    rgb(255 255 255 / 0%) 58%,
    transparent 64%
  );
  background-position: 0% 0%;
  background-size: 300% 300%;
  -webkit-mask-image: url("./images/badges/contour-badge-assiduite-level-7-8.webp");
  mask-image: url("./images/badges/contour-badge-assiduite-level-7-8.webp");
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  opacity: 0;
  filter: drop-shadow(0 0 4px rgb(255 255 255 / 76%));
  mix-blend-mode: screen;
  transform: scale(var(--profile-legendary-assiduity-reflection-scale));
  transform-origin: center;
  will-change: background-position, opacity;
  animation: profile-legendary-assiduity-reflection 5.925s ease-in-out infinite;
}

@keyframes profile-legendary-assiduity-reflection {
  0%,
  8.354% {
    background-position: 0% 0%;
    opacity: 0;
  }

  12.996% {
    opacity: 1;
  }

  31.561% {
    background-position: 100% 100%;
    opacity: 1;
  }

  36.203%,
  100% {
    background-position: 100% 100%;
    opacity: 0;
  }
}

@keyframes profile-legendary-assiduity-spark {
  0%,
  25.992% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(0deg) scale(0.12);
  }

  29.241% {
    opacity: 0.55;
    transform: translate(-50%, -50%) rotate(24deg) scale(0.58);
  }

  32.489% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(52deg) scale(1);
  }

  36.203% {
    opacity: 0.78;
    transform: translate(-50%, -50%) rotate(72deg) scale(0.7);
  }

  40.844%,
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(90deg) scale(0.12);
  }
}

.profile-achievement-badge:focus-visible {
  outline: 3px solid rgb(96 165 250 / 88%);
  outline-offset: 5px;
}

.profile-achievement-badge.is-newly-earned .profile-achievement-visual,
.profile-achievement-badge.is-newly-earned .profile-war-badge {
  animation: profile-new-badge-glow 1.55s ease-in-out infinite;
}

@keyframes profile-new-badge-glow {
  0%,
  100% {
    filter:
      drop-shadow(0 0 6px rgb(103 232 249 / 58%))
      drop-shadow(0 0 14px rgb(59 130 246 / 34%));
  }
  50% {
    filter:
      drop-shadow(0 0 10px rgb(165 243 252 / 96%))
      drop-shadow(0 0 25px rgb(34 211 238 / 76%))
      drop-shadow(0 0 38px rgb(59 130 246 / 48%));
  }
}

@media (hover: hover) and (pointer: fine) {
  .profile-achievement-badge:hover .profile-achievement-visual,
  .profile-achievement-badge:hover .profile-war-badge {
    transform: translateY(-3px) scale(1.03);
  }
}

.profile-achievement-badge:active .profile-achievement-visual,
.profile-achievement-badge:active .profile-war-badge {
  transform: scale(0.96);
}

@media (max-width: 390px) {
  .profile-badges-grid {
    gap: 9px;
  }

  .profile-achievement-visual {
    width: min(100%, 74px);
  }

  .profile-badges-grid .profile-war-badge {
    width: min(100%, 104px);
  }

  .profile-clean-days-visual {
    border-radius: 20px;
  }

  .profile-clean-days-check {
    right: 5px;
    bottom: 5px;
    width: 19px;
    height: 19px;
    font-size: 0.72rem;
  }
}

/* v0.9.3.39 — fenêtre de détail des badges, inspirée de la collection en jeu */
.profile-badge-dialog {
  width: min(430px, calc(100vw - 28px));
  max-width: none;
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 0;
  background: transparent;
  color: #f8fafc;
  overflow: visible;
}

.profile-badge-dialog::backdrop {
  background: rgb(2 6 23 / 82%);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.profile-badge-dialog[open] .profile-badge-dialog-surface {
  animation: profile-badge-dialog-pop 180ms cubic-bezier(0.2, 0.9, 0.24, 1.18) both;
}

@keyframes profile-badge-dialog-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.profile-badge-dialog-surface {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-height: calc(100dvh - 28px);
  padding: 30px 24px 24px;
  overflow: auto;
  border: 1px solid rgb(148 163 184 / 34%);
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% -12%, rgb(59 130 246 / 34%), transparent 42%),
    linear-gradient(160deg, rgb(26 47 78 / 98%), rgb(9 20 38 / 99%) 70%);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 7%),
    0 28px 70px rgb(0 0 0 / 58%);
  text-align: center;
}

.profile-badge-dialog-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid rgb(148 163 184 / 28%);
  border-radius: 50%;
  background: rgb(15 23 42 / 76%);
  color: #e2e8f0;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.profile-badge-dialog-close:focus-visible {
  outline: 3px solid rgb(96 165 250 / 88%);
  outline-offset: 2px;
}

.profile-badge-dialog-visual {
  display: grid;
  width: 154px;
  height: 154px;
  margin: 0 auto 8px;
  place-items: center;
}

.profile-badge-dialog-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.22);
  filter: drop-shadow(0 14px 16px rgb(0 0 0 / 40%));
}

.profile-badge-dialog-clean-days {
  position: relative;
  display: grid;
  width: 122px;
  height: 122px;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgb(96 165 250 / 72%);
  border-radius: 32px;
  background:
    radial-gradient(circle at 30% 22%, rgb(147 197 253 / 38%), transparent 38%),
    linear-gradient(145deg, rgb(37 99 235 / 56%), rgb(15 23 42 / 96%));
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 11%),
    0 14px 24px rgb(0 0 0 / 34%);
}

.profile-badge-dialog-clean-days strong {
  font-family: "Clash Royale", "Trebuchet MS", sans-serif;
  color: #f8fafc;
  font-size: 3.1rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: 0 4px 0 rgb(15 23 42 / 72%);
}

.profile-badge-dialog-clean-days span {
  position: absolute;
  right: 10px;
  bottom: 9px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #22c55e;
  color: #052e16;
  font-size: 1rem;
  font-weight: 950;
  box-shadow: 0 4px 10px rgb(0 0 0 / 38%);
}

.profile-badge-dialog-rarity {
  width: fit-content;
  margin: 0 auto 10px;
  padding: 6px 12px;
  border: 1px solid rgb(96 165 250 / 42%);
  border-radius: 999px;
  background: rgb(37 99 235 / 18%);
  color: #93c5fd;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-badge-dialog-rarity[data-rarity="common"] {
  border-color: rgb(203 213 225 / 42%);
  background: rgb(100 116 139 / 20%);
  color: #e2e8f0;
}

.profile-badge-dialog-rarity[data-rarity="rare"] {
  border-color: rgb(96 165 250 / 42%);
  background: rgb(37 99 235 / 18%);
  color: #93c5fd;
}

.profile-badge-dialog-rarity[data-rarity="epic"] {
  border-color: rgb(192 132 252 / 48%);
  background: rgb(126 34 206 / 20%);
  color: #d8b4fe;
}

.profile-badge-dialog-rarity[data-rarity="legendary"] {
  border-color: rgb(250 204 21 / 52%);
  background: rgb(202 138 4 / 20%);
  color: #fde68a;
}

.profile-badge-dialog h2 {
  margin: 0;
  font-family: "Clash Royale", system-ui, sans-serif;
  color: #f8fafc;
  font-size: clamp(1.7rem, 7vw, 2.2rem);
  line-height: 1.05;
}

.profile-badge-dialog-milestone {
  margin: 12px 0 0;
  color: #facc15;
  font-size: clamp(1rem, 4vw, 1.18rem);
  font-weight: 900;
  line-height: 1.25;
  white-space: pre-line;
}

.profile-badge-dialog-description {
  margin: 14px auto 0;
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.5;
}

.profile-badge-dialog-details {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
}

.profile-badge-dialog-details[hidden] {
  display: none !important;
}

.profile-badge-dialog-details > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgb(15 23 42 / 52%);
}

.profile-badge-dialog-details dt,
.profile-badge-dialog-details dd {
  margin: 0;
}

.profile-badge-dialog-details dt {
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 700;
}

.profile-badge-dialog-details dd {
  color: #f8fafc;
  font-size: 0.86rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.profile-badge-dialog-progress {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid rgb(148 163 184 / 22%);
  border-radius: 20px;
  background: rgb(2 6 23 / 38%);
  text-align: left;
}

.profile-badge-dialog-progress[hidden] {
  display: none !important;
}

.profile-badge-dialog-progress-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-badge-dialog-progress-heading strong {
  color: #f8fafc;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
}

.profile-badge-dialog-progress-track {
  height: 16px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgb(15 23 42 / 74%);
  border-radius: 999px;
  background: rgb(15 23 42 / 88%);
  box-shadow: inset 0 2px 5px rgb(0 0 0 / 40%);
}

.profile-badge-dialog-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgb(125 211 252 / 98%), rgb(37 99 235 / 98%));
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 44%),
    0 0 12px rgb(59 130 246 / 52%);
  transition: width 320ms ease-out;
}

.profile-badge-dialog-progress > p {
  margin: 9px 0 0;
  color: #94a3b8;
  font-size: 0.78rem;
  line-height: 1.35;
}

@media (max-width: 390px) {
  .profile-badge-dialog {
    width: min(392px, calc(100vw - 20px));
    max-height: calc(100dvh - 20px);
  }

  .profile-badge-dialog-surface {
    max-height: calc(100dvh - 20px);
    padding: 26px 19px 20px;
    border-radius: 26px;
  }

  .profile-badge-dialog-visual {
    width: 138px;
    height: 138px;
  }

  .profile-badge-dialog-description {
    font-size: 0.9rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .profile-badge-dialog[open] .profile-badge-dialog-surface {
    animation: none;
  }

  .profile-badge-dialog-progress-track span {
    transition: none;
  }
}

/* v0.9.3.46 — célébration plein écran des badges débloqués ou améliorés */
.profile-badge-celebration {
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f8fafc;
  overflow: hidden;
}

.profile-badge-celebration::backdrop {
  background: #06152f;
}

.profile-badge-celebration-surface {
  position: relative;
  isolation: isolate;
  display: grid;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding:
    max(38px, env(safe-area-inset-top))
    max(22px, env(safe-area-inset-right))
    max(30px, env(safe-area-inset-bottom))
    max(22px, env(safe-area-inset-left));
  grid-template-rows: minmax(140px, 22dvh) auto auto minmax(18px, 1fr) auto;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgb(23 35 58 / 76%) 0%, rgb(16 24 39 / 82%) 52%, rgb(12 20 34 / 88%) 100%),
    url("./images/ui/ui-tex.webp");
  background-color: #101827;
  background-repeat: no-repeat, repeat;
  background-position: center, center top;
  background-size: 100% 100%, clamp(106.667px, 33.333vw, 240px) auto;
}

.profile-badge-celebration-surface::before {
  position: absolute;
  z-index: -3;
  inset: 0;
  background: radial-gradient(
    circle at 50% 42%,
    transparent 0 24%,
    rgb(3 18 43 / 12%) 52%,
    rgb(3 18 43 / 52%) 100%
  );
  content: "";
}

.profile-badge-celebration-close {
  position: absolute;
  z-index: 8;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid rgb(191 219 254 / 34%);
  border-radius: 50%;
  background: rgb(3 18 43 / 56%);
  color: #dbeafe;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.profile-badge-dialog-close,
.profile-badge-celebration-close {
  font-size: 0;
  line-height: 0;
}

.profile-badge-dialog-close::before,
.profile-badge-dialog-close::after,
.profile-badge-celebration-close::before,
.profile-badge-celebration-close::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 19px;
  height: 3px;
  border-radius: 999px;
  background: currentcolor;
  content: "";
}

.profile-badge-dialog-close::before,
.profile-badge-celebration-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.profile-badge-dialog-close::after,
.profile-badge-celebration-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.profile-badge-celebration-close:focus-visible,
.profile-badge-celebration-continue:focus-visible {
  outline: 3px solid #bfdbfe;
  outline-offset: 3px;
}

.profile-badge-celebration-copy {
  position: relative;
  z-index: 4;
  grid-row: 1;
  align-self: end;
  text-align: center;
  text-shadow: 0 4px 0 rgb(4 19 44 / 58%);
}

.profile-badge-celebration-copy p {
  margin: 0 0 9px;
  color: #facc15;
  font-size: clamp(0.82rem, 3.4vw, 1rem);
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.profile-badge-celebration-copy h2 {
  margin: 0;
  font-family: "Clash Royale", system-ui, sans-serif;
  color: #f8fafc;
  font-size: clamp(2rem, 9.5vw, 3.8rem);
  line-height: 0.95;
}

.profile-badge-celebration-stage {
  position: relative;
  z-index: 3;
  isolation: isolate;
  grid-row: 2;
  width: min(58vw, 280px);
  height: min(58vw, 280px);
  align-self: center;
}

.profile-badge-celebration-stage::before {
  position: absolute;
  z-index: -1;
  inset: -34%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgb(45 255 237 / 76%) 0,
    rgb(34 211 238 / 42%) 25%,
    rgb(59 130 246 / 18%) 46%,
    transparent 69%
  );
  content: "";
  filter: blur(9px);
}

.profile-badge-celebration-visual {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  will-change: opacity, transform, filter;
}

.profile-badge-celebration-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.08);
  filter:
    drop-shadow(0 0 13px rgb(103 232 249 / 92%))
    drop-shadow(0 0 34px rgb(34 211 238 / 72%))
    drop-shadow(0 18px 20px rgb(0 8 28 / 58%));
}

.profile-badge-celebration-visual strong {
  display: grid;
  width: 48%;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border: 3px solid rgb(147 197 253 / 86%);
  border-radius: 28%;
  background:
    radial-gradient(circle at 30% 22%, rgb(191 219 254 / 45%), transparent 38%),
    linear-gradient(145deg, rgb(37 99 235 / 84%), rgb(15 23 42 / 98%));
  color: #f8fafc;
  font-family: "Clash Royale", "Trebuchet MS", sans-serif;
  font-size: clamp(3rem, 16vw, 5.8rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  box-shadow:
    inset 0 0 0 2px rgb(255 255 255 / 11%),
    0 0 18px rgb(103 232 249 / 82%),
    0 0 46px rgb(34 211 238 / 54%),
    0 22px 30px rgb(0 8 28 / 52%);
  text-shadow: 0 5px 0 rgb(15 23 42 / 74%);
}

.profile-badge-celebration-level {
  position: relative;
  z-index: 5;
  grid-row: 3;
  align-self: start;
  margin: -14px 0 0;
  color: #86efac;
  font-family: "Clash Royale", system-ui, sans-serif;
  font-size: clamp(1.25rem, 5vw, 1.85rem);
  line-height: 1;
  text-align: center;
  text-shadow:
    0 3px 0 rgb(5 46 22 / 82%),
    0 0 18px rgb(34 197 94 / 52%);
}

.profile-badge-celebration-continue {
  position: relative;
  z-index: 5;
  grid-row: 5;
  align-self: end;
  min-width: min(248px, 72vw);
  min-height: 54px;
  padding: 13px 30px;
  border: 1px solid rgb(147 197 253 / 40%);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 0, rgb(96 165 250 / 28%), transparent 68%),
    linear-gradient(145deg, rgb(30 64 110 / 92%), rgb(8 15 27 / 94%));
  color: #dbeafe;
  font-size: 0.94rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 18%),
    inset 0 0 0 1px rgb(59 130 246 / 10%),
    0 12px 28px rgb(0 8 28 / 34%);
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease,
    transform 100ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .profile-badge-celebration-continue:hover {
    border-color: rgb(147 197 253 / 66%);
    background:
      radial-gradient(circle at 50% 0, rgb(96 165 250 / 38%), transparent 68%),
      linear-gradient(145deg, rgb(36 78 132 / 94%), rgb(10 22 40 / 96%));
  }
}

.profile-badge-celebration-continue:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 12%),
    inset 0 0 0 1px rgb(59 130 246 / 12%),
    0 7px 16px rgb(0 8 28 / 30%);
}

.profile-badge-celebration-rays,
.profile-badge-celebration-flash,
.profile-badge-celebration-particles {
  position: absolute;
  z-index: 1;
  top: 42%;
  left: 50%;
  width: min(120vw, 760px);
  aspect-ratio: 1;
  pointer-events: none;
}

.profile-badge-celebration-rays {
  background: repeating-conic-gradient(
    from 4deg,
    rgb(219 234 254 / 22%) 0deg 5deg,
    transparent 5deg 15deg
  );
  border-radius: 50%;
  -webkit-mask-image: radial-gradient(circle, transparent 0 18%, #000 38%, transparent 70%);
  mask-image: radial-gradient(circle, transparent 0 18%, #000 38%, transparent 70%);
  opacity: 0.46;
  transform: translate(-50%, -50%);
}

.profile-badge-celebration-flash {
  z-index: 2;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0, rgb(191 219 254 / 92%) 12%, rgb(96 165 250 / 24%) 37%, transparent 68%);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.2);
}

.profile-badge-celebration-particles {
  z-index: 4;
  width: 1px;
  height: 1px;
}

.profile-badge-celebration-particles span {
  --particle-x: 0px;
  --particle-y: 0px;
  --particle-delay: 0ms;
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fef08a;
  box-shadow: 0 0 12px #fde047;
  opacity: 0;
}

.profile-badge-celebration-particles span:nth-child(1) {
  --particle-x: -118px;
  --particle-y: -132px;
}

.profile-badge-celebration-particles span:nth-child(2) {
  --particle-x: -42px;
  --particle-y: -174px;
  --particle-delay: 90ms;
}

.profile-badge-celebration-particles span:nth-child(3) {
  --particle-x: 72px;
  --particle-y: -160px;
  --particle-delay: 180ms;
}

.profile-badge-celebration-particles span:nth-child(4) {
  --particle-x: 134px;
  --particle-y: -82px;
  --particle-delay: 40ms;
}

.profile-badge-celebration-particles span:nth-child(5) {
  --particle-x: 148px;
  --particle-y: 36px;
  --particle-delay: 130ms;
}

.profile-badge-celebration-particles span:nth-child(6) {
  --particle-x: 94px;
  --particle-y: 126px;
  --particle-delay: 220ms;
}

.profile-badge-celebration-particles span:nth-child(7) {
  --particle-x: -78px;
  --particle-y: 142px;
  --particle-delay: 70ms;
}

.profile-badge-celebration-particles span:nth-child(8) {
  --particle-x: -142px;
  --particle-y: 58px;
  --particle-delay: 160ms;
}

.profile-badge-celebration.is-playing .profile-badge-celebration-rays {
  animation: profile-badge-celebration-rays 8s linear infinite;
}

.profile-badge-celebration.is-playing .profile-badge-celebration-copy {
  animation: profile-badge-celebration-copy 420ms 1250ms ease-out both;
}

.profile-badge-celebration.is-playing .profile-badge-celebration-level {
  animation: profile-badge-celebration-copy 420ms 1460ms ease-out both;
}

.profile-badge-celebration.is-playing .profile-badge-celebration-continue {
  animation: profile-badge-celebration-copy 360ms 1660ms ease-out both;
}

.profile-badge-celebration[data-mode="upgrade"].is-playing .profile-badge-celebration-visual.is-old {
  animation: profile-badge-celebration-old 980ms 120ms cubic-bezier(0.22, 0.82, 0.3, 1) both;
}

.profile-badge-celebration.is-playing .profile-badge-celebration-visual.is-new {
  animation: profile-badge-celebration-new 820ms 850ms cubic-bezier(0.16, 1.12, 0.3, 1) both;
}

.profile-badge-celebration[data-mode="unlock"].is-playing .profile-badge-celebration-visual.is-new {
  animation-delay: 260ms;
}

.profile-badge-celebration.is-playing .profile-badge-celebration-flash {
  animation: profile-badge-celebration-flash 720ms 720ms ease-out both;
}

.profile-badge-celebration[data-mode="unlock"].is-playing .profile-badge-celebration-flash {
  animation-delay: 180ms;
}

.profile-badge-celebration.is-playing .profile-badge-celebration-particles span {
  animation: profile-badge-celebration-particle 900ms calc(840ms + var(--particle-delay)) ease-out both;
}

.profile-badge-celebration[data-mode="unlock"].is-playing .profile-badge-celebration-particles span {
  animation-delay: calc(280ms + var(--particle-delay));
}

@keyframes profile-badge-celebration-old {
  0% {
    opacity: 1;
    transform: translateY(0) scale(0.82);
  }
  68% {
    opacity: 1;
    transform: translateY(-22px) scale(1.14);
    filter: brightness(1.35);
  }
  100% {
    opacity: 0;
    transform: translateY(-28px) scale(1.82);
    filter: brightness(2.8) blur(2px);
  }
}

@keyframes profile-badge-celebration-new {
  0% {
    opacity: 0;
    transform: scale(0.12);
    filter: brightness(3.2) blur(4px);
  }
  62% {
    opacity: 1;
    transform: scale(1.12);
    filter: brightness(1.35) blur(0);
  }
  82% {
    transform: scale(0.96);
    filter: brightness(1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes profile-badge-celebration-flash {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.12);
  }
  24% {
    opacity: 0.92;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes profile-badge-celebration-particle {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.2);
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--particle-x), var(--particle-y)) scale(1.15);
  }
}

@keyframes profile-badge-celebration-copy {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes profile-badge-celebration-rays {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@media (max-height: 680px) {
  .profile-badge-celebration-surface {
    grid-template-rows: minmax(72px, 18dvh) auto auto minmax(8px, 1fr) auto;
  }

  .profile-badge-celebration-stage {
    width: min(46vh, 250px);
    height: min(46vh, 250px);
  }

  .profile-badge-celebration-level {
    margin-top: -10px;
  }
}

@media (max-height: 560px) {
  .profile-badge-celebration-surface {
    padding:
      max(10px, env(safe-area-inset-top))
      max(18px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(18px, env(safe-area-inset-left));
    grid-template-rows: auto auto auto minmax(4px, 1fr) auto;
  }

  .profile-badge-celebration-copy p {
    margin-bottom: 5px;
    font-size: 0.7rem;
  }

  .profile-badge-celebration-copy h2 {
    font-size: clamp(1.55rem, 7vw, 2rem);
  }

  .profile-badge-celebration-stage {
    width: min(38vh, 210px);
    height: min(38vh, 210px);
  }

  .profile-badge-celebration-level {
    margin-top: -10px;
    font-size: 1.08rem;
  }

  .profile-badge-celebration-continue {
    min-height: 42px;
    padding: 8px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-achievement-badge.has-legendary-assiduity-reflection .profile-assiduity-badge::before,
  .profile-achievement-badge.has-legendary-assiduity-reflection .profile-assiduity-badge::after,
  .profile-badge-dialog-visual.has-legendary-assiduity-reflection::before,
  .profile-badge-dialog-visual.has-legendary-assiduity-reflection::after,
  .profile-badge-celebration-visual.has-legendary-assiduity-reflection::before,
  .profile-badge-celebration-visual.has-legendary-assiduity-reflection::after {
    animation: none;
    opacity: 0;
  }

  .profile-achievement-badge.is-newly-earned .profile-achievement-visual,
  .profile-achievement-badge.is-newly-earned .profile-war-badge {
    animation: none;
    filter:
      drop-shadow(0 0 9px rgb(165 243 252 / 84%))
      drop-shadow(0 0 22px rgb(34 211 238 / 62%));
  }

  .profile-badge-celebration.is-playing .profile-badge-celebration-rays,
  .profile-badge-celebration.is-playing .profile-badge-celebration-copy,
  .profile-badge-celebration.is-playing .profile-badge-celebration-level,
  .profile-badge-celebration.is-playing .profile-badge-celebration-continue,
  .profile-badge-celebration.is-playing .profile-badge-celebration-visual,
  .profile-badge-celebration.is-playing .profile-badge-celebration-flash,
  .profile-badge-celebration.is-playing .profile-badge-celebration-particles span {
    animation: none;
  }

  .profile-badge-celebration-visual.is-old,
  .profile-badge-celebration-flash,
  .profile-badge-celebration-particles {
    display: none;
  }
}
