/* Achievement dialog. A dark celebration screen in both themes, like the
   design; the buttons and the caption accent follow the operator brand. */

.ac-lock {
  overflow: hidden;
}

.ac-overlay {
  --ac-card: min(100%, clamp(200px, calc((100vh - 420px) * 0.8), 400px));
  position: fixed;
  inset: 0;
  z-index: 310;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  box-sizing: border-box;
  padding: 16px 16px 28px;
  overflow-y: auto;
  background: radial-gradient(
    ellipse at 50% 35%,
    rgba(34, 28, 8, 0.97),
    rgba(0, 0, 0, 0.96) 72%
  );
  color: #ffffff;
  font-family: "Inter", system-ui, sans-serif;
  line-height: normal;
  animation: ac-fade 0.35s ease-out both;
}

.ac-overlay *,
.ac-overlay *::before,
.ac-overlay *::after {
  box-sizing: border-box;
}

@keyframes ac-fade {
  from {
    opacity: 0;
  }
}

.ac-confetti {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ac-piece {
  position: absolute;
  top: -24px;
  display: block;
  opacity: 0;
  animation-name: ac-fall;
  animation-timing-function: cubic-bezier(0.3, 0.6, 0.4, 1);
  animation-fill-mode: forwards;
}

@keyframes ac-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0);
  }

  8% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate3d(24px, 105vh, 0) rotate(540deg);
  }
}

.ac-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 440px;
  margin: auto 0;
}

.ac-overlay .ac-dialog:focus-visible,
.ac-dialog:focus {
  outline: none;
}

.ac-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: var(--ac-card);
}

.ac-label {
  color: var(--ac-c1, #ffd000);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.ac-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #2c2b28;
  color: #ffffff;
  cursor: pointer;
}

.ac-pop {
  position: relative;
  width: var(--ac-card);
  animation: ac-pop 0.75s cubic-bezier(0.2, 1.2, 0.35, 1) both;
}

@keyframes ac-pop {
  from {
    opacity: 0;
    transform: translateY(34px) scale(0.72) rotate(-3deg);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.ac-glow {
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--ac-c1, #ffd000) 42%, transparent),
    transparent 66%
  );
  pointer-events: none;
  animation: ac-glow 2.2s 0.2s ease-out both;
}

@keyframes ac-glow {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }

  35% {
    opacity: 1;
  }

  100% {
    opacity: 0.5;
    transform: scale(1.08);
  }
}

.ac-card {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}

.ac-actions {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: min(100%, 400px);
  margin-top: 4px;
}

.ac-save {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 54px;
  border: 0;
  border-radius: 16px;
  background: var(--ac-c1, #ffd000);
  color: #111111;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px
    color-mix(in srgb, var(--ac-c1, #ffd000) 22%, transparent);
}

.ac-share {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ac-rule {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ac-rule > span:not(.ac-rule-text) {
  flex: 1 1 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.14);
}

.ac-rule-text,
.ac-caption-label {
  color: #a9a6a2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.ac-tiles {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.ac-tile {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d8d6d2;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.ac-tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 26px;
  background: #242321;
}

.ac-caption {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: #1b1a18;
}

.ac-caption-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ac-caption-label {
  letter-spacing: 0.14em;
}

.ac-copy {
  height: 28px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--ac-c1, #ffd000) 50%, transparent);
  border-radius: 14px;
  background: transparent;
  color: var(--ac-c1, #ffd000);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.ac-caption-input {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: #ffffff;
  font: inherit;
  font-size: 14px;
  line-height: 20px;
}

.ac-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 1;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: #ffffff;
  color: #111111;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%);
  animation: ac-toast 0.25s ease both;
}

.ac-toast[hidden] {
  display: none;
}

@keyframes ac-toast {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.ac-offscreen {
  position: fixed;
  opacity: 0;
}

.ac-overlay a:hover,
.ac-overlay button:hover {
  filter: brightness(1.12);
}

.ac-overlay :focus-visible {
  outline: 2px solid var(--ac-c1, #ffd000);
  outline-offset: 2px;
}

.ac-caption-input:focus-visible {
  outline: none;
}

.ac-caption:focus-within {
  border-color: var(--ac-c1, #ffd000);
  outline: 2px solid var(--ac-c1, #ffd000);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .ac-overlay,
  .ac-pop,
  .ac-glow,
  .ac-toast {
    animation: none;
  }

  .ac-piece {
    display: none;
  }
}

/* "View achievement" in the streak card header */
.sc-head-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.sc-achievement {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 560px) {
  .ac-close {
    width: 44px;
    height: 44px;
  }

  .ac-copy {
    height: 44px;
  }
}
