.profile-modal {
  position: fixed;
  inset: 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.72);
  isolation: isolate;
}

.profile-card {
  width: min(920px, 100%);
  max-height: calc(100vh - 24px);
  overflow: auto;
  border: 3px solid #003399;
  border-radius: 0;
  box-shadow: 0 0 0 2px #ffcc00, 0 12px 40px rgba(0, 0, 0, 0.55);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: #111;
}

.profile-card.theme-classic {
  background: #ffffff url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='60' height='60' fill='%23eef3ff'/%3E%3Ccircle cx='10' cy='10' r='2' fill='%23c8d8ff'/%3E%3C/svg%3E");
}

.profile-card.theme-neon {
  background: linear-gradient(180deg, #12001f 0%, #1a0033 100%);
  border-color: #ff00ff;
  box-shadow: 0 0 0 2px #00ffff, 0 0 24px rgba(255, 0, 255, 0.45);
  color: #f5e9ff;
}

.profile-card.theme-midnight {
  background: linear-gradient(180deg, #0b1020 0%, #151b2e 100%);
  border-color: #4466aa;
  box-shadow: 0 0 0 2px #223355, 0 12px 40px rgba(0, 0, 0, 0.7);
  color: #dce6ff;
}

.profile-card.theme-solar {
  background: linear-gradient(180deg, #fff8e7 0%, #ffe8b8 100%);
  border-color: #cc6600;
  box-shadow: 0 0 0 2px #ff9933, 0 12px 40px rgba(204, 102, 0, 0.25);
  color: #3a2200;
}

.profile-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: linear-gradient(90deg, #003399, #3366cc);
  color: #fff;
}

.profile-top h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-close {
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
}

.profile-top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.profile-customize-btn {
  font-size: 0.85rem;
  padding: 6px 12px;
}

.profile-edit-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-edit-media-stage {
  margin: 8px -12px 0;
}

.profile-edit-company-content {
  padding-bottom: 12px;
}

.profile-edit-header-banner {
  margin-bottom: 0;
}

.profile-edit-media-toolbar {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-top: 2px dashed rgba(0, 51, 153, 0.35);
  background: rgba(255, 255, 255, 0.55);
}

.theme-neon .profile-edit-media-toolbar,
.theme-midnight .profile-edit-media-toolbar {
  background: rgba(255, 255, 255, 0.06);
}

.theme-solar .profile-edit-media-toolbar {
  background: rgba(255, 255, 255, 0.35);
}

.profile-edit-media-row {
  display: grid;
  grid-template-columns: minmax(88px, 112px) minmax(0, 1fr);
  gap: 8px 12px;
  align-items: start;
}

.profile-edit-media-row-label {
  margin: 0;
  padding-top: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
}

.profile-edit-media-row-body {
  min-width: 0;
}

.profile-edit-media-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.profile-edit-company-row-actions .profile-edit-company-name-field {
  flex: 1 1 180px;
  min-width: 0;
}

.profile-edit-media-row-actions .profile-media-btn {
  width: auto;
  flex: 0 1 auto;
  min-width: 7rem;
}

.profile-edit-media-status {
  margin: 4px 0 0;
  font-size: 0.72rem;
  line-height: 1.25;
  word-break: break-word;
}

.profile-edit-company-name-field {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #99bbee;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font-size: 0.92rem;
}

.theme-neon .profile-edit-company-name-field,
.theme-midnight .profile-edit-company-name-field {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.25);
  color: inherit;
}

.profile-photo-upload-compact {
  width: 100%;
  gap: 4px;
}

.profile-media-btn {
  width: 100%;
  padding: 4px 8px;
  font-size: 0.72rem;
  line-height: 1.25;
  min-height: 0;
}

.profile-photo-upload-compact .profile-save-status {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.25;
  text-align: center;
  word-break: break-word;
}

.profile-edit-save-row {
  padding: 4px 10px 12px;
}

.profile-company-actions,
.profile-company-list-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}

.profile-company-list-row input[type="number"] {
  flex: 1 1 140px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #99bbee;
  border-radius: 0;
  background: #fff;
  color: #111;
}

.profile-banner {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 120px;
  gap: 16px;
  padding: 16px;
  align-items: start;
  border-bottom: 2px dashed rgba(0, 51, 153, 0.35);
  position: relative;
  background-color: #e8f0ff;
  background-image: radial-gradient(circle at 25% 25%, rgba(102, 153, 255, 0.22) 1px, transparent 1px);
  background-size: 12px 12px;
}

.profile-banner.has-custom-background {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.profile-banner.has-custom-background::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.62) 0%,
    rgba(255, 255, 255, 0.38) 45%,
    rgba(255, 255, 255, 0.38) 55%,
    rgba(255, 255, 255, 0.62) 100%
  );
  pointer-events: none;
}

.profile-banner.has-custom-background > * {
  position: relative;
  z-index: 1;
}

.profile-background-preview {
  min-height: 110px;
  margin-bottom: 12px;
  border: 2px dashed #99bbee;
  border-radius: 0;
  background-color: #e8f0ff;
  background-image: radial-gradient(circle at 25% 25%, rgba(102, 153, 255, 0.22) 1px, transparent 1px);
  background-size: 12px 12px;
  background-repeat: repeat;
}

.profile-background-preview.has-custom-background {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.theme-neon .profile-banner,
.theme-midnight .profile-banner {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

.theme-solar .profile-banner {
  border-bottom-color: rgba(204, 102, 0, 0.25);
}

.profile-avatar-column {
  width: 120px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 3px solid #003399;
  background: linear-gradient(135deg, #6699ff, #003399);
  color: #fff;
  font-size: 2.4rem;
  font-weight: 700;
  text-transform: uppercase;
}

.profile-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.profile-avatar-initials {
  position: relative;
  z-index: 1;
}

.profile-avatar.has-photo .profile-avatar-initials {
  display: none;
}

.profile-mine-name-label {
  display: block;
  line-height: 1.35;
}

.profile-company-column {
  width: 120px;
  flex-shrink: 0;
  justify-self: end;
}

.profile-company-logo-slot {
  width: 120px;
  height: 120px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: visible;
  border: none;
  background: transparent;
  box-sizing: border-box;
}

.profile-company-logo {
  position: relative;
  z-index: 1;
  max-width: 120px;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
  background: transparent;
  filter: drop-shadow(0 2px 8px rgba(0, 20, 60, 0.45));
}

.profile-company-logo-placeholder {
  display: none;
}

.profile-company-logo-slot.has-logo .profile-company-logo-placeholder {
  display: none;
}

.profile-company-logo-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.profile-photo-upload {
  display: grid;
  gap: 6px;
  width: 100%;
}

.profile-photo-btn {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.82rem;
}

.profile-photo-upload .profile-save-status {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.3;
  text-align: center;
  word-break: break-word;
}

.profile-pronouns-hint {
  margin: 6px 0 0;
  font-size: 0.82rem;
  opacity: 0.85;
  max-width: 28rem;
}

.profile-preferred-pronouns-section {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px dashed rgba(0, 51, 153, 0.3);
  background: rgba(255, 255, 255, 0.45);
}

.profile-avatar-preset-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed rgba(0, 51, 153, 0.25);
}

.profile-avatar-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.profile-avatar-preset-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 2px solid rgba(0, 51, 153, 0.25);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: center;
}

.profile-avatar-preset-option:hover {
  border-color: rgba(0, 51, 153, 0.55);
}

.profile-avatar-preset-option.is-selected {
  border-color: #003399;
  box-shadow: 0 0 0 2px rgba(0, 51, 153, 0.15);
}

.profile-avatar-preset-option:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.profile-avatar-preset-thumb {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(0, 51, 153, 0.2);
}

.profile-avatar-preset-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #003399;
}

.theme-neon .profile-avatar-preset-label {
  color: #ff66ff;
}

.theme-midnight .profile-avatar-preset-label {
  color: #aaccff;
}

.theme-solar .profile-avatar-preset-label {
  color: #994400;
}

.profile-photo-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.profile-add-friend-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.profile-add-friend-row input {
  flex: 1 1 180px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  font-family: "Courier New", Consolas, monospace;
}

.profile-photo-row input[type="file"] {
  flex: 1 1 180px;
  min-width: 0;
  color: inherit;
}

.theme-neon .profile-avatar {
  border-color: #ff00ff;
  background: linear-gradient(135deg, #ff00ff, #6600cc);
}

.theme-midnight .profile-avatar {
  border-color: #6688cc;
  background: linear-gradient(135deg, #4466aa, #112244);
}

.theme-solar .profile-avatar {
  border-color: #cc6600;
  background: linear-gradient(135deg, #ffcc66, #cc6600);
}

.profile-headline h3 {
  margin: 0 0 6px;
  font-size: 1.8rem;
  color: #003399;
}

.theme-neon .profile-headline h3 {
  color: #ff66ff;
}

.theme-midnight .profile-headline h3 {
  color: #aaccff;
}

.theme-solar .profile-headline h3 {
  color: #994400;
}

.profile-mood-display {
  margin: 0 0 8px;
  font-style: italic;
  font-size: 1.05rem;
}

.profile-mood-display::before {
  content: "Mood: ";
  font-weight: 700;
  font-style: normal;
}

.profile-member-since {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.75;
}

.profile-number {
  margin: 0 0 6px;
  font-family: "Courier New", Consolas, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.profile-number::before {
  content: "Profile !: ";
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  opacity: 0.75;
}

.profile-body {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr);
  gap: 14px;
  padding: 14px;
}

.profile-box {
  border: 2px solid #99bbee;
  background: rgba(255, 255, 255, 0.72);
  margin-bottom: 12px;
}

.theme-neon .profile-box,
.theme-midnight .profile-box {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

.theme-solar .profile-box {
  background: rgba(255, 255, 255, 0.55);
  border-color: #ffcc88;
}

.profile-box h4 {
  margin: 0;
  padding: 6px 10px;
  background: linear-gradient(90deg, #6699ff, #99bbee);
  color: #001133;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.theme-neon .profile-box h4 {
  background: linear-gradient(90deg, #6600aa, #ff00ff);
  color: #fff;
}

.theme-midnight .profile-box h4 {
  background: linear-gradient(90deg, #223355, #446688);
  color: #eef4ff;
}

.theme-solar .profile-box h4 {
  background: linear-gradient(90deg, #ff9933, #ffcc66);
  color: #4a2200;
}

.profile-box-content {
  padding: 10px 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  min-height: 48px;
}

.profile-box-content.empty {
  opacity: 0.55;
  font-style: italic;
}

.profile-social-view {
  white-space: normal;
}

.profile-social-empty {
  margin: 0;
  opacity: 0.55;
  font-style: italic;
}

.profile-friends-list {
  white-space: normal;
  display: grid;
  gap: 8px;
  min-height: 0;
}

.profile-friends-list.empty {
  opacity: 0.55;
  font-style: italic;
}

.profile-friend-item {
  padding: 8px 10px;
  border: 1px solid #99bbee;
  background: rgba(255, 255, 255, 0.85);
}

.theme-neon .profile-friend-item,
.theme-midnight .profile-friend-item {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.25);
}

.theme-solar .profile-friend-item {
  border-color: #ffcc88;
  background: rgba(255, 255, 255, 0.65);
}

.profile-friend-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.profile-friend-name {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.profile-friend-name:hover {
  color: #003399;
}

.theme-neon .profile-friend-name:hover,
.theme-midnight .profile-friend-name:hover {
  color: #aaccff;
}

.profile-friend-number {
  font-family: "Courier New", Consolas, monospace;
  font-size: 0.8rem;
  opacity: 0.75;
}

.profile-friend-status {
  margin: 4px 0 0;
  font-size: 0.9rem;
}

.profile-friend-mood {
  margin: 2px 0 0;
  font-size: 0.85rem;
  opacity: 0.75;
  font-style: italic;
}

.profile-social-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.profile-social-list li {
  display: grid;
  gap: 2px;
}

.profile-social-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

.profile-social-list a {
  color: inherit;
  word-break: break-word;
}

.profile-social-list a:hover {
  text-decoration: underline;
}

.profile-stats {
  display: grid;
  gap: 6px;
}

.profile-stats dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  opacity: 0.7;
}

.profile-stats dd {
  margin: 0 0 8px;
  font-weight: 700;
}

.profile-sidebar-number,
.profile-edit-number {
  font-family: "Courier New", Consolas, monospace;
  letter-spacing: 0.02em;
}

.profile-number-label {
  margin: 12px 0 4px;
  font-size: 0.85rem;
  font-weight: 700;
}

.profile-number-hint {
  margin: 4px 0 12px;
  font-size: 0.85rem;
  opacity: 0.75;
}

.profile-edit-panel label {
  display: block;
  margin: 8px 0 4px;
  font-size: 0.85rem;
  font-weight: 700;
}

.profile-edit-panel input,
.profile-edit-panel textarea,
.profile-edit-panel select {
  width: 100%;
  padding: 8px;
  border: 1px solid #99bbee;
  border-radius: 0;
  background: #fff;
  color: #111;
}

.theme-neon .profile-edit-panel input,
.theme-neon .profile-edit-panel textarea,
.theme-neon .profile-edit-panel select,
.theme-midnight .profile-edit-panel input,
.theme-midnight .profile-edit-panel textarea,
.theme-midnight .profile-edit-panel select {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.25);
  color: inherit;
}

.profile-edit-panel textarea {
  min-height: 72px;
  resize: vertical;
}

.profile-edit-panel .profile-privacy-options {
  margin: 12px 0 4px;
}

.profile-edit-panel .profile-privacy-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.4;
  cursor: pointer;
}

.profile-edit-panel .profile-privacy-option input[type="checkbox"] {
  width: auto;
  min-width: 1rem;
  padding: 0;
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.profile-save-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 10px 10px;
}

.profile-save-status {
  font-size: 0.85rem;
}

.profile-save-status.error {
  color: #993333;
}

.profile-save-status.success {
  color: #226633;
}

.player-name.clickable {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.35);
  text-underline-offset: 3px;
}

.player-name.clickable:hover {
  color: #aaccff;
}

.friends-add {
  margin-bottom: 18px;
}

.friends-add label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.friends-add-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.friends-add-row input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
}

.friends-status {
  min-height: 1.2rem;
  margin: 8px 0 0;
  font-size: 0.9rem;
}

.friends-status.error {
  color: #ff8877;
}

.friends-status.success {
  color: #7fd99a;
}

.friends-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.friends-columns h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.friends-list {
  display: grid;
  gap: 8px;
}

.friend-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
}

.friend-item-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.friend-item-name {
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.friend-item-number {
  font-family: "Courier New", Consolas, monospace;
  font-size: 0.85rem;
  color: var(--muted);
}

.friend-item-mood {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

.friend-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-friend-status {
  margin: 0 0 10px;
  font-weight: 700;
}

.profile-friend-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .friends-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .profile-banner {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .profile-edit-media-row {
    grid-template-columns: 1fr;
  }

  .profile-edit-media-row-label {
    padding-top: 0;
  }

  .profile-edit-media-row-actions .profile-media-btn {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }

  .profile-avatar-column,
  .profile-company-column {
    justify-self: center;
  }

  .profile-avatar-column {
    align-items: center;
  }

  .profile-body {
    grid-template-columns: 1fr;
  }
}

.profile-flag-notice {
  margin: 0 16px 16px;
  padding: 14px 16px;
  border: 2px solid #cc6600;
  background: #fff4df;
  color: #5c3d00;
}

.profile-flag-notice strong {
  display: block;
  margin-bottom: 8px;
}

.profile-flag-comment {
  margin: 0 0 8px;
  white-space: pre-wrap;
}

.profile-flag-hint {
  margin: 0;
  font-size: 0.9rem;
  color: #7a5418;
}

.profile-completion-modal {
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.85);
}

.profile-completion-modal[hidden] {
  display: none !important;
}

.profile-completion-card {
  width: min(480px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 20px 22px 24px;
  border: 3px solid #003399;
  background: #fff;
  box-shadow: 0 0 0 2px #ffcc00, 0 12px 40px rgba(0, 0, 0, 0.55);
  color: #111;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.profile-completion-intro {
  margin: 0 0 16px;
  line-height: 1.45;
  color: #333;
}

.profile-completion-fields label {
  display: block;
  margin: 12px 0 4px;
  font-weight: 700;
}

.profile-completion-fields select {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid rgba(0, 51, 153, 0.35);
  font: inherit;
}

.profile-completion-actions {
  margin-top: 18px;
}
