:root {
  --profile-bg: #091019;
  --profile-panel: rgba(17, 27, 41, .88);
  --profile-line: rgba(209, 173, 108, .2);
  --profile-gold: #d1ad6c;
  --profile-paper: #eee6d6;
  --profile-muted: #99a4b2;
  --profile-success: #75b89a;
  --profile-danger: #d77b7f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body.profile-page {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--profile-paper);
  background:
    radial-gradient(circle at 8% 0%, rgba(46, 78, 112, .2), transparent 34rem),
    radial-gradient(circle at 92% 26%, rgba(126, 76, 69, .12), transparent 30rem),
    var(--profile-bg);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

.profile-ambient { position: fixed; z-index: -1; width: 24rem; height: 24rem; border-radius: 50%; filter: blur(100px); opacity: .15; }
.profile-ambient-a { top: 15%; left: -12rem; background: #47749e; }
.profile-ambient-b { right: -10rem; bottom: -5rem; background: #9a6c45; }

.profile-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  min-height: 88px;
  margin: auto;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.profile-brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.profile-brand > span:first-child { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--profile-gold); border-radius: 50%; color: var(--profile-gold); }
.profile-brand strong, .profile-brand small { display: block; }
.profile-brand strong { font-family: "Noto Serif SC", serif; letter-spacing: .12em; }
.profile-brand small { margin-top: 4px; color: var(--profile-muted); font-size: 9px; letter-spacing: .18em; }
.profile-header nav { display: flex; align-items: center; gap: 22px; }
.profile-header nav a, .profile-header nav button { border: 0; color: var(--profile-muted); background: none; font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; }
.profile-header nav a:hover, .profile-header nav button:hover { color: var(--profile-gold); }

.profile-main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 64px 0 100px; }
.static-session-note { margin: 0 0 24px; padding: 15px 18px; border: 1px solid rgba(209,173,108,.28); border-left: 3px solid var(--profile-gold); color: #cbd2da; background: rgba(209,173,108,.07); font-size: 14px; line-height: 1.8; }
.static-session-note strong { margin-right: 8px; color: var(--profile-gold); }
.profile-loading { display: grid; min-height: 55vh; place-items: center; align-content: center; gap: 20px; color: var(--profile-muted); }
.loading-orbit { width: 52px; height: 52px; border: 1px solid rgba(209,173,108,.25); border-top-color: var(--profile-gold); border-radius: 50%; animation: profile-spin 1s linear infinite; }
@keyframes profile-spin { to { transform: rotate(360deg); } }

.signed-out-card { width: min(520px, 100%); margin: 5vh auto; padding: clamp(28px, 5vw, 52px); border: 1px solid var(--profile-line); background: var(--profile-panel); box-shadow: 0 30px 80px rgba(0,0,0,.28); }
.signed-out-card h1 { margin: 7px 0 12px; font: 700 clamp(30px, 6vw, 48px)/1.2 "Noto Serif SC", serif; }
.signed-out-card > p { color: var(--profile-muted); line-height: 1.8; }
.profile-text-link { display: inline-block; margin-top: 20px; color: var(--profile-gold); text-decoration: none; }

.identity-hero { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 26px; margin-bottom: 28px; padding: clamp(26px, 4vw, 44px); border: 1px solid var(--profile-line); background: linear-gradient(135deg, rgba(25,39,57,.95), rgba(12,20,31,.92)); box-shadow: 0 24px 70px rgba(0,0,0,.22); }
.identity-avatar { display: grid; width: 88px; height: 88px; overflow: hidden; place-items: center; border: 1px solid var(--profile-gold); border-radius: 50%; color: var(--profile-gold); background: rgba(209,173,108,.07); font: 700 34px "Noto Serif SC", serif; }
.identity-avatar img, .avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.profile-eyebrow { margin: 0; color: var(--profile-gold); font-size: 10px; font-weight: 700; letter-spacing: .19em; }
.identity-copy h1 { margin: 6px 0 3px; font: 700 clamp(30px, 5vw, 48px)/1.2 "Noto Serif SC", serif; }
.identity-copy > p:not(.profile-eyebrow) { margin: 0; color: var(--profile-muted); font-size: 13px; }
.identity-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.identity-badges span { padding: 5px 10px; border: 1px solid rgba(255,255,255,.1); color: #bdc7d2; font-size: 11px; }
.identity-badges .locked-badge { border-color: rgba(209,173,108,.35); color: var(--profile-gold); }
.identity-stat { min-width: 120px; text-align: right; }
.identity-stat span, .identity-stat strong { display: block; }
.identity-stat span { color: var(--profile-muted); font-size: 11px; }
.identity-stat strong { margin-top: 7px; color: var(--profile-gold); font: 600 18px "Noto Serif SC", serif; }

.profile-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 28px; }
.profile-panel { margin-top: 28px; padding: clamp(24px, 4vw, 38px); border: 1px solid rgba(255,255,255,.09); background: var(--profile-panel); box-shadow: 0 20px 60px rgba(0,0,0,.16); }
.profile-grid .profile-panel { margin-top: 0; }
.profile-panel > header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.profile-panel h2 { margin: 5px 0 0; font: 700 25px "Noto Serif SC", serif; }
.profile-panel > header > span { color: var(--profile-muted); font-size: 11px; }
.new-work-link { padding: 9px 13px; border: 1px solid rgba(209,173,108,.35); color: var(--profile-gold); font-size: 11px; text-decoration: none; }
.profile-form, .compact-form { display: grid; gap: 18px; }
.profile-form label, .compact-form label { display: grid; gap: 8px; }
.profile-form label > span, .compact-form label > span { color: #c6cfda; font-size: 12px; }
.profile-form input, .profile-form textarea, .compact-form input { width: 100%; border: 1px solid rgba(255,255,255,.12); outline: 0; color: var(--profile-paper); background: rgba(4,10,17,.5); font: inherit; font-size: 14px; }
.profile-form input, .compact-form input { height: 48px; padding: 0 14px; }
.profile-form textarea { resize: vertical; min-height: 128px; padding: 13px 14px; line-height: 1.7; }
.profile-form input:focus, .profile-form textarea:focus, .compact-form input:focus { border-color: var(--profile-gold); box-shadow: 0 0 0 3px rgba(209,173,108,.08); }
.profile-form label small { color: var(--profile-muted); text-align: right; }
.profile-primary { min-height: 46px; padding: 0 18px; border: 1px solid var(--profile-gold); color: #101722; background: var(--profile-gold); font: 600 13px inherit; cursor: pointer; transition: transform .18s ease, opacity .18s ease; }
.profile-primary:hover { transform: translateY(-1px); }
.profile-primary:disabled { opacity: .55; cursor: wait; }
.profile-form > p { margin: 0; color: var(--profile-muted); font-size: 13px; line-height: 1.8; }
.security-grid { margin-top: 28px; }
.security-grid .profile-panel { margin-top: 0; }
.compact-security-form { padding-bottom: 24px; border-bottom: 1px solid rgba(255,255,255,.08); }
.compact-security-form > small { margin-top: -8px; color: var(--profile-muted); font-size: 12px; line-height: 1.7; }
.security-static-note { margin: 0; padding: 16px; border: 1px solid rgba(209,173,108,.28); border-left: 3px solid var(--profile-gold); color: #cbd2da; background: rgba(209,173,108,.06); font-size: 14px; line-height: 1.8; }
.session-revoke { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 24px; }
.session-revoke strong { color: var(--profile-paper); font: 600 15px "Noto Serif SC", serif; }
.session-revoke p { margin: 6px 0 0; color: var(--profile-muted); font-size: 13px; line-height: 1.7; }
.profile-secondary, .profile-danger { min-height: 44px; padding: 0 16px; border: 1px solid rgba(209,173,108,.36); color: var(--profile-gold); background: transparent; font: 600 13px inherit; cursor: pointer; }
.profile-danger { border-color: rgba(215,123,127,.48); color: #efa3a6; }
.profile-secondary:hover { background: rgba(209,173,108,.08); }
.profile-danger:hover { background: rgba(215,123,127,.08); }
.profile-secondary:disabled, .profile-danger:disabled { opacity: .55; cursor: wait; }
.privacy-facts { display: grid; gap: 0; margin: 0; }
.privacy-facts > div { padding: 16px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.privacy-facts > div:first-child { padding-top: 0; }
.privacy-facts dt { color: var(--profile-paper); font-weight: 600; }
.privacy-facts dd { margin: 6px 0 0; color: var(--profile-muted); font-size: 13px; line-height: 1.75; }
.privacy-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.avatar-editor { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 18px; align-items: center; padding: 18px; border: 1px solid rgba(255,255,255,.09); background: rgba(4,10,17,.28); }
.avatar-preview { display: grid; width: 92px; height: 92px; overflow: hidden; place-items: center; border: 1px solid rgba(209,173,108,.55); border-radius: 50%; color: var(--profile-gold); background: rgba(209,173,108,.08); font: 700 30px "Noto Serif SC", serif; }
.avatar-editor-copy > strong { display: block; color: var(--profile-paper); font: 600 15px "Noto Serif SC", serif; }
.avatar-editor-copy > p { margin: 7px 0 0; color: var(--profile-muted); font-size: 12px; line-height: 1.7; }
.avatar-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.avatar-upload, .avatar-remove { min-height: 36px; display: inline-flex !important; align-items: center; justify-content: center; padding: 0 13px; border: 1px solid rgba(209,173,108,.38); color: var(--profile-gold); background: transparent; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
.avatar-upload:hover, .avatar-remove:hover { border-color: var(--profile-gold); background: rgba(209,173,108,.08); }
.avatar-upload:focus-within, .avatar-remove:focus-visible { outline: 2px solid var(--profile-gold); outline-offset: 2px; }
.avatar-upload input { position: absolute; width: 1px !important; height: 1px !important; overflow: hidden; padding: 0 !important; border: 0 !important; opacity: 0; clip-path: inset(50%); }
.avatar-remove:disabled { opacity: .42; cursor: default; }
.avatar-message { min-height: 1.4em; margin-top: 8px !important; color: var(--profile-success) !important; }
.avatar-message.error { color: var(--profile-danger) !important; }
.form-message { margin: 0; color: var(--profile-success) !important; }
.form-message.error { color: var(--profile-danger) !important; }

.status-card { margin-bottom: 22px; padding: 18px; border: 1px solid rgba(255,255,255,.1); }
.status-card.verified { border-color: rgba(117,184,154,.33); background: rgba(117,184,154,.07); }
.status-card.pending { border-color: rgba(209,173,108,.32); background: rgba(209,173,108,.06); }
.status-card strong { color: var(--profile-success); }
.status-card.pending strong { color: var(--profile-gold); }
.status-card p { margin: 9px 0 0; color: var(--profile-muted); line-height: 1.7; }
.status-card blockquote { margin: 16px 0 0; padding-left: 14px; border-left: 2px solid rgba(209,173,108,.45); color: #cbd2da; font-size: 13px; line-height: 1.75; }

.works-list, .applications-list { display: grid; gap: 14px; }
.work-card { display: grid; grid-template-columns: 1fr minmax(260px, .8fr); align-items: center; gap: 26px; padding: 22px; border: 1px solid rgba(209,173,108,.16); background: rgba(8,15,24,.54); }
.work-card h3 { margin: 5px 0; font: 700 21px "Noto Serif SC", serif; }
.work-card p { margin: 0; color: var(--profile-muted); font-size: 12px; }
.work-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.work-actions a { padding: 8px 11px; border: 1px solid rgba(255,255,255,.1); color: #c9d1da; font-size: 10px; text-decoration: none; }
.work-actions a.manage { border-color: rgba(209,173,108,.35); color: var(--profile-gold); }
.works-empty { display: grid; grid-template-columns: 46px 1fr auto; gap: 18px; align-items: center; padding: 24px; border: 1px dashed rgba(209,173,108,.25); color: var(--profile-muted); }
.works-empty > span { color: var(--profile-gold); font-size: 25px; }
.works-empty strong { color: var(--profile-paper); }
.works-empty p { margin: 5px 0 0; font-size: 11px; }
.works-empty a { padding: 9px 12px; border: 1px solid rgba(209,173,108,.35); color: var(--profile-gold); font-size: 10px; text-decoration: none; }
.work-key label { display: block; margin-bottom: 7px; color: var(--profile-gold); font-size: 10px; letter-spacing: .12em; }
.key-control { display: flex; flex-wrap: wrap; }
.key-control input { min-width: 0; flex: 1; height: 44px; padding: 0 12px; border: 1px solid rgba(255,255,255,.12); color: var(--profile-paper); background: #080f18; font: 13px monospace; }
.key-control button { padding: 0 13px; border: 1px solid rgba(209,173,108,.35); color: var(--profile-gold); background: transparent; cursor: pointer; }
.key-control button:disabled { opacity: .55; cursor: wait; }
.work-key small { display: block; margin-top: 7px; color: var(--profile-muted); }
.static-key-note { padding: 14px; border: 1px solid rgba(209,173,108,.18); background: rgba(209,173,108,.045); }
.static-key-note small { margin: 0; font-size: 13px; line-height: 1.7; }
.static-key-note .key-control { margin-top: 10px; }

.application-card { display: grid; grid-template-columns: 1fr auto; gap: 18px; padding: 20px; border: 1px solid rgba(255,255,255,.09); background: rgba(8,15,24,.46); }
.application-card h3 { margin: 0 0 4px; font-size: 16px; }
.application-card small { color: var(--profile-muted); }
.application-card p { margin: 12px 0 0; color: #c8d0da; line-height: 1.7; }
.review-actions { display: flex; align-items: center; gap: 8px; }
.review-actions button { padding: 9px 12px; border: 1px solid rgba(255,255,255,.13); color: #d7dee6; background: transparent; cursor: pointer; }
.review-actions .approve { border-color: rgba(117,184,154,.4); color: var(--profile-success); }
.review-actions .reject { color: var(--profile-danger); }
.empty-applications { padding: 26px; color: var(--profile-muted); text-align: center; }

.profile-toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: min(380px, calc(100% - 48px)); padding: 13px 18px; border: 1px solid rgba(209,173,108,.3); color: var(--profile-paper); background: #111c29; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.profile-toast.visible { opacity: 1; transform: none; }

@media (max-width: 820px) {
  .profile-grid { grid-template-columns: 1fr; }
  .identity-hero { grid-template-columns: auto 1fr; }
  .identity-stat { grid-column: 1 / -1; text-align: left; }
  .work-card { grid-template-columns: 1fr; }
  .works-empty { grid-template-columns: 1fr; }
  .application-card { grid-template-columns: 1fr; }
}

@media (max-width: 580px) {
  .profile-header { width: min(100% - 28px, 1180px); min-height: 74px; }
  .profile-header nav a:nth-child(2) { display: none; }
  .profile-header nav { gap: 12px; }
  .profile-brand small { display: none; }
  .profile-main { width: min(100% - 28px, 1180px); padding-top: 34px; }
  .identity-hero { grid-template-columns: 1fr; text-align: center; }
  .identity-avatar { margin: auto; }
  .avatar-editor { grid-template-columns: 1fr; text-align: center; }
  .avatar-preview { margin: 0 auto; }
  .avatar-actions { justify-content: center; }
  .identity-badges { justify-content: center; }
  .identity-stat { text-align: center; }
  .profile-panel > header { align-items: start; flex-direction: column; }
  .key-control { flex-wrap: wrap; }
  .key-control input { flex-basis: 100%; }
  .key-control button { min-height: 40px; flex: 1; }
  .session-revoke { align-items: stretch; flex-direction: column; }
  .privacy-actions > button { flex: 1 1 100%; }
}
