/* The Discord Activity (docs/DISCORD-ACTIVITY-WEB.md): web/discord-activity.html
   loads it after app.css for its own window, web/discord-activity-verify.html
   for its anti-robot page. DESIGN.md's night tokens only. Discord's mobile
   safe areas come first (--discord-safe-area-inset-*, set by Discord, possibly
   late), the device's env() insets otherwise. */

/* The engine reads the safe areas from this probe (js/engine/core.js); the
   Activity entry asks it again whenever Discord changes them. */
.safe-area {
  padding:
    var(--discord-safe-area-inset-top, env(safe-area-inset-top, 0px))
    var(--discord-safe-area-inset-right, env(safe-area-inset-right, 0px))
    var(--discord-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))
    var(--discord-safe-area-inset-left, env(safe-area-inset-left, 0px));
}

/* The Activity's window: a native modal dialog over the whole frame, its card
   centred inside the safe areas. The game beneath is inert while it is open. */
.activity-gate {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  z-index: 4;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border: 0;
  padding:
    max(16px, var(--discord-safe-area-inset-top, env(safe-area-inset-top, 0px)))
    max(12px, var(--discord-safe-area-inset-right, env(safe-area-inset-right, 0px)))
    max(16px, var(--discord-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)))
    max(12px, var(--discord-safe-area-inset-left, env(safe-area-inset-left, 0px)));
  overflow: auto;
  background: transparent;
  color: #f6f3ee;
}

.activity-gate[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-gate::backdrop {
  background: rgba(19, 20, 38, 0.92);
}

.activity-card {
  box-sizing: border-box;
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid #3b3c5c;
  border-radius: 22px;
  background: #1f1f36;
  color: #f6f3ee;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  font-family: "M PLUS Rounded 1c", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.activity-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-family: "Mochiy Pop One", "M PLUS Rounded 1c", system-ui, sans-serif;
  font-size: 20px;
}

.activity-brand img {
  flex: none;
  width: 44px;
  height: 44px;
}

.activity-card h1 {
  margin: 0 0 12px;
  font-size: 1.625rem;
  line-height: 1.25;
}

.activity-card h1:focus {
  outline: none;
}

.activity-card p {
  margin: 12px 0;
}

.activity-detail,
.activity-note {
  color: #c4bfd2;
  font-size: 14px;
}

/* The same breathing Persimmon bar as the game's loader (app.css .boot-bar). */
.activity-progress {
  position: relative;
  height: 6px;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.activity-progress[hidden] {
  display: none;
}

.activity-progress span {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #f57868;
  opacity: 0.3;
  animation: activity-breathe 1.6s ease-in-out infinite alternate;
}

@keyframes activity-breathe {
  from { opacity: 0.3; }
  to { opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  .activity-progress span { opacity: 0.7; animation: none; }
}

.activity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.activity-actions button {
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid #aeacbf;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.activity-actions button:first-child {
  border-color: #f57868;
  background: #f57868;
  color: #170d0d;
}

.activity-actions button[hidden] {
  display: none;
}

.activity-actions button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.activity-card :focus-visible {
  outline: 2px solid #f6f3ee;
  outline-offset: 4px;
}

.activity-card a {
  color: inherit;
  text-underline-offset: 3px;
}

/* The anti-robot page (/verify), outside Discord: the night behind its card. */
.activity-page {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding:
    max(16px, env(safe-area-inset-top, 0px))
    max(12px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
  background: #131426;
  color: #f6f3ee;
  -webkit-text-size-adjust: 100%;
}

.activity-widget {
  display: flex;
  justify-content: center;
  min-height: 65px;
  margin: 16px 0;
}

.activity-note a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.activity-verify .noscript {
  font-weight: 700;
}

@media (max-width: 380px) {
  .activity-card { padding: 18px; }
}
