.auth-widget {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 999px;
  color: #1f2937;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  font: inherit;
}
.auth-btn:hover {
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}
.auth-btn:active { transform: translateY(0); }
.auth-btn svg { color: #475569; flex-shrink: 0; }

.auth-label {
  display: inline-block;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.auth-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  padding: 8px;
  box-sizing: border-box;
}
.auth-menu[hidden] { display: none; }

.auth-menu .auth-email {
  padding: 8px 10px;
  font-size: 12px;
  color: #64748b;
  word-break: break-all;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 4px;
}

.auth-logout {
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  color: #dc2626;
  font: inherit;
}
.auth-logout:hover { background: #fef2f2; }

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.auth-modal[hidden] { display: none; }

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(2px);
}

.auth-modal-card {
  position: relative;
  background: #fff;
  border-radius: 14px;
  padding: 28px 24px 22px;
  width: min(92vw, 380px);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  font-family: inherit;
}

.auth-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: none;
  border: 0;
  font-size: 24px;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  border-radius: 6px;
}
.auth-modal-close:hover { color: #475569; background: #f8fafc; }

.auth-modal-title {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
}

.auth-field {
  display: block;
  margin-bottom: 14px;
}
.auth-field > span {
  display: block;
  font-size: 12px;
  color: #475569;
  margin-bottom: 4px;
}
.auth-field input {
  display: block;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-size: 14px;
  box-sizing: border-box;
  background: #fff;
  color: #0f172a;
  font-family: inherit;
}
.auth-field input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.auth-error {
  margin: 4px 0 10px;
  padding: 8px 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #b91c1c;
  font-size: 13px;
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
  padding: 10px 14px;
  background: #2563eb;
  color: #fff;
  border: 0;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.auth-submit:hover { background: #1d4ed8; }
.auth-submit:disabled { background: #94a3b8; cursor: wait; }

.auth-toggle {
  margin: 14px 0 0;
  font-size: 13px;
  color: #64748b;
  text-align: center;
}
.auth-toggle-btn {
  background: none;
  border: 0;
  color: #2563eb;
  cursor: pointer;
  font-size: 13px;
  padding: 0 4px;
  font-family: inherit;
}
.auth-toggle-btn:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .auth-widget { top: 10px; right: 10px; }
  .auth-btn { padding: 5px 10px; }
  .auth-label { max-width: 140px; }
}
