#career-profile-desk {
  width: min(720px, calc(100% - var(--sal) - var(--sar) - 26px));
  max-width: none;
  max-height: calc(100vh - var(--sat) - var(--sab) - 22px);
  max-height: calc(100dvh - var(--sat) - var(--sab) - 22px);
  min-height: 0;
  padding: 0;
  margin: auto;
  overflow: hidden;
  border: 4px solid var(--ink);
  border-radius: var(--wob);
  color: var(--ink);
  background: var(--paper);
  box-shadow: 6px 7px 0 var(--ink), 0 0 0 2px var(--paper);
  font: 600 clamp(15px, 2.7vw, 18px)/1.25 var(--f-ui);
}

#career-profile-desk[open] { display: flex; flex-direction: column; }
#career-profile-desk::backdrop { background: #1a1238aa; }

.pd-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 3px solid var(--ink);
  background: radial-gradient(circle, #1a123828 1px, transparent 1.5px) 0 0 / 7px 7px, var(--sun);
}

.pd-header > div { min-width: 0; }
.pd-header h2 { font: 400 clamp(19px, 4vw, 29px)/1.1 var(--f-display); text-transform: uppercase; }
.pd-account { margin-top: 3px; font-size: .95em; font-weight: 800; overflow-wrap: anywhere; }

.pd-button {
  appearance: none;
  min-width: 0;
  min-height: 44px;
  padding: 5px 12px;
  border: 2px solid var(--ink);
  border-radius: var(--wob-s);
  background: #fffaf0;
  box-shadow: 2px 3px 0 var(--ink);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.pd-button:active { transform: translate(1px, 1px); box-shadow: 1px 2px 0 var(--ink); }
.pd-button:focus-visible, .pd-panel:focus-visible, .pd-friend-form input:focus-visible {
  outline: 3px solid #205d68;
  outline-offset: 2px;
}
.pd-close { flex: 0 0 44px; padding: 0 0 2px; border-radius: 50%; font-size: 29px; line-height: 1; }
.pd-primary { background: var(--sun); }

.pd-tabs {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 7px 10px 9px;
  border-bottom: 2px solid var(--ink);
  background: #eedecb;
}
.pd-tab { min-height: 44px; padding-inline: 2px; text-transform: uppercase; }
.pd-tab[aria-selected="true"] { background: var(--ink); color: var(--sun); box-shadow: 2px 3px 0 #8b79a8; }

.pd-body { min-height: 0; overflow: auto; overscroll-behavior: contain; touch-action: pan-y; }
.pd-panel { min-width: 0; display: grid; align-content: start; gap: 10px; padding: 11px 13px 16px; }
.pd-panel:focus-visible { outline-offset: -4px; }
.pd-panel h3 { font-size: clamp(17px, 3vw, 21px); line-height: 1.1; }
.pd-subtle { color: #5c4d6d; }

.pd-progression {
  display: grid;
  gap: 7px;
  justify-items: start;
  min-width: 0;
  padding: 10px 12px 12px;
  border: 2px solid var(--ink);
  border-radius: var(--wob-s);
  background: #fffaf0;
  box-shadow: 2px 3px 0 var(--ink);
}
.pd-level { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.pd-level h3 { font: 400 clamp(20px, 3.8vw, 25px)/1.1 var(--f-display); text-transform: uppercase; }
.pd-badge {
  flex: none;
  padding: 2px 7px 3px;
  border: 1.5px solid var(--ink);
  border-radius: var(--wob-s);
  background: var(--paper);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pd-level .pd-badge { background: var(--mint); }
.pd-progress {
  appearance: none;
  width: 100%;
  height: 13px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background-color: #efe2cf;
  color: #078878;
  accent-color: #078878;
}
.pd-progress::-webkit-progress-bar { background-color: #efe2cf; }
.pd-progress::-webkit-progress-value { background-color: #078878; }
.pd-progress::-moz-progress-bar { background-color: #078878; }
.pd-prestige-review { width: 100%; display: grid; gap: 6px; }

.pd-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 132px), 1fr)); gap: 6px; }
.pd-stat { min-width: 0; padding: 7px 9px; border: 1.5px solid var(--ink); border-radius: var(--wob-s); background: #fffaf0; }
.pd-stat dt { color: #5c4d6d; }
.pd-stat dd { font-size: 1.25em; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.pd-achievement-count { font-weight: 800; }
.pd-achievements, .pd-friends-list { display: grid; gap: 7px; list-style: none; padding: 0; margin: 0; }
.pd-achievements { grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr)); }
.pd-achievement, .pd-friend {
  padding: 7px 9px;
  border: 2px solid var(--ink);
  border-radius: var(--wob-s);
  background: #fffaf0;
}
.pd-achievement { display: grid; align-content: start; gap: 3px; }
.pd-achievement-heading { display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: 4px 6px; }
.pd-achievement small { color: #5c4d6d; font-weight: 800; }
.pd-unlocked { background: #e0f6ea; }
.pd-unlocked .pd-badge { background: var(--mint); }

.pd-friend-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.pd-friend-form label { display: grid; gap: 3px; font-weight: 800; }
.pd-friend-form input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 4px 8px;
  border: 2px solid var(--ink);
  border-radius: var(--wob-s);
  color: var(--ink);
  background: #fffaf0;
  font: inherit;
  font-size: max(16px, 1em);
  -webkit-user-select: text;
  user-select: text;
}
.pd-friend-form input, .pd-friend-form button { touch-action: manipulation; }
.pd-friend-groups { display: grid; gap: 6px; }
.pd-friends-heading { margin-top: 5px; }
.pd-friend { display: flex; align-items: center; justify-content: space-between; gap: 7px; flex-wrap: wrap; }
.pd-friend-name { display: grid; min-width: 0; overflow-wrap: anywhere; }
.pd-friend-name small { color: #5c4d6d; }
.pd-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.pd-refresh { justify-self: start; }
.pd-status { flex: none; padding: 6px 12px; border-top: 2px solid var(--ink); background: #e0f6ea; overflow-wrap: anywhere; }
.pd-status.pd-error { background: #ffd8ca; }

@media (max-width: 450px) {
  .pd-friend-form { grid-template-columns: 1fr; }
  .pd-friend-form button { justify-self: start; }
}

@media (max-height: 440px) and (orientation: landscape) {
  #career-profile-desk { max-height: calc(100dvh - var(--sat) - var(--sab) - 14px); }
  .pd-header { padding-block: 4px; }
  .pd-tabs { padding-block: 4px 6px; }
  .pd-panel { padding-block: 8px 12px; }
}
