@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

html,
body {
  margin: 0;
  background: transparent;
  overflow: hidden;
}

.goal {
  --accent: #ffb020;
  --accent-soft: rgba(255, 176, 32, 0.18);
  --card: rgba(18, 18, 24, 0.86);
  --text: #fff;
  --muted: rgba(255, 255, 255, 0.7);
  --scale: 1;

  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 2.4em;
  box-sizing: border-box;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: calc(22px * var(--scale));
  color: var(--text);
  pointer-events: none;
  -webkit-font-smoothing: antialiased;
  transition: opacity 400ms ease;
}
.goal[data-pos='top'] { align-items: flex-start; }
.goal[data-pos='center'] { align-items: center; }
.goal.stale { opacity: 0.45; }

.card {
  position: relative;
  width: 36em;
  max-width: 100%;
  padding: 0.85em 1.2em 1em;
  border-radius: 1.1em;
  background: var(--card);
  box-shadow: 0 0.6em 2em rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
  overflow: hidden;
}
.card.done { box-shadow: 0 0.6em 2em rgba(0, 0, 0, 0.35), inset 0 0 0 2px var(--accent); }

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1em;
  margin-bottom: 0.55em;
}
.title {
  display: flex;
  align-items: center;
  gap: 0.35em;
  min-width: 0;
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1.3;
}
.title .text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check { display: none; flex: none; color: var(--accent); }
.check svg { width: 1em; height: 1em; display: block; }
.done .check { display: inline-flex; }

.nums {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.num {
  font-size: 1.9em;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.target { font-weight: 600; color: var(--muted); }

.bottom {
  display: flex;
  align-items: center;
  gap: 0.8em;
}
.bar {
  position: relative;
  flex: 1;
  height: 0.85em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
}
.pct {
  flex: none;
  min-width: 3.2em;
  text-align: right;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.done .pct { color: var(--accent); }

/* One-time celebration when the target is reached. */
.card.celebrate { animation: cheer 900ms cubic-bezier(0.2, 0.9, 0.3, 1.3); }
.card.celebrate::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.2) 50%, transparent 65%);
  transform: translateX(-100%);
  animation: shine 1.4s 200ms ease-in-out 2;
}
.card.celebrate .fill { animation: flash 1.2s ease-out; }

@keyframes cheer {
  0% { transform: none; }
  35% { transform: scale(1.04); box-shadow: 0 0 3em var(--accent-soft), 0 0.6em 2em rgba(0, 0, 0, 0.35), inset 0 0 0 3px var(--accent); }
  100% { transform: none; }
}
@keyframes shine {
  to { transform: translateX(100%); }
}
@keyframes flash {
  0%, 100% { filter: none; }
  30% { filter: brightness(1.5); }
}

@media (prefers-reduced-motion: reduce) {
  .card.celebrate, .card.celebrate::after, .card.celebrate .fill { animation-duration: 1ms; }
}
