.tcg-island {
  --island-forest: var(--forest, #14241c);
  --island-cream: var(--cream, #f6f1e6);
  --island-yellow: var(--accent, #ffcc00);
  --pill-width: max-content;
  position: fixed;
  inset-block-start: calc(var(--island-header, var(--header-height, 84px)) + 12px);
  inset-inline-start: 50%;
  translate: -50% 0;
  z-index: 29;
  display: grid;
  grid-template-rows: 44px 0fr;
  inline-size: var(--pill-width);
  max-inline-size: calc(100vw - max(32px, env(safe-area-inset-left) + env(safe-area-inset-right)));
  border-radius: 999px;
  overflow: clip;
  background: var(--island-forest);
  color: var(--island-cream);
  font: 600 15px/1.3 "Source Sans 3", system-ui, sans-serif;
  text-transform: none;
}
.tcg-island [hidden] { display: none !important; }
html.tcg-island-off .tcg-island, html.tcg-island-off .tcg-island-space,
body:not(:has(> .tcg-island-space, .tcg-culture-shell > main > .tcg-island-space)) .tcg-island { display: none; }
html.tcg-island-boot .tcg-island,
body:has(.mast.is-open, [data-cc-menu-toggle][aria-expanded=true], .dk-dock.is-menu, .modal-wrap.is-open, dialog[open]) .tcg-island { visibility: hidden; }
body:has(.tcg-culture-shell) .tcg-island { z-index: 3; }
@media (max-width: 1024px) {
  body:has(.tcg-culture-shell) .tcg-island { --header-height: 72px; }
}
.tcg-island[data-open] {
  grid-template-rows: 44px 1fr;
  inline-size: min(92vw, 400px);
  border-radius: 28px;
}
.tcg-island[data-compact]:not([data-open], :hover, :focus-within) { inline-size: 44px; }
.tcg-island[data-compact]:not([data-open], :hover, :focus-within) :is(.tcg-island-label,.tcg-island-chevron) {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.tcg-island .tcg-island-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-block-size: 44px;
  padding: 0 15px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.tcg-island :is(button,a).tcg-island-row { cursor: pointer; }
.tcg-island[data-open] .tcg-island-row { justify-content: flex-start; padding-inline: 18px; }
.tcg-island-dot {
  position: relative;
  inline-size: 10px;
  block-size: 10px;
  border-radius: 50%;
  background: var(--island-yellow);
  flex: none;
}
.tcg-island-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--island-yellow);
  border-radius: 50%;
  opacity: 0;
}
.tcg-island-chevron {
  inline-size: 7px;
  block-size: 7px;
  border-inline-end: 1.5px solid;
  border-block-end: 1.5px solid;
  transform: translateY(-2px) rotate(45deg);
  flex: none;
}
.tcg-island[data-open] .tcg-island-chevron { margin-inline-start: auto; transform: translateY(2px) rotate(225deg); }
.tcg-island:focus-within { outline: 2px solid var(--island-yellow); outline-offset: 3px; }
.tcg-island :is(a,button):focus-visible { outline: 2px solid var(--island-yellow); outline-offset: -3px; }
.tcg-island-panel { min-block-size: 0; overflow: hidden; }
.tcg-island-content {
  display: grid;
  justify-items: start;
  gap: 9px;
  max-block-size: calc(100dvh - var(--island-header, 84px) - 72px);
  overflow: auto;
  padding: 5px 18px 16px;
  font-weight: 400;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.tcg-island-content :is(h2,p) { margin: 0; color: inherit; }
.tcg-island-content h2 { font: 500 28px/1.13 "Source Serif 4", Georgia, serif; }
.tcg-island-content :is(a,button) {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: .2em;
}
.tcg-island-content button { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.tcg-island-content .tcg-island-primary {
  background: var(--island-yellow);
  color: var(--island-forest);
  padding-inline: 12px;
  font-weight: 600;
  text-decoration: none;
}
.tcg-island-primary:focus-visible { outline-color: var(--island-forest) !important; }
.tcg-island[data-closing] .tcg-island-content, .tcg-island:not([data-open]) .tcg-island-content { opacity: 0; }

.tcg-island-space { --space-for-island: 32px; block-size: var(--space-for-island); }
.tcg-island-space:has(+ main > .ng) { --space-for-island: 0px; }
.tcg-island-space:has(+ main > .page-head) { --space-for-island: 64px; }
.tcg-island-space:has(+ main > .vert, + main > .ed-explore, + main > .enter-page) { --space-for-island: 16px; }
.tcg-island-space:has(+ main > .ed-place, + main > .story-head) { --space-for-island: 40px; }
main.page > .tcg-island-space { --space-for-island: 0px; }
main:is(.page--about, .page--fashion-flow) > .tcg-island-space { --space-for-island: 64px; }
main:is(.page--home,.page--archive) > .tcg-island-space { --space-for-island: 18px; }
@media (max-width: 1024px) {
  main.page--home > .tcg-island-space { --space-for-island: 54px; }
}
@media (max-width: 639px), (min-width: 900px) {
  .tcg-island-space:has(+ main > .story-head:not(.story-head-text), + main > .ed-explore) { --space-for-island: 8px; }
}
@media (min-width: 900px) {
  .tcg-island-space:has(+ main > .vert, + main > .consult, + main > .ed-place) { --space-for-island: 0px; }
}
html.tcg-island-leaving .tcg-island-space { block-size: 0; }
@media (prefers-reduced-motion: no-preference) {
  .tcg-island {
    transition: inline-size 380ms ease-in-out, grid-template-rows 380ms ease-in-out, border-radius 380ms ease-in-out;
  }
  .tcg-island[data-open] {
    transition-duration: 520ms;
    transition-timing-function: cubic-bezier(.22, 1, .36, 1);
  }
  .tcg-island:not([data-open]):is(:hover,:focus-within) { inline-size: calc(var(--pill-width) + 4px); }
  .tcg-island-chevron { transition: transform 180ms ease-out; }
  .tcg-island:not([data-open]):is(:hover,:focus-within) .tcg-island-chevron { transform: translateY(0) rotate(45deg); }
  .tcg-island-dot::after { animation: tcg-island-pulse 2.4s ease-out infinite; }
  html.tcg-island-paused .tcg-island-dot::after { animation-play-state: paused; }
  .tcg-island-content { transition: opacity 150ms ease-out; }
  .tcg-island[data-open]:not([data-closing]) .tcg-island-content > * {
    animation: tcg-island-reveal 180ms ease-out calc(312ms + 50ms * var(--order, 0)) both;
  }
  .tcg-island[data-arriving] .tcg-island-label {
    animation: tcg-island-sharpen 240ms ease-out 360ms both;
  }
  .tcg-island-space { transition: block-size 350ms ease-in-out; }
}
@keyframes tcg-island-reveal { from { opacity: 0; transform: translateY(6px); } }
@keyframes tcg-island-sharpen { from { opacity: 0; filter: blur(4px); } }
@keyframes tcg-island-pulse { 15% { opacity: .48; } 75%,100% { opacity: 0; transform: scale(2.1); } }

/* On phones the pill stays under the masthead and opens a thumb-reachable sheet. */
@media (max-width: 639.98px) {
  .tcg-island[data-open] {
    inset-block: auto max(12px, env(safe-area-inset-bottom));
    inline-size: calc(100vw - max(24px, env(safe-area-inset-left) + env(safe-area-inset-right)));
    max-inline-size: none;
    grid-template-rows: 52px 1fr;
  }
  .tcg-island[data-open] .tcg-island-row { min-block-size: 52px; }
  .tcg-island-content { padding: 10px 20px 16px; }
  .tcg-island-content .tcg-island-primary { justify-self: stretch; justify-content: center; }
  .tcg-island-content button { justify-self: center; }
}
@media (max-width: 639.98px) and (prefers-reduced-motion: no-preference) {
  .tcg-island[data-open] { animation: tcg-island-sheet 240ms ease-out both; }
  .tcg-island[data-open]:not([data-closing]) .tcg-island-content > * { animation-delay: calc(75ms + 35ms * var(--order, 0)); }
}
@keyframes tcg-island-sheet { from { opacity: 0; transform: translateY(14px); } }

/* While a stepped form is being filled on a phone the pill stays compact and sits in the slot reserved for it
   at the right end of the sticky progress row (sizes: --fp-* in css/phone.css), so it never covers the step count. */
@media (max-width: 639.98px) {
  body:has(.form-progress:not([hidden])) .tcg-island:not([data-open]) {
    inset-block-start: calc(var(--island-header, var(--header-height, 56px)) + var(--fp-pad-top, .5rem) + var(--fp-bar, 4px) + var(--fp-gap, .375rem));
    inset-inline: auto var(--ph-pad, 1.125rem);
    translate: none;
    inline-size: 44px;
  }
  body:has(.form-progress:not([hidden])) .tcg-island:not([data-open]) :is(.tcg-island-label, .tcg-island-chevron) {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }
}
