@font-face {
  font-family: "Workspace Inter";
  src: url("/fonts/Inter-latin-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* Member views and their top-layer dialogs share one graphite palette. */
body:has(.user-shell) {
  --work-font: "Workspace Inter", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: dark;
  --bg: #09090b; --surface: #151517; --high: #232326;
  --text: #f1f1f3; --muted: #aeafb5; --border: #333336;
  --accent: #ececee; --work-selection: #29292d; --home-blue: var(--accent);
  background: var(--bg); color: var(--text); font-family: var(--work-font);
}
body .user-shell { --work-font: inherit; font-family: inherit; }
body:has(.user-shell) :is(.user-shell, #dialog) :is(h1,h2,h3,h4,p,button,input,select,textarea,dt,dd) {
  font-family: "Workspace Inter", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.user-shell :is(.main,.content,.contribution-home,.matching-scene,.information-page) {
  background: var(--bg); color: var(--text);
}
.user-shell :is(.contribution-hero,.contribution-section,.matching-intro,.checkin-heading,.history-heading,.account-title) :is(h1,h2) {
  color: var(--text); font-weight: 610; letter-spacing: -.035em;
}
.user-shell :is(.panel,.profile-groups section,.compact-profile .profile-assets,.history-list,
                .checkin-main,.activity-list-item,.information-hero) {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: none;
}
.user-shell :is(.history-list li,.matching-account,.member-line,.matching-work,.contribution-section,
                .checkin-calendar,.account-row,.history-overview,.table-wrap,th,td) { border-color: var(--border); }
.user-shell .history-list { padding-inline: clamp(12px,2vw,22px); }
.user-shell .checkin-today { padding-inline-start: clamp(12px,2vw,24px); }
.user-shell .checkin-calendar { padding-inline-end: clamp(12px,2vw,24px); }
.user-shell .matching-action { background: transparent; padding: clamp(14px,2vw,24px) 0; border: 0; backdrop-filter: none; }
#app .user-shell .matching-action > .badge { display: inline-flex; align-items: center; gap: 7px; padding: 0; background: transparent!important; border: 0; }
.user-shell .matching-action > .badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.user-shell .matching-account { border-bottom: 0; margin-bottom: 0; }
.user-shell .task-backdrop { opacity: .16; }
.user-shell .matching-action h2 { max-width: none; }
.user-shell :is(.contribution-lead,.matching-intro p,.matching-account dt,.history-title small) { color: var(--muted); }
.user-shell :is(.contribution-totals dd,.contribution-links a:first-child,.checkin-status) { color: var(--accent); }
body:has(.user-shell) :is(.user-shell .main,#dialog) button.primary:not(:disabled) {
  background: var(--accent)!important; border-color: var(--accent)!important; color: #151517!important; box-shadow: none;
}
body:has(.user-shell) :is(.main,#dialog) button.primary:hover:enabled { background: #fff!important; }
.user-shell .compact-profile .profile-groups button.account-row {
  background: transparent; border-radius: 0!important; border-color: var(--border); box-shadow: none;
}
.user-shell .topbar, .user-shell .sidebar { background: var(--surface); border-color: var(--border); }
.user-shell .topbar .desktop-workspace-nav button.active,
.user-shell .sidebar .nav button.active { color: var(--text)!important; background: var(--work-selection)!important; }
body:has(.user-shell) #dialog[open]:has(> .dialog-head) { border-color: var(--border); color: var(--text); background: var(--surface); }
body:has(.user-shell) #dialog .dialog-head { border-color: var(--border); }
.user-shell :is(.topbar,.sidebar,.main) :focus-visible { outline-color: var(--accent); }
@media (max-width:700px) {
  .user-shell .sidebar { box-shadow: 0 2px 10px #20202e12; }
}

/* The member shell owns these colors even when legacy components supply their own. */
@scope (body:has(.user-shell)) {
  :is(.user-shell,.user-shell .main,.user-shell .content,.user-shell .contribution-home,
      .user-shell .contribution-hero,.user-shell .matching-scene,.user-shell .information-page) {
    background: var(--bg)!important; color: var(--text);
  }
  :is(.user-shell, #dialog) :is(h1,h2,h3,h4,strong,b,dd,legend,.brand,.checkin-status,.checkin-earned,.history-earned,
      .information-index,.faq-plus,.asset-line,.matching-action,.vip-level-mark,.profile-vip-symbol) { color: var(--text)!important; }
  :is(.user-shell, #dialog) :is(p,small,dt,label,time,th,.eyebrow,.muted,.history-title small,.scene-metric span,
      .contribution-workflow span,.industry-directions span,.industry-coverage span,.contribution-methods span,
      .matching-knowledge span,.matching-work span,.checkin-week,.checkin-heading span,.checkin-streak span,
      .checkin-milestone-grid article>span,.checkin-today-reward span,.information-kicker,.account-row span:last-child) { color: var(--muted)!important; }
  :is(.user-shell,#dialog) :is(a,td,summary,.detail-row,.account-page,.checkin-page,.activity-center,.history-page,
      .information-articles,.information-faq,.contribution-section,.matching-knowledge,.scene-section-title) { color: var(--text); }
  :is(.user-shell,#dialog) :is(.panel,.profile-assets,.profile-groups section,.checkin-main,.vip-current,.vip-benefits article,
      .information-hero,.information-faq details,.history-list,.history-overview,.activity-list-item,.activity-detail,.combo-ticket-head,
      .scene-bars,.sample,.choice,.image-job-context,.completion-receipt,.table-wrap,table,th,td,.member-chat,.chat-log) {
    background-color: var(--surface)!important; background-image: none!important; border-color: var(--border)!important;
  }
  :is(.user-shell,#dialog) :is(section,article,li,dl,header,footer,hr,tr,.detail-row,.member-line,.asset-line,.contribution-totals>div,.matching-work) { border-color: var(--border)!important; }
  .user-shell :is(.topbar,.sidebar) { background: #101012!important; border-color: var(--border)!important; box-shadow: none; }
  :is(.user-shell,#dialog) :is(button,.button,input,textarea,select) { color: var(--text)!important; background-color: var(--high)!important; border-color: var(--border)!important; }
  :is(.user-shell,#dialog) :is(.topbar button,.sidebar .nav button,.header-support,.front-language,.home-profile,.account-row,.text-btn,.history-action,.ghost,.member-invite) {
    background: transparent!important; color: var(--muted)!important;
  }
  .user-shell :is(.desktop-workspace-nav,.sidebar .nav) button.active { background: var(--work-selection)!important; color: white!important; }
  :is(.user-shell,#dialog) button.primary:not(:disabled) { background: var(--accent)!important; color: #121214!important; border-color: transparent!important; }
  :is(.user-shell,#dialog) button.primary span { color: inherit!important; }
  :is(.user-shell,#dialog) :is(button,a):focus-visible { outline-color: white!important; }
  .user-shell :is(.checkin-days .signed,.badge) { background: var(--high)!important; color: var(--text)!important; border-color: var(--border)!important; }
  .user-shell .history-status .badge { background: transparent!important; }
  .user-shell .checkin-days .today { border-color: #bbbcc2!important; }
  .user-shell .history-status .red, :is(.user-shell,#dialog) :is(.negative,.error) { color: #f1a7a7!important; }
  .user-shell progress { accent-color: #d3d3da; }
  .user-shell :is(.industry-track i,.scene-bars i,.contribution-stream span) { background: #929298!important; box-shadow: none; }
  .user-shell .industry-track { background: var(--high); }
  .user-shell .contribution-stream path { stroke: #a0a0a6!important; }
  .user-shell :is(.matching-art,.task-backdrop) { filter: grayscale(1); }
  #dialog[open], #dialog :is(.dialog-head,.dialog-body,.dialog-foot,.attempt-actions) { color: var(--text)!important; background: var(--surface)!important; border-color: var(--border)!important; }
  #front-language-panel,#toast { color: var(--text); background: var(--surface); border-color: var(--border); }
  #front-language-panel button { color: var(--text); }
  #front-language-panel button:is(:hover,[aria-pressed="true"]) { color: white; background: var(--high); }
}
body:has(.user-shell) .user-shell .topbar :is(.header-support,.front-language,.home-profile) {
  border-color: transparent!important; box-shadow: none!important;
}
#app .user-shell :is(.desktop-workspace-nav,.sidebar .nav) button[aria-current="page"] {
  background: #303034!important; color: #fff!important;
}
#app .user-shell .topbar :is(.header-support,.front-language,.home-profile) { border: 0!important; }
.user-shell :is(.history-heading>span,.history-overview span,.checkin-page .checkin-week) { color: var(--muted); }
.user-shell .history-overview>div+div { border-color: var(--border); }

#app .user-shell .matching-account dd.amount-earned { color: #93d4af!important; }
#app .user-shell .matching-account dd.amount-negative { color: #f0a2a4!important; }
.user-shell .matching-intro { min-height: 0; padding-right: 0; margin-bottom: clamp(20px,3vw,40px); }
/* The network sits behind the workspace without reserving a row. */
.user-shell .content:has(.matching-scene) { max-width: none; padding-inline: 0; }
.user-shell .matching-scene { padding-inline: clamp(18px,4vw,80px); }
.user-shell .matching-knowledge { margin-inline: clamp(18px,4vw,80px); }
.contribution-network { position: absolute; inset: 0; margin: 0; z-index: -1; pointer-events: none; opacity: .76; mask-image: linear-gradient(90deg, #0005, black 36%, black 51%, #0002 68%, #0001); }
.contribution-network svg { display: block; width: 100%; height: 100%; }
.contribution-network figcaption {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
.network-line,.network-signal,.network-wave { fill: none; stroke-linecap: round; }
.network-line { stroke: #b4c1cd; stroke-opacity: .7; stroke-width: 1.1; }
.network-signal { opacity: 0; stroke: white; stroke-width: 1.8; stroke-dasharray: 4 120; }
.network-trail { stroke: #9ccfff; stroke-width: 3.6; stroke-dasharray: 16 108; filter: blur(1.6px); }
.network-wave { opacity: 0; stroke: #e8edf5; stroke-width: .7; }
@media(prefers-reduced-motion:no-preference) {
  .matching-scene:not(.scene-paused) .contribution-network svg { animation: map-arrival 2.6s cubic-bezier(.16,.75,.24,1) backwards; }
  .matching-scene:not(.scene-paused) .network-signal { animation: network-transfer 2.8s linear calc(var(--step)*-.47s) infinite; }
  .matching-scene:not(.scene-paused) .network-wave { animation: network-arrival 2.8s ease-out calc(1.5s - var(--step)*.47s) infinite; }
  @keyframes map-arrival { from { transform: translateY(4%) scale(.94); opacity: .18; } }
  @keyframes network-transfer { 0% { stroke-dashoffset: 16; opacity: 0; } 6%,48% { opacity: 1; } 55%,100% { stroke-dashoffset: -100; opacity: 0; } }
  @keyframes network-arrival { 0% { r: 9px; opacity: 1; } 45%,100% { r: 22px; opacity: 0; } }
}
@media(min-width:701px) {
  .matching-scene .matching-columns { grid-template-columns: minmax(160px,.65fr) minmax(0,1fr) minmax(285px,1.15fr); gap: clamp(16px,2vw,32px); }
  .matching-scene .matching-action { grid-column: 3; }
}
@media(max-width:700px) {
  .user-shell .matching-intro { margin-bottom: 4px; }
  .contribution-network { height: min(80vw,320px); opacity: .42; mask-image: linear-gradient(165deg, #0004, black 25%, #0003 54%, transparent 83%); }
}

body:has(.user-shell) #dialog .support-channel-list a {
  background: var(--high); color: var(--text); border-color: var(--border);
}
body:has(.user-shell) #dialog .support-channel-list a:is(:hover,:focus-visible) {
  background: #303034; border-color: #686870;
}
body:has(.user-shell) #dialog .support-channel-list a:focus-visible {
  outline: 2px solid var(--text); outline-offset: 3px;
}
body:has(.user-shell) #dialog .support-channel-list a > span:last-child { color: var(--muted); }
body:has(.user-shell) #dialog .dialog-head button[data-action="close"] { border: 0; }

/* Profile overview and directory */
#app .compact-profile .profile-assets {
  background: linear-gradient(115deg, #1d1e23, #111114 80%)!important;
  border: 0; border-radius: 12px; padding: clamp(18px, 3vw, 30px);
}
.compact-profile .profile-portrait {
  width: 56px; height: 56px; flex: none; overflow: hidden;
}
.compact-profile .profile-avatar {
  display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(1.28); transform-origin: 36% 48%; mask: url("/art/profile-terminal-mask.png") center / cover no-repeat; filter: hue-rotate(var(--avatar-hue)) saturate(.78);
}
.compact-profile .member-identity { flex: 1; min-width: 0; }
.compact-profile .member-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 2px 10px; }
.compact-profile .member-heading strong { font-size: 18px; line-height: 1.3; }
#app .compact-profile .member-heading button { min-height: 40px; margin-inline-start: auto; max-width: 100%; overflow-wrap: anywhere; color: var(--text)!important; }
#app .compact-profile .member-invite { min-height: 30px; max-width: 100%; flex-wrap: wrap; }
.compact-profile .member-invite span:nth-child(2) { color: var(--text); }
#app .compact-profile .member-heading > button,
#app .compact-profile .asset-line > button,
#app .compact-profile footer button {
  background: transparent!important; border: 0; padding-inline: 6px; font-size: 13px;
}
#app .compact-profile .asset-line strong { font-size: clamp(34px, 4vw, 48px); letter-spacing: -.045em; }
#app .compact-profile .asset-actions { flex-wrap: wrap; }
#app .compact-profile .asset-actions button { flex: 0 1 auto; padding-inline: 14px; font-size: 13px; }
#app .compact-profile .profile-groups { gap: clamp(22px, 4vw, 52px); margin-top: 26px; }
#app .compact-profile .profile-groups section { padding: 0; border: 0; background: transparent; }
#app .compact-profile .profile-groups h2 { font-size: 14px; margin-bottom: 6px; }
#app .compact-profile .account-row { font-size: 14px; font-weight: 450; padding-inline: 0; }
#app .compact-profile .account-row:hover { background: var(--surface)!important; }
@media(max-width:680px) {
  #app .compact-profile .profile-groups section:last-child { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 18px; }
  #app .compact-profile .profile-groups section:last-child h2 { grid-column: 1/-1; }
  #app .compact-profile .member-line { gap: 12px; }
}

#app .user-shell .information-back,
#app .user-shell .main button[data-view="profile"]:not(.nav button,.desktop-workspace-nav button,.home-profile) {
  background: transparent!important; border: 0; box-shadow: none;
  min-height: 44px; padding: 0 4px; font-size: 13px; font-weight: 500;
}
#app .user-shell .information-back:hover { text-decoration: underline; text-underline-offset: 4px; }
.user-shell .information-orbit {
  inset: -35% -5% auto auto; width: min(58%, 340px); height: auto; aspect-ratio: 1;
  border: 0; box-shadow: none; border-radius: 50%; pointer-events: none;
  background: repeating-radial-gradient(circle, transparent 0 17px, #98accc55 18px, transparent 19px 32px);
  mask-image: linear-gradient(100deg, transparent, black 85%);
}
@media(prefers-reduced-motion:no-preference) {
  .user-shell .information-orbit { animation: guide-ripple 7s ease-in-out infinite alternate; }
  @keyframes guide-ripple { to { transform: scale(1.08); opacity: .65; } }
}

#app .compact-profile footer button[data-action="logout"] {
  width: 100%; min-height: 44px; background: var(--surface)!important;
  border: 1px solid var(--border); border-radius: 8px; color: var(--text)!important;
}
#app .compact-profile footer button[data-action="logout"]:hover { background: var(--high)!important; }
