/* Missions.
   Every rule is scoped under .ms- so nothing here can reach Arena or Insights.
   Colours, radii and type come from veranta-ds.css tokens; the --ms- names below
   are aliases onto those tokens, never new values. */

:root{
  --ms-ground:var(--grey-950);
  --ms-panel:var(--grey-800);
  --ms-panel-quiet:var(--grey-900);
  --ms-line:var(--grey-600);
  --ms-line-strong:var(--grey-500);
  --ms-text:var(--grey-50);
  --ms-text-soft:var(--grey-200);
  --ms-text-quiet:var(--grey-300);
  --ms-earned:var(--lime-500);
  --ms-progress:var(--lime-700);
  --ms-earned-edge:var(--lime-950);
  --ms-review:var(--yellow-500);
  --ms-missed:var(--error-500);
}

.ms-page{display:flex;flex-direction:column;gap:14px;font-variant-numeric:tabular-nums}

/* ── Hero: what you have earned, and when it arrives ─────────────── */
.ms-hero{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:24px;
  min-height:132px;padding:20px 24px;border:1px solid var(--ms-earned-edge);border-radius:var(--radius-lg);
  background:linear-gradient(90deg,var(--ms-panel-quiet) 18%,rgba(0,0,0,.35)),var(--ms-hero-art,none) center 45%/cover}
.ms-hero__left{min-width:320px}
.ms-hero h1{margin:8px 0 6px;font-size:40px;font-weight:500;line-height:1.05;letter-spacing:-.03em}
.ms-hero h1 b{font-weight:500;color:var(--ms-earned)}
.ms-hero p{margin:0;font-size:12px;color:var(--ms-text-soft)}
.ms-hero__clock{display:flex;align-items:center;gap:24px}
.ms-hero__clock b{font-size:20px;font-weight:500}
.ms-hero__clock p{margin:5px 0 0;font-size:12px;color:var(--ms-text-quiet)}

.ms-tag{display:inline-block;font-size:11px;line-height:16px;border-radius:var(--radius-xs);
  background:var(--ms-line);color:var(--grey-100);padding:3px 7px;white-space:nowrap}
.ms-tag--review{color:var(--ms-review)}
.ms-tag--earned{background:var(--ms-earned);color:var(--ms-ground)}

.ms-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:36px;
  padding:9px 20px;border:1px solid transparent;border-radius:var(--radius-sm);
  background:var(--ms-earned);color:var(--ms-ground);font:inherit;font-size:13px;font-weight:500;
  text-decoration:none;cursor:pointer}
.ms-button--ghost{background:var(--ms-line);border-color:var(--ms-line-strong);color:var(--grey-100)}

/* ── Board ───────────────────────────────────────────────────────── */
.ms-board{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}

/* No overflow clip: a tier's tooltip has to escape the card it belongs to. The art
   rounds its own top corners instead, which is all the clip was ever doing. */
.ms-card{position:relative;display:flex;flex-direction:column;min-width:0;
  background:var(--ms-panel);border:1px solid var(--ms-line);border-radius:var(--radius-lg);
  transition:border-color .16s ease}
.ms-card:hover{border-color:var(--ms-line-strong)}
/* While a tooltip is up, this card paints over its neighbours. */
.ms-card:hover,.ms-card:focus-within{z-index:10}
.ms-card--earned{border-color:var(--ms-earned-edge)}
.ms-card--earned:hover{border-color:var(--ms-progress)}
.ms-card__art{height:64px;padding:9px 11px;display:flex;justify-content:space-between;align-items:flex-start;gap:8px;
  background-size:cover;background-position:center 45%;
  border-radius:calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0}
.ms-card__body{flex-grow:1;padding:13px 15px 15px;display:flex;flex-direction:column;gap:11px}
.ms-card__eyebrow{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
.ms-card__eyebrow h2{margin:0;font-size:14px;font-weight:500;letter-spacing:-.01em;color:var(--ms-text)}
.ms-card__eyebrow small{font-size:11px;color:var(--ms-text-quiet);white-space:nowrap}
.ms-card__figure{display:flex;align-items:baseline;gap:7px;flex-wrap:wrap}
.ms-card__figure b{font-size:27px;font-weight:500;line-height:1.05;letter-spacing:-.02em}
.ms-card__figure small{font-size:11px;color:var(--ms-text-quiet)}

/* The card's one action: go trade this mission's market, or copy your code. */
.ms-card__cta{display:flex;align-items:center;justify-content:center;gap:6px;min-height:34px;width:100%;
  padding:8px 12px;border:1px solid var(--ms-line-strong);border-radius:var(--radius-sm);
  background:var(--ms-panel-quiet);color:var(--ms-text);font:inherit;font-size:12px;font-weight:500;
  text-align:center;text-decoration:none;cursor:pointer;transition:background .14s,border-color .14s,color .14s}
.ms-card__cta:hover{background:var(--ms-earned);border-color:var(--ms-earned);color:var(--ms-ground)}
.ms-card__cta.is-done{background:var(--ms-earned);border-color:var(--ms-earned);color:var(--ms-ground)}

/* The mission's own data, where the old card put a gradient. */
.ms-shape{height:38px;display:flex;align-items:flex-end;gap:3px}
.ms-shape--cells{align-items:center;gap:2px}
.ms-shape--rows{flex-direction:column;align-items:stretch;justify-content:center;gap:7px}
.ms-shape__bar{flex:1;background:var(--ms-line-strong);border-radius:1px;min-height:2px}
.ms-shape__bar--peak{background:var(--grey-400)}
.ms-shape__bar--idle{background:var(--ms-line);height:2px}
.ms-shape__cell{flex:1;height:16px;border-radius:var(--radius-xs);background:var(--ms-text-soft)}
.ms-shape__cell--missed{background:var(--ms-missed)}
.ms-shape__cell--pending{background:var(--ms-line-strong)}
.ms-shape__cell--upcoming{height:9px;background:var(--ms-line)}
.ms-shape__legend{display:flex;gap:12px;font-size:10px;color:var(--ms-text-quiet)}
.ms-shape__pips{display:flex;gap:4px;height:10px}
.ms-shape__pips>*{flex:1;height:10px;border-radius:999px}

/* ── Tier chips ──────────────────────────────────────────────────
   Two lines: the reward, and what it takes. The status word that used to sit on a
   third line is now the chip's colour and the sentence it shows on hover, and the
   progress that used to need a separate ladder row fills the chip's bottom edge. */
.ms-tiers{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}
/* Not overflow:hidden — that would clip the chip's own tooltip. The 2px fill below
   rounds its own left corner instead, which is all the clip was for. */
.ms-tier{position:relative;min-width:0;padding:7px 8px 9px;
  border:1px solid var(--ms-line-strong);border-radius:var(--radius-sm);
  font-size:11px;line-height:1.3;cursor:default;transition:border-color .14s,background .14s}
.ms-tier:hover,.ms-tier:focus-visible{border-color:var(--ms-text-quiet);background:var(--ms-panel-quiet)}
.ms-tier b{display:block;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ms-tier small{display:block;margin-top:2px;font-size:10px;color:var(--ms-text-quiet);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* the fill rides the chip's own bottom edge */
.ms-tier::after{content:"";position:absolute;left:0;bottom:0;height:2px;width:0;
  background:var(--ms-progress);border-radius:0 0 0 var(--radius-sm);max-width:100%}
.ms-tier--in_progress{border-color:var(--ms-progress)}
.ms-tier--in_progress::after{width:var(--ms-fill,0%)}
.ms-tier--earned,.ms-tier--paid{background:var(--ms-earned);border-color:var(--ms-earned);color:var(--ms-ground)}
.ms-tier--earned:hover,.ms-tier--paid:hover{background:var(--ms-earned);border-color:var(--ms-earned)}
.ms-tier--earned small,.ms-tier--paid small{color:rgba(0,0,0,.66)}
.ms-tier--locked b,.ms-tier--not_started b,.ms-tier--expired b{color:var(--ms-text-soft)}
.ms-tier--unreachable{border-color:#4A3B02}
.ms-tier--unreachable small{color:var(--ms-review)}

.ms-next{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:7px 10px;
  background:var(--ms-panel-quiet);border:1px solid var(--ms-line);border-radius:var(--radius-sm);font-size:11px}
.ms-next span{color:var(--ms-text-soft)}
.ms-next b{font-weight:500;color:var(--ms-text)}
.ms-next b.is-earned{color:var(--ms-earned)}

/* The quick look still draws a three-segment ladder per mission. */
.ms-ladder{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.ms-ladder__seg{height:4px;border-radius:var(--radius-xs);background:var(--ms-line);overflow:hidden}
.ms-ladder__seg--earned{background:var(--ms-earned)}
.ms-ladder__seg i{display:block;height:100%;border-radius:var(--radius-xs);background:var(--ms-progress)}

/* ── Tooltips ────────────────────────────────────────────────────
   One pattern for everything the card stopped spelling out. Hover and focus both
   open it, and `:focus` rather than `:focus-visible` so a tap opens it on a phone,
   where there is no hover at all. The text is already escaped by the renderer. */
[data-ms-tip]{position:relative}
[data-ms-tip]::before,[data-ms-tip]::after{opacity:0;pointer-events:none;transition:opacity .12s .04s}
[data-ms-tip]::before{content:attr(data-ms-tip);position:absolute;bottom:calc(100% + 8px);left:50%;
  transform:translateX(-50%);z-index:40;width:max-content;max-width:min(230px,72vw);
  white-space:normal;text-align:left;padding:7px 9px;
  background:var(--ms-line);border:1px solid var(--ms-line-strong);border-radius:var(--radius-sm);
  color:var(--ms-text);font-size:11px;font-weight:400;line-height:1.4;letter-spacing:0;
  box-shadow:0 10px 30px rgba(0,0,0,.65)}
[data-ms-tip]::after{content:"";position:absolute;bottom:calc(100% + 3px);left:50%;transform:translateX(-50%);
  z-index:41;border:5px solid transparent;border-top-color:var(--ms-line-strong)}
[data-ms-tip]:hover::before,[data-ms-tip]:hover::after,
[data-ms-tip]:focus::before,[data-ms-tip]:focus::after{opacity:1}
/* The outer chips would push their bubble past the card edge; anchor those inside. */
.ms-tier:first-child::before{left:0;transform:none}
.ms-tier:last-child::before{left:auto;right:0;transform:none}
@media(prefers-reduced-motion:reduce){[data-ms-tip]::before,[data-ms-tip]::after{transition:none}}

/* ── Legend and footer ───────────────────────────────────────────── */
/* Hugs its content instead of stretching to a mission card's height: it is an
   explanation, and a tall panel of empty space reads as something failing to load. */
.ms-legend{align-self:start;display:flex;flex-direction:column;gap:10px;padding:18px;
  background:var(--ms-panel);border:1px solid var(--ms-line);border-radius:var(--radius-lg)}
.ms-legend h2{margin:0 0 2px;font-size:18px;font-weight:500;line-height:1.2}
.ms-legend p{margin:0;font-size:12px;line-height:1.55;color:var(--ms-text-soft)}
.ms-legend p b{font-weight:500;color:var(--ms-earned)}
.ms-legend__more{border-top:1px solid var(--ms-line);padding-top:9px}
.ms-legend__more summary{display:flex;align-items:center;justify-content:space-between;gap:10px;
  list-style:none;cursor:pointer;font-size:12px;color:var(--ms-text)}
.ms-legend__more summary::-webkit-details-marker{display:none}
.ms-legend__more summary::after{content:"+";color:var(--ms-text-quiet);font-size:13px;line-height:1}
.ms-legend__more[open] summary::after{content:"\2212"}
.ms-legend__more p{margin-top:9px}
.ms-legend__keys{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px}
.ms-legend__key{display:flex;align-items:center;gap:8px;font-size:11px;color:var(--ms-text-soft)}
.ms-legend__key i{width:24px;height:4px;flex-shrink:0;border-radius:var(--radius-xs)}

.ms-footer{display:flex;justify-content:space-between;gap:24px;padding-top:14px;
  border-top:1px solid var(--ms-line);font-size:11px;color:var(--ms-text-quiet)}

/* ── Gates, empty and error ──────────────────────────────────────── */
.ms-state{overflow:hidden;background:var(--ms-panel);border:1px solid var(--ms-line);border-radius:var(--radius-lg)}
.ms-state__art{height:148px;background-size:cover;background-position:center 58%}
.ms-state__body{display:flex;flex-direction:column;gap:14px;align-items:flex-start;padding:28px}
.ms-state h2{margin:0;font-size:26px;font-weight:500;line-height:1.15;letter-spacing:-.02em}
.ms-state p{margin:0;font-size:14px;line-height:1.6;color:var(--ms-text-soft);max-width:58ch}
.ms-state__note{font-size:12px!important;color:var(--ms-text-quiet)!important}
.ms-state--error .ms-state__art{display:none}
.ms-state--error{border-color:#5A2422}
.ms-state--error h2{color:var(--ms-missed)}

.ms-skeleton{border-radius:var(--radius-lg);background:var(--grey-700)}
@keyframes ms-pulse{0%,100%{opacity:1}50%{opacity:.55}}
.ms-skeleton{animation:ms-pulse 1.6s ease-in-out infinite}
@media(prefers-reduced-motion:reduce){.ms-skeleton{animation:none}}

/* ── The chip, shared with Arena, Insights and Past arenas ───────── */
.ms-chip{position:relative;display:inline-flex;align-items:center;gap:8px;min-height:38px;
  padding:4px 12px 4px 5px;border:1px solid var(--ms-line-strong);border-radius:999px;
  background:var(--ms-panel-quiet);color:var(--ms-text);font:inherit;font-size:13px;font-weight:500;
  white-space:nowrap;cursor:pointer}
.ms-chip--earned{border-color:var(--ms-earned-edge)}
.ms-chip--review{border-color:#4A3B02;color:var(--ms-review)}
.ms-chip--paid{border-color:var(--ms-earned-edge);color:var(--ms-earned)}
.ms-chip--error{border-color:#5A2422;color:var(--ms-missed)}
.ms-chip--quiet{color:var(--ms-text-quiet)}
.ms-chip__medal{position:relative;width:28px;height:28px;display:grid;place-items:center}
.ms-chip__medal img{width:18px;height:18px;border-radius:999px;object-fit:cover}
.ms-chip__ring{position:absolute;inset:-2px;width:32px;height:32px;fill:none;transform:rotate(-90deg)}

.ms-quicklook{position:absolute;top:calc(100% + 10px);right:0;z-index:70;width:410px;padding:20px;
  background:var(--ms-panel);border:1px solid var(--ms-line-strong);border-radius:var(--radius-lg);
  box-shadow:0 20px 60px rgba(0,0,0,.6)}
.ms-quicklook[hidden]{display:none}
.ms-quicklook__head{display:flex;justify-content:space-between;align-items:center;gap:12px;font-size:13px}
.ms-quicklook__total{margin:14px 0 10px}
.ms-quicklook__total small{font-size:12px;color:var(--ms-text-soft)}
.ms-quicklook__total h2{margin:3px 0 0;font-size:27px;font-weight:500;line-height:1.1;color:var(--ms-earned)}
.ms-quicklook__row{display:block;padding:13px 0;border-top:1px solid var(--ms-line)}
.ms-quicklook__row-head{display:flex;align-items:center;gap:10px;font-size:13px}
.ms-quicklook__row-head b{font-weight:500}
.ms-quicklook__row-head small{margin-left:auto;font-size:12px;color:var(--ms-text-soft)}
.ms-quicklook__row-head small.is-earned{color:var(--ms-earned)}
.ms-quicklook__foot{display:flex;justify-content:space-between;align-items:center;gap:12px;
  margin-top:4px;padding-top:16px;border-top:1px solid var(--ms-line)}
.ms-quicklook__foot a{font-size:13px;font-weight:500;color:var(--ms-text);text-decoration:none}

/* ── Responsive: the live breakpoints, not new ones ──────────────── */
@media(max-width:1100px){
  .ms-board{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:700px){
  .ms-board{grid-template-columns:minmax(0,1fr)}
  .ms-hero{min-height:0;padding:16px}
  .ms-hero h1{font-size:32px}
  .ms-hero__clock{width:100%;justify-content:space-between}
  .ms-footer{flex-direction:column;gap:8px}
  .ms-quicklook{position:fixed;left:16px;right:16px;bottom:16px;top:auto;width:auto;
    max-height:70vh;overflow-y:auto;padding-bottom:calc(20px + env(safe-area-inset-bottom))}
}

/* The sign-in line sits beside the header's connect button. It is the only
   place the page reports a wallet problem, so it stays readable at nav size. */
.ms-signin-note{
  max-width:34ch;
  font-size:12px;
  line-height:1.35;
  color:var(--ms-text-quiet);
}
@media (max-width:720px){ .ms-signin-note{ display:none } }
