/* Shared EnjakuAi credential entry and modal. Uses the host page's color variables. */
.phx-auth-entry {
  flex-shrink: 0;
  text-align: center;
}
.phx-auth-entry__mascot {
  position: relative;
  z-index: 0;
  height: 98px;               /* 80%：原 122px */
  display: grid;
  place-items: end center;
  overflow: hidden;
  pointer-events: none;
}
.phx-auth-entry__mascot img {
  width: 114px;               /* 80%：原 142px */
  height: 101px;              /* 80%：原 126px */
  display: block;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 7px 14px rgba(219, 119, 117, .14));
}
.phx-auth-entry__panel {
  position: relative;
  z-index: 1;
  width: calc(100% - 24px);
  margin: -4px 12px 12px;
  overflow: hidden;
  border: 1px solid var(--border-strong, rgba(255, 255, 255, .13));
  border-radius: 14px;
  background: var(--card, #211b20);
  color: var(--text, #fff9f7);
  box-shadow: 0 10px 24px rgba(12, 8, 18, .16);
}
.phx-auth-entry__button {
  width: 100%;
  min-height: 62px;
  margin: 0;
  padding: 10px 14px 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text, #fff9f7);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .15s;
}
.phx-auth-entry__button:hover {
  background: var(--hover, rgba(255, 255, 255, .045));
}
.phx-auth-entry__button-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.phx-auth-entry__button-copy strong {
  display: block;
  font-size: 16px;
  line-height: 1.15;
  font-weight: 760;
}
.phx-auth-entry__button svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.phx-auth-entry__summary {
  display: block;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text-dim, #e7dfe3);
  font-size: 11.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.phx-auth-entry__legal {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 6px 14px 5px;
  color: var(--text-faint, #8d8189);
  font-size: 10.5px;
  text-align: left;
}
.phx-auth-entry__legal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 1px;
  background: var(--border, rgba(255, 255, 255, .08));
}
.phx-auth-entry__legal a { color: var(--ink-accent, #ffaaa0); transition: color .15s; }
.phx-auth-entry__legal a:hover { color: var(--accent, #ef7365); }
.phx-auth-entry__button[hidden],
.phx-auth-entry__summary[hidden],
.phx-auth-entry__account[hidden] { display: none; }
.phx-auth-entry[data-auth-state="account"] .phx-auth-entry__legal,
.phx-auth-entry[data-auth-state="custom-key"] .phx-auth-entry__legal { display: none; }
.phx-auth-entry__account {
  width: 100%;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
}
.phx-auth-entry__identity {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 0;
  background: var(--soft-accent, rgba(239,115,101,.1));
  color: var(--text, #fff9f7);
  font: inherit;
  text-align: left;
  cursor: default;
}
.phx-auth-entry__avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent, #ef7365) 36%, transparent);
  border-radius: 50%;
  background: var(--card-2, #312a31);
  color: var(--ink-accent, #ffaaa0);
  font-size: 14px;
  font-weight: 750;
}
.phx-auth-entry__identity-text { min-width: 0; display: grid; gap: 2px; }
.phx-auth-entry__identity-text strong,
.phx-auth-entry__identity-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.phx-auth-entry__identity-text strong { font-size: 13px; font-weight: 700; }
.phx-auth-entry__identity-text small { color: var(--text-dim, #c8bdc4); font-size: 10.5px; }
.phx-auth-entry__actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-top: 1px solid var(--border, rgba(255,255,255,.08));
}
.phx-auth-entry__actions a,
.phx-auth-entry__actions button {
  min-width: 0;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 8px;
  border: 0;
  background: transparent;
  color: var(--text-dim, #c8bdc4);
  font: inherit;
  font-size: 10.5px;
  cursor: pointer;
}
.phx-auth-entry__actions svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.phx-auth-entry__actions button { border-left: 1px solid var(--border, rgba(255,255,255,.08)); }
.phx-auth-entry__actions a:hover { color: var(--ink-accent, #ffaaa0); }
.phx-auth-entry__actions button:hover { color: var(--red, #f87171); }
.phx-auth-entry[data-auth-state="custom-key"] .phx-auth-entry__actions {
  grid-template-columns: minmax(0, 1fr);
}
.phx-auth-entry[data-auth-state="custom-key"] [data-phx-account-dashboard] { display: none; }
.phx-auth-entry[data-auth-state="custom-key"] .phx-auth-entry__actions button { border-left: 0; }

.phx-auth-entry--workspace { border-top: 1px solid var(--border, rgba(255,255,255,.08)); }

.phx-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background: var(--overlay, rgba(12, 8, 18, .66));
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
}
.phx-auth-overlay.is-open { opacity: 1; pointer-events: auto; }
.phx-auth-dialog {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 25px;
  border: 1px solid var(--border-strong, rgba(255,255,255,.16));
  border-radius: 8px;
  background: var(--card, #25212d);
  color: var(--text, #f7f0f4);
  box-shadow: 0 22px 70px rgba(12, 8, 18, .36);
  transform: translateY(10px) scale(.985);
  transition: transform .18s;
}
.phx-auth-overlay.is-open .phx-auth-dialog { transform: none; }
.phx-auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim, #bdb0c0);
  cursor: pointer;
}
.phx-auth-close:hover { background: var(--hover, rgba(255,255,255,.05)); color: var(--text, #fff); }
.phx-auth-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.phx-auth-dialog__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 35px;
  margin-bottom: 18px;
  text-align: left;
}
.phx-auth-dialog__head img { width: 44px; height: 44px; object-fit: contain; flex: 0 0 auto; }
.phx-auth-dialog__head h2 { margin: 0 0 3px; font-size: 18px; letter-spacing: 0; }
.phx-auth-dialog__head p { margin: 0; color: var(--text-dim, #bdb0c0); font-size: 12px; line-height: 1.5; }
.phx-auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 17px;
  padding: 4px;
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 8px;
  background: var(--field, rgba(255,255,255,.04));
}
.phx-auth-tabs button {
  min-height: 36px;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim, #bdb0c0);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.phx-auth-tabs button.is-active {
  background: var(--grad, var(--grad-primary, linear-gradient(120deg,#ef7365,#e3658e)));
  color: #fff;
  font-weight: 650;
  box-shadow: var(--grad-shadow, 0 4px 12px rgba(227,101,142,.22));
}
.phx-auth-form { display: grid; gap: 13px; }
.phx-auth-form label { display: grid; gap: 6px; text-align: left; }
.phx-auth-form label > span { color: var(--text-dim, #bdb0c0); font-size: 12px; }
.phx-auth-form input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-strong, rgba(255,255,255,.16));
  border-radius: 8px;
  outline: none;
  background: var(--field, rgba(255,255,255,.04));
  color: var(--text, #f7f0f4);
  font: inherit;
  font-size: 13.5px;
}
.phx-auth-form input:focus { border-color: var(--accent, #ef7365); box-shadow: 0 0 0 3px var(--soft-accent, rgba(239,115,101,.1)); }
.phx-auth-form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.phx-auth-primary {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--grad, var(--grad-primary, linear-gradient(120deg,#ef7365,#e3658e)));
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: var(--grad-shadow, 0 4px 12px rgba(227,101,142,.22));
}
.phx-auth-primary:disabled { opacity: .6; cursor: default; }
.phx-auth-key-note {
  margin-bottom: 13px;
  padding: 11px 12px;
  border-left: 3px solid var(--accent, #ef7365);
  background: var(--soft-accent, rgba(239,115,101,.1));
  text-align: left;
}
.phx-auth-key-note strong { display: block; margin-bottom: 3px; font-size: 12.5px; }
.phx-auth-key-note p { margin: 0; color: var(--text-dim, #bdb0c0); font-size: 11.5px; line-height: 1.65; }
.phx-auth-message {
  margin: 12px 0 0;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--red, #f87171) 35%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--red, #f87171) 9%, transparent);
  color: var(--red, #f87171);
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
}
.phx-auth-message.is-ok {
  border-color: color-mix(in srgb, var(--green, #34d399) 35%, transparent);
  background: color-mix(in srgb, var(--green, #34d399) 9%, transparent);
  color: var(--green, #34d399);
}
.phx-auth-dialog__foot {
  min-height: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border, rgba(255,255,255,.08));
}
.phx-auth-dialog__foot button {
  border: 0;
  background: transparent;
  color: var(--text-dim, #bdb0c0);
  font: inherit;
  font-size: 11.5px;
  text-decoration: underline;
  cursor: pointer;
}
.phx-auth-dialog__foot button:hover { color: var(--text, #f7f0f4); }
.phx-auth-locked { cursor: not-allowed !important; }
.phx-auth-locked:not(.app-card) { opacity: .72; }
.phx-auth-locked.app-card::after {
  content: "需登录账号";
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--card-2, #302936);
  color: var(--text-dim, #bdb0c0);
  font-size: 10px;
}
body.phx-auth-modal-open { overflow: hidden; }

html.theme-light .phx-auth-overlay {
  background: var(--overlay, rgba(55, 45, 62, .4));
}
html.theme-light .phx-auth-tabs,
html.theme-light .phx-auth-form input {
  background: var(--field, rgba(108, 66, 84, .04));
}
html.theme-light .phx-auth-dialog,
html.theme-light .phx-auth-entry__panel {
  box-shadow: 0 12px 36px rgba(82, 56, 70, .1);
}

@media (max-height: 700px) {
  .phx-auth-entry--workspace .phx-auth-entry__mascot { display: none; }
}
@media (max-width: 560px) {
  .phx-auth-overlay { padding: 0; align-items: end; }
  .phx-auth-dialog {
    width: 100%;
    max-height: min(92vh, 760px);
    padding: 20px 16px max(18px, env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 8px 8px 0 0;
  }
  .phx-auth-dialog__head h2 { font-size: 17px; }
  .phx-auth-form__grid { grid-template-columns: 1fr; }
}

/* 侧栏真实头像（与主页同源） */
.phx-auth-entry__avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
