/* CuteX additions layered over the preserved DateRoom utility stylesheet. */
body.source-page[data-page] {
  min-width: 320px;
  color-scheme: dark;
  color: var(--text);
  background-color: var(--bg);
  font-family: "Figtree", ui-sans-serif, system-ui, sans-serif;
  text-rendering: optimizeLegibility;
  --ink: var(--bg);
  --ink-raised: var(--bg-raised);
  --panel-soft: var(--panel-2);
  --paper: var(--text);
  --silver: var(--text-dim);
  --muted: var(--text-mute);
  --quiet: color-mix(in oklab, var(--text-mute) 72%, var(--bg));
  --focus: var(--brand-hover);
  --sans: "Figtree", ui-sans-serif, system-ui, sans-serif;
  --display: "Lilita One", "Figtree", sans-serif;
  --font-figtree: "Figtree", Arial, sans-serif;
  --font-quick-love: "Lilita One", "Figtree", sans-serif;
  --font-display: "Lilita One", "Figtree", sans-serif;
  --brand-foreground: #111111;
}

body.source-page .font-display {
  font-family: var(--font-display);
  text-transform: uppercase;
}
body.source-page [data-store-brand] .font-display { font-family: var(--font-display); text-transform: uppercase; }

body.source-page [hidden] { display: none !important; }
body.source-page :focus-visible { outline: 2px solid var(--brand-hover); outline-offset: 3px; }
body.source-page button:disabled,
body.source-page input:disabled,
body.source-page select:disabled { cursor: not-allowed; opacity: .55; }
body.source-page button,
body.source-page a { -webkit-tap-highlight-color: transparent; }

body.source-page [data-store-header] {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in oklab, var(--bg) 94%, transparent);
  backdrop-filter: blur(14px);
}
body.source-page [data-store-brand] {
  color: var(--text);
  text-decoration: none;
}
body.source-page .cutex-source-brand-mark,
body.source-page [data-store-brand] img {
  flex: 0 0 auto;
  object-fit: contain;
  filter: grayscale(1);
}
body.source-page [data-store-header] nav a {
  color: var(--text-mute);
  transition: color .15s ease, background-color .15s ease;
}
body.source-page [data-store-header] nav a:hover,
body.source-page [data-store-header] nav a[aria-current="page"] {
  color: var(--text);
}
body.source-page [data-server-invite] {
  border-radius: 999px;
  font-weight: 650;
  text-decoration: none;
}
body.source-page .cart-link {
  position: relative;
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
body.source-page .cart-link:hover { color: var(--text); background: var(--panel); border-color: var(--line-soft); }
body.source-page .cart-link svg { width: 20px; height: 20px; }
body.source-page .cart-count {
  position: absolute;
  top: -3px;
  right: -4px;
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  padding: 0 4px;
  border: 1px solid var(--bg);
  border-radius: 999px;
  color: var(--brand-foreground);
  background: var(--brand);
  font-size: .68rem;
  font-weight: 700;
  line-height: 1;
}
body.source-page .cart-count[hidden] { display: none !important; }
body.source-page .account-slot:not([hidden]) { display: inline-flex; align-items: center; gap: 10px; }
body.source-page .account-name { max-width: 120px; overflow: hidden; color: var(--text-mute); font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }
body.source-page .account-perks { color: var(--text-dim); font-size: .84rem; text-underline-offset: .22em; }
body.source-page .account-slot button {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}
body.source-page .account-slot button:hover { border-color: var(--text-mute); background: var(--panel); }
body.source-page [data-login-unavailable],
body.source-page [data-login-fallback] {
  border: 1px solid #747474 !important;
  color: #111111 !important;
  background: #c8c8c8 !important;
  -webkit-text-fill-color: #111111 !important;
  opacity: 1 !important;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 28%);
  cursor: not-allowed;
}
body.source-page [data-login-unavailable] svg,
body.source-page [data-login-fallback] svg {
  color: #111111 !important;
  fill: currentColor;
}

/* The silver brand fill needs a dark foreground on every source CTA. */
body.source-page .bg-brand,
body.source-page .bg-brand.text-white,
body.source-page [data-server-invite].bg-brand {
  color: var(--brand-foreground);
  -webkit-text-fill-color: var(--brand-foreground);
}
body.source-page .bg-brand svg { color: inherit; }
body.source-page .hover\:bg-brand-hover:hover { background-color: var(--brand-hover); }
body.source-page .brand-button,
body.source-page .button-light {
  border-color: var(--brand);
  border-radius: 999px;
  color: var(--brand-foreground);
  background: var(--brand);
  font-weight: 650;
  -webkit-text-fill-color: var(--brand-foreground);
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
body.source-page .brand-button:hover,
body.source-page .button-light:hover { border-color: var(--brand-hover); color: var(--brand-foreground); background: var(--brand-hover); }
body.source-page .button-quiet {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: transparent;
}
body.source-page .button-quiet:hover { border-color: var(--text-mute); color: var(--text); background: var(--panel); }

body.source-page [data-store-footer] {
  border-top: 1px solid var(--line-soft);
  background: var(--bg-raised);
}
body.source-page [data-store-footer] a { color: var(--text-dim); text-underline-offset: .22em; }
body.source-page [data-store-footer] a:hover { color: var(--text); }
body.source-page [data-store-footer-copy] { color: var(--text-mute); }

/* The Sub Train keeps its downloaded five-stop layout while reflecting live state. */
body.source-page [data-sub-train] [data-train-status] { color: var(--text-dim); }
body.source-page [data-sub-train] [data-train-note] { color: var(--text-mute); }
body.source-page [data-sub-train] [data-train-stops] [hidden] { display: none !important; }
body.source-page [data-sub-train][data-state="unconfigured"] [data-train-progress-line],
body.source-page [data-sub-train][data-state="error"] [data-train-progress-line] {
  width: 0 !important;
  background: var(--line);
}
body.source-page [data-sub-train][data-state="unconfigured"] [data-train-status] { color: var(--text-dim); }
body.source-page [data-sub-train][data-state="error"] [data-train-status] { color: var(--text); }

/* Functional cart and checkout subtrees remain CuteX-specific and scoped. */
body.source-page[data-page="cart"] .cart-layout,
body.source-page[data-page="checkout"] .checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
  align-items: start;
  gap: 28px;
}
body.source-page[data-page="cart"] .cart-lines,
body.source-page[data-page="cart"] .cart-summary,
body.source-page[data-page="checkout"] .checkout-summary,
body.source-page[data-page="checkout"] .checkout-panel {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--bg-raised);
}
body.source-page[data-page="cart"] .cart-group { padding: 19px 20px 8px; }
body.source-page[data-page="cart"] .cart-group + .cart-group { border-top: 1px solid var(--line); }
body.source-page[data-page="cart"] .cart-group h2,
body.source-page[data-page="checkout"] .checkout-summary h2,
body.source-page[data-page="checkout"] .checkout-panel h2 {
  margin: 0 0 13px;
  color: var(--text);
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 400;
}
body.source-page[data-page="cart"] .cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: start;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}
body.source-page[data-page="cart"] .cart-row:first-of-type { border-top: 0; }
body.source-page[data-page="cart"] .cart-item-name { margin: 0; color: var(--text); font-weight: 650; }
body.source-page[data-page="cart"] .cart-item-meta { margin: 4px 0 0; color: var(--text-mute); font-size: .82rem; }
body.source-page[data-page="cart"] .recipient-label { color: var(--text-dim); }
body.source-page[data-page="cart"] .cart-item-price { min-width: 85px; color: var(--text); text-align: right; white-space: nowrap; }
body.source-page[data-page="cart"] .quantity-control { display: inline-flex; align-items: center; gap: 8px; }
body.source-page[data-page="cart"] .quantity-control button,
body.source-page[data-page="cart"] .remove-item,
body.source-page[data-page="perks"] .shared-remove,
body.source-page[data-page="perks"] .leaderboard-boost {
  min-width: 38px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}
body.source-page[data-page="cart"] .quantity-control button:hover,
body.source-page[data-page="cart"] .remove-item:hover,
body.source-page[data-page="perks"] .shared-remove:hover,
body.source-page[data-page="perks"] .leaderboard-boost:hover:not(:disabled) {
  border-color: var(--text-mute);
  background: var(--panel);
}
body.source-page[data-page="cart"] .quantity-value { min-width: 20px; color: var(--text-dim); text-align: center; }
body.source-page[data-page="cart"] .remove-item { min-width: 0; font-size: .78rem; }
body.source-page[data-page="cart"] .cart-total,
body.source-page[data-page="checkout"] .checkout-total {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
}
body.source-page[data-page="cart"] .cart-summary { position: sticky; top: 18px; background: var(--panel); }
body.source-page[data-page="cart"] .cart-summary-inner,
body.source-page[data-page="checkout"] .checkout-summary,
body.source-page[data-page="checkout"] .checkout-panel { padding: 20px; }
body.source-page[data-page="cart"] .summary-label,
body.source-page[data-page="checkout"] .summary-label {
  margin: 0 0 7px;
  color: var(--text-mute);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
body.source-page[data-page="cart"] .summary-total { margin: 0; font-size: 2rem; font-weight: 650; letter-spacing: -.05em; }
body.source-page[data-page="cart"] .summary-caption { margin: 3px 0 16px; color: var(--text-mute); font-size: .83rem; }
body.source-page[data-page="cart"] .cart-summary .button,
body.source-page[data-page="checkout"] .checkout-panel .button { width: 100%; }
body.source-page[data-page="cart"] .cart-limit-note { margin: 0; padding: 13px 20px; border-top: 1px solid var(--line-soft); color: var(--text-mute); font-size: .78rem; }
body.source-page[data-page="cart"] .cart-empty {
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--bg-raised);
}
body.source-page[data-page="cart"] .cart-empty h2 { margin: 0; font-family: var(--display); font-size: 2rem; font-weight: 400; }
body.source-page[data-page="cart"] .cart-empty p { margin: 10px 0 22px; color: var(--text-mute); }
body.source-page[data-page="cart"] .cart-empty-actions { display: flex; flex-wrap: wrap; gap: 10px; }
body.source-page[data-page="checkout"] .checkout-panel > p { color: var(--text-mute); font-size: .88rem; }
body.source-page[data-page="checkout"] .checkout-groups { margin: 0; padding: 0; list-style: none; }
body.source-page[data-page="checkout"] .checkout-groups li { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line-soft); color: var(--text-dim); font-size: .87rem; }
body.source-page[data-page="checkout"] .checkout-consent { display: grid; grid-template-columns: 18px 1fr; gap: 11px; margin-top: 18px; color: var(--text-dim); font-size: .82rem; }
body.source-page[data-page="checkout"] .checkout-consent input { width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--brand); }
body.source-page[data-page="checkout"] .checkout-error,
body.source-page[data-page="checkout"] .checkout-status { color: var(--text-dim); }

body.source-page dialog.gift-dialog {
  width: min(480px, 100vw);
  max-width: 100vw;
  max-height: min(94dvh, 820px);
  margin: auto 0 0;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  color: var(--text);
  background: var(--bg-raised);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 90%);
}
body.source-page dialog.gift-dialog:not([open]) { display: none; }
body.source-page dialog.gift-dialog::backdrop { background: rgb(0 0 0 / 72%); backdrop-filter: blur(4px); }
body.source-page .gift-form { padding: 28px; }
body.source-page .gift-form-top { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
body.source-page .gift-form h2 { margin: 0; color: var(--text); font-family: var(--font-display); font-size: 1.9rem; font-weight: 400; line-height: 1.08; text-transform: uppercase; }
body.source-page .dialog-close { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border: 0; border-radius: 999px; color: var(--text-mute); background: transparent; font-size: 1.55rem; cursor: pointer; }
body.source-page .dialog-close:hover { color: var(--text); background: var(--panel-2); }
body.source-page .gift-form > p { margin: 12px 0 18px; color: var(--text-mute); font-size: .9rem; }
body.source-page .gift-form label { display: block; margin-bottom: 7px; color: var(--text-dim); font-size: .84rem; font-weight: 600; }
body.source-page .gift-form input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--bg);
}
body.source-page .gift-form input:hover { border-color: var(--text-mute); }
body.source-page .gift-form input:focus-visible { border-color: var(--brand-hover); outline: 2px solid var(--brand-hover); outline-offset: 2px; }
body.source-page .gift-form input[aria-invalid="true"] { border-color: var(--danger); }
body.source-page .gift-error { min-height: 1.3em; margin: 7px 0 12px; color: var(--text-dim); font-size: .8rem; }
body.source-page .gift-form .button { width: 100%; }
body.source-page .gift-disclaimer { margin: 14px 0 0 !important; color: var(--text-mute) !important; font-size: .76rem !important; }

body.source-page dialog.ref-purchase-dialog,
body.source-page .buy-dialog {
  width: min(480px, 100vw);
  max-height: min(94dvh, 820px);
  margin: auto 0 0;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  color: var(--text);
  background: var(--bg-raised);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 90%);
}
body.source-page dialog.ref-purchase-dialog:not([open]),
body.source-page .buy-dialog:not([open]) { display: none; }
body.source-page dialog.ref-purchase-dialog::backdrop,
body.source-page .buy-dialog::backdrop { background: rgb(0 0 0 / 72%); backdrop-filter: blur(4px); }
body.source-page .ref-purchase-dialog-inner { padding: 28px; }
body.source-page .ref-dialog-top { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
body.source-page .ref-purchase-dialog h2 { margin: 0; color: var(--text); font-family: var(--font-display); font-size: 1.9rem; font-weight: 400; line-height: 1.08; text-transform: uppercase; }
body.source-page .ref-dialog-product { margin: 7px 0 0; color: var(--text-mute); font-size: .8rem; }
body.source-page .ref-dialog-close { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border: 0; border-radius: 999px; color: var(--text-mute); background: transparent; font-size: 1.55rem; cursor: pointer; }
body.source-page .ref-dialog-close:hover { color: var(--text); background: var(--panel-2); }
body.source-page .ref-dialog-description { margin: 20px 0; color: var(--text-dim); font-size: .94rem; line-height: 1.55; }
body.source-page .ref-dialog-actions { display: grid; gap: 10px; }
body.source-page .ref-dialog-actions .ref-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: transparent;
  font-size: .95rem;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
body.source-page .ref-dialog-actions .ref-button:hover { border-color: var(--text-mute); background: var(--panel); }
body.source-page .ref-dialog-actions .ref-button-primary {
  border-color: var(--brand);
  color: var(--brand-foreground);
  background: var(--brand);
  -webkit-text-fill-color: var(--brand-foreground);
}
body.source-page .ref-dialog-actions .ref-button-primary:hover { border-color: var(--brand-hover); color: var(--brand-foreground); background: var(--brand-hover); }
body.source-page .ref-dialog-hint { margin: 14px 0 0; color: var(--text-mute); font-size: .78rem; line-height: 1.5; }
body.source-page .buy-dialog h1,
body.source-page .buy-dialog h2,
body.source-page .buy-dialog h3 { font-family: var(--font-display); text-transform: uppercase; }

@media (min-width: 640px) {
  body.source-page dialog.gift-dialog,
  body.source-page dialog.ref-purchase-dialog,
  body.source-page .buy-dialog { width: min(480px, calc(100vw - 32px)); margin: auto; border-radius: 24px; }
}
@media (max-width: 820px) {
  body.source-page[data-page="cart"] .cart-layout,
  body.source-page[data-page="checkout"] .checkout-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  body.source-page[data-page="cart"] .cart-summary { position: static; }
}
@media (max-width: 560px) {
  body.source-page .account-name { display: none; }
  body.source-page .account-slot:not([hidden]) { gap: 7px; }
  body.source-page [data-store-header] .ml-auto { gap: 5px; }
  body.source-page .account-slot button { padding-inline: 8px; }
  body.source-page[data-page="cart"] .cart-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  body.source-page[data-page="cart"] .cart-item-price { grid-column: 2; grid-row: 1; min-width: auto; }
  body.source-page[data-page="cart"] .quantity-control { grid-column: 1; grid-row: 2; justify-self: start; }
  body.source-page[data-page="cart"] .remove-item { grid-column: 2; grid-row: 2; justify-self: end; }
  body.source-page[data-page="cart"] .cart-group { padding-inline: 16px; }
  body.source-page .gift-form { padding: 24px; }
}

@media (max-width: 420px) {
  body.source-page [data-sub-train] [data-train-stops] li:nth-last-child(-n + 2) [data-train-stop-number],
  body.source-page [data-sub-train] [data-train-stops] li:nth-last-child(-n + 2) [data-train-stop-reward] {
    display: block !important;
    width: 36px;
    max-width: 36px;
    overflow: visible;
    font-size: 10px !important;
    line-height: 1.05 !important;
    white-space: normal;
    overflow-wrap: anywhere;
    text-wrap: balance;
    -webkit-line-clamp: unset;
  }
}
@media (max-width: 360px) {
  body.source-page [data-sub-train] [data-train-stops] li:nth-last-child(-n + 2) [data-train-stop-number],
  body.source-page [data-sub-train] [data-train-stops] li:nth-last-child(-n + 2) [data-train-stop-reward] {
    width: 26px;
    max-width: 26px;
    font-size: 8.5px !important;
  }
  body.source-page [data-sub-train] [data-train-stops] li:nth-last-child(2) [data-train-stop-number],
  body.source-page [data-sub-train] [data-train-stops] li:nth-last-child(2) [data-train-stop-reward] {
    position: relative;
    left: -12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.source-page *, body.source-page *::before, body.source-page *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
